├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .prettierrc
├── .wepyignore
├── README.md
├── package-lock.json
├── package.json
├── project.config.json
├── screenshots
├── 1.jpeg
├── 2.jpeg
├── 3.jpeg
├── 4.jpeg
├── 5.jpeg
└── 6.jpeg
├── src
├── api
│ └── api.js
├── app.wpy
├── components
│ ├── comment_list.wpy
│ ├── common
│ │ ├── bottom_load_more.wpy
│ │ └── placeholder.wpy
│ ├── discover.wpy
│ ├── filter_bar.wpy
│ ├── filter_slider.wpy
│ ├── rate.wpy
│ ├── search.wpy
│ └── shop_grid_list.wpy
├── images
│ ├── alert.png
│ ├── authorize.png
│ ├── empty_cart.png
│ ├── error.png
│ ├── icon_cart.png
│ ├── icon_cart_active.png
│ ├── icon_category.png
│ ├── icon_category_active.png
│ ├── icon_home.png
│ ├── icon_home_active.png
│ ├── icon_info.png
│ ├── icon_info_active.png
│ ├── info
│ │ ├── 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
│ ├── loadding.gif
│ ├── nav
│ │ ├── icon_nav_01_new.png
│ │ ├── icon_nav_02_new.png
│ │ ├── icon_nav_03_new.png
│ │ └── icon_nav_04_new.png
│ └── rate
│ │ ├── half.png
│ │ ├── normal.png
│ │ └── selected.png
├── index.template.html
├── pages
│ ├── authorization.wpy
│ ├── cart.wpy
│ ├── category.wpy
│ ├── goods_detail.wpy
│ ├── home.wpy
│ ├── home_detail.wpy
│ ├── info.wpy
│ └── search.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
│ ├── 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 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/*
2 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | globals: { wx: true },
4 | parser: 'babel-eslint',
5 | parserOptions: {
6 | sourceType: 'module'
7 | },
8 | env: {
9 | browser: true
10 | },
11 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
12 | extends: 'standard',
13 | // required to lint *.wpy files
14 | plugins: [
15 | 'html'
16 | ],
17 | settings: {
18 | 'html/html-extensions': ['.html', '.wpy']
19 | },
20 | // add your custom rules here
21 | 'rules': {
22 | // allow paren-less arrow functions
23 | 'arrow-parens': 0,
24 | // allow async-await
25 | 'generator-star-spacing': 0,
26 | // allow debugger during development
27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
28 | 'space-before-function-paren': 0
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/.wepyignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | .DS_Store
4 | *.wpy___jb_tmp___
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Fashion Mall
2 |
3 | 这是用 Wepy 开发的一个服装购物商场小程序。主要是参考了 [wepy-mall](https://github.com/dyq086/wepy-mall),但在它的基础上做了一些代码的优化,包括代码风格,命名等。
4 |
5 | 在学习开发的过程中,将各个模块分成9个不同的 branch,目的是让初学者更容易上手。相当于一步一步从头开始带这你写小程序。同时,配套了一个本地可以运行的 mock server [fashion-mall-server](https://github.com/weimingwill/fashion-mall-server),可以更容易的看数据,进行API的测试和再开发。
6 |
7 | ## 使用指南
8 |
9 | ### 安装
10 |
11 | ```bash
12 | git clone https://github.com/weimingwill/fashion-mall.git
13 | cd fashion-mall
14 | npm install
15 | ```
16 |
17 | ```bash
18 | npm install wepy-cli -g
19 | ```
20 |
21 | ```bash
22 | wepy build --watch
23 | ```
24 |
25 | ### 看演示
26 |
27 | 运行完上面的代码后,将 fashion-mall 下面的 `dist` 文件夹导入 微信开发者工具 可以了。
28 |
29 | #### 微信开发者工具设置(重要!)
30 |
31 | 在 微信开发者工具 任务栏 里的 `详情` -> `本地设置` 里,进行下面这些配置:
32 |
33 | > es6: 对应关闭ES6转ES5选项,关闭。 重要:未关闭会运行报错。
34 | >
35 | > postcss: 对应关闭上传代码时样式自动补全选项,关闭。 重要:某些情况下漏掉此项也会运行报错。
36 | >
37 | > minified: 对应关闭代码压缩上传选项,关闭。重要:开启后,会导致真机computed, props.sync 等等属性失效。(注:压缩功能可使用WePY提供的build指令代替,详见后文相关介绍以及Demo项目根目录中的wepy.config.js和package.json文件。)
38 | >
39 | > urlCheck: 对应不检查安全域名选项,开启。 如果已配置好安全域名则建议关闭。
40 |
41 | 具体设置的地方可能会随着开发者工具更新而改变,如果变了可以直接搜索一下。
42 |
43 | ### 目录结构
44 |
45 | ```
46 | src
47 | ├── api
48 | │ └── api.js // 接口定义
49 | ├── app.wpy // 入口文件
50 | ├── components // 组件
51 | │ ├── comment_list.wpy // 评论
52 | │ ├── common
53 | │ │ ├── bottom_load_more.wpy // 底部加载
54 | │ │ └── placeholder.wpy // 空列表
55 | │ ├── discover.wpy // 发现组建
56 | │ ├── filter_bar.wpy // 筛选栏组建
57 | │ ├── filter_slider.wpy // 筛选右侧栏
58 | │ ├── rate.wpy // 评分
59 | │ ├── search.wpy // 搜索
60 | │ ├── shop_grid_list.wpy // 购物商品矩阵
61 | ├── images // 图片文件夹
62 | ├── pages // 页面
63 | │ ├── authorization.wpy // 授权
64 | │ ├── cart.wpy // 购物车
65 | │ ├── category.wpy // 分类
66 | │ ├── goods_detail.wpy // 商品详情
67 | │ ├── home.wpy // 首页
68 | │ ├── home_detail.wpy // 首页详情
69 | │ ├── info.wpy // 我的
70 | │ └── search.wpy // 搜索
71 | ├── plugins
72 | │ └── wxParse // 小程序富文本
73 | ├── styles // 样式
74 | └── utils // 帮助文件夹
75 | ```
76 |
77 | ### 开发前最好有一些基础知识
78 |
79 | 1. HTML, CSS, Javascript
80 |
81 | 2. 小程序开发的基础知识:代码结构、配置文件、运行机制、加载机制、生命周期等。可以参考[官方文档](https://developers.weixin.qq.com/miniprogram/dev/framework/quickstart/)。极客时间的 9小时搞定微信小程序开发 制作的还不错,可以考虑。
82 |
83 | 3. [Wepy 官方文档](https://tencent.github.io/wepy/document.html#/)
84 |
85 |
86 | ### 部分功能截图 (From Wepy Mall)
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | ### Branches
100 |
101 | * master:用 `wepy new standard ` 初始化后得到的模版,修复了很多个 npm package 的问题。
102 | * 1.tab-bar:创建了 tabbar
103 | * 2.authorization:初次登陆,授权访问
104 | * 3.info:个人页面
105 | * 4.home-page:首页
106 | * 5.category:分类页
107 | * 6.home_detail:展示首页图片相关的所有商品(比较复杂)
108 | * 7.goods_detail:商品详情(比较复杂)
109 | * 8.cart:购物车
110 | * 9.search:搜索功能
111 | * develop:包含了所有的功能,最新的 branch
112 |
113 | 每一次的更改可以看这些 [Pull Request](https://github.com/weimingwill/fashion-mall/pulls)。
114 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fashion-mall",
3 | "version": "0.0.2",
4 | "description": "Learn wepy by building wepy-mall",
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 | "./src/components/list": "./src/components/wepy-list.wpy"
16 | },
17 | "author": "Weiming ",
18 | "license": "MIT",
19 | "dependencies": {
20 | "wepy": "^1.7.2"
21 | },
22 | "devDependencies": {
23 | "babel-eslint": "^7.2.3",
24 | "babel-plugin-transform-class-properties": "^6.24.1",
25 | "babel-plugin-transform-decorators-legacy": "^1.3.5",
26 | "babel-plugin-transform-export-extensions": "^6.22.0",
27 | "babel-plugin-transform-object-rest-spread": "^6.26.0",
28 | "babel-preset-env": "^1.7.0",
29 | "cross-env": "^5.1.3",
30 | "eslint": "^4.18.2",
31 | "eslint-config-standard": "^7.1.0",
32 | "eslint-friendly-formatter": "^2.0.7",
33 | "eslint-plugin-html": "^2.0.3",
34 | "eslint-plugin-promise": "^3.8.0",
35 | "eslint-plugin-standard": "^2.3.1",
36 | "less": "^3.9.0",
37 | "wepy-async-function": "^1.4.7",
38 | "wepy-com-toast": "^1.0.2",
39 | "wepy-compiler-babel": "^1.5.3",
40 | "wepy-compiler-less": "^1.3.14",
41 | "wepy-eslint": "^1.5.4"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Learn wepy by building wepy-mall",
3 | "setting": {
4 | "urlCheck": true,
5 | "es6": false,
6 | "postcss": false,
7 | "minified": false
8 | },
9 | "compileType": "miniprogram",
10 | "appid": "wxc4dbee764f033e20",
11 | "projectname": "fashion-mall",
12 | "miniprogramRoot": "./dist"
13 | }
14 |
--------------------------------------------------------------------------------
/screenshots/1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/1.jpeg
--------------------------------------------------------------------------------
/screenshots/2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/2.jpeg
--------------------------------------------------------------------------------
/screenshots/3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/3.jpeg
--------------------------------------------------------------------------------
/screenshots/4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/4.jpeg
--------------------------------------------------------------------------------
/screenshots/5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/5.jpeg
--------------------------------------------------------------------------------
/screenshots/6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/screenshots/6.jpeg
--------------------------------------------------------------------------------
/src/api/api.js:
--------------------------------------------------------------------------------
1 | import { wxRequest } from '@/utils/wxRequest';
2 |
3 | let env = "-test" //-dev 或者 -test
4 | // const apiMall = 'https://sujiefs.com/'
5 | const apiMall = 'http://localhost:5000'
6 |
7 | //微信的jscode换取sessionKey
8 | const wxJsCode2Session = (params) => wxRequest(params, apiMall + "/api/wechat/jscode2session");
9 |
10 | //用户是否绑定手机号
11 | const getUserInfo = (params) => wxRequest(params, apiMall + '/api/userCenter/getUserInfo');
12 |
13 |
14 | //商品接口
15 | //首页发现商品接口
16 | const getHomeDisvocerList = (params) => wxRequest(params, apiMall + '/api/mall/discoverList');
17 | //查询广告列表
18 | const getAdList = (params) => wxRequest(params, apiMall + '/api/adverts/list');
19 | //广告商品列表
20 | const getAdGoodsList = (params) => wxRequest(params, apiMall + '/api/home/hostGoodsList');
21 | //查询商品列表
22 | const getGoodsList = (params) => wxRequest(params, apiMall + '/api/mall/searchGoodsList');
23 | //查询商品详情信息
24 | const getGoodsDetail = (params) => wxRequest(params, apiMall + '/api/mall/goods');
25 | //商品收藏
26 | const favoriteGoods = (params) => wxRequest(params, apiMall + '/api/mall/goodsFavorite/add');
27 | //商品收藏删除
28 | const unfavoriteGoods = (params) => wxRequest(params, apiMall + '/api/mall/goodsFavorite/delete');
29 | //商品是否已收藏
30 | const isGoodsFavorite = (params) => wxRequest(params, apiMall + '/api/mall/goodsFavorite/goodsIsFavorite');
31 |
32 | // 购物车
33 | // 加入购物车
34 | const addToCart = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/add');
35 |
36 | //一级分类
37 | const getRootCategoryList = (params) => wxRequest(params, apiMall + '/api/mall/rootCtegoryList');
38 | //二级三级分类
39 | const getChildCategoryList = (params) => wxRequest(params, apiMall + '/api/mall/childGoodsCatetoryList');
40 |
41 | //查询关键字保存
42 | const addSearchKeyword = (params) => wxRequest(params, apiMall + '/api/searchkeyword/add');
43 | //查询关键字列表
44 | const getSearchKeywordList = (params) => wxRequest(params, apiMall + '/api/searchkeyword/list');
45 | //查询关键字清除
46 | const clearSearchKeyword = (params) => wxRequest(params, apiMall + '/api/searchkeyword/clear');
47 |
48 |
49 | export default {
50 | wxJsCode2Session,
51 | getUserInfo,
52 | getHomeDisvocerList,
53 | getAdList,
54 | getAdGoodsList,
55 | getGoodsList,
56 | getGoodsDetail,
57 | favoriteGoods,
58 | unfavoriteGoods,
59 | isGoodsFavorite,
60 | getRootCategoryList,
61 | getChildCategoryList,
62 | addToCart,
63 | addSearchKeyword,
64 | getSearchKeywordList,
65 | clearSearchKeyword
66 | }
67 |
--------------------------------------------------------------------------------
/src/app.wpy:
--------------------------------------------------------------------------------
1 |
95 |
100 |
--------------------------------------------------------------------------------
/src/components/comment_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
19 |
20 |
21 |
22 | 暂无评论
23 |
24 |
25 |
26 |
27 |
49 |
107 |
--------------------------------------------------------------------------------
/src/components/common/bottom_load_more.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ message }}
5 |
6 |
7 |
21 |
41 |
--------------------------------------------------------------------------------
/src/components/common/placeholder.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{message}}
5 |
6 |
7 |
22 |
48 |
--------------------------------------------------------------------------------
/src/components/discover.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 | {{ item.attrName.attrName }}:
11 |
12 | {{ item.attrVal }}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
42 |
93 |
--------------------------------------------------------------------------------
/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 |
88 |
89 |
155 |
--------------------------------------------------------------------------------
/src/components/filter_slider.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 尺码
6 |
7 |
8 | {{ item }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
44 |
45 |
112 |
--------------------------------------------------------------------------------
/src/components/rate.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
62 |
84 |
--------------------------------------------------------------------------------
/src/components/search.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
52 |
104 |
--------------------------------------------------------------------------------
/src/components/shop_grid_list.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 | {{ item.name }}
12 |
13 | ¥{{ item.price }}
14 | ¥{{ item.marketPrice }}
15 | 销量{{ item.saleCount }}件
16 |
17 |
18 |
19 |
20 |
21 |
22 |
41 |
113 |
--------------------------------------------------------------------------------
/src/images/alert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/alert.png
--------------------------------------------------------------------------------
/src/images/authorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/authorize.png
--------------------------------------------------------------------------------
/src/images/empty_cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/empty_cart.png
--------------------------------------------------------------------------------
/src/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/error.png
--------------------------------------------------------------------------------
/src/images/icon_cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_cart.png
--------------------------------------------------------------------------------
/src/images/icon_cart_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_cart_active.png
--------------------------------------------------------------------------------
/src/images/icon_category.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_category.png
--------------------------------------------------------------------------------
/src/images/icon_category_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_category_active.png
--------------------------------------------------------------------------------
/src/images/icon_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_home.png
--------------------------------------------------------------------------------
/src/images/icon_home_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_home_active.png
--------------------------------------------------------------------------------
/src/images/icon_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_info.png
--------------------------------------------------------------------------------
/src/images/icon_info_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/icon_info_active.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_01.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_02.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_03.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_04.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_05.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_06.png
--------------------------------------------------------------------------------
/src/images/info/icon_my_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/info/icon_my_07.png
--------------------------------------------------------------------------------
/src/images/loadding.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/loadding.gif
--------------------------------------------------------------------------------
/src/images/nav/icon_nav_01_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/nav/icon_nav_01_new.png
--------------------------------------------------------------------------------
/src/images/nav/icon_nav_02_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/nav/icon_nav_02_new.png
--------------------------------------------------------------------------------
/src/images/nav/icon_nav_03_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/nav/icon_nav_03_new.png
--------------------------------------------------------------------------------
/src/images/nav/icon_nav_04_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/nav/icon_nav_04_new.png
--------------------------------------------------------------------------------
/src/images/rate/half.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/rate/half.png
--------------------------------------------------------------------------------
/src/images/rate/normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/rate/normal.png
--------------------------------------------------------------------------------
/src/images/rate/selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/weimingwill/fashion-mall/242dc85ab237e2e0579896855eb3510fb7c645be/src/images/rate/selected.png
--------------------------------------------------------------------------------
/src/index.template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 转 WEB DEMO
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/pages/authorization.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 商城申请获取以下权限:
5 | 获取你的公开信息(头像、昵称等)
6 |
7 |
10 |
11 |
12 |
13 |
100 |
128 |
--------------------------------------------------------------------------------
/src/pages/cart.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 购物车还是空的
6 |
7 |
8 | 去逛逛
9 |
10 |
11 |
12 |
13 |
14 |
15 |
47 |
102 |
--------------------------------------------------------------------------------
/src/pages/category.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 搜索商品
8 |
9 |
10 |
11 |
12 |
13 |
17 |
21 | {{ item.name }}
22 |
23 |
24 |
25 |
29 |
30 |
33 |
34 | {{ item.secondCategory.name }}
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
132 |
197 |
--------------------------------------------------------------------------------
/src/pages/goods_detail.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{ detail.name }}
23 |
24 | ¥{{ detail.price }}
25 |
28 |
29 | 满{{ detail.freeShipNum }}件包邮
30 |
31 |
32 |
33 |
34 | 库存:
35 | {{ detail.stockNum }}件
36 |
37 | 规定单数:
38 | {{ detail.minBuyNum }}件成团
39 |
40 | 订单中:
41 | 已拼{{ detail.saleCount }}件
42 |
43 |
44 |
45 |
46 |
47 | 拼货流程
48 |
49 |
50 | 新款展示
51 | 拼单结束
52 | 生产商品
53 | 商品检验
54 | 商品发货
55 |
56 |
57 | 如若出现特殊情况外,发货时间则会延迟5-10天左右。
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 拼单说明
66 |
67 |
68 | 此商品在拼单期间可接收订单,如若超过拼单时间则不能下单;拼单结束后未付款订单系统将会自动取消,所以,亲下单以后请尽快付款。我们会以实际订单为准为您发货,如超过订单时间而又没有拼购到规定数量的,我们将会第一时间为您退款,请您放心购买!
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | 商品评价
77 |
78 |
79 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | 商品信息
90 |
91 |
92 |
94 |
96 | {{ item.attrName }}: {{ item.attrVal }}
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | 商品详情
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | 首页
123 |
124 |
125 |
126 |
127 | 客服
128 |
129 |
130 |
131 |
132 | 收藏
133 |
134 | 加入购物车
135 | {{ purchaseText }}
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
152 |
153 |
155 | {{ item.skuName }}
156 |
157 |
160 | {{ item.skuVal }}
161 |
162 |
163 |
164 |
165 | 数量
166 | 库存:{{ detail.stockNum }}件
167 |
168 | -
169 |
170 | +
171 |
172 |
173 |
174 |
175 |
176 | 确定
177 |
178 |
179 |
180 |
552 |
936 |
--------------------------------------------------------------------------------
/src/pages/home.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 搜索商品
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{ item.text }}
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
168 |
217 |
--------------------------------------------------------------------------------
/src/pages/home_detail.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{ ad.name }}
9 |
10 |
11 | ◆ {{ item.attrName.attrName }}:
12 |
13 | {{ item.attrVal }}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
139 |
172 |
--------------------------------------------------------------------------------
/src/pages/info.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 | 绑定手机号
15 |
16 | 绑定手机号可更好的让我们服务好您!
17 |
18 | >
19 |
20 |
21 |
22 |
23 |
24 | {{ item.text }}
25 |
26 | >
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | {{ item.text }}
37 |
38 | >
39 |
40 |
41 |
42 |
43 |
44 |
45 |
141 |
211 |
--------------------------------------------------------------------------------
/src/pages/search.wpy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 历史记录
15 |
16 |
17 | {{ item.keyword }}
18 |
19 |
20 |
21 | 清除历史记录
22 |
23 |
24 |
25 |
26 |
27 |
251 |
252 |
295 |
--------------------------------------------------------------------------------
/src/plugins/wxParse/html2json.js:
--------------------------------------------------------------------------------
1 | /**
2 | * html2Json 改造来自: https://github.com/Jxck/html2json
3 | *
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 |
15 | var __placeImgeUrlHttps = "https";
16 | var __emojisReg = '';
17 | var __emojisBaseSrc = '';
18 | var __emojis = {};
19 | var wxDiscode = require('./wxDiscode.js');
20 | var HTMLParser = require('./htmlparser.js');
21 | // Empty Elements - HTML 5
22 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
23 | // Block Elements - HTML 5
24 | var block = makeMap("br,a,code,address,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");
25 |
26 | // Inline Elements - HTML 5
27 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,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");
28 |
29 | // Elements that you can, intentionally, leave open
30 | // (and which close themselves)
31 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
32 |
33 | // Attributes that have their values filled in disabled="disabled"
34 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
35 |
36 | // Special Elements (can contain anything)
37 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
38 | function makeMap(str) {
39 | var obj = {}, items = str.split(",");
40 | for (var i = 0; i < items.length; i++)
41 | obj[items[i]] = true;
42 | return obj;
43 | }
44 |
45 | function q(v) {
46 | return '"' + v + '"';
47 | }
48 |
49 | function removeDOCTYPE(html) {
50 | return html
51 | .replace(/<\?xml.*\?>\n/, '')
52 | .replace(/<.*!doctype.*\>\n/, '')
53 | .replace(/<.*!DOCTYPE.*\>\n/, '');
54 | }
55 |
56 | function trimHtml(html) {
57 | return html
58 | .replace(/\n+/g, '')
59 | .replace(//ig, '')
60 | .replace(/\/\*.*?\*\//ig, '')
61 | .replace(/[ ]+
189 | // add to parents
190 | var parent = bufArray[0] || results;
191 | if (parent.nodes === undefined) {
192 | parent.nodes = [];
193 | }
194 | parent.nodes.push(node);
195 | } else {
196 | bufArray.unshift(node);
197 | }
198 | },
199 | end: function (tag) {
200 | //debug(tag);
201 | // merge into parent tag
202 | var node = bufArray.shift();
203 | if (node.tag !== tag) console.error('invalid state: mismatch end tag');
204 |
205 | //当有缓存source资源时于于video补上src资源
206 | if(node.tag === 'video' && results.source){
207 | node.attr.src = results.source;
208 | delete result.source;
209 | }
210 |
211 | if (bufArray.length === 0) {
212 | results.nodes.push(node);
213 | } else {
214 | var parent = bufArray[0];
215 | if (parent.nodes === undefined) {
216 | parent.nodes = [];
217 | }
218 | parent.nodes.push(node);
219 | }
220 | },
221 | chars: function (text) {
222 | //debug(text);
223 | var node = {
224 | node: 'text',
225 | text: text,
226 | textArray:transEmojiStr(text)
227 | };
228 |
229 | if (bufArray.length === 0) {
230 | results.nodes.push(node);
231 | } else {
232 | var parent = bufArray[0];
233 | if (parent.nodes === undefined) {
234 | parent.nodes = [];
235 | }
236 | node.index = parent.index + '.' + parent.nodes.length
237 | parent.nodes.push(node);
238 | }
239 | },
240 | comment: function (text) {
241 | //debug(text);
242 | // var node = {
243 | // node: 'comment',
244 | // text: text,
245 | // };
246 | // var parent = bufArray[0];
247 | // if (parent.nodes === undefined) {
248 | // parent.nodes = [];
249 | // }
250 | // parent.nodes.push(node);
251 | },
252 | });
253 | return results;
254 | };
255 |
256 | function transEmojiStr(str){
257 | // var eReg = new RegExp("["+__reg+' '+"]");
258 | // str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
259 |
260 | var emojiObjs = [];
261 | //如果正则表达式为空
262 | if(__emojisReg.length == 0 || !__emojis){
263 | var emojiObj = {}
264 | emojiObj.node = "text";
265 | emojiObj.text = str;
266 | array = [emojiObj];
267 | return array;
268 | }
269 | //这个地方需要调整
270 | str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
271 | var eReg = new RegExp("[:]");
272 | var array = str.split(eReg);
273 | for(var i = 0; i < array.length; i++){
274 | var ele = array[i];
275 | var emojiObj = {};
276 | if(__emojis[ele]){
277 | emojiObj.node = "element";
278 | emojiObj.tag = "emoji";
279 | emojiObj.text = __emojis[ele];
280 | emojiObj.baseSrc= __emojisBaseSrc;
281 | }else{
282 | emojiObj.node = "text";
283 | emojiObj.text = ele;
284 | }
285 | emojiObjs.push(emojiObj);
286 | }
287 |
288 | return emojiObjs;
289 | }
290 |
291 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
292 | __emojisReg = reg;
293 | __emojisBaseSrc=baseSrc;
294 | __emojis=emojis;
295 | }
296 |
297 | module.exports = {
298 | html2json: html2json,
299 | emojisInit:emojisInit
300 | };
301 |
302 |
--------------------------------------------------------------------------------
/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/wxDiscode.js:
--------------------------------------------------------------------------------
1 | // HTML 支持的数学符号
2 | function strNumDiscode(str){
3 | str = str.replace(/∀/g, '∀');
4 | str = str.replace(/∂/g, '∂');
5 | str = str.replace(/&exists;/g, '∃');
6 | str = str.replace(/∅/g, '∅');
7 | str = str.replace(/∇/g, '∇');
8 | str = str.replace(/∈/g, '∈');
9 | str = str.replace(/∉/g, '∉');
10 | str = str.replace(/∋/g, '∋');
11 | str = str.replace(/∏/g, '∏');
12 | str = str.replace(/∑/g, '∑');
13 | str = str.replace(/−/g, '−');
14 | str = str.replace(/∗/g, '∗');
15 | str = str.replace(/√/g, '√');
16 | str = str.replace(/∝/g, '∝');
17 | str = str.replace(/∞/g, '∞');
18 | str = str.replace(/∠/g, '∠');
19 | str = str.replace(/∧/g, '∧');
20 | str = str.replace(/∨/g, '∨');
21 | str = str.replace(/∩/g, '∩');
22 | str = str.replace(/∩/g, '∪');
23 | str = str.replace(/∫/g, '∫');
24 | str = str.replace(/∴/g, '∴');
25 | str = str.replace(/∼/g, '∼');
26 | str = str.replace(/≅/g, '≅');
27 | str = str.replace(/≈/g, '≈');
28 | str = str.replace(/≠/g, '≠');
29 | str = str.replace(/≤/g, '≤');
30 | str = str.replace(/≥/g, '≥');
31 | str = str.replace(/⊂/g, '⊂');
32 | str = str.replace(/⊃/g, '⊃');
33 | str = str.replace(/⊄/g, '⊄');
34 | str = str.replace(/⊆/g, '⊆');
35 | str = str.replace(/⊇/g, '⊇');
36 | str = str.replace(/⊕/g, '⊕');
37 | str = str.replace(/⊗/g, '⊗');
38 | str = str.replace(/⊥/g, '⊥');
39 | str = str.replace(/⋅/g, '⋅');
40 | return str;
41 | }
42 |
43 | //HTML 支持的希腊字母
44 | function strGreeceDiscode(str){
45 | str = str.replace(/Α/g, 'Α');
46 | str = str.replace(/Β/g, 'Β');
47 | str = str.replace(/Γ/g, 'Γ');
48 | str = str.replace(/Δ/g, 'Δ');
49 | str = str.replace(/Ε/g, 'Ε');
50 | str = str.replace(/Ζ/g, 'Ζ');
51 | str = str.replace(/Η/g, 'Η');
52 | str = str.replace(/Θ/g, 'Θ');
53 | str = str.replace(/Ι/g, 'Ι');
54 | str = str.replace(/Κ/g, 'Κ');
55 | str = str.replace(/Λ/g, 'Λ');
56 | str = str.replace(/Μ/g, 'Μ');
57 | str = str.replace(/Ν/g, 'Ν');
58 | str = str.replace(/Ξ/g, 'Ν');
59 | str = str.replace(/Ο/g, 'Ο');
60 | str = str.replace(/Π/g, 'Π');
61 | str = str.replace(/Ρ/g, 'Ρ');
62 | str = str.replace(/Σ/g, 'Σ');
63 | str = str.replace(/Τ/g, 'Τ');
64 | str = str.replace(/Υ/g, 'Υ');
65 | str = str.replace(/Φ/g, 'Φ');
66 | str = str.replace(/Χ/g, 'Χ');
67 | str = str.replace(/Ψ/g, 'Ψ');
68 | str = str.replace(/Ω/g, 'Ω');
69 |
70 | str = str.replace(/α/g, 'α');
71 | str = str.replace(/β/g, 'β');
72 | str = str.replace(/γ/g, 'γ');
73 | str = str.replace(/δ/g, 'δ');
74 | str = str.replace(/ε/g, 'ε');
75 | str = str.replace(/ζ/g, 'ζ');
76 | str = str.replace(/η/g, 'η');
77 | str = str.replace(/θ/g, 'θ');
78 | str = str.replace(/ι/g, 'ι');
79 | str = str.replace(/κ/g, 'κ');
80 | str = str.replace(/λ/g, 'λ');
81 | str = str.replace(/μ/g, 'μ');
82 | str = str.replace(/ν/g, 'ν');
83 | str = str.replace(/ξ/g, 'ξ');
84 | str = str.replace(/ο/g, 'ο');
85 | str = str.replace(/π/g, 'π');
86 | str = str.replace(/ρ/g, 'ρ');
87 | str = str.replace(/ς/g, 'ς');
88 | str = str.replace(/σ/g, 'σ');
89 | str = str.replace(/τ/g, 'τ');
90 | str = str.replace(/υ/g, 'υ');
91 | str = str.replace(/φ/g, 'φ');
92 | str = str.replace(/χ/g, 'χ');
93 | str = str.replace(/ψ/g, 'ψ');
94 | str = str.replace(/ω/g, 'ω');
95 | str = str.replace(/ϑ/g, 'ϑ');
96 | str = str.replace(/ϒ/g, 'ϒ');
97 | str = str.replace(/ϖ/g, 'ϖ');
98 | str = str.replace(/·/g, '·');
99 | return str;
100 | }
101 |
102 | //
103 |
104 | function strcharacterDiscode(str){
105 | // 加入常用解析
106 | str = str.replace(/ /g, ' ');
107 | str = str.replace(/"/g, "'");
108 | str = str.replace(/&/g, '&');
109 | // str = str.replace(/</g, '‹');
110 | // str = str.replace(/>/g, '›');
111 |
112 | str = str.replace(/</g, '<');
113 | str = str.replace(/>/g, '>');
114 | str = str.replace(/•/g, '•');
115 |
116 | return str;
117 | }
118 |
119 | // HTML 支持的其他实体
120 | function strOtherDiscode(str){
121 | str = str.replace(/Œ/g, 'Œ');
122 | str = str.replace(/œ/g, 'œ');
123 | str = str.replace(/Š/g, 'Š');
124 | str = str.replace(/š/g, 'š');
125 | str = str.replace(/Ÿ/g, 'Ÿ');
126 | str = str.replace(/ƒ/g, 'ƒ');
127 | str = str.replace(/ˆ/g, 'ˆ');
128 | str = str.replace(/˜/g, '˜');
129 | str = str.replace(/ /g, '');
130 | str = str.replace(/ /g, '');
131 | str = str.replace(/ /g, '');
132 | str = str.replace(//g, '');
133 | str = str.replace(//g, '');
134 | str = str.replace(//g, '');
135 | str = str.replace(//g, '');
136 | str = str.replace(/–/g, '–');
137 | str = str.replace(/—/g, '—');
138 | str = str.replace(/‘/g, '‘');
139 | str = str.replace(/’/g, '’');
140 | str = str.replace(/‚/g, '‚');
141 | str = str.replace(/“/g, '“');
142 | str = str.replace(/”/g, '”');
143 | str = str.replace(/„/g, '„');
144 | str = str.replace(/†/g, '†');
145 | str = str.replace(/‡/g, '‡');
146 | str = str.replace(/•/g, '•');
147 | str = str.replace(/…/g, '…');
148 | str = str.replace(/‰/g, '‰');
149 | str = str.replace(/′/g, '′');
150 | str = str.replace(/″/g, '″');
151 | str = str.replace(/‹/g, '‹');
152 | str = str.replace(/›/g, '›');
153 | str = str.replace(/‾/g, '‾');
154 | str = str.replace(/€/g, '€');
155 | str = str.replace(/™/g, '™');
156 |
157 | str = str.replace(/←/g, '←');
158 | str = str.replace(/↑/g, '↑');
159 | str = str.replace(/→/g, '→');
160 | str = str.replace(/↓/g, '↓');
161 | str = str.replace(/↔/g, '↔');
162 | str = str.replace(/↵/g, '↵');
163 | str = str.replace(/⌈/g, '⌈');
164 | str = str.replace(/⌉/g, '⌉');
165 |
166 | str = str.replace(/⌊/g, '⌊');
167 | str = str.replace(/⌋/g, '⌋');
168 | str = str.replace(/◊/g, '◊');
169 | str = str.replace(/♠/g, '♠');
170 | str = str.replace(/♣/g, '♣');
171 | str = str.replace(/♥/g, '♥');
172 |
173 | str = str.replace(/♦/g, '♦');
174 | str = str.replace(/'/g, '\'');
175 | return str;
176 | }
177 |
178 | function strMoreDiscode(str){
179 | str = str.replace(/\r\n/g,"");
180 | str = str.replace(/\n/g,"");
181 |
182 | str = str.replace(/code/g,"wxxxcode-style");
183 | return str;
184 | }
185 |
186 | function strDiscode(str){
187 | str = strNumDiscode(str);
188 | str = strGreeceDiscode(str);
189 | str = strcharacterDiscode(str);
190 | str = strOtherDiscode(str);
191 | str = strMoreDiscode(str);
192 | return str;
193 | }
194 | function urlToHttpUrl(url,rep){
195 |
196 | var patt1 = new RegExp("^//");
197 | var result = patt1.test(url);
198 | if(result){
199 | url = rep+":"+url;
200 | }
201 | return url;
202 | }
203 |
204 | module.exports = {
205 | strDiscode:strDiscode,
206 | urlToHttpUrl:urlToHttpUrl
207 | }
--------------------------------------------------------------------------------
/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 | } else if (type == 'md' || type == 'markdown') {
37 | var converter = new showdown.Converter();
38 | var html = converter.makeHtml(data);
39 | transData = HtmlToJson.html2json(html, bindName);
40 | }
41 | transData.view = {};
42 | transData.view.imagePadding = 0;
43 | if(typeof(imagePadding) != 'undefined'){
44 | transData.view.imagePadding = imagePadding
45 | }
46 | var bindData = {};
47 | bindData[bindName] = transData;
48 | that.setData(bindData)
49 | that.bindData = bindData // 增加这一行代码
50 | that.wxParseImgLoad = wxParseImgLoad;
51 | that.wxParseImgTap = wxParseImgTap;
52 | }
53 | // 图片点击事件
54 | function wxParseImgTap(e) {
55 | var that = this;
56 | var nowImgUrl = e.target.dataset.src;
57 | var tagFrom = e.target.dataset.from;
58 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
59 | wx.previewImage({
60 | current: nowImgUrl, // 当前显示图片的http链接
61 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
62 | })
63 | }
64 | }
65 |
66 | /**
67 | * 图片视觉宽高计算函数区
68 | **/
69 | function wxParseImgLoad(e) {
70 | var that = this;
71 | var tagFrom = e.target.dataset.from;
72 | var idx = e.target.dataset.idx;
73 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
74 | calMoreImageInfo(e, idx, that, tagFrom)
75 | }
76 | }
77 | // 假循环获取计算图片视觉最佳宽高
78 | function calMoreImageInfo(e, idx, that, bindName) {
79 | var temData = that.data[bindName];
80 | if (!temData || temData.images.length == 0) {
81 | return;
82 | }
83 | var temImages = temData.images;
84 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
85 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
86 | // temImages[idx].width = recal.imageWidth;
87 | // temImages[idx].height = recal.imageheight;
88 | // temData.images = temImages;
89 | // var bindData = {};
90 | // bindData[bindName] = temData;
91 | // that.setData(bindData);
92 | var index = temImages[idx].index
93 | var key = `${bindName}`
94 | for (var i of index.split('.')) key+=`.nodes[${i}]`
95 | var keyW = key + '.width'
96 | var keyH = key + '.height'
97 | that.setData({
98 | [keyW]: recal.imageWidth,
99 | [keyH]: recal.imageheight,
100 | })
101 | }
102 |
103 | // 计算视觉优先的图片宽高
104 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
105 | //获取图片的原始长宽
106 | var windowWidth = 0, windowHeight = 0;
107 | var autoWidth = 0, autoHeight = 0;
108 | var results = {};
109 | var padding = that.data[bindName].view.imagePadding;
110 | windowWidth = realWindowWidth-2*padding;
111 | windowHeight = realWindowHeight;
112 | //判断按照那种方式进行缩放
113 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
114 | autoWidth = windowWidth;
115 | autoHeight = (autoWidth * originalHeight) / originalWidth;
116 | results.imageWidth = autoWidth;
117 | results.imageheight = autoHeight;
118 | } else {//否则展示原来的数据
119 | results.imageWidth = originalWidth;
120 | results.imageheight = originalHeight;
121 | }
122 | return results;
123 | }
124 |
125 | function wxParseTemArray(temArrayName,bindNameReg,total,that){
126 | var array = [];
127 | var temData = that.data;
128 | var obj = null;
129 | for(var i = 0; i < total; i++){
130 | var simArr = temData[bindNameReg+i].nodes;
131 | array.push(simArr);
132 | }
133 |
134 | temArrayName = temArrayName || 'wxParseTemArray';
135 | obj = JSON.parse('{"'+ temArrayName +'":""}');
136 | obj[temArrayName] = array;
137 | that.setData(obj);
138 | }
139 |
140 | /**
141 | * 配置emojis
142 | *
143 | */
144 |
145 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
146 | HtmlToJson.emojisInit(reg,baseSrc,emojis);
147 | }
148 |
149 | module.exports = {
150 | wxParse: wxParse,
151 | wxParseTemArray:wxParseTemArray,
152 | emojisInit:emojisInit
153 | }
154 |
--------------------------------------------------------------------------------
/src/plugins/wxParse/wxParse.wxml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 | {{item.text}}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | \n
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
--------------------------------------------------------------------------------
/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: 26rpx;
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 | export const SELECTED_CLASS_CODE = "selectedClassCode"
20 |
21 | /**
22 | * 搜索历史
23 | * @type {Array}
24 | */
25 | export const SEARCH_KEYWORDS = "searchHistoryKeywords"
26 |
--------------------------------------------------------------------------------
/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 | static error(title, onHide) {
87 | wx.showToast({
88 | title: title,
89 | image: "../images/error.png",
90 | mask: true,
91 | duration: 500
92 | });
93 | // 隐藏结束回调
94 | if (onHide) {
95 | setTimeout(() => {
96 | onHide();
97 | }, 500);
98 | }
99 | }
100 |
101 | /**
102 | * 弹出加载提示
103 | */
104 | static loading(title = "加载中") {
105 | if (Tips.isLoading) {
106 | return;
107 | }
108 | Tips.isLoading = true;
109 | wx.showLoading({
110 | title: title,
111 | mask: true
112 | });
113 | }
114 |
115 | /**
116 | * 加载完毕
117 | */
118 | static loaded() {
119 | if (Tips.isLoading) {
120 | Tips.isLoading = false;
121 | wx.hideLoading();
122 | }
123 | }
124 |
125 | static share(title, url, desc) {
126 | return {
127 | title: title,
128 | path: url,
129 | desc: desc,
130 | success: function(res) {
131 | Tips.toast("分享成功");
132 | }
133 | };
134 | }
135 | }
136 |
137 | /**
138 | * 静态变量,是否加载中
139 | */
140 | Tips.isLoading = false;
141 |
--------------------------------------------------------------------------------
/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 | module.exports = {
26 | wxRequest
27 | }
28 |
--------------------------------------------------------------------------------
/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: true,
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 | 'syntax-export-extensions'
41 | ]
42 | }
43 | },
44 | plugins: {
45 | },
46 | appConfig: {
47 | noPromiseAPI: ['createSelectorQuery']
48 | }
49 | }
50 |
51 | if (prod) {
52 |
53 | // 压缩sass
54 | // module.exports.compilers['sass'] = {outputStyle: 'compressed'}
55 |
56 | // 压缩js
57 | module.exports.plugins = {
58 | uglifyjs: {
59 | filter: /\.js$/,
60 | config: {
61 | }
62 | },
63 | imagemin: {
64 | filter: /\.(jpg|png|jpeg)$/,
65 | config: {
66 | jpg: {
67 | quality: 80
68 | },
69 | png: {
70 | quality: 80
71 | }
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------