├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── package.json
├── screenshots
├── WechatIMG263.jpeg
├── WechatIMG264.jpeg
├── WechatIMG265.jpeg
├── WechatIMG266.jpeg
├── WechatIMG267.jpeg
├── WechatIMG268.jpeg
├── WechatIMG269.jpeg
├── WechatIMG270.jpeg
├── WechatIMG271.jpeg
├── WechatIMG272.jpeg
├── WechatIMG273.jpeg
├── WechatIMG274.jpeg
├── WechatIMG275.jpeg
├── WechatIMG276.jpg
├── WechatIMG277.jpeg
├── WechatIMG278.png
└── qr.jpg
├── src
├── api
│ └── api.js
├── app.wpy
├── components
│ ├── address_add.wpy
│ ├── address_edit.wpy
│ ├── address_list.wpy
│ ├── bomb_screen.wpy
│ ├── collection_list.wpy
│ ├── comment_list.wpy
│ ├── common
│ │ ├── bottomLoadMore.wpy
│ │ ├── placeholder.wpy
│ │ ├── timer.wpy
│ │ ├── wepy-area-picker.wpy
│ │ ├── wepy-sign-time.wpy
│ │ └── wepy-swipe-delete.wpy
│ ├── discover.wpy
│ ├── filterSlider.wpy
│ ├── filter_bar.wpy
│ ├── order_item.wpy
│ ├── points_detail.wpy
│ ├── points_rule.wpy
│ ├── rate.wpy
│ ├── search.wpy
│ ├── shop_cart.wpy
│ ├── shop_grid_list.wpy
│ ├── shop_item_list.wpy
│ └── tab.wpy
├── images
│ ├── alert.png
│ ├── authorize.png
│ ├── bc_qdyl.png
│ ├── empty.png
│ ├── empty_cart.png
│ ├── error.png
│ ├── half.png
│ ├── icon_alert.png
│ ├── icon_classify.png
│ ├── icon_classify_active.png
│ ├── icon_home.png
│ ├── icon_home_active.png
│ ├── icon_info.png
│ ├── icon_info_active.png
│ ├── icon_my_01.png
│ ├── icon_my_02.png
│ ├── icon_my_03.png
│ ├── icon_my_04.png
│ ├── icon_my_05.png
│ ├── icon_my_06.png
│ ├── icon_my_07.png
│ ├── icon_nav_01.png
│ ├── icon_nav_01_new.png
│ ├── icon_nav_02.png
│ ├── icon_nav_02_new.png
│ ├── icon_nav_03.png
│ ├── icon_nav_03_new.png
│ ├── icon_nav_04.png
│ ├── icon_nav_04_new.png
│ ├── icon_notting.png
│ ├── icon_shop_cart.png
│ ├── icon_shop_cart_active.png
│ ├── image_demo.png
│ ├── loadding.gif
│ ├── no_image.png
│ ├── normal.png
│ └── selected.png
├── pages
│ ├── address.wpy
│ ├── authorize.wpy
│ ├── classify.wpy
│ ├── collection.wpy
│ ├── comfire_order.wpy
│ ├── comment.wpy
│ ├── comment_add.wpy
│ ├── exchange_goods.wpy
│ ├── filter.wpy
│ ├── goods_detail.wpy
│ ├── home.wpy
│ ├── home_detail.wpy
│ ├── info.wpy
│ ├── logistics.wpy
│ ├── messages.wpy
│ ├── order.wpy
│ ├── order_detail.wpy
│ ├── pay_success.wpy
│ ├── points.wpy
│ ├── points_more.wpy
│ ├── points_rule.wpy
│ ├── register.wpy
│ ├── reorder.wpy
│ ├── replenishment_goods.wpy
│ ├── search.wpy
│ ├── setting.wpy
│ ├── shop_cart.wpy
│ ├── sign_in.wpy
│ ├── test.wpy
│ └── wholesale.wpy
├── plugins
│ └── wxParse
│ │ ├── html2json.js
│ │ ├── htmlparser.js
│ │ ├── showdown.js
│ │ ├── wxDiscode.js
│ │ ├── wxParse.js
│ │ ├── wxParse.wxml
│ │ └── wxParse.wxss
├── styles
│ ├── base.less
│ ├── icon.less
│ └── style.less
└── utils
│ ├── constant.js
│ ├── md5.js
│ ├── regions.js
│ ├── tip.js
│ ├── util.js
│ └── wxRequest.js
└── wepy.config.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/*
2 | src/*
3 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | env: {
8 | browser: true
9 | },
10 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
11 | extends: 'standard',
12 | // required to lint *.wpy files
13 | plugins: [
14 | 'html'
15 | ],
16 | settings: {
17 | 'html/html-extensions': ['.html', '.wpy']
18 | },
19 | // add your custom rules here
20 | 'rules': {
21 | // allow paren-less arrow functions
22 | 'arrow-parens': 0,
23 | // allow async-await
24 | 'generator-star-spacing': 0,
25 | // allow debugger during development
26 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
27 | 'space-before-function-paren': 0
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # ---> Yii
2 | assets/*
3 | !assets/.gitignore
4 | runtime/*
5 | !runtime/.gitignore
6 | web/assets/*
7 | tests/
8 | .settings/
9 | .buildpath
10 | .project
11 | .idea
12 | node_modules
13 | test.js
14 | npm-debug.log
15 | dist
16 | node_modules
17 |
18 |
19 |
20 | # idea ignore
21 | .idea/
22 | *.ipr
23 | *.iml
24 | *.iws
25 |
26 | *.wepycache
27 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 |
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 yongqing.deng
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### 安装(更新) wepy 命令行工具。
2 | yarn: yarn global add wepy-cli
3 | npm: npm i wepy-cli -g
4 |
5 | ### 安装依赖包
6 | yarn / npm install
7 |
8 | ### 开发实时编译。
9 | yarn dev / npm run dev
10 |
11 | ### 生产压缩
12 | yarn build / npm run build //上传代码时,请先执行此命令,否则会提示包体积过大
13 |
14 |
15 | ### 开发使用说明(重要)
16 |
17 | 1、使用微信开发者工具-->添加项目,项目目录请选择dist目录。
18 |
19 | 2、微信开发者工具-->项目-->关闭ES6转ES5。 重要:漏掉此项会运行报错。
20 |
21 | 3、微信开发者工具-->项目-->关闭上传代码时样式自动补全。 重要:某些情况下漏掉此项也会运行报错。
22 |
23 | 4、微信开发者工具-->项目-->关闭代码压缩上传。 重要:开启后,会导致真机computed, props.sync 等等属性失效。
24 |
25 |
26 |
27 | ### wepy开发文档地址
28 | https://tencent.github.io/wepy/
29 |
30 | ### 小程序开发文档
31 | http://mp.weixin.qq.com/debug/wxadoc/dev/
32 |
33 | ### 演示地址
34 |
35 | 打开微信扫一扫
36 |
37 |
38 |
39 |
40 | ### 目录结构
41 |
42 | ├── api
43 | │ └── api.js //接口
44 | ├── app.wpy //入口文件
45 | ├── components //组件
46 | │ ├── address_add.wpy //新增地址组件
47 | │ ├── address_edit.wpy //编辑地址组件
48 | │ ├── address_list.wpy //地址列表组件
49 | │ ├── bomb_screen.wpy //首页弹屏组件
50 | │ ├── collection_list.wpy //收藏列表组件
51 | │ ├── comment_list.wpy //评论列表组件
52 | │ ├── common //公共组件
53 | │ │ ├── bottomLoadMore.wpy //底部加载更多组件
54 | │ │ ├── placeholder.wpy //空列表显示组件
55 | │ │ ├── timer.wpy //倒计时组件
56 | │ │ ├── wepy-area-picker.wpy //省市区组件
57 | │ │ ├── wepy-sign-time.wpy //签到组件
58 | │ │ └── wepy-swipe-delete.wpy //左滑删除组件
59 | │ ├── discover.wpy //发现列表
60 | │ ├── filterSlider.wpy //筛选右侧栏组件
61 | │ ├── filter_bar.wpy //分类排序组件
62 | │ ├── order_item.wpy //订单列表组件
63 | │ ├── points_detail.wpy //列表组件
64 | │ ├── points_rule.wpy //列表组件
65 | │ ├── rate.wpy //评分组件
66 | │ ├── search.wpy //搜索组件
67 | │ ├── shop_cart.wpy //购物车组件
68 | │ ├── shop_grid_list.wpy //矩阵列表
69 | │ ├── shop_item_list.wpy //条形列表
70 | │ └── tab.wpy //选项卡组件
71 | ├── images //图片文件夹
72 | ├── pages //页面
73 | │ ├── address.wpy //地址
74 | │ ├── classify.wpy //分类
75 | │ ├── collection.wpy //收藏
76 | │ ├── comfire_order.wpy //确认订单
77 | │ ├── comment.wpy //评论列表
78 | │ ├── comment_add.wpy //添加评论
79 | │ ├── exchange_goods.wpy //换货
80 | │ ├── filter.wpy //筛选
81 | │ ├── goods_detail.wpy //商品详情
82 | │ ├── home.wpy //首页
83 | │ ├── home_detail.wpy //首页详情
84 | │ ├── info.wpy //我的
85 | │ ├── logistics.wpy //物流
86 | │ ├── messages.wpy //我的消息
87 | │ ├── order.wpy //订单列表
88 | │ ├── order_detail.wpy //订单详情
89 | │ ├── pay_success.wpy //支付结果
90 | │ ├── points.wpy //积分
91 | │ ├── points_more.wpy //更多积分
92 | │ ├── points_rule.wpy //积分规则
93 | │ ├── register.wpy //注册
94 | │ ├── reorder.wpy //--
95 | │ ├── replenishment_goods.wpy //补货
96 | │ ├── search.wpy //搜索
97 | │ ├── setting.wpy //设置
98 | │ ├── shop_cart.wpy //购物车
99 | │ ├── sign_in.wpy //签到
100 | │ ├── test.wpy //---
101 | │ └── wholesale.wpy //现货批发
102 | ├── plugins //插件
103 | │ └── wxParse //富文本
104 | │ ├── html2json.js
105 | │ ├── htmlparser.js
106 | │ ├── showdown.js
107 | │ ├── wxDiscode.js
108 | │ ├── wxParse.js
109 | │ ├── wxParse.wxml
110 | │ └── wxParse.wxss
111 | ├── styles //样式
112 | │ ├── base.less
113 | │ ├── icon.less // 图标文件
114 | │ └── style.less
115 | └── utils //工具类
116 | ├── constant.js //常量
117 | ├── md5.js //md5
118 | ├── regions.js //省市区数据
119 | ├── tip.js //提示弹框组件
120 | ├── util.js //工具
121 | └── wxRequest.js //ajax请求
122 |
123 |
124 |
125 |
126 | ### 部分功能截图
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | ### 说明
148 |
149 | 此小程序借助于wepy进行高度的组件封装,仅供学习参考。喜欢就动手点个star吧~^o^~
150 |
151 | ### 寻找有缘合作伙伴,可提供一切开发技术服务;(2021-05-20)
152 |
153 |
154 |
155 | ### 友情赞助
156 | 如果本项目对你有较大的帮助,可以对我打赏,否则不需要,随便放个二维码,看看有没有对我特别好的小伙伴 ~ 哈哈
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wepy-mall",
3 | "version": "1.0.2",
4 | "description": "wepy-mall project",
5 | "main": "dist/app.js",
6 | "scripts": {
7 | "dev": "wepy build --watch",
8 | "build": "cross-env NODE_ENV=production wepy build --no-cache",
9 | "dev:web": "wepy build --output web",
10 | "clean": "find ./dist -maxdepth 1 -not -name 'project.config.json' -not -name 'dist' | xargs rm -rf",
11 | "test": "echo \"Error: no test specified\" && exit 1"
12 | },
13 | "wepy": {
14 | "module-a": false
15 | },
16 | "author": "yongqing <490844594@qq.com>",
17 | "license": "MIT",
18 | "dependencies": {
19 | "wepy": "^1.6.0",
20 | "wepy-async-function": "^1.4.4",
21 | "wepy-com-toast": "^1.0.2",
22 | "wepy-plugin-imagemin": "^1.5.3",
23 | "wepy-plugin-uglifyjs": "^1.3.7"
24 | },
25 | "devDependencies": {
26 | "babel-eslint": "^7.2.1",
27 | "babel-plugin-transform-class-properties": "^6.24.1",
28 | "babel-plugin-transform-decorators-legacy": "^1.3.4",
29 | "babel-plugin-transform-export-extensions": "^6.22.0",
30 | "babel-plugin-transform-object-rest-spread": "^6.26.0",
31 | "babel-preset-env": "^1.6.1",
32 | "cross-env": "^5.1.3",
33 | "eslint": ">=4.18.2",
34 | "eslint-config-standard": "^7.1.0",
35 | "eslint-friendly-formatter": "^2.0.7",
36 | "eslint-plugin-html": "^2.0.1",
37 | "eslint-plugin-promise": "^3.5.0",
38 | "eslint-plugin-standard": "^2.0.1",
39 | "less": "^3.10.3",
40 | "wepy-compiler-babel": "^1.5.1",
41 | "wepy-compiler-less": "^1.3.10",
42 | "wepy-eslint": "^1.5.3"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/screenshots/WechatIMG263.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG263.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG264.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG264.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG265.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG265.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG266.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG266.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG267.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG267.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG268.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG268.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG269.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG269.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG270.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG270.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG271.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG271.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG272.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG272.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG273.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG273.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG274.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG274.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG275.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG275.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG276.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG276.jpg
--------------------------------------------------------------------------------
/screenshots/WechatIMG277.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG277.jpeg
--------------------------------------------------------------------------------
/screenshots/WechatIMG278.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/WechatIMG278.png
--------------------------------------------------------------------------------
/screenshots/qr.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/screenshots/qr.jpg
--------------------------------------------------------------------------------
/src/app.wpy:
--------------------------------------------------------------------------------
1 |
7 |
97 |
--------------------------------------------------------------------------------
/src/components/address_add.wpy:
--------------------------------------------------------------------------------
1 |
28 |
29 |
67 |
68 |
166 |
--------------------------------------------------------------------------------
/src/components/address_edit.wpy:
--------------------------------------------------------------------------------
1 |
28 |
29 |
67 |
68 |
202 |
--------------------------------------------------------------------------------
/src/components/address_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.receiverName}}
10 | {{item.mobile}}
11 |
12 |
13 | [默认]
14 | {{item.provinceName}} {{item.cityName}} {{item.areaName}} {{item.adressDetail}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 新增地址
25 |
26 |
27 |
123 |
172 |
--------------------------------------------------------------------------------
/src/components/bomb_screen.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 恭喜获得红包
15 | 恭喜获得一张卡券,已发放至该账号
16 |
17 |
18 | 点击领取
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
60 |
139 |
--------------------------------------------------------------------------------
/src/components/collection_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | {{item.name}}
14 | ¥ {{item.price}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
136 |
187 |
--------------------------------------------------------------------------------
/src/components/comment_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
17 |
18 |
19 | 暂无评论
20 |
21 |
22 |
23 |
64 |
115 |
--------------------------------------------------------------------------------
/src/components/common/bottomLoadMore.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{message}}
5 |
6 |
7 |
21 |
39 |
--------------------------------------------------------------------------------
/src/components/common/placeholder.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{message}}
5 |
6 |
7 |
21 |
46 |
--------------------------------------------------------------------------------
/src/components/common/timer.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{strD>=0?strD+"天":""}}{{strH}}:{{strM}}:{{strS}}
12 | 订单结束
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{endTxt}}
25 | 订单结束
26 |
27 |
28 |
29 |
168 |
245 |
--------------------------------------------------------------------------------
/src/components/common/wepy-sign-time.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{item.signTime}}
8 | {{item.award}}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
77 |
78 |
148 |
--------------------------------------------------------------------------------
/src/components/common/wepy-swipe-delete.wpy:
--------------------------------------------------------------------------------
1 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 删除
66 |
67 |
68 |
69 |
138 |
--------------------------------------------------------------------------------
/src/components/discover.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 | {{item.attrName.attrName}}:{{item.attrVal}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
44 |
96 |
--------------------------------------------------------------------------------
/src/components/filterSlider.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 | 尺码
18 |
19 | XS
20 | S
21 | M
22 | L
23 | XL
24 | XXL
25 |
26 |
27 |
28 |
29 | 重置
30 |
31 |
32 | 确认
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
69 |
70 |
157 |
--------------------------------------------------------------------------------
/src/components/filter_bar.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 综合
6 | 销量
7 |
8 | 价格
9 |
10 |
11 |
12 |
13 |
14 |
15 | 筛选
16 |
17 |
18 |
19 |
20 |
21 |
22 |
102 |
103 |
163 |
--------------------------------------------------------------------------------
/src/components/points_detail.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 每日签到获得
7 | 连续签到7天获得
8 | {{item.signTime}}
9 |
10 |
11 | +{{item.signPoint}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
52 |
84 |
--------------------------------------------------------------------------------
/src/components/points_rule.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 素洁服装厂积分规则
5 |
6 |
7 | 1.签到积分规则
8 | 亲,每天签到送积分啦!每天签到一次送10积分,多签多得,积分可以抵消现金的,记得每天签到一次哦。
9 |
10 |
11 | 2.积分使用规则
12 | 亲,签到的积分可以享受满立减,下单更优惠!即满100积分可抵消5元现金;在您下单微信支付界面,系统会自动显示你的总积分多少可用多少,微信付款之后在商品金额上系统会自动减去5元。
13 |
14 |
18 |
19 |
20 |
43 |
73 |
--------------------------------------------------------------------------------
/src/components/rate.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
81 |
--------------------------------------------------------------------------------
/src/components/search.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
55 |
104 |
--------------------------------------------------------------------------------
/src/components/shop_grid_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{item.name}}
11 |
12 | ¥{{item.price}}
13 | ¥{{item.marketPrice}}
14 | 销量{{item.saleCount}}件
15 |
16 |
17 |
18 |
19 |
20 |
21 |
52 |
116 |
--------------------------------------------------------------------------------
/src/components/shop_item_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.goodsName}}
10 | 规格:{{item.goodsSkuVals}}
11 |
12 | ¥{{item.price}}
13 | x{{item.num}}
14 |
15 |
16 |
27 |
28 |
29 |
30 |
31 |
32 |
114 |
--------------------------------------------------------------------------------
/src/components/tab.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{item.name? item.name:item}}
6 | {{item.dotNum}}
7 |
8 |
9 |
10 |
60 |
135 |
--------------------------------------------------------------------------------
/src/images/alert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/alert.png
--------------------------------------------------------------------------------
/src/images/authorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/authorize.png
--------------------------------------------------------------------------------
/src/images/bc_qdyl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/bc_qdyl.png
--------------------------------------------------------------------------------
/src/images/empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/empty.png
--------------------------------------------------------------------------------
/src/images/empty_cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/empty_cart.png
--------------------------------------------------------------------------------
/src/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/error.png
--------------------------------------------------------------------------------
/src/images/half.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/half.png
--------------------------------------------------------------------------------
/src/images/icon_alert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_alert.png
--------------------------------------------------------------------------------
/src/images/icon_classify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_classify.png
--------------------------------------------------------------------------------
/src/images/icon_classify_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_classify_active.png
--------------------------------------------------------------------------------
/src/images/icon_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_home.png
--------------------------------------------------------------------------------
/src/images/icon_home_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_home_active.png
--------------------------------------------------------------------------------
/src/images/icon_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_info.png
--------------------------------------------------------------------------------
/src/images/icon_info_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_info_active.png
--------------------------------------------------------------------------------
/src/images/icon_my_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_01.png
--------------------------------------------------------------------------------
/src/images/icon_my_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_02.png
--------------------------------------------------------------------------------
/src/images/icon_my_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_03.png
--------------------------------------------------------------------------------
/src/images/icon_my_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_04.png
--------------------------------------------------------------------------------
/src/images/icon_my_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_05.png
--------------------------------------------------------------------------------
/src/images/icon_my_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_06.png
--------------------------------------------------------------------------------
/src/images/icon_my_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_my_07.png
--------------------------------------------------------------------------------
/src/images/icon_nav_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_01.png
--------------------------------------------------------------------------------
/src/images/icon_nav_01_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_01_new.png
--------------------------------------------------------------------------------
/src/images/icon_nav_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_02.png
--------------------------------------------------------------------------------
/src/images/icon_nav_02_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_02_new.png
--------------------------------------------------------------------------------
/src/images/icon_nav_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_03.png
--------------------------------------------------------------------------------
/src/images/icon_nav_03_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_03_new.png
--------------------------------------------------------------------------------
/src/images/icon_nav_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_04.png
--------------------------------------------------------------------------------
/src/images/icon_nav_04_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_nav_04_new.png
--------------------------------------------------------------------------------
/src/images/icon_notting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_notting.png
--------------------------------------------------------------------------------
/src/images/icon_shop_cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_shop_cart.png
--------------------------------------------------------------------------------
/src/images/icon_shop_cart_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/icon_shop_cart_active.png
--------------------------------------------------------------------------------
/src/images/image_demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/image_demo.png
--------------------------------------------------------------------------------
/src/images/loadding.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/loadding.gif
--------------------------------------------------------------------------------
/src/images/no_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/no_image.png
--------------------------------------------------------------------------------
/src/images/normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/normal.png
--------------------------------------------------------------------------------
/src/images/selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dyq086/wepy-mall/0ac29da0653e02c36118718ec1f2db02f895f1d3/src/images/selected.png
--------------------------------------------------------------------------------
/src/pages/address.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
117 |
123 |
--------------------------------------------------------------------------------
/src/pages/authorize.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 商城申请获取以下权限:
5 | 获取你的公开信息(头像、昵称等)
6 |
7 |
8 |
9 |
10 |
11 |
99 |
124 |
--------------------------------------------------------------------------------
/src/pages/classify.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 搜索商品
7 |
8 |
9 |
10 |
11 |
12 |
13 | {{item.name}}
14 |
15 |
16 |
17 |
18 |
19 |
20 | {{item.secondCategory.name}}
21 |
22 |
23 |
24 |
25 |
26 |
148 |
214 |
--------------------------------------------------------------------------------
/src/pages/collection.wpy:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
207 |
--------------------------------------------------------------------------------
/src/pages/comment.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 全部评价(20)
5 |
6 |
7 |
8 |
9 |
10 |
54 |
71 |
--------------------------------------------------------------------------------
/src/pages/comment_add.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 评分:
6 |
7 |
8 |
9 |
10 |
11 | 内容:
12 |
13 |
14 |
15 |
16 | 发表评论
17 |
18 |
19 |
48 |
71 |
--------------------------------------------------------------------------------
/src/pages/exchange_goods.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
92 |
--------------------------------------------------------------------------------
/src/pages/filter.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
38 |
46 |
--------------------------------------------------------------------------------
/src/pages/home_detail.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{cate.name}}
9 |
10 | ◆ {{item.attrName.attrName}}:{{item.attrVal}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
180 |
216 |
--------------------------------------------------------------------------------
/src/pages/info.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 | 绑定手机号
15 |
16 | 绑定手机号可更好的让我们服务好您!
17 |
18 | >
19 |
20 |
21 |
22 |
23 | 全部订单
24 |
25 | >
26 |
27 |
28 |
29 |
30 | 补货订单
31 |
32 | >
33 |
34 |
35 |
36 |
37 | 我的积分
38 |
39 | >
40 |
41 |
42 |
43 |
44 | 我的足迹
45 |
46 | >
47 |
48 |
49 |
50 |
51 | 我的收藏
52 |
53 | >
54 |
55 |
56 |
57 |
58 |
59 |
60 | 我的消息
61 |
62 | >
63 |
64 |
65 |
66 |
67 | 设置
68 |
69 | >
70 |
71 |
72 |
73 |
74 |
138 |
201 |
--------------------------------------------------------------------------------
/src/pages/logistics.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{expresses.exName}}
9 | 运单号:{{orderExpress.expressNo}}
10 |
11 |
12 |
13 |
14 | 已发货
15 |
16 | {{orderExpress.departLocation}}
17 |
18 |
19 | 运输中
20 |
21 |
22 |
23 |
24 | 派件中
25 |
26 |
27 |
28 | 签收
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{item.updateTime}}
36 |
37 |
38 | {{item.flowName}}
39 |
40 |
41 |
42 |
43 |
107 |
266 |
--------------------------------------------------------------------------------
/src/pages/messages.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 | {{item.detail}}
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
132 |
173 |
--------------------------------------------------------------------------------
/src/pages/pay_success.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 恭喜支付成功
7 |
8 |
9 |
10 |
11 | 支付方式
12 | 微信支付
13 |
14 |
15 |
16 |
17 |
18 | 支付金额
19 | {{totalFee}}
20 |
21 |
22 |
23 |
24 | 查看订单
25 | 继续购物
26 |
27 |
28 |
29 |
30 |
92 |
161 |
--------------------------------------------------------------------------------
/src/pages/points.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
19 | 积分明细
20 | 查看更多
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
112 |
200 |
--------------------------------------------------------------------------------
/src/pages/points_more.wpy:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
112 |
--------------------------------------------------------------------------------
/src/pages/points_rule.wpy:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
41 |
--------------------------------------------------------------------------------
/src/pages/register.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
130 |
167 |
--------------------------------------------------------------------------------
/src/pages/replenishment_goods.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
153 |
--------------------------------------------------------------------------------
/src/pages/setting.wpy:
--------------------------------------------------------------------------------
1 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 昵称
37 | {{userInfo.nickName}}
38 |
39 |
40 | 我的手机
41 | {{userInfo.mobile}}
42 |
43 |
44 | 收货地址
45 | 更改地址 >
46 |
47 |
48 |
49 |
50 |
51 |
52 |
111 |
--------------------------------------------------------------------------------
/src/pages/shop_cart.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
37 |
43 |
--------------------------------------------------------------------------------
/src/pages/sign_in.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 积分:{{score}}
6 |
7 |
8 |
9 |
10 | 已签到
11 | 签到
12 |
13 |
14 | 连续{{conDays}}天
15 |
16 |
17 |
18 | 今日已签到,获得10积分
19 | 今日还未签到
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
155 |
156 |
246 |
--------------------------------------------------------------------------------
/src/pages/test.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
52 |
53 |
123 |
--------------------------------------------------------------------------------
/src/pages/wholesale.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
105 |
--------------------------------------------------------------------------------
/src/plugins/wxParse/htmlparser.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
4 | *
5 | * author: Di (微信小程序开发工程师)
6 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7 | * 垂直微信小程序开发交流社区
8 | *
9 | * github地址: https://github.com/icindy/wxParse
10 | *
11 | * for: 微信小程序富文本解析
12 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13 | */
14 | // Regular Expressions for parsing tags and attributes
15 | var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
16 | endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
17 | attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
18 |
19 | // Empty Elements - HTML 5
20 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
21 |
22 | // Block Elements - HTML 5
23 | var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
24 |
25 | // Inline Elements - HTML 5
26 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
27 |
28 | // Elements that you can, intentionally, leave open
29 | // (and which close themselves)
30 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
31 |
32 | // Attributes that have their values filled in disabled="disabled"
33 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
34 |
35 | // Special Elements (can contain anything)
36 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
37 |
38 | function HTMLParser(html, handler) {
39 | var index, chars, match, stack = [], last = html;
40 | stack.last = function () {
41 | return this[this.length - 1];
42 | };
43 |
44 | while (html) {
45 | chars = true;
46 |
47 | // Make sure we're not in a script or style element
48 | if (!stack.last() || !special[stack.last()]) {
49 |
50 | // Comment
51 | if (html.indexOf("");
53 |
54 | if (index >= 0) {
55 | if (handler.comment)
56 | handler.comment(html.substring(4, index));
57 | html = html.substring(index + 3);
58 | chars = false;
59 | }
60 |
61 | // end tag
62 | } else if (html.indexOf("") == 0) {
63 | match = html.match(endTag);
64 |
65 | if (match) {
66 | html = html.substring(match[0].length);
67 | match[0].replace(endTag, parseEndTag);
68 | chars = false;
69 | }
70 |
71 | // start tag
72 | } else if (html.indexOf("<") == 0) {
73 | match = html.match(startTag);
74 |
75 | if (match) {
76 | html = html.substring(match[0].length);
77 | match[0].replace(startTag, parseStartTag);
78 | chars = false;
79 | }
80 | }
81 |
82 | if (chars) {
83 | index = html.indexOf("<");
84 | var text = ''
85 | while (index === 0) {
86 | text += "<";
87 | html = html.substring(1);
88 | index = html.indexOf("<");
89 | }
90 | text += index < 0 ? html : html.substring(0, index);
91 | html = index < 0 ? "" : html.substring(index);
92 |
93 | if (handler.chars)
94 | handler.chars(text);
95 | }
96 |
97 | } else {
98 |
99 | html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
100 | text = text.replace(/|/g, "$1$2");
101 | if (handler.chars)
102 | handler.chars(text);
103 |
104 | return "";
105 | });
106 |
107 |
108 | parseEndTag("", stack.last());
109 | }
110 |
111 | if (html == last)
112 | throw "Parse Error: " + html;
113 | last = html;
114 | }
115 |
116 | // Clean up any remaining tags
117 | parseEndTag();
118 |
119 | function parseStartTag(tag, tagName, rest, unary) {
120 | tagName = tagName.toLowerCase();
121 |
122 | if (block[tagName]) {
123 | while (stack.last() && inline[stack.last()]) {
124 | parseEndTag("", stack.last());
125 | }
126 | }
127 |
128 | if (closeSelf[tagName] && stack.last() == tagName) {
129 | parseEndTag("", tagName);
130 | }
131 |
132 | unary = empty[tagName] || !!unary;
133 |
134 | if (!unary)
135 | stack.push(tagName);
136 |
137 | if (handler.start) {
138 | var attrs = [];
139 |
140 | rest.replace(attr, function (match, name) {
141 | var value = arguments[2] ? arguments[2] :
142 | arguments[3] ? arguments[3] :
143 | arguments[4] ? arguments[4] :
144 | fillAttrs[name] ? name : "";
145 |
146 | attrs.push({
147 | name: name,
148 | value: value,
149 | escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
150 | });
151 | });
152 |
153 | if (handler.start) {
154 | handler.start(tagName, attrs, unary);
155 | }
156 |
157 | }
158 | }
159 |
160 | function parseEndTag(tag, tagName) {
161 | // If no tag name is provided, clean shop
162 | if (!tagName)
163 | var pos = 0;
164 |
165 | // Find the closest opened tag of the same type
166 | else {
167 | tagName = tagName.toLowerCase();
168 | for (var pos = stack.length - 1; pos >= 0; pos--)
169 | if (stack[pos] == tagName)
170 | break;
171 | }
172 | if (pos >= 0) {
173 | // Close all the open elements, up the stack
174 | for (var i = stack.length - 1; i >= pos; i--)
175 | if (handler.end)
176 | handler.end(stack[i]);
177 |
178 | // Remove the open elements from the stack
179 | stack.length = pos;
180 | }
181 | }
182 | };
183 |
184 |
185 | function makeMap(str) {
186 | var obj = {}, items = str.split(",");
187 | for (var i = 0; i < items.length; i++)
188 | obj[items[i]] = true;
189 | return obj;
190 | }
191 |
192 | module.exports = HTMLParser;
193 |
--------------------------------------------------------------------------------
/src/plugins/wxParse/wxParse.js:
--------------------------------------------------------------------------------
1 | /**
2 | * author: Di (微信小程序开发工程师)
3 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
4 | * 垂直微信小程序开发交流社区
5 | *
6 | * github地址: https://github.com/icindy/wxParse
7 | *
8 | * for: 微信小程序富文本解析
9 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
10 | */
11 |
12 | /**
13 | * utils函数引入
14 | **/
15 | import showdown from './showdown.js';
16 | import HtmlToJson from './html2json.js';
17 | /**
18 | * 配置及公有属性
19 | **/
20 | var realWindowWidth = 0;
21 | var realWindowHeight = 0;
22 | wx.getSystemInfo({
23 | success: function (res) {
24 | realWindowWidth = res.windowWidth
25 | realWindowHeight = res.windowHeight
26 | }
27 | })
28 | /**
29 | * 主函数入口区
30 | **/
31 | function wxParse(bindName = 'wxParseData', type='html', data='
数据不能为空
', target,imagePadding) {
32 | var that = target;
33 | var transData = {};//存放转化后的数据
34 | if (type == 'html') {
35 | transData = HtmlToJson.html2json(data, bindName);
36 | console.log(JSON.stringify(transData, ' ', ' '));
37 | } else if (type == 'md' || type == 'markdown') {
38 | var converter = new showdown.Converter();
39 | var html = converter.makeHtml(data);
40 | transData = HtmlToJson.html2json(html, bindName);
41 | console.log(JSON.stringify(transData, ' ', ' '));
42 | }
43 | transData.view = {};
44 | transData.view.imagePadding = 0;
45 | if(typeof(imagePadding) != 'undefined'){
46 | transData.view.imagePadding = imagePadding
47 | }
48 | var bindData = {};
49 | bindData[bindName] = transData;
50 | that.setData(bindData)
51 | that.bindData = bindData // 增加这一行代码
52 | that.wxParseImgLoad = wxParseImgLoad;
53 | that.wxParseImgTap = wxParseImgTap;
54 | }
55 | // 图片点击事件
56 | function wxParseImgTap(e) {
57 | var that = this;
58 | var nowImgUrl = e.target.dataset.src;
59 | var tagFrom = e.target.dataset.from;
60 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
61 | wx.previewImage({
62 | current: nowImgUrl, // 当前显示图片的http链接
63 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
64 | })
65 | }
66 | }
67 |
68 | /**
69 | * 图片视觉宽高计算函数区
70 | **/
71 | function wxParseImgLoad(e) {
72 | var that = this;
73 | var tagFrom = e.target.dataset.from;
74 | var idx = e.target.dataset.idx;
75 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
76 | calMoreImageInfo(e, idx, that, tagFrom)
77 | }
78 | }
79 | // 假循环获取计算图片视觉最佳宽高
80 | function calMoreImageInfo(e, idx, that, bindName) {
81 | var temData = that.data[bindName];
82 | if (!temData || temData.images.length == 0) {
83 | return;
84 | }
85 | var temImages = temData.images;
86 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
87 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
88 | // temImages[idx].width = recal.imageWidth;
89 | // temImages[idx].height = recal.imageheight;
90 | // temData.images = temImages;
91 | // var bindData = {};
92 | // bindData[bindName] = temData;
93 | // that.setData(bindData);
94 | var index = temImages[idx].index
95 | var key = `${bindName}`
96 | for (var i of index.split('.')) key+=`.nodes[${i}]`
97 | var keyW = key + '.width'
98 | var keyH = key + '.height'
99 | that.setData({
100 | [keyW]: recal.imageWidth,
101 | [keyH]: recal.imageheight,
102 | })
103 | }
104 |
105 | // 计算视觉优先的图片宽高
106 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
107 | //获取图片的原始长宽
108 | var windowWidth = 0, windowHeight = 0;
109 | var autoWidth = 0, autoHeight = 0;
110 | var results = {};
111 | var padding = that.data[bindName].view.imagePadding;
112 | windowWidth = realWindowWidth-2*padding;
113 | windowHeight = realWindowHeight;
114 | //判断按照那种方式进行缩放
115 | // console.log("windowWidth" + windowWidth);
116 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
117 | autoWidth = windowWidth;
118 | // console.log("autoWidth" + autoWidth);
119 | autoHeight = (autoWidth * originalHeight) / originalWidth;
120 | // console.log("autoHeight" + autoHeight);
121 | results.imageWidth = autoWidth;
122 | results.imageheight = autoHeight;
123 | } else {//否则展示原来的数据
124 | results.imageWidth = originalWidth;
125 | results.imageheight = originalHeight;
126 | }
127 | return results;
128 | }
129 |
130 | function wxParseTemArray(temArrayName,bindNameReg,total,that){
131 | var array = [];
132 | var temData = that.data;
133 | var obj = null;
134 | for(var i = 0; i < total; i++){
135 | var simArr = temData[bindNameReg+i].nodes;
136 | array.push(simArr);
137 | }
138 |
139 | temArrayName = temArrayName || 'wxParseTemArray';
140 | obj = JSON.parse('{"'+ temArrayName +'":""}');
141 | obj[temArrayName] = array;
142 | that.setData(obj);
143 | }
144 |
145 | /**
146 | * 配置emojis
147 | *
148 | */
149 |
150 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
151 | HtmlToJson.emojisInit(reg,baseSrc,emojis);
152 | }
153 |
154 | module.exports = {
155 | wxParse: wxParse,
156 | wxParseTemArray:wxParseTemArray,
157 | emojisInit:emojisInit
158 | }
159 |
160 |
161 |
--------------------------------------------------------------------------------
/src/plugins/wxParse/wxParse.wxss:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * author: Di (微信小程序开发工程师)
4 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
5 | * 垂直微信小程序开发交流社区
6 | *
7 | * github地址: https://github.com/icindy/wxParse
8 | *
9 | * for: 微信小程序富文本解析
10 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
11 | */
12 |
13 | .wxParse{
14 | margin: 0 5px;
15 | font-family: Helvetica,sans-serif;
16 | font-size: 28rpx;
17 | color: #666;
18 | line-height: 1.8;
19 | }
20 | view{
21 | word-break:break-all; overflow:auto;
22 | }
23 | .wxParse-inline{
24 | display: inline;
25 | margin: 0;
26 | padding: 0;
27 | }
28 | /*//标题 */
29 | .wxParse-div{margin: 0;padding: 0;}
30 | .wxParse-h1{ font-size:2em; margin: .67em 0 }
31 | .wxParse-h2{ font-size:1.5em; margin: .75em 0 }
32 | .wxParse-h3{ font-size:1.17em; margin: .83em 0 }
33 | .wxParse-h4{ margin: 1.12em 0}
34 | .wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
35 | .wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
36 |
37 | .wxParse-h1 {
38 | font-size: 18px;
39 | font-weight: 400;
40 | margin-bottom: .9em;
41 | }
42 | .wxParse-h2 {
43 | font-size: 16px;
44 | font-weight: 400;
45 | margin-bottom: .34em;
46 | }
47 | .wxParse-h3 {
48 | font-weight: 400;
49 | font-size: 15px;
50 | margin-bottom: .34em;
51 | }
52 | .wxParse-h4 {
53 | font-weight: 400;
54 | font-size: 14px;
55 | margin-bottom: .24em;
56 | }
57 | .wxParse-h5 {
58 | font-weight: 400;
59 | font-size: 13px;
60 | margin-bottom: .14em;
61 | }
62 | .wxParse-h6 {
63 | font-weight: 400;
64 | font-size: 12px;
65 | margin-bottom: .04em;
66 | }
67 |
68 | .wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
69 |
70 | .wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
71 | .wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
72 | .wxParse-pre{white-space:pre}
73 | .wxParse-big{font-size:1.17em}
74 | .wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
75 | .wxParse-sub{vertical-align:sub}
76 | .wxParse-sup{vertical-align:super}
77 | .wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
78 | /*wxparse-自定义个性化的css样式*/
79 | /*增加video的css样式*/
80 | .wxParse-strong,.wxParse-s{display: inline}
81 | .wxParse-a{
82 | color: deepskyblue;
83 | word-break:break-all;
84 | overflow:auto;
85 | }
86 |
87 | .wxParse-video{
88 | text-align: center;
89 | margin: 10px 0;
90 | }
91 |
92 | .wxParse-video-video{
93 | width:100%;
94 | }
95 |
96 | .wxParse-img{
97 | /*background-color: #efefef;*/
98 | overflow: hidden;
99 | }
100 |
101 | .wxParse-blockquote {
102 | margin: 0;
103 | padding:10px 0 10px 5px;
104 | font-family:Courier, Calibri,"宋体";
105 | background:#f5f5f5;
106 | border-left: 3px solid #dbdbdb;
107 | }
108 |
109 | .wxParse-code,.wxParse-wxxxcode-style{
110 | display: inline;
111 | background:#f5f5f5;
112 | }
113 | .wxParse-ul{
114 | margin: 20rpx 10rpx;
115 | }
116 |
117 | .wxParse-li,.wxParse-li-inner{
118 | display: flex;
119 | align-items: baseline;
120 | margin: 10rpx 0;
121 | }
122 | .wxParse-li-text{
123 |
124 | align-items: center;
125 | line-height: 20px;
126 | }
127 |
128 | .wxParse-li-circle{
129 | display: inline-flex;
130 | width: 5px;
131 | height: 5px;
132 | background-color: #333;
133 | margin-right: 5px;
134 | }
135 |
136 | .wxParse-li-square{
137 | display: inline-flex;
138 | width: 10rpx;
139 | height: 10rpx;
140 | background-color: #333;
141 | margin-right: 5px;
142 | }
143 | .wxParse-li-ring{
144 | display: inline-flex;
145 | width: 10rpx;
146 | height: 10rpx;
147 | border: 2rpx solid #333;
148 | border-radius: 50%;
149 | background-color: #fff;
150 | margin-right: 5px;
151 | }
152 |
153 | /*.wxParse-table{
154 | width: 100%;
155 | height: 400px;
156 | }
157 | .wxParse-thead,.wxParse-tfoot,.wxParse-tr{
158 | display: flex;
159 | flex-direction: row;
160 | }
161 | .wxParse-th,.wxParse-td{
162 | display: flex;
163 | width: 580px;
164 | overflow: auto;
165 | }*/
166 |
167 | .wxParse-u {
168 | text-decoration: underline;
169 | }
170 | .wxParse-hide{
171 | display: none;
172 | }
173 | .WxEmojiView{
174 | align-items: center;
175 | }
176 | .wxEmoji{
177 | width: 16px;
178 | height:16px;
179 | }
180 | .wxParse-tr{
181 | display: flex;
182 | border-right:1px solid #e0e0e0;
183 | border-bottom:1px solid #e0e0e0;
184 | border-top:1px solid #e0e0e0;
185 | }
186 | .wxParse-th,
187 | .wxParse-td{
188 | flex:1;
189 | padding:5px;
190 | font-size:28rpx;
191 | border-left:1px solid #e0e0e0;
192 | word-break: break-all;
193 | }
194 | .wxParse-td:last{
195 | border-top:1px solid #e0e0e0;
196 | }
197 | .wxParse-th{
198 | background:#f0f0f0;
199 | border-top:1px solid #e0e0e0;
200 | }
201 | .wxParse-del{
202 | display: inline;
203 | }
204 | .wxParse-figure {
205 | overflow: hidden;
206 | }
207 |
--------------------------------------------------------------------------------
/src/styles/base.less:
--------------------------------------------------------------------------------
1 | view {
2 | font-size: 30rpx;
3 | color: #666;
4 | }
5 |
6 | page {
7 | background: #f5f5f5;
8 | }
9 |
10 | .container {
11 | position: relative;
12 | background: #ffffff;
13 | }
14 |
15 | .no_data {
16 | font-size: 40rpx;
17 | width: 100%;
18 | margin: 0 auto;
19 | text-align: center;
20 | color: #8b8b8b;
21 | padding-top: 20rpx;
22 | .iconfont {
23 | font-size: 40rpx;
24 | }
25 | }
26 |
27 | .loadMoreGif {
28 | align-items: center;
29 | display: flex;
30 | justify-content: center;
31 | margin: 15rpx auto;
32 | width: 220rpx;
33 | text {
34 | font-size: 30rpx;
35 | color: #999;
36 | margin-left: 10rpx;
37 | }
38 | image {
39 | width: 30rpx;
40 | height: 30rpx;
41 | }
42 | }
43 |
44 | .hidden {
45 | display: none;
46 | }
47 |
48 | .tc {
49 | text-align: center;
50 | }
51 |
52 | .tl {
53 | text-align: left;
54 | }
55 |
56 | .tr {
57 | text-align: right;
58 | }
59 |
60 | .c666 {
61 | color: #666;
62 | }
63 |
64 | .c333 {
65 | color: #333;
66 | }
67 |
68 | .c000 {
69 | color: #000;
70 | }
71 |
72 | .c999 {
73 | color: #999;
74 | }
75 |
76 | .cfff {
77 | color: #ffffff;
78 | }
79 |
80 | .fz24 {
81 | font-size: 24rpx;
82 | }
83 |
84 | .fz25 {
85 | font-size: 25rpx;
86 | }
87 |
88 | .fz26 {
89 | font-size: 26rpx;
90 | }
91 |
92 | .fz27 {
93 | font-size: 27rpx;
94 | }
95 |
96 | .fz28 {
97 | font-size: 28rpx;
98 | }
99 |
100 | .fz29 {
101 | font-size: 29rpx;
102 | }
103 |
104 | .fz30 {
105 | font-size: 30rpx;
106 | }
107 |
108 | .fz31 {
109 | font-size: 31rpx;
110 | }
111 |
112 | .fz32 {
113 | font-size: 32rpx;
114 | }
115 |
116 | .type_red {
117 | background: #ea4a3a;
118 | color: #fff;
119 | }
120 |
121 | .type_yellow {
122 | background: #ff6a3c;
123 | color: #fff;
124 | }
125 |
126 | .type_green {
127 | background: #09bb07;
128 | color: #fff;
129 | }
130 |
131 | .type_pick {
132 | background: #ff4856;
133 | color: #fff;
134 | border: 1px solid #ff4856;
135 | }
136 |
137 | .type_empity {
138 | color: #333;
139 | border: 1px solid #cccccc;
140 | }
141 |
142 | .button {
143 | font-size: 36rpx;
144 | height: 95rpx;
145 | line-height: 95rpx;
146 | text-align: center;
147 | margin: 0 auto;
148 | width: 100%;
149 | -moz-border-radius: 10rpx;
150 | /* Firefox */
151 | -webkit-border-radius: 10rpx;
152 | /* Safari 和 Chrome */
153 | border-radius: 10rpx;
154 | /* Opera 10.5+, 以及使用了IE-CSS3的IE浏览器 */
155 | }
156 |
--------------------------------------------------------------------------------
/src/styles/icon.less:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'iconfont';
3 | /* project id 349464 */
4 | src: url('//at.alicdn.com/t/font_349464_e2gyuo97tlu15rk9.eot');
5 | src: url('//at.alicdn.com/t/font_349464_e2gyuo97tlu15rk9.eot?#iefix') format('embedded-opentype'),
6 | url('//at.alicdn.com/t/font_349464_e2gyuo97tlu15rk9.woff') format('woff'),
7 | url('//at.alicdn.com/t/font_349464_e2gyuo97tlu15rk9.ttf') format('truetype'),
8 | url('//at.alicdn.com/t/font_349464_e2gyuo97tlu15rk9.svg#iconfont') format('svg');
9 | }
10 |
11 | .iconfont {
12 | font-family: "iconfont" !important;
13 | font-size: 16px;
14 | font-style: normal;
15 | -webkit-font-smoothing: antialiased;
16 | -moz-osx-font-smoothing: grayscale;
17 | }
18 |
19 | .icon-next:before {
20 | content: "\e67c";
21 | }
22 |
23 | .icon-message:before {
24 | content: "\e602";
25 | }
26 |
27 | .icon-filter:before {
28 | content: "\e653";
29 | }
30 |
31 | .icon-jifen:before {
32 | content: "\e61a";
33 | }
34 |
35 | .icon-money:before {
36 | content: "\e681";
37 | }
38 |
39 | .icon-collection:before {
40 | content: "\e608";
41 | }
42 |
43 | .icon-home:before {
44 | content: "\e665";
45 | }
46 |
47 | .icon-search:before {
48 | content: "\e63e";
49 | }
50 |
51 | .icon-share:before {
52 | content: "\e669";
53 | }
54 |
55 | .icon-up:before {
56 | content: "\e614";
57 | }
58 |
59 | .icon-del:before {
60 | content: "\e60d";
61 | }
62 |
63 | .icon-close:before {
64 | content: "\e66d";
65 | }
66 |
67 | .icon-success:before {
68 | content: "\e600";
69 | }
70 |
71 | .icon-paytype:before {
72 | content: "\e601";
73 | }
74 |
75 | .icon-wait:before {
76 | content: "\e62c";
77 | }
78 |
79 | .icon-down:before {
80 | content: "\e613";
81 | }
82 |
83 | .icon-bottom-check:before {
84 | content: "\e6d5";
85 | }
86 |
87 | .icon-edit:before {
88 | content: "\e7f4";
89 | }
90 |
91 | .icon-complete:before {
92 | content: "\e64a";
93 | }
94 |
95 | .icon-gouwuchekong:before {
96 | content: "\e62a";
97 | }
98 |
--------------------------------------------------------------------------------
/src/styles/style.less:
--------------------------------------------------------------------------------
1 | .search_read_only {
2 | align-items: center;
3 | display: flex;
4 | margin: 0 auto;
5 | width: 650rpx;
6 | .search_content {
7 | display: flex;
8 | align-items: center;
9 | border-radius: 100rpx;
10 | color: #999;
11 | width: 500rpx;
12 | background: #efefef;
13 | padding: 0 30rpx;
14 | height: 55rpx;
15 | margin: 0 auto;
16 | .search_input {
17 | font-size: 26rpx;
18 | width: 100%;
19 | }
20 | }
21 | .icon-search {
22 | font-size: 40rpx;
23 | }
24 | .icon-message {
25 | font-size: 50rpx;
26 | }
27 | }
28 |
29 | .top_search {
30 | padding: 20rpx 0rpx;
31 | background: #fff;
32 | }
33 |
34 | .spacing {
35 | height: 20rpx;
36 | width: 100%;
37 | overflow: hidden;
38 | background-color: #f5f5f5;
39 | }
40 |
--------------------------------------------------------------------------------
/src/utils/constant.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 用户code 换取 session_key
3 | * @type {String}
4 | */
5 | export const USER_SPECICAL_INFO = "userSpecialInfo";
6 |
7 | /**
8 | * 用户信息
9 | * @type {String}
10 | */
11 | export const USER_INFO = "userInfo";
12 |
13 | /**
14 | * 系统信息
15 | * @type {String}
16 | */
17 | export const SYSTEM_INFO = "systemInfo";
18 |
19 |
20 | export const ADDRESS_ID = "addressId";
21 |
22 | export const SEL_CLASS_CODE = "selClassCode";
23 |
--------------------------------------------------------------------------------
/src/utils/md5.js:
--------------------------------------------------------------------------------
1 | var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz))}function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz))}function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz))}function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data))}function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data))}function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data))}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C}var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128)}function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF)}function bit_rol(num,cnt){return(num<>>(32-cnt))}function str2binl(str){var bin=Array();var mask=(1<>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin}function binl2str(bin){var str="";var mask=(1<>5]>>>(i%32))&mask);return str}function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i>2]>>((i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF)}return str}function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F)}}return str}module.exports={hex_md5:hex_md5}
--------------------------------------------------------------------------------
/src/utils/tip.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 提示与加载工具类
3 | */
4 | export default class Tips {
5 | constructor() {
6 | this.isLoading = false;
7 | }
8 | /**
9 | * 弹出提示框
10 | */
11 |
12 | static success(title, duration = 500) {
13 | setTimeout(() => {
14 | wx.showToast({
15 | title: title,
16 | icon: "success",
17 | mask: true,
18 | duration: duration
19 | });
20 | }, 300);
21 | if (duration > 0) {
22 | return new Promise((resolve, reject) => {
23 | setTimeout(() => {
24 | resolve();
25 | }, duration);
26 | });
27 | }
28 | }
29 |
30 | /**
31 | * 弹出确认窗口
32 | */
33 | static confirm(text, payload = {}, title = "提示") {
34 | return new Promise((resolve, reject) => {
35 | wx.showModal({
36 | title: title,
37 | content: text,
38 | showCancel: true,
39 | success: res => {
40 | if (res.confirm) {
41 | resolve(payload);
42 | } else if (res.cancel) {
43 | reject(payload);
44 | }
45 | },
46 | fail: res => {
47 | reject(payload);
48 | }
49 | });
50 | });
51 | }
52 |
53 | static toast(title, onHide, icon = "success") {
54 | setTimeout(() => {
55 | wx.showToast({
56 | title: title,
57 | icon: icon,
58 | mask: true,
59 | duration: 500
60 | });
61 | }, 300);
62 |
63 | // 隐藏结束回调
64 | if (onHide) {
65 | setTimeout(() => {
66 | onHide();
67 | }, 500);
68 | }
69 | }
70 |
71 | /**
72 | * 警告框
73 | */
74 | static alert(title) {
75 | wx.showToast({
76 | title: title,
77 | image: "../images/alert.png",
78 | mask: true,
79 | duration: 1500
80 | });
81 | }
82 |
83 | /**
84 | * 错误框
85 | */
86 |
87 | static error(title, onHide) {
88 | wx.showToast({
89 | title: title,
90 | image: "../images/error.png",
91 | mask: true,
92 | duration: 500
93 | });
94 | // 隐藏结束回调
95 | if (onHide) {
96 | setTimeout(() => {
97 | onHide();
98 | }, 500);
99 | }
100 | }
101 |
102 | /**
103 | * 弹出加载提示
104 | */
105 | static loading(title = "加载中") {
106 | if (Tips.isLoading) {
107 | return;
108 | }
109 | Tips.isLoading = true;
110 | wx.showLoading({
111 | title: title,
112 | mask: true
113 | });
114 | }
115 |
116 | /**
117 | * 加载完毕
118 | */
119 | static loaded() {
120 | if (Tips.isLoading) {
121 | Tips.isLoading = false;
122 | wx.hideLoading();
123 | }
124 | }
125 |
126 | static share(title, url, desc) {
127 | return {
128 | title: title,
129 | path: url,
130 | desc: desc,
131 | success: function(res) {
132 | Tips.toast("分享成功");
133 | }
134 | };
135 | }
136 | }
137 |
138 | /**
139 | * 静态变量,是否加载中
140 | */
141 | Tips.isLoading = false;
142 |
--------------------------------------------------------------------------------
/src/utils/util.js:
--------------------------------------------------------------------------------
1 | function getCurrentTime() {
2 | let keep = ''
3 | let date = new Date()
4 | let y = date.getFullYear()
5 | let m = date.getMonth() + 1
6 | m = m < 10 ? '0' + m : m
7 | let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
8 | let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
9 | let f = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
10 | let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
11 | keep = y + '' + m + '' + d + '' + h + '' + f + '' + s
12 | return keep // 20160614134947
13 | }
14 |
15 | function objLength(input) {
16 | let type = toString(input)
17 | let length = 0
18 | if (type !== '[object Object]') {
19 | // throw '输入必须为对象{}!'
20 | } else {
21 | for (let key in input) {
22 | if (key !== 'number') {
23 | length++
24 | }
25 | }
26 | }
27 | return length
28 | }
29 | // 验证是否是手机号码
30 | function vailPhone(number) {
31 | let flag = true
32 | let myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/
33 | if (number.length !== 11 || !myreg.test(number)) {
34 | flag = false
35 | }
36 | return flag
37 | }
38 | // 验证是否西班牙手机(6开头 9位数)
39 | function ifSpanish(number) {
40 | let flag = true
41 | let myreg = /^([6|7|9]{1}(\d+){8})$/
42 | if (number.length !== 9 || !myreg.test(number)) {
43 | flag = false
44 | }
45 | return flag
46 | }
47 | // 浮点型除法
48 | function div(a, b) {
49 | let c, d, e, f
50 | try {
51 | e = a.toString().split('.')[1].length
52 | } catch (g) { }
53 | try {
54 | f = b.toString().split('.')[1].length
55 | } catch (g) {}
56 | // [eslint] Return statement should not contain assignment. (no-return-assign)
57 | c = Number(a.toString().replace('.', ''))
58 | d = Number(b.toString().replace('.', ''))
59 | return mul(c / d, Math.pow(10, f - e))
60 | }
61 | // 浮点型加法函数
62 | function accAdd(arg1, arg2) {
63 | let r1, r2, m
64 | try {
65 | r1 = arg1.toString().split('.')[1].length
66 | } catch (e) {
67 | r1 = 0
68 | }
69 | try {
70 | r2 = arg2.toString().split('.')[1].length
71 | } catch (e) {
72 | r2 = 0
73 | }
74 | m = Math.pow(10, Math.max(r1, r2))
75 | return ((arg1 * m + arg2 * m) / m).toFixed(2)
76 | }
77 | // 浮点型乘法
78 | function mul(a, b) {
79 | let c = 0
80 | let d = a.toString()
81 | let e = b.toString()
82 | try {
83 | c += a.toString().split('.')[1].length
84 | } catch (f) { }
85 | try {
86 | c += b.toString().split('.')[1].length
87 | } catch (f) { }
88 | return Number(d.replace('.', '')) * Number(e.replace('.', '')) / Math.pow(10, c)
89 | }
90 |
91 | // 遍历对象属性和值
92 | function displayProp(obj) {
93 | let names = ''
94 | for (let name in obj) {
95 | names += name + obj[name]
96 | }
97 | return names
98 | }
99 | // 去除字符串所有空格
100 | function sTrim(text) {
101 | return text.replace(/\s/g, '')
102 | }
103 | // 去除所有:,英文冒号
104 | function replaceColon(txt) {
105 | return txt.replace(/:/g, '')
106 | }
107 | // 转换星星分数
108 | function convertStarArray(score) {
109 | // 1 全星,0 空星,2半星
110 | let arr = []
111 | for (let i = 1; i <= 5; i++) {
112 | if (score >= i) {
113 | arr.push(1)
114 | } else if (score > i - 1 && score < i + 1) {
115 | arr.push(2)
116 | } else {
117 | arr.push(0)
118 | }
119 | }
120 | return arr
121 | }
122 | module.exports = {
123 | getCurrentTime: getCurrentTime,
124 | objLength: objLength,
125 | displayProp: displayProp,
126 | sTrim: sTrim,
127 | replaceColon: replaceColon,
128 | vailPhone: vailPhone,
129 | ifSpanish: ifSpanish,
130 | div: div,
131 | mul: mul,
132 | accAdd: accAdd,
133 | convertStarArray: convertStarArray
134 | }
135 |
--------------------------------------------------------------------------------
/src/utils/wxRequest.js:
--------------------------------------------------------------------------------
1 | import wepy from 'wepy';
2 | import util from './util';
3 | import md5 from './md5';
4 | import tip from './tip'
5 |
6 | const API_SECRET_KEY = 'www.mall.cycle.com'
7 | const TIMESTAMP = util.getCurrentTime()
8 | const SIGN = md5.hex_md5((TIMESTAMP + API_SECRET_KEY).toLowerCase())
9 |
10 | const wxRequest = async(params = {}, url) => {
11 | tip.loading();
12 | let data = params.query || {};
13 | data.sign = SIGN;
14 | data.time = TIMESTAMP;
15 | let res = await wepy.request({
16 | url: url,
17 | method: params.method || 'GET',
18 | data: data,
19 | header: { 'Content-Type': 'application/json' },
20 | });
21 | tip.loaded();
22 | return res;
23 | };
24 |
25 |
26 | module.exports = {
27 | wxRequest
28 | }
29 |
--------------------------------------------------------------------------------
/wepy.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | var prod = process.env.NODE_ENV === 'production';
3 |
4 | module.exports = {
5 | wpyExt: '.wpy',
6 | eslint: false,
7 | cliLogs: !prod,
8 | build: {
9 | web: {
10 | htmlTemplate: path.join('src', 'index.template.html'),
11 | htmlOutput: path.join('web', 'index.html'),
12 | jsOutput: path.join('web', 'index.js')
13 | }
14 | },
15 | resolve: {
16 | alias: {
17 | counter: path.join(__dirname, 'src/components/counter'),
18 | '@': path.join(__dirname, 'src')
19 | },
20 | aliasFields: ['wepy', 'weapp'],
21 | modules: ['node_modules']
22 | },
23 | compilers: {
24 | less: {
25 | compress: prod
26 | },
27 | /*sass: {
28 | outputStyle: 'compressed'
29 | },*/
30 | babel: {
31 | sourceMap: true,
32 | presets: [
33 | 'env'
34 | ],
35 | plugins: [
36 | 'transform-class-properties',
37 | 'transform-decorators-legacy',
38 | 'transform-object-rest-spread',
39 | 'transform-export-extensions',
40 | ]
41 | }
42 | },
43 | plugins: {
44 | },
45 | appConfig: {
46 | noPromiseAPI: ['createSelectorQuery']
47 | }
48 | }
49 |
50 | if (prod) {
51 |
52 | // 压缩sass
53 | // module.exports.compilers['sass'] = {outputStyle: 'compressed'}
54 |
55 | // 压缩js
56 | module.exports.plugins = {
57 | uglifyjs: {
58 | filter: /\.js$/,
59 | config: {
60 | }
61 | },
62 | imagemin: {
63 | filter: /\.(jpg|png|jpeg)$/,
64 | config: {
65 | jpg: {
66 | quality: 80
67 | },
68 | png: {
69 | quality: 80
70 | }
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------