commit 5fe9f2bb2046c70261e22a07295023bedb184c95 Author: zhl Date: Thu Feb 14 13:21:52 2019 +0800 project init diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9d08a1a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e268586 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +/.env +/.idea/ +/.wepycache/ +.wepycache + +**/node_modules +**/.DS_Store + +/config/config.js +/config/group_config.js +/config/plugin_config.js +/config/bot_config.js + +/public +/logs +/build +/dist +/lib +rev-manifest.json +/yarn.lock +/nohup.out +/package-lock.json +/dist.tar.gz +/config/apiclient_cert.p12 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/.wepyignore b/.wepyignore new file mode 100644 index 0000000..e4f5602 --- /dev/null +++ b/.wepyignore @@ -0,0 +1,4 @@ +node_modules +dist +.DS_Store +*.wpy___jb_tmp___ diff --git a/package.json b/package.json new file mode 100644 index 0000000..20c67c0 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "game", + "version": "0.0.2", + "description": "A WePY project", + "main": "dist/app.js", + "scripts": { + "dev": "wepy build --watch", + "build": "cross-env NODE_ENV=production wepy build --no-cache", + "dev:web": "wepy build --output web", + "clean": "find ./dist -maxdepth 1 -not -name 'project.config.json' -not -name 'dist' | xargs rm -rf", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "wepy": { + "module-a": false, + "./src/components/list": "./src/components/wepy-list.wpy" + }, + "author": "zhl ", + "license": "MIT", + "dependencies": { + "redux": "^3.7.2", + "redux-actions": "^2.2.1", + "redux-promise": "^0.5.3", + "wepy": "^1.7.2", + "wepy-async-function": "^1.4.4", + "wepy-com-toast": "^1.0.2", + "wepy-redux": "^1.5.3" + }, + "devDependencies": { + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "cross-env": "^5.1.3", + "less": "^3.8.1", + "wepy-compiler-babel": "^1.5.3", + "wepy-compiler-less": "^1.3.14" + } +} diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..2c3258f --- /dev/null +++ b/project.config.json @@ -0,0 +1,13 @@ +{ + "description": "A WePY project", + "setting": { + "urlCheck": true, + "es6": false, + "postcss": false, + "minified": false + }, + "compileType": "miniprogram", + "appid": "touristappid", + "projectname": "game", + "miniprogramRoot": "./dist" +} diff --git a/src/app.wpy b/src/app.wpy new file mode 100644 index 0000000..c81a9f0 --- /dev/null +++ b/src/app.wpy @@ -0,0 +1,69 @@ + + + diff --git a/src/common/global.js b/src/common/global.js new file mode 100644 index 0000000..eceab5a --- /dev/null +++ b/src/common/global.js @@ -0,0 +1,5 @@ +export default { + apiBase: 'https://pay-test.kingsome.cn', + hostBase: 'https://pay.kingsome.cn', + version: '1.0.1' +} diff --git a/src/common/images.js b/src/common/images.js new file mode 100644 index 0000000..3015555 --- /dev/null +++ b/src/common/images.js @@ -0,0 +1,4 @@ +export default { + info_img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAALGPC/xhBQAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjMxN4N3hgAAA/BJREFUeF7tmiGPFEEUhE8gNkFwCQKCIARBFoFAkJxAIJFIJBKJRJ5DnkQikfwEJPIkEolE4nZ5ncwl5NjjZntLdE19m7xcsjfdefVVTW/3ZI6O+EAAAhCAAAQgAAEIQAACEIAABCAAgRAC2+12XfXiojabzUmI9FyZZfZx1WmZ/b3+/vOp739WndU/7uZSWqjyMvZ11a9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G1wLmlpZDpCOEQ4MjQwMUQ2ODQxMUU4QTU5NTgwMjFCMjhERjBGOCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpCOEQ4MjQwMkQ2ODQxMUU4QTU5NTgwMjFCMjhERjBGOCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pjl/41gAAAIcSURBVHja7N1BVsMwEATRKM/3v/KwZJMFxJatUf9aQwCpetQOBo+qeiGXtyUgAAgAAoAAIAAIAAKAACAACAACgAAgAAgAAoAAIAAIgF04LMFS/PUGzWECgACh6f/vxxIABAABthn/lx4DrgL6bfynzx8mQN7mX/JaBNAB0Dz9p15TB+i/8ac6gQmwz+Z/9bUIsLdwRYC89OsANt5VgM0nAAgg/TqAjTcBbD4BQADp1wFsvAlg8wmAJ4+A2//wQfrXmQC1wQLXTpuvBO6d+rHaBMBim3+nANU8cds+VeNYfOFO3/cetPFfrdG7yeKVzfc+ACZcNr8bpaekf/0OsNx97878+yZA94RGPj9PBwg7868+Ap5MTV24ELFPzzyaL9bZTlCJqd/xCCip1wGc+eEClPQ//z7A6p2gpD7jCCip1wGc+eEClPTndQBnvgkAAjjzpwowXuvft48bOsBwmdUz9Y4ATBHAsdBwrUwAHWCa2TpBgwlpAugAWcZLvwmAiR1AJ2g2AU0AHUAikn9WE0AHeCwZJfUmAIIFGNJvAiCsA+zUCbaYYCaADiBRyf3FBNABlk1WSb0JgGABhu/FBEBYB1ipE0T89tIE0AFce6em3wRAu/8PMLMTRN7FbALoAG0Z0m8CIFyAIf0mAIKuAiTYBAABQAAQAAQAAUAAEAAEAAFAABAABAABQAAQAAQAAUAAEAAEAAFAAPzyI8AAliJQGcH8J6wAAAAASUVORK5CYII=', +} diff --git a/src/components/game-cell.wpy b/src/components/game-cell.wpy new file mode 100644 index 0000000..88afc5f --- /dev/null +++ b/src/components/game-cell.wpy @@ -0,0 +1,34 @@ + + + + diff --git a/src/components/zan-dialog.wpy b/src/components/zan-dialog.wpy new file mode 100644 index 0000000..aa0865a --- /dev/null +++ b/src/components/zan-dialog.wpy @@ -0,0 +1,66 @@ + + + diff --git a/src/components/zan-loadmore.wpy b/src/components/zan-loadmore.wpy new file mode 100644 index 0000000..6574c8b --- /dev/null +++ b/src/components/zan-loadmore.wpy @@ -0,0 +1,107 @@ + + + diff --git a/src/components/zan-quantity.wpy b/src/components/zan-quantity.wpy new file mode 100644 index 0000000..899c4c4 --- /dev/null +++ b/src/components/zan-quantity.wpy @@ -0,0 +1,141 @@ + + + diff --git a/src/components/zan-steps.wpy b/src/components/zan-steps.wpy new file mode 100644 index 0000000..af7e661 --- /dev/null +++ b/src/components/zan-steps.wpy @@ -0,0 +1,268 @@ + + + diff --git a/src/components/zan-switch.wpy b/src/components/zan-switch.wpy new file mode 100644 index 0000000..4aae26d --- /dev/null +++ b/src/components/zan-switch.wpy @@ -0,0 +1,122 @@ + + + diff --git a/src/components/zan-tab.wpy b/src/components/zan-tab.wpy new file mode 100644 index 0000000..6ee8e8b --- /dev/null +++ b/src/components/zan-tab.wpy @@ -0,0 +1,95 @@ + + + diff --git a/src/components/zan-toast.wpy b/src/components/zan-toast.wpy new file mode 100644 index 0000000..42af831 --- /dev/null +++ b/src/components/zan-toast.wpy @@ -0,0 +1,61 @@ + + + diff --git a/src/components/zan-toptips.wpy b/src/components/zan-toptips.wpy new file mode 100644 index 0000000..8df3cfd --- /dev/null +++ b/src/components/zan-toptips.wpy @@ -0,0 +1,88 @@ + + + diff --git a/src/index.template.html b/src/index.template.html new file mode 100644 index 0000000..93a1b07 --- /dev/null +++ b/src/index.template.html @@ -0,0 +1,21 @@ + + + + + + + + + + 转 WEB DEMO + + + +
+ + +
+ + diff --git a/src/mixins/base.js b/src/mixins/base.js new file mode 100644 index 0000000..1022f6f --- /dev/null +++ b/src/mixins/base.js @@ -0,0 +1,156 @@ +import wepy from 'wepy' + +export default class baseMixin extends wepy.mixin { + /** + * [公共方法] + * @param {[type]} item [description] + * @return {Boolean} [description] + */ + noop() { + return null; + } + hasOwn(obj, type) { + return Object.prototype.hasOwnProperty.call(obj, type); + } + + /** + * [isXXX 基础方法] + * @param {[type]} item [description] + * @return {Boolean} [description] + */ + isUndefined(item) { + return typeof item === 'undefined'; + } + isDefined(item) { + return !this.isUndefined(item); + } + isString(item) { + return typeof item === 'string'; + } + isNumber(item) { + return typeof item === 'number'; + } + isArray(item) { + return Object.prototype.toString.apply(item) === '[object Array]'; + } + isObject(item) { + return typeof item === 'object' && !this.isArray(item); + } + isFunction(item) { + return typeof item === 'function'; + } + + /** + * [getXXX 增强方法] + * @param {[type]} item [description] + * @return {Boolean} [description] + */ + getString(item, defaultStr) { + if (this.isString(item)) return item.trim(); + if (this.isNumber(item)) return `${item}`.trim(); + return defaultStr || ''; + } + getNumber(item, defaultNum) { + var matches = this.getString(item).match(/\d+/); + return this.isNumber(matches && +matches[0]) ? +matches[0] : defaultNum; + } + getArray(item, defaultArr) { + return this.isArray(item) ? item : (defaultArr || []); + } + getObject(item, defaultObj) { + return this.isObject(item) ? item : (defaultObj || {}); + } + getFunction(item) { + return this.isFunction(item) ? item : noop; + } + + /** + * [JSON方法] + * @param {[type]} item [description] + * @return {Boolean} [description] + */ + $json(item) { + let str = {type: Object.prototype.toString.call(item)} + try { + str = JSON.stringify(item) + } catch (e) { + str.error = e && e.stack || '' + } + return this.isString(str) ? str : this.$json(str) + } + $parse(item) { + let obj = {type: Object.prototype.toString.call(item)} + try { + obj = JSON.parse(item) + } catch (e) { + obj.error = e && e.stack || '' + } + return this.isObject(obj) ? obj : this.$parse(obj) + } + + /** + * [功能方法] + * @param {[type]} item [description] + * @return {Boolean} [description] + */ + isPhone(str) { + return /^1\d{10}$/.test(str) + } + $alert(item = '标题', item2) { + const param = this.isObject(item) ? Object.assign({ + // 首参数为obj + title: 'title', content: 'content' + }, item) : this.isString(item) ? this.isString(item2) ? { + // 俩参数均为字符串 + title: item, content: item2 + } : { + // 只有首参为字符串 + title: '', content: item + } : { + // 尝试转换字符串 + title: item.toString ? item.toString() : '参数异常' + } + wx.showModal(Object.assign({ + showCancel: false + }, param)) + } + $info(str) { + console.log('INFO:: %s', str) + } + $error(str) { + console.log('ERROR:: %s', str) + } + $trimStart(str, char) { + let r2 = new RegExp('^' + char + '+') + return str.replace(r2, '') + } + $remove(array, func) { + return array.filter(func) + } + generateShareID () { + let d = new Date().getTime() + if (typeof performance !== 'undefined' && typeof performance.now === 'function') { + d += performance.now() + } + return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + let r = (d + Math.random() * 16) % 16 | 0 + d = Math.floor(d / 16) + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16) + }) + } + $formatMoney(money) { + return (money/100).toFixed(2) + } + $randomNum(minNum,maxNum){ + return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10); + } + $getRandomColor() { + let rgb = [] + for (let i = 0; i < 3; ++i) { + let color = Math.floor(Math.random() * 256).toString(16) + color = color.length == 1 ? '0' + color : color + rgb.push(color) + } + return '#' + rgb.join('') + } +} diff --git a/src/mixins/tips.js b/src/mixins/tips.js new file mode 100644 index 0000000..3e56f2d --- /dev/null +++ b/src/mixins/tips.js @@ -0,0 +1,25 @@ +import wepy from 'wepy' + +export default class testMixin extends wepy.mixin { + + showToast (title, duration) { + if (!duration) { + duration = 15000 + } + wepy.showToast({ + title: title, + icon: 'loading', + duration: duration + }) + } + showLoading() { + wepy.showToast({ + title: '加载中', + icon: 'loading', + duration: 3000 + }) + } + hideToast () { + wepy.hideToast() + } +} diff --git a/src/pages/game.wpy b/src/pages/game.wpy new file mode 100644 index 0000000..7ecd3e1 --- /dev/null +++ b/src/pages/game.wpy @@ -0,0 +1,26 @@ + + + + diff --git a/src/pages/index.wpy b/src/pages/index.wpy new file mode 100644 index 0000000..326eb79 --- /dev/null +++ b/src/pages/index.wpy @@ -0,0 +1,109 @@ + + + + diff --git a/src/pages/login.wpy b/src/pages/login.wpy new file mode 100644 index 0000000..e1d5f63 --- /dev/null +++ b/src/pages/login.wpy @@ -0,0 +1,59 @@ + + + + diff --git a/src/style/game-cell.wxss b/src/style/game-cell.wxss new file mode 100644 index 0000000..28c939e --- /dev/null +++ b/src/style/game-cell.wxss @@ -0,0 +1,42 @@ +.game-cell { + display: flex; + flex-flow: row nowrap; + padding: 20rpx; + width: 660rpx; + border-bottom: 1px solid #eee; +} +.game-cell .game-icon { + width: 130px; + float: left; + position: relative; + overflow: hidden; + background-size: cover; + margin-left: -15px; + padding: 2px; +} +.game-cell .game-icon image { + width: 100%; + height: 100%; + max-width: 100%; + max-height: 100%; +} +.content-view { + display: flex; + flex-flow: column nowrap; + margin-left: 5px; +} +.content-view .title { + font-size: 16px; +} +.content-view .content { + font-size: 14px; +} +.game-cell::after { + position: absolute; + left: 15px; + right: 0; + bottom: 0; + border-top: 1rpx solid #e5e5e5; + background: #e5e5e5; + content: ' '; +} diff --git a/src/style/index.wxss b/src/style/index.wxss new file mode 100644 index 0000000..3de08de --- /dev/null +++ b/src/style/index.wxss @@ -0,0 +1,35 @@ +.userinfo { + display: flex; + align-items: center; + margin: 10px; +} + +.userinfo-avatar { + width: 40px; + height: 40px; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; + font-size: 60 rpx; + margin-left: 8px; +} + +.zan-btns { + width: 700 rpx; + margin-top: 60 rpx; + +} + +.top-view { + border-bottom: 1 rpx solid #eee; + box-shadow: 15 rpx 0 15px 0 rgba(0, 0, 0, 0.2); + background-color: #fff; + z-index: 2; + width: 100%; +} + +.zan-loadmore--nodata { + margin-top: 60px; +} diff --git a/src/style/zanui/badge.wxss b/src/style/zanui/badge.wxss new file mode 100644 index 0000000..eecdb63 --- /dev/null +++ b/src/style/zanui/badge.wxss @@ -0,0 +1,24 @@ +.zan-badge { + position: relative; +} +.zan-badge__count { + position: absolute; + top: -8px; + right: 0px; + height: 1.6em; + min-width: 1.6em; + line-height: 1.6; + padding: 0 .4em; + font-size: 10px; + font-family: tahoma; + border-radius: .8em; + background: #FF4444; + color: #fff; + text-align: center; + white-space: nowrap; + transform: translateX(50%); + transform-origin: -10% center; + z-index: 10; + box-shadow: 0 0 0 1px #fff; + box-sizing: border-box; +} diff --git a/src/style/zanui/btn.wxss b/src/style/zanui/btn.wxss new file mode 100644 index 0000000..7e945c8 --- /dev/null +++ b/src/style/zanui/btn.wxss @@ -0,0 +1,142 @@ +.zan-btn { + position: relative; + color: #333; + background-color: #fff; + margin-bottom: 10px; + padding-left: 15px; + padding-right: 15px; + border-radius: 2px; + border: 1rpx solid #e5e5e5; + font-size: 16px; + line-height: 45px; + height: 45px; + box-sizing: border-box; + text-decoration: none; + text-align: center; + vertical-align: middle; +} +.zan-btn::after { + display: none; +} +.zan-btns { + margin: 15px; +} + +/* type */ +.zan-btn--primary { + color: #fff; + background-color: #4b0; + border-color: #0a0; +} + +.zan-btn--warn { + color: #fff; + background-color: #f85; + border-color: #f85; +} + +.zan-btn--danger { + color: #fff; + background-color: #f44; + border-color: #e33; +} + +/* size */ +.zan-btn--small { + display: inline-block; + height: 30px; + line-height: 30px; + font-size: 12px; + margin-right: 5px; + margin-bottom: 0; +} +.zan-btn--mini { + display: inline-block; + line-height: 21px; + height: 22px; + font-size: 10px; + margin-right: 5px; + margin-bottom: 0; + padding-left: 5px; + padding-right: 5px; +} +.zan-btn--large { + border-radius: 0; + margin-bottom: 0; + border: none; + line-height: 50px; + height: 50px; +} + +/* plain */ +.zan-btn--plain.zan-btn { + background-color: transparent; +} +.zan-btn--plain.zan-btn--primary { + color: #06BF04; +} +.zan-btn--plain.zan-btn--warn { + color: #FF6600; +} +.zan-btn--plain.zan-btn--danger { + color: #FF4444; +} + +/* 重写button组件的button-hover样式 */ +.button-hover { + opacity: 0.9; +} + +/* loading */ +.zan-btn--loading { + color: transparent; + opacity: 1; +} +.zan-btn--loading::before { + position: absolute; + left: 50%; + top: 50%; + content: ' '; + width: 16px; + height: 16px; + margin-left: -8px; + margin-top: -8px; + border: 3px solid #e5e5e5; + border-color: #666 #e5e5e5 #e5e5e5 #e5e5e5; + border-radius: 8px; + box-sizing: border-box; + animation: btn-spin 0.6s linear; + animation-iteration-count: infinite; +} +.zan-btn--primary.zan-btn--loading::before, +.zan-btn--warn.zan-btn--loading::before, +.zan-btn--danger.zan-btn--loading::before { + border-color: #fff rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1); +} + +@keyframes btn-spin { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} + +/* disabled */ +.zan-btn.zan-btn--disabled { + /* 防止样式被 button[disabled] 的规则覆盖,所以使用了important */ + color: #999 ! important; + background: #f8f8f8 ! important; + border-color: #e5e5e5 ! important; + cursor: not-allowed ! important; + opacity: 1 ! important; +} + +/* :last-child */ +.zan-btn--last-child, +.zan-btn:last-child { + margin-bottom: 0; + margin-right: 0; +} + diff --git a/src/style/zanui/card.wxss b/src/style/zanui/card.wxss new file mode 100644 index 0000000..27a4376 --- /dev/null +++ b/src/style/zanui/card.wxss @@ -0,0 +1,53 @@ +.zan-card { + margin-left: 0px; + width: auto; + padding: 5px 15px; + overflow: hidden; + position: relative; + font-size: 14px; +} + +.zan-card__thumb { + width: 90px; + height: 90px; + float: left; + position: relative; + margin-left: auto; + margin-right: auto; + overflow: hidden; + background-size: cover; +} + +.zan-card__img { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: auto; + height: auto; + max-width: 100%; + max-height: 100%; +} + +.zan-card__detail { + margin-left: 100px; + width: auto; + position: relative; +} + +.zan-card__detail-row { + overflow: hidden; + line-height: 20px; + min-height: 20px; + margin-bottom: 3px; +} + +.zan-card__right-col { + float: right; +} + +.zan-card__left-col { + margin-right: 80px; +} + diff --git a/src/style/zanui/cell.wxss b/src/style/zanui/cell.wxss new file mode 100644 index 0000000..ee63bdd --- /dev/null +++ b/src/style/zanui/cell.wxss @@ -0,0 +1,53 @@ +.zan-cell { + position: relative; + padding: 12px 15px; + display: flex; + align-items: center; + line-height: 1.4; + font-size: 14px; +} + +.zan-cell::after { + position: absolute; + left: 15px; + right: 0; + bottom: 0; + border-top: 1rpx solid #e5e5e5; + background: #e5e5e5; + content: ' '; +} +.zan-cell__bd { + flex: 1; +} +.zan-cell__ft { + position: relative; + text-align: right; + color: #666; +} + +.zan-cell--last-child::after, +.zan-cell:last-child::after { + display: none; +} + +.zan-cell--access .zan-cell__ft { + padding-right: 13px; +} + +.zan-cell--access .zan-cell__ft::after { + position: absolute; + top: 50%; + right: 2px; + content: " "; + display: inline-block; + height: 6px; + width: 6px; + border-width: 2px 2px 0 0; + border-color: #c8c8c8; + border-style: solid; + transform: translateY(-50%) matrix(0.71, 0.71, -0.71, 0.71, 0, 0); +} +.zan-cell--switch { + padding-top: 6px; + padding-bottom: 6px; +} diff --git a/src/style/zanui/color.wxss b/src/style/zanui/color.wxss new file mode 100644 index 0000000..f61ea66 --- /dev/null +++ b/src/style/zanui/color.wxss @@ -0,0 +1,27 @@ +.zan-c-red { + color: #f44 !important; +} + +.zan-c-gray { + color: #c9c9c9 !important; +} + +.zan-c-gray-dark { + color: #999 !important; +} + +.zan-c-gray-darker { + color: #666 !important; +} + +.zan-c-black { + color: #333 !important; +} + +.zan-c-blue { + color: #3283fa !important; +} + +.zan-c-green { + color: #44BB00 !important; +} diff --git a/src/style/zanui/form.wxss b/src/style/zanui/form.wxss new file mode 100644 index 0000000..d3dac94 --- /dev/null +++ b/src/style/zanui/form.wxss @@ -0,0 +1,38 @@ +.zan-form { + background-color: #fff; + border-top: 1rpx solid #e5e5e5; + border-bottom: 1rpx solid #e5e5e5; +} + +.zan-form__item { + line-height: 26px; +} + +.zan-form__title { + float: left; + width: 80px; + font-size: 14px; +} + +.zan-form__title--top { + align-self: flex-start; +} + +.zan-form__input, .zan-form__textarea { + min-height: 26px; +} + +.zan-form__input input { + min-height: 26px; +} + +.zan-form__textarea { + display: -webkit-flex; + display: flex; + align-items: center; +} + +.zan-form__textarea textarea { + width: auto; + flex: 1; +} diff --git a/src/style/zanui/helper.wxss b/src/style/zanui/helper.wxss new file mode 100644 index 0000000..a80f4d3 --- /dev/null +++ b/src/style/zanui/helper.wxss @@ -0,0 +1,101 @@ +.zan-pull-left { + float: left; +} + +.zan-pull-right { + float: right; +} + +.zan-center { + text-align: center; +} + +.zan-right { + text-align: right; +} + +.zan-text-deleted { + text-decoration: line-through; +} +.zan-font-8 { + font-size: 8px; +} +.zan-font-10 { + font-size: 10px; +} +.zan-font-12 { + font-size: 12px; +} +.zan-font-14 { + font-size: 14px; +} +.zan-font-16 { + font-size: 16px; +} +.zan-font-18 { + font-size: 18px; +} +.zan-font-20 { + font-size: 20px; +} +.zan-font-22 { + font-size: 22px; +} +.zan-font-24 { + font-size: 22px; +} +.zan-font-30 { + font-size: 30px; +} +.zan-font-bold { + font-weight: bold; +} + +.zan-arrow { + position: absolute; + right: 15px; + top: 50%; + display: inline-block; + height: 6px; + width: 6px; + border-width: 2px 2px 0 0; + border-color: #c8c8c8; + border-style: solid; + transform: translateY(-50%) matrix(0.71, 0.71, -0.71, 0.71, 0, 0); +} + +.zan-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + word-wrap: normal; +} + +.zan-ellipsis--l2 { + max-height: 40px; + line-height: 20px; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.zan-ellipsis--l3 { + max-height: 60px; + line-height: 20px; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; +} + +.zan-clearfix { + zoom: 1; +} +.zan-clearfix::after { + content: ''; + display: table; + clear: both; +} diff --git a/src/style/zanui/icon.wxss b/src/style/zanui/icon.wxss new file mode 100644 index 0000000..4d8b6bf --- /dev/null +++ b/src/style/zanui/icon.wxss @@ -0,0 +1,66 @@ +/* DO NOT EDIT! Generated by fount */ + +@font-face { + font-family: 'zuiicon'; + src: url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.eot'); + src: url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.eot?#iefix') format('embedded-opentype'), + url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.woff2') format('woff2'), + url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.woff') format('woff'), + url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.ttf') format('truetype') +} + +.zan-icon { + display: inline-block; +} +.zan-icon::before { + font-family: "zuiicon" !important; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + text-align: center; + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + /* Animation center compensation - margins should be symmetric */ + /* remove if not needed */ + /* margin-left: .2em; */ + + /* you can be more comfortable with increased icons size */ + /* font-size: 120%; */ + + /* Font smoothing. That was taken from TWBS */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + /* Uncomment for 3D effect */ + /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ +} +/* DO NOT EDIT! Generated by fount */ + + +.zan-icon-album:before { content: '\e800'; } /* '' */ +.zan-icon-arrow:before { content: '\e801'; } /* '' */ +.zan-icon-camera:before { content: '\e802'; } /* '' */ +.zan-icon-certificate:before { content: '\e803'; } /* '' */ +.zan-icon-check:before { content: '\e804'; } /* '' */ +.zan-icon-checked:before { content: '\e805'; } /* '' */ +.zan-icon-close:before { content: '\e806'; } /* '' */ +.zan-icon-gift:before { content: '\e807'; } /* '' */ +.zan-icon-home:before { content: '\e808'; } /* '' */ +.zan-icon-location:before { content: '\e809'; } /* '' */ +.zan-icon-message:before { content: '\e80a'; } /* '' */ +.zan-icon-send:before { content: '\e80b'; } /* '' */ +.zan-icon-shopping-cart:before { content: '\e80c'; } /* '' */ +.zan-icon-sign:before { content: '\e80d'; } /* '' */ +.zan-icon-store:before { content: '\e80e'; } /* '' */ +.zan-icon-topay:before { content: '\e80f'; } /* '' */ +.zan-icon-tosend:before { content: '\e810'; } /* '' */ diff --git a/src/style/zanui/index.wxss b/src/style/zanui/index.wxss new file mode 100644 index 0000000..cc8abca --- /dev/null +++ b/src/style/zanui/index.wxss @@ -0,0 +1,10 @@ +@import "badge.wxss"; +@import "btn.wxss"; +@import "card.wxss"; +@import "cell.wxss"; +@import "color.wxss"; +@import "form.wxss"; +@import "helper.wxss"; +@import "icon.wxss"; +@import "label.wxss"; +@import "panel.wxss"; diff --git a/src/style/zanui/label.wxss b/src/style/zanui/label.wxss new file mode 100644 index 0000000..7c02728 --- /dev/null +++ b/src/style/zanui/label.wxss @@ -0,0 +1,34 @@ +.zan-label { + display: inline-block; + font-size: 12px; + height: 28px; + line-height: 28px; + color: #333; + border: 1rpx solid #999; + padding: 0px 10px; + border-radius: 2px; + margin-right: 10px; + box-sizing: border-box; + vertical-align: middle; + text-align: center; +} +.zan-label--primary { + color: #fff; + background: #f44; + border: 1rpx solid #f44; +} +.zan-label--disabled { + color: #cacaca; + background: #eee; + border: 1rpx solid #e5e5e5; +} +.zan-label--small { + font-size: 11px; + height: 16px; + line-height: 16px; + padding: 0px 3px; +} +.zan-label--plain.zan-label--primary { + color: #f44; + background: #fff; +} diff --git a/src/style/zanui/panel.wxss b/src/style/zanui/panel.wxss new file mode 100644 index 0000000..1ba5f97 --- /dev/null +++ b/src/style/zanui/panel.wxss @@ -0,0 +1,19 @@ +.zan-panel { + background: #fff; + border-top: 1rpx solid #e5e5e5; + border-bottom: 1rpx solid #e5e5e5; + margin-top: 10px; + overflow: hidden; +} + +.zan-panel-title { + font-size: 24rpx; + line-height: 1; + color: #999; + padding: 20px 15px 0 15px; +} + + +.zan-panel--without-margin-top { + margin-top: 0; +} diff --git a/src/utils/http.js b/src/utils/http.js new file mode 100644 index 0000000..5d9f791 --- /dev/null +++ b/src/utils/http.js @@ -0,0 +1,43 @@ +import wepy from 'wepy' +import g from '../common/global' + +const get = (url, data, header) => { + header = header || {} + header['accept-version'] = g.version + return Ajax(url, 'GET', data, header) +}; + +const post = (url, data, header) => { + header = header || {} + header['Content-Type'] = 'application/x-www-form-urlencoded' + header['accept-version'] = g.version + return Ajax(url, 'POST', data, header) +} + +const Ajax = (url, method, data, header) => { + url = g.apiBase + url + header = header || {} + + return new Promise((resolve, reject) => { + wepy.request({ + url: url, + data: data, + method: method, + header: header + }).then(res => { + console.log(res) + if (res.errcode === 0) { + resolve(res) + } else { + reject(res) + } + }, error => { + reject(error) + }) + }) +} + +export default { + get, + post +} diff --git a/wepy.config.js b/wepy.config.js new file mode 100644 index 0000000..b7a82c1 --- /dev/null +++ b/wepy.config.js @@ -0,0 +1,74 @@ +const path = require('path'); +var prod = process.env.NODE_ENV === 'production'; + +module.exports = { + wpyExt: '.wpy', + eslint: false, + cliLogs: !prod, + build: { + web: { + htmlTemplate: path.join('src', 'index.template.html'), + htmlOutput: path.join('web', 'index.html'), + jsOutput: path.join('web', 'index.js') + } + }, + resolve: { + alias: { + counter: path.join(__dirname, 'src/components/counter'), + '@': path.join(__dirname, 'src') + }, + aliasFields: ['wepy', 'weapp'], + modules: ['node_modules'] + }, + compilers: { + less: { + compress: prod + }, + /*sass: { + outputStyle: 'compressed' + },*/ + babel: { + sourceMap: true, + presets: [ + 'env' + ], + plugins: [ + 'transform-class-properties', + 'transform-decorators-legacy', + 'transform-object-rest-spread', + 'transform-export-extensions', + ] + } + }, + plugins: { + }, + appConfig: { + noPromiseAPI: ['createSelectorQuery'] + } +} + +if (prod) { + + // 压缩sass + // module.exports.compilers['sass'] = {outputStyle: 'compressed'} + + // 压缩js + module.exports.plugins = { + uglifyjs: { + filter: /\.js$/, + config: { + } + }, + imagemin: { + filter: /\.(jpg|png|jpeg)$/, + config: { + jpg: { + quality: 80 + }, + png: { + quality: 80 + } + } + } + } +}