├── LICENSE
├── README.md
├── app.js
├── app.json
├── app.wxss
├── components
├── blankBox
│ ├── blankBox.js
│ ├── blankBox.json
│ ├── blankBox.wxml
│ └── blankBox.wxss
├── brickBox
│ ├── brickBox.js
│ ├── brickBox.json
│ ├── brickBox.wxml
│ └── brickBox.wxss
├── categoryListBox
│ ├── categoryListBox.js
│ ├── categoryListBox.json
│ ├── categoryListBox.wxml
│ └── categoryListBox.wxss
├── cellBox
│ ├── cellBox.js
│ ├── cellBox.json
│ ├── cellBox.wxml
│ └── cellBox.wxss
├── cellListBox
│ ├── cellListBox.js
│ ├── cellListBox.json
│ ├── cellListBox.wxml
│ └── cellListBox.wxss
├── commentBox
│ ├── commentBox.js
│ ├── commentBox.json
│ ├── commentBox.wxml
│ └── commentBox.wxss
├── productSection
│ ├── productSection.js
│ ├── productSection.json
│ ├── productSection.wxml
│ └── productSection.wxss
└── promotions
│ ├── promotions.js
│ ├── promotions.json
│ ├── promotions.wxml
│ └── promotions.wxss
├── images
├── cart
│ ├── cc-cart-gray.png
│ └── cc-cart.png
├── common
│ ├── clear.png
│ ├── coupon.png
│ ├── error-network.png
│ ├── exclamation.png
│ ├── order.png
│ └── qrcode.png
├── loading.gif
├── mine
│ ├── icon_coupon.png
│ ├── icon_fcode.png
│ ├── icon_order.png
│ └── icon_setting.png
├── searchResult
│ └── hm5.jpg
└── tabbar
│ ├── cart_off.png
│ ├── cart_on.png
│ ├── category_off.png
│ ├── category_on.png
│ ├── find_off.png
│ ├── find_on.png
│ ├── index_off.png
│ ├── index_on.png
│ ├── user_off.png
│ └── user_on.png
├── pages
├── cart
│ ├── cart.js
│ ├── cart.json
│ ├── cart.wxml
│ └── cart.wxss
├── category
│ ├── category.js
│ ├── category.json
│ ├── category.wxml
│ └── category.wxss
├── discovery
│ ├── discovery.js
│ ├── discovery.json
│ ├── discovery.wxml
│ └── discovery.wxss
├── error
│ ├── error.js
│ ├── error.json
│ ├── error.wxml
│ └── error.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── subPages
│ ├── coupon
│ │ ├── coupon.js
│ │ ├── coupon.json
│ │ ├── coupon.wxml
│ │ └── coupon.wxss
│ ├── detail
│ │ ├── detail.js
│ │ ├── detail.json
│ │ ├── detail.wxml
│ │ └── detail.wxss
│ ├── fcode
│ │ ├── fcode.js
│ │ ├── fcode.json
│ │ ├── fcode.wxml
│ │ └── fcode.wxss
│ ├── order
│ │ ├── order.js
│ │ ├── order.json
│ │ ├── order.wxml
│ │ └── order.wxss
│ ├── search
│ │ ├── search.js
│ │ ├── search.json
│ │ ├── search.wxml
│ │ └── search.wxss
│ └── setting
│ │ ├── setting.js
│ │ ├── setting.json
│ │ ├── setting.wxml
│ │ └── setting.wxss
└── user
│ ├── user.js
│ ├── user.json
│ ├── user.wxml
│ └── user.wxss
├── project.config.json
└── utils
├── detailData1.js
└── util.js
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 小米商城Lite-demo
2 | 微信小程序小米商城Lite,初试微信小程序
3 | (最近开始在广州实习搬砖了,公司有点东西要赶,之后再慢慢完善这个小程序~)
4 |
5 | #### 目的
6 | 学习微信小程序的api
7 |
8 | #### 截图
9 |
10 | 
11 |
12 | 
13 |
14 | 
15 |
16 | 
17 |
18 | 
19 |
20 | 
21 |
22 | 
23 |
24 |
25 | #### 需完成部分
26 |
27 | > 首页
28 | > > 首页布局 **get** 2018-01-15
29 | >
30 | > > 首页懒加载 **get** 2018-01-25
31 | >
32 | > > > 搜索商品页面 **get** 2018-01-25
33 | >
34 | > > > > 搜索商品页面缓存数据处理 **get** 2018-01-25
35 | >
36 | > > > > 搜索商品页面逻辑处理 **get** 2018-01-27
37 | >
38 | > 分类
39 | > > 分类页面布局 **get** 2018-01-23
40 | >
41 | > > 分类页面滚动监听 **get** 2018-01-29
42 | >
43 | > 发现
44 | > > 发现页面布局 **get** 2018-01-24
45 | >
46 | > > 发现页面懒加载 **get** 2018-01-30
47 | >
48 | > 购物车
49 | > > 购物车页面布局 **get** 2018-01-24
50 | >
51 | > > 增删改商品逻辑
52 | >
53 | > 我的
54 | > > 我的页面布局 **get** 2018-01-24
55 | >
56 | > > 获取个人信息 **get** 2018-01-30
57 | >
58 | > 商品详细页 **modify** 2018-01-31
59 | >
60 | > 无网络状态页面 **get** 2018-01-31
61 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | var that = this;
5 | // // 展示本地存储能力
6 | // var logs = wx.getStorageSync('logs') || []
7 | // logs.unshift(Date.now())
8 | // wx.setStorageSync('logs', logs)
9 |
10 | // 登录
11 | wx.login({
12 | success: res => {
13 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
14 | wx.getUserInfo({
15 | success: function (res) {
16 | var simpleUser = res.userInfo;
17 | that.globalData.userInfo = simpleUser;
18 | }
19 | });
20 | }
21 | })
22 | // 获取用户信息
23 | wx.getSetting({
24 | success: res => {
25 | if (res.authSetting['scope.userInfo']) {
26 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
27 | wx.getUserInfo({
28 | success: res => {
29 | // 可以将 res 发送给后台解码出 unionId
30 | this.globalData.userInfo = res.userInfo
31 |
32 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
33 | // 所以此处加入 callback 以防止这种情况
34 | if (this.userInfoReadyCallback) {
35 | this.userInfoReadyCallback(res)
36 | }
37 | }
38 | })
39 | }
40 | }
41 | })
42 |
43 |
44 | // 获取网络改变状态
45 | wx.onNetworkStatusChange(function (res) {
46 | if(res.networkType == "none") {
47 | wx.reLaunch({
48 | url: '/pages/error/error',
49 | })
50 | } else {
51 | wx.reLaunch({
52 | url: '/pages/index/index',
53 | })
54 | }
55 | })
56 |
57 | // 请求数据,获得返回数据存放在全局变量中
58 | // wx.request({
59 | // url: 'test.action', //仅为示例,并非真实的接口地址
60 | // data: {
61 | // x: '',
62 | // y: ''
63 | // },
64 | // header: {
65 | // 'content-type': 'application/json' // 默认值
66 | // },
67 | // success: function (res) {
68 | // that.globalData.isLoading = false;
69 | // },
70 | // fail: function (res ) {
71 | // that.globalData.isLoading = true;
72 | // }
73 | // })
74 | },
75 | globalData: {
76 | userInfo: null,
77 | isLoading: false
78 | }
79 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/discovery/discovery",
5 | "pages/user/user",
6 | "pages/cart/cart",
7 | "pages/category/category",
8 | "pages/subPages/search/search",
9 | "pages/subPages/order/order",
10 | "pages/subPages/coupon/coupon",
11 | "pages/subPages/fcode/fcode",
12 | "pages/subPages/setting/setting",
13 | "pages/subPages/detail/detail",
14 | "pages/error/error"
15 | ],
16 | "window": {
17 | "backgroundTextStyle": "light",
18 | "navigationBarBackgroundColor": "#ff6700",
19 | "navigationBarTitleText": "小米商城Lite",
20 | "navigationBarTextStyle": "white",
21 | "backgroundColor": "#ebebeb"
22 | },
23 | "tabBar": {
24 | "list": [
25 | {
26 | "text": "首页",
27 | "pagePath": "pages/index/index",
28 | "iconPath": "images/tabbar/index_off.png",
29 | "selectedIconPath": "images/tabbar/index_on.png"
30 | },
31 | {
32 | "text": "分类",
33 | "pagePath": "pages/category/category",
34 | "iconPath": "images/tabbar/category_off.png",
35 | "selectedIconPath": "images/tabbar/category_on.png"
36 | },
37 | {
38 | "text": "发现",
39 | "pagePath": "pages/discovery/discovery",
40 | "iconPath": "images/tabbar/find_off.png",
41 | "selectedIconPath": "images/tabbar/find_on.png"
42 | },
43 | {
44 | "text": "购物车",
45 | "pagePath": "pages/cart/cart",
46 | "iconPath": "images/tabbar/cart_off.png",
47 | "selectedIconPath": "images/tabbar/cart_on.png"
48 | },
49 | {
50 | "text": "我的",
51 | "pagePath": "pages/user/user",
52 | "iconPath": "images/tabbar/user_off.png",
53 | "selectedIconPath": "images/tabbar/user_on.png"
54 | }
55 | ],
56 | "color": "#707070",
57 | "selectedColor": "#ff6700"
58 | }
59 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 |
3 | .container {
4 | height: 100%;
5 | font-family: 'Avenir', Helvetica, Arial, sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | /* flex-direction: column; */
9 | /* align-items: center; */
10 | /* justify-content: space-between; */
11 | /* padding: 200rpx 0; */
12 | /* box-sizing: border-box; */
13 | }
--------------------------------------------------------------------------------
/components/blankBox/blankBox.js:
--------------------------------------------------------------------------------
1 | // components/blankBox/blankBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | imgSrc: "../../images/cart/cc-cart.png",
11 | backgroundColor: "#d4d4d4",
12 | title: "购物车还是空的",
13 | btnTitle: "到小米商城逛逛",
14 | isShowBtn: true,
15 | isSmallImg: true,
16 | isSmallBtn: true,
17 | },
18 | observer: function ( newVal, oldVal ) {
19 | this.setData({
20 | innerData: newVal
21 | });
22 | }
23 | }
24 | },
25 |
26 | /**
27 | * 组件的初始数据
28 | */
29 | data: {
30 |
31 | },
32 |
33 | /**
34 | * 组件的方法列表
35 | */
36 | methods: {
37 | /**
38 | * 返回首页
39 | */
40 | toIndex: function () {
41 | wx.switchTab({
42 | url: '/pages/index/index'
43 | });
44 | }
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/components/blankBox/blankBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/blankBox/blankBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{ innerData.title }}
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/components/blankBox/blankBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/blankBox/blankBox.wxss */
2 | .no-product-box {
3 | height: 100vh;
4 | width: 100vw;
5 | display: -webkit-box;
6 | display: -webkit-flex;
7 | display: flex;
8 | flex-direction: column;
9 | align-items: center;
10 | }
11 | .logo-cart-wrapper {
12 | display: flex;
13 | justify-content: center;
14 | align-items: center;
15 | width: 210rpx;
16 | height: 210rpx;
17 | border-radius: 50%;
18 | margin-top:120rpx;
19 | }
20 | .big-wrap {
21 | width: 260rpx;
22 | height: 260rpx;
23 | }
24 | .logo-cart-small {
25 | width: 100rpx;
26 | height: 100rpx;
27 | }
28 | .logo-cart-big {
29 | width: inherit;
30 | height: inherit;
31 | }
32 | .title {
33 | margin-top: 50rpx;
34 | font-size: 34rpx;
35 | font-weight: 400;
36 | color: #333;
37 | }
38 | .btn-cart {
39 | width: 540rpx;
40 | height: 90rpx;
41 | line-height: 90rpx;
42 | margin-top: 50rpx;
43 | background-color: #ff6700;
44 | color: white;
45 | font-weight: 200;
46 | border-radius: 5rpx;
47 | }
48 | .btn-cart-hover {
49 | background-color: #ff7500;
50 | }
51 | .btn-cart-big {
52 | width: 680rpx;
53 | height: 100rpx;
54 | line-height: 100rpx;
55 | margin-top: 40rpx;
56 | border: 2rpx solid #b9b9b9;
57 | color: #a0a0a0;
58 | background-color: #ebebeb;
59 | }
--------------------------------------------------------------------------------
/components/brickBox/brickBox.js:
--------------------------------------------------------------------------------
1 | // components/brickBox/brickBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerObject: {
8 | type: Object,
9 | value: {
10 | name: 'star',
11 | title: '明星单品',
12 | bannerSrc: '../../images/index/star/star_banner1.png',
13 | isShowBanner: true,
14 | child: [
15 | [
16 | {
17 | index: 1,
18 | title: '小米5X 变焦双摄',
19 | desc: '5.5"大屏轻薄全金属',
20 | price: '1299元起',
21 | price_del: '',
22 | commodityType: '',
23 | imgSrc: '../../images/index/star/mi_5x.png'
24 | },
25 | {
26 | index: 2,
27 | title: '红米5',
28 | desc: '千元全面屏,前置柔光自拍',
29 | price: '799元起',
30 | price_del: '',
31 | commodityType: '',
32 | imgSrc: '../../images/index/star/hm_5.png'
33 | }
34 | ],
35 | [
36 | {
37 | index: 3,
38 | title: '小米移动电源高配版',
39 | desc: '轻薄设计,轻松出行',
40 | price: '149元',
41 | price_del: '',
42 | commodityType: '',
43 | imgSrc: '../../images/index/star/mi_powerpro.png'
44 | },
45 | {
46 | index: 4,
47 | title: '小米电视4A 65"',
48 | desc: '4K超清大屏,64位处理器',
49 | price: '4999元',
50 | price_del: '',
51 | commodityType: '',
52 | imgSrc: '../../images/index/star/mi_tv_4a65.png'
53 | }
54 | ],
55 | [
56 | {
57 | index: 5,
58 | title: '小米电视4A 49英寸"',
59 | desc: '全高清,HDR,64位处理器',
60 | price: '2399元',
61 | price_del: '',
62 | commodityType: '',
63 | imgSrc: '../../images/index/star/mi_tv_4a49.png'
64 | },
65 | {
66 | index: 6,
67 | title: '小米空气净化器 2"',
68 | desc: '10分钟,房间空气焕然一新',
69 | price: '599元',
70 | price_del: '699元',
71 | commodityType: 'discount',
72 | imgSrc: '../../images/index/star/mi_air2.png'
73 | }
74 | ]
75 | ]
76 | },
77 | observer: function ( newVal, oldVal ) {
78 | this.setData({
79 | data: newVal
80 | });
81 | }
82 | }
83 | },
84 | /**
85 | * 组件的初始数据
86 | */
87 | data: {
88 | data: {
89 | name: 'star',
90 | title: '明星单品',
91 | bannerSrc: '../../images/index/star/star_banner1.png',
92 | isShowBanner: true,
93 | child: [
94 | [
95 | {
96 | index: 1,
97 | title: '小米5X 变焦双摄',
98 | desc: '5.5"大屏轻薄全金属',
99 | price: '1299元起',
100 | price_del: '',
101 | commodityType: '',
102 | imgSrc: '../../images/index/star/mi_5x.png'
103 | },
104 | {
105 | index: 2,
106 | title: '红米5',
107 | desc: '千元全面屏,前置柔光自拍',
108 | price: '799元起',
109 | price_del: '',
110 | commodityType: '',
111 | imgSrc: '../../images/index/star/hm_5.png'
112 | }
113 | ],
114 | [
115 | {
116 | index: 3,
117 | title: '小米移动电源高配版',
118 | desc: '轻薄设计,轻松出行',
119 | price: '149元',
120 | price_del: '',
121 | commodityType: '',
122 | imgSrc: '../../images/index/star/mi_powerpro.png'
123 | },
124 | {
125 | index: 4,
126 | title: '小米电视4A 65"',
127 | desc: '4K超清大屏,64位处理器',
128 | price: '4999元',
129 | price_del: '',
130 | commodityType: '',
131 | imgSrc: '../../images/index/star/mi_tv_4a65.png'
132 | }
133 | ],
134 | [
135 | {
136 | index: 5,
137 | title: '小米电视4A 49英寸"',
138 | desc: '全高清,HDR,64位处理器',
139 | price: '2399元',
140 | price_del: '',
141 | commodityType: '',
142 | imgSrc: '../../images/index/star/mi_tv_4a49.png'
143 | },
144 | {
145 | index: 6,
146 | title: '小米空气净化器 2"',
147 | desc: '10分钟,房间空气焕然一新',
148 | price: '599元',
149 | price_del: '699元',
150 | commodityType: 'discount',
151 | imgSrc: '../../images/index/star/mi_air2.png'
152 | }
153 | ]
154 | ]
155 | },
156 | isLazyLoad: true
157 | },
158 | ready: function () {
159 | },
160 | /**
161 | * 组件的方法列表
162 | */
163 | methods: {
164 | _changeToDetail: function ( e ) {
165 | var uid = e.currentTarget.dataset.uid;
166 | wx.showToast({
167 | title: "正在请求数据",
168 | mask: true,
169 | icon: "loading",
170 | duration: 800
171 | })
172 | setTimeout(function () {
173 | if (uid == 1010101 || uid == 1010102) {
174 | wx.navigateTo({
175 | url: '/pages/subPages/detail/detail?uid=' + uid,
176 | })
177 | } else {
178 | wx.showModal({
179 | content: '由于没有后台数据,所以该页面没有制作,点击确认跳转到小米5X详细页面',
180 | success: function (res) {
181 | if (res.confirm) {
182 | wx.navigateTo({
183 | url: '/pages/subPages/detail/detail?uid=1010101',
184 | })
185 | } else if (res.cancel) {
186 | console.log('用户点击取消')
187 | }
188 | }
189 | })
190 | }
191 | }, 800);
192 |
193 |
194 | }
195 | }
196 | })
197 |
--------------------------------------------------------------------------------
/components/brickBox/brickBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/brickBox/brickBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | {{ item.title }}
22 |
23 | {{ item.desc }}
24 |
25 |
26 | {{ item.price }}
27 | {{ item.price_del }}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/components/brickBox/brickBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/brickBox/brickBox.wxss */
2 | .section-brick {
3 | width: 100%;
4 | /* padding: 14rpx 0; */
5 | border-top: 14rpx solid #ececec;
6 | }
7 | .brick-header {
8 | width: 100%;
9 | display: -webkit-flex;
10 | display: flex;
11 | flex-direction: column;
12 | }
13 |
14 | .brick-banner {
15 | width: 100%;
16 | height: 460rpx;
17 | background-color: gainsboro;
18 | }
19 | .brick-as-banner {
20 | width: 100%;
21 | height: 300rpx;
22 | background-color: seashell;
23 | }
24 | .brick-list {
25 | width: 100%;
26 | flex-direction: row;
27 | border-top: 10rpx solid white;
28 | }
29 | /* .brick-list::before, .brick-list::after {
30 | display: table;
31 | content: "";
32 | }
33 | .brick-list:after {
34 | clear: both;
35 | } */
36 | .brick-list-two {
37 | display: -webkit-box;
38 | display: -webkit-flex;
39 | display: flex;
40 | flex-direction: row;
41 | }
42 | .brick-item {
43 | -webkit-box-flex: 1;
44 | -webkit-flex:1 1 auto;
45 | flex: 1 1 auto;
46 | width: 49.33%;
47 | padding-left: 10rpx;
48 | background-color: #ffffff;
49 | }
50 | .brick-item:nth-child( 2n + 1 ) {
51 | padding-left: 0;
52 | }
53 | .item-image-wrapper {
54 | width: 100%;
55 | height: 280rpx;
56 | background-color: papayawhip;
57 | }
58 | .item-image {
59 | width: 100%;
60 | height: inherit;
61 | }
62 | .item-title {
63 | margin: 30rpx 0 0 20rpx;
64 | font-size: 30rpx;
65 | max-width: 75%;
66 | overflow: hidden;
67 | white-space: nowrap;
68 | -ms-text-overflow: ellipsis;
69 | -o-text-overflow: ellipsis;
70 | text-overflow: ellipsis;
71 | }
72 | .item-desc {
73 | margin: 6rpx 0 0 20rpx;
74 | font-size: 22rpx;
75 | color: #999;
76 | max-width: 75%;
77 | overflow: hidden;
78 | white-space: nowrap;
79 | -ms-text-overflow: ellipsis;
80 | -o-text-overflow: ellipsis;
81 | text-overflow: ellipsis;
82 | }
83 | .item-price-wrapper {
84 | margin: 8rpx 0 30rpx 20rpx;
85 | font-size: 30rpx;
86 | color: #ff6700;
87 |
88 | }
89 | .item-price-wrapper .price-del {
90 | text-decoration: line-through;
91 | font-size: 24rpx;
92 | margin-left: 10rpx;
93 | color: rgba(0,0,0,.54);
94 | }
--------------------------------------------------------------------------------
/components/categoryListBox/categoryListBox.js:
--------------------------------------------------------------------------------
1 | // components/categoryIistBox/categoryListBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | name: "new",
11 | title: "新品",
12 | data: [
13 | {
14 | name: "phone",
15 | title: "手机",
16 | childData: [
17 | {
18 | id: 2010101,
19 | title: "红米5",
20 | imgSrc: "../../images/b2c-mimall-media/hm5.png"
21 | },
22 | {
23 | id: 2010102,
24 | title: "红米5 Plus",
25 | imgSrc: "../../images/b2c-mimall-media/hm5_plus.png"
26 | },
27 | {
28 | id: 2010103,
29 | title: "小米MIX 2",
30 | imgSrc: "../../images/b2c-mimall-media/xm_mix2.png"
31 | },
32 | {
33 | id: 2010104,
34 | title: "小米Note 3",
35 | imgSrc: "../../images/b2c-mimall-media/xm_note3.png"
36 | },
37 | {
38 | id: 2010105,
39 | title: "小米6",
40 | imgSrc: "../../images/b2c-mimall-media/xm6.png"
41 | },
42 | {
43 | id: 2010106,
44 | title: "小米5X",
45 | imgSrc: "../../images/b2c-mimall-media/xm_5x.png"
46 | }
47 | ]
48 | },
49 | {
50 | name: "tv",
51 | title: "电视",
52 | childData: [
53 | {
54 | id: 2010201,
55 | title: "32英寸",
56 | imgSrc: "../../images/b2c-mimall-media/32yc.png"
57 | },
58 | {
59 | id: 2010202,
60 | title: "43英寸",
61 | imgSrc: "../../images/b2c-mimall-media/43yc.png"
62 | },
63 | {
64 | id: 2010203,
65 | title: "55英寸",
66 | imgSrc: "../../images/b2c-mimall-media/55yc.png"
67 | }
68 | ]
69 | },
70 | {
71 | name: "computer",
72 | title: "电脑",
73 | childData: [
74 | {
75 | id: 2010301,
76 | title: "笔记本Pro 15.6",
77 | imgSrc: "../../images/b2c-mimall-media/bjb_pro_15.6.png"
78 | },
79 | {
80 | id: 2010202,
81 | title: '笔记本13.3" i7',
82 | imgSrc: "../../images/b2c-mimall-media/bjb_13.3_i7.png"
83 | }
84 | ]
85 | }
86 | ]
87 | },
88 | observer: function ( newVal, oldVal ) {
89 | this.setData({
90 | innerData: newVal
91 | });
92 | }
93 | }
94 | },
95 |
96 | /**
97 | * 组件的初始数据
98 | */
99 | data: {
100 |
101 | },
102 |
103 | /**
104 | * 组件的方法列表
105 | */
106 | methods: {
107 |
108 | }
109 | })
110 |
--------------------------------------------------------------------------------
/components/categoryListBox/categoryListBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/categoryListBox/categoryListBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ item.title }}
6 |
7 |
8 |
9 | var getMessage = function ( array ) {
10 | var row = 0, height = 0,len = array.length;
11 |
12 | row = ( len <= 3 )? 1: ( len % 3 != 0)? Math.floor( len / 3) + 1: Math.floor( len / 3);
13 | var tempArr = [];
14 | var start = 0;
15 | var end = 3;
16 | for ( var i = 0; i < row; i++ ) {
17 |
18 | tempArr[ i ] = array.slice( start, end );
19 | start = end;
20 | end += 3;
21 | }
22 | return tempArr;
23 | }
24 | module.exports.getMessage = getMessage;
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {{ childItem.title }}
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/components/categoryListBox/categoryListBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/categoryIistBox/categoryListBox.wxss */
2 | .category-list {
3 | margin: 0;
4 | padding: 0;
5 | }
6 | .category-title {
7 | background: #fff;
8 | font-size: 36rpx;
9 | display: -webkit-box;
10 | display: -webkit-flex;
11 | display: flex;
12 | justify-content: center;
13 | align-items: center;
14 | height: 120rpx;
15 | }
16 | .category-title text {
17 | position: relative;
18 | font-weight: 400;
19 | font-size: 30rpx;
20 | color: #3c3c3c;
21 | }
22 | .category-title text::before,.category-title text::after {
23 | content: "";
24 | position: absolute;
25 | top: 50%;
26 | left: 0;
27 | width: 40rpx;
28 | border-top: 1px solid #e0e0e0;
29 | transform: translate3d(-150%,-50%,0);
30 | -webkit-transform: translate3d(-150%,-50%,0);
31 | }
32 | .category-title text::after {
33 | left: auto;
34 | right: 0;
35 | transform: translate3d(150%,-50%,0);
36 | -webkit-transform: translate3d(150%,-50%,0);
37 | }
38 | .category-group {
39 | margin: 0;
40 | padding: 0;
41 | display: -webkit-box;
42 | display: -webkit-flex;
43 | display: flex;
44 | flex-direction: column;
45 | justify-content: center;
46 | }
47 | .group-column-3 {
48 | width: 100%;
49 | margin: 20rpx 0 30rpx 0;
50 | display: -webkit-box;
51 | display: -webkit-flex;
52 | display: flex;
53 | }
54 | .group-item {
55 | /* -webkit-box-flex: 1;
56 | -webkit-flex: 1;
57 | flex: 1; */
58 | width: 33%;
59 | text-align: center;
60 | }
61 | .item-img-wrap {
62 | margin: 0 auto;
63 | width: 104rpx;
64 | height: 104rpx;
65 | }
66 | .item-img{
67 | width: 104rpx;
68 | height: 104rpx;
69 | }
70 | .item-name {
71 | margin-top: 30rpx;
72 | font-size: 24rpx;
73 | color: rgba(0, 0, 0, .54);
74 | }
--------------------------------------------------------------------------------
/components/cellBox/cellBox.js:
--------------------------------------------------------------------------------
1 | // components/cellBox/cellBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | name: "order",
11 | title: "我的订单",
12 | imgSrc: "../../images/mine/icon_order.png"
13 | },
14 | observer: function ( newVal, oldVal ) {
15 | this.setData({
16 | innerData: newVal
17 | });
18 | }
19 | }
20 | },
21 |
22 | /**
23 | * 组件的初始数据
24 | */
25 | data: {
26 |
27 | },
28 |
29 | /**
30 | * 组件的方法列表
31 | */
32 | methods: {
33 | _changeTo: function ( e ) {
34 | var name = e.currentTarget.dataset.name;
35 | wx.navigateTo({
36 | url: '/pages/subPages/'+ name +'/' + name
37 | })
38 | }
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/components/cellBox/cellBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/cellBox/cellBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{ innerData.title }}
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/components/cellBox/cellBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/cellBox/cellBox.wxss */
2 | .cell-box-outer {
3 | height: 108rpx;
4 | width: 90vw;
5 | padding:0 5vw;
6 | background-color: white;
7 | transition: background-color .2s linear;
8 | }
9 | .cell-enter {
10 | background-color: #fcfcfc;
11 | }
12 | .cell-box-inner {
13 | height: inherit;
14 | width: 100%;
15 | display: -webkit-box;
16 | display: -webkit-flex;
17 | display: flex;
18 | flex-direction: row;
19 | align-items: center;
20 | border-bottom: 1px solid #e5e5e5;
21 | border-top: 1px solid #f2f2f2;
22 | }
23 | .cell-img-wrap {
24 | display: -webkit-box;
25 | display: -webkit-flex;
26 | display: flex;
27 | justify-content: center;
28 | align-items: center;
29 | height: 108rpx;
30 | width: 108rpx;
31 | }
32 | .cell-img {
33 | height: 70rpx;
34 | width: 70rpx;
35 | }
36 | .cell-title {
37 | font-size: 32rpx;
38 | }
--------------------------------------------------------------------------------
/components/cellListBox/cellListBox.js:
--------------------------------------------------------------------------------
1 | // components/cellListBox/cellListBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | id: 3010101,
11 | title: "50元红包等你划分",
12 | typeTitle: "年货节",
13 | imgSrc: "../../images/discovery/new_year_bonus.png"
14 | },
15 | observer: function ( newVal, oldVal ) {
16 | this.setData({
17 | innerData: newVal
18 | });
19 | }
20 | }
21 | },
22 |
23 | /**
24 | * 组件的初始数据
25 | */
26 | data: {
27 | isVisible: ""
28 | },
29 |
30 | /**
31 | * 组件的方法列表
32 | */
33 | methods: {
34 |
35 | },
36 | ready: function () {
37 | this.setData({
38 | isVisible: "is-visible"
39 | });
40 | }
41 | })
42 |
--------------------------------------------------------------------------------
/components/cellListBox/cellListBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/cellListBox/cellListBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{ innerData.typeTitle }}
12 |
13 |
14 | {{ innerData.title }}
15 |
16 |
17 |
--------------------------------------------------------------------------------
/components/cellListBox/cellListBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/cellListBox/cellListBox.wxss */
2 | .cellList-box {
3 | height: 480rpx;
4 | width: 94vw;
5 | margin: 20rpx 3vw 0;
6 | display: -webkit-box;
7 | display: -webkit-flex;
8 | display: flex;
9 | -ms-flex-direction: column;
10 | flex-direction: column;
11 | border-radius: 6rpx;
12 | }
13 | .cellList-img-wrap {
14 | width: 100%;
15 | height: 360rpx;
16 | border-top-left-radius: 6rpx;
17 | border-top-right-radius: 6rpx;
18 | background-color: papayawhip;
19 | }
20 | .cellList-img {
21 | width: 100%;
22 | height: 360rpx;
23 | opacity: 0;
24 | transition: all .8s;
25 | }
26 | .is-visible .cellList-img {
27 | opacity: 1;
28 | }
29 | .cellList-bottom {
30 | display: -webkit-box;
31 | display: -webkit-flex;
32 | display: flex;
33 | -ms-flex-direction: row;
34 | flex-direction: row;
35 | justify-content: center;
36 | align-items: center;
37 | height: 120rpx;
38 | width: 100%;
39 | background-color: white;
40 | border-bottom-left-radius: 6rpx;
41 | border-bottom-right-radius: 6rpx;
42 | }
43 | .cellList-type-wrap {
44 | display: -webkit-box;
45 | display: -webkit-flex;
46 | display: flex;
47 | align-items: center;
48 | height: auto;
49 | padding: 6rpx 14rpx 6rpx;
50 | background-color: #ff6700;
51 | border-radius: 12rpx;
52 | margin-right: 14rpx;
53 | }
54 | .cellList-type {
55 | font-size: 24rpx;
56 | color: white;
57 | }
58 | .cellList-title {
59 | font-size: 30rpx;
60 | }
--------------------------------------------------------------------------------
/components/commentBox/commentBox.js:
--------------------------------------------------------------------------------
1 | // components/commentBox/commentBox.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | add_time: "2018-01-30",
11 | average_grade: 5,
12 | comment_content: "我感觉手机比客服妹子美啊!",
13 | comment_full_images: ["//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/205abda3647029237da9871ae4d2fd58.webp", "//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/feef74ec3072012cf2bff96a7ad6c77a.webp"],
14 | comment_grade: 1,
15 | comment_id: "154482520",
16 | comment_images: ["//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/205abda3647029237da9871ae4d2fd58.webp", "//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/feef74ec3072012cf2bff96a7ad6c77a.webp"],
17 | comment_title: "",
18 | down: false,
19 | down_num: 0,
20 | has_up_customer: false,
21 | is_top: "1",
22 | reply_content: "那妹子就负责任的告诉你:这,不是你的错觉(✿◡‿◡)感谢您对小米的支持。",
23 | reply_time: "2018-01-30",
24 | site_id: "101",
25 | site_name: "小米移动商城",
26 | up: false,
27 | up_customer_num: 20,
28 | up_num: 14,
29 | up_rate: 100,
30 | user_avatar: "//s1.mi-img.com/mfsv2/avatar/fdsc3/p0136e7Mzb7r/z7PFQfgQffxwcD_90.jpg",
31 | user_id: "119***5273",
32 | user_name: "那就这样吧",
33 | user_reply_num: 0,
34 | user_replys: []
35 | },
36 | observer:function ( newVal, oldVal ) {
37 | this.setData({
38 | innerData: newVal
39 | });
40 | }
41 | }
42 | },
43 |
44 | /**
45 | * 组件的初始数据
46 | */
47 | data: {
48 |
49 | },
50 |
51 | /**
52 | * 组件的方法列表
53 | */
54 | methods: {
55 |
56 | }
57 | })
58 |
--------------------------------------------------------------------------------
/components/commentBox/commentBox.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/commentBox/commentBox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
30 |
--------------------------------------------------------------------------------
/components/commentBox/commentBox.wxss:
--------------------------------------------------------------------------------
1 | /* components/commentBox/commentBox.wxss */
2 | .comment-box {
3 | display: -webkit-box;
4 | display: -webkit-flex;
5 | display: flex;
6 | margin: 20rpx 30rpx;
7 | }
8 | .comment-left {
9 | width: 90rpx;
10 | margin-right: 16rpx;
11 | }
12 | .avatar-img-box {
13 | width: 90rpx;
14 | }
15 | .avatar-img {
16 | width: inherit;
17 | height: 90rpx;
18 | border-radius: 50%;
19 | }
20 | .comment-right {
21 | -webkit-box-flex: 1;
22 | -webkit-flex: 1 0 auto;
23 | flex: 1 0 auto;
24 | }
25 |
26 | .comment-content-outer {
27 | display: -webkit-box;
28 | display: -webkit-flex;
29 | display: flex;
30 | -ms-flex-direction: column;
31 | flex-direction: column;
32 | }
33 | .user-info {
34 | height: 40rpx;
35 | margin-bottom: 12rpx;
36 | }
37 |
38 | .text {
39 | font-size: 28rpx;
40 | }
41 | .comment-content-inner {
42 | display: -webkit-box;
43 | display: -webkit-flex;
44 | display: flex;
45 | -ms-flex-direction: column;
46 | flex-direction: column;
47 | }
48 | .photoes {
49 | display: -webkit-box;
50 | display: -webkit-flex;
51 | display: flex;
52 | width: 600rpx;
53 | flex-wrap: wrap;
54 | margin-bottom: 12rpx;
55 | }
56 | .photoes .photo {
57 | width: 160rpx;
58 | height: 160rpx;
59 | margin-top: 24rpx;
60 | margin-left: 24rpx;
61 | }
62 | .photoes .photo:nth-child(3n + 1) {
63 | margin-left: 0;
64 | }
65 |
66 | /*回复区 */
67 |
68 | .comment-reply {
69 | width: 580rpx;
70 | background-color: #f6f6f6;
71 | padding: 10rpx 14rpx;
72 | }
73 | .comment-reply-item {
74 | line-height: 40rpx;
75 | font-size: 26rpx;
76 | }
77 | .official .text {
78 | color: #ff6700;
79 | }
80 |
--------------------------------------------------------------------------------
/components/productSection/productSection.js:
--------------------------------------------------------------------------------
1 | // components/productSection/productSection.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | title: "已选",
11 | desc: "小米5X 4GB+32GB 金色",
12 | num: 1
13 | },
14 | observer: function ( newVal, oldVal ) {
15 | this.setData({
16 | innerData: newVal
17 | });
18 | }
19 | }
20 | },
21 |
22 | /**
23 | * 组件的初始数据
24 | */
25 | data: {
26 |
27 | },
28 |
29 | /**
30 | * 组件的方法列表
31 | */
32 | methods: {
33 |
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/components/productSection/productSection.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/productSection/productSection.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ innerData.title }}
6 |
7 |
8 | {{ innerData.desc }} x {{ innerData.num }}
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/components/productSection/productSection.wxss:
--------------------------------------------------------------------------------
1 | /* components/productSection/productSection.wxss */
2 | .product-section{
3 | width: 100%;
4 | height: 106rpx;
5 | background-color: #fff;
6 | }
7 | .section-inner {
8 | display: -webkit-box;
9 | display: -webkit-flex;
10 | display: flex;
11 | -ms-flex-direction: row;
12 | flex-direction: row;
13 | height: inherit;
14 | line-height: 106rpx;
15 | border-bottom: 4rpx solid #f3f3f3;
16 | width: 92vw;
17 | margin: 0 4vw;
18 | }
19 | .product-title-wrap {
20 | margin-right: 40rpx;
21 | font-size: 28rpx;
22 | }
23 | .product-title {
24 | color: #8c8c8c;
25 | }
26 | .product-flex {
27 | -webkit-box-flex: 1;
28 | -webkit-flex: 1 0 auto;
29 | flex: 1 0 auto;
30 | font-size: 30rpx;
31 | position: relative;
32 | }
33 | .product-desc {
34 | color: #202020;
35 | }
36 | .more::before {
37 | content: "";
38 | position: absolute;
39 | right: 16rpx;
40 | top: 50%;
41 | width: 20rpx;
42 | height: 20rpx;
43 | transform: translate3d(0,-50%,0) rotate(135deg);
44 | -webkit-transform: translate3d(0,-50%,0) rotate(135deg);
45 | border-left: 2rpx solid currentColor;
46 | border-top: 2rpx solid currentColor;
47 | }
--------------------------------------------------------------------------------
/components/promotions/promotions.js:
--------------------------------------------------------------------------------
1 | // components/promotions/promotions.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | innerData: {
8 | type: Object,
9 | value: {
10 | title: "促销",
11 | typeTitle: "赠品",
12 | desc: "无限流量米粉卡 含100元话费"
13 | },
14 | observer: function ( newVal, oldVal ) {
15 | this.setData({
16 | innerData: newVal
17 | });
18 | }
19 | }
20 | },
21 |
22 | /**
23 | * 组件的初始数据
24 | */
25 | data: {
26 |
27 | },
28 |
29 | /**
30 | * 组件的方法列表
31 | */
32 | methods: {
33 |
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/components/promotions/promotions.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/promotions/promotions.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ innerData.title }}
7 |
8 |
9 | {{ innerData.typeTitle }}
10 |
11 |
12 | {{ innerData.desc }}
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/components/promotions/promotions.wxss:
--------------------------------------------------------------------------------
1 | /* components/promotions/promotions.wxss */
2 | .promotions-section{
3 | width: 100%;
4 | height: 106rpx;
5 | background-color: #fff;
6 | }
7 | .section-inner {
8 | display: -webkit-box;
9 | display: -webkit-flex;
10 | display: flex;
11 | -ms-flex-direction: row;
12 | flex-direction: row;
13 | height: inherit;
14 | line-height: 106rpx;
15 | border-bottom: 4rpx solid #f3f3f3;
16 | width: 92vw;
17 | margin: 0 4vw;
18 | }
19 | .promotions-title-wrap {
20 | margin-right: 40rpx;
21 | font-size: 28rpx;
22 | }
23 | .promotions-title {
24 | color: #8c8c8c;
25 | }
26 | .promotions-type-wrap {
27 | margin-right: 10rpx;
28 | font-size: 28rpx;
29 | }
30 | .promotions-type {
31 | color: #ff6700;
32 | padding: 4rpx 10rpx;
33 | border: 4rpx solid #ff6700;
34 | border-radius: 8rpx;
35 | }
36 | .promotions-flex {
37 | -webkit-box-flex: 1;
38 | -webkit-flex: 1 0 auto;
39 | flex: 1 0 auto;
40 | overflow: hidden;
41 | text-overflow: ellipsis;
42 | white-space: nowrap;
43 | font-size: 30rpx;
44 | }
45 | .promotions-desc {
46 | color: #202020;
47 | }
--------------------------------------------------------------------------------
/images/cart/cc-cart-gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/cart/cc-cart-gray.png
--------------------------------------------------------------------------------
/images/cart/cc-cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/cart/cc-cart.png
--------------------------------------------------------------------------------
/images/common/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/clear.png
--------------------------------------------------------------------------------
/images/common/coupon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/coupon.png
--------------------------------------------------------------------------------
/images/common/error-network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/error-network.png
--------------------------------------------------------------------------------
/images/common/exclamation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/exclamation.png
--------------------------------------------------------------------------------
/images/common/order.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/order.png
--------------------------------------------------------------------------------
/images/common/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/common/qrcode.png
--------------------------------------------------------------------------------
/images/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/loading.gif
--------------------------------------------------------------------------------
/images/mine/icon_coupon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/mine/icon_coupon.png
--------------------------------------------------------------------------------
/images/mine/icon_fcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/mine/icon_fcode.png
--------------------------------------------------------------------------------
/images/mine/icon_order.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/mine/icon_order.png
--------------------------------------------------------------------------------
/images/mine/icon_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/mine/icon_setting.png
--------------------------------------------------------------------------------
/images/searchResult/hm5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/searchResult/hm5.jpg
--------------------------------------------------------------------------------
/images/tabbar/cart_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/cart_off.png
--------------------------------------------------------------------------------
/images/tabbar/cart_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/cart_on.png
--------------------------------------------------------------------------------
/images/tabbar/category_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/category_off.png
--------------------------------------------------------------------------------
/images/tabbar/category_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/category_on.png
--------------------------------------------------------------------------------
/images/tabbar/find_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/find_off.png
--------------------------------------------------------------------------------
/images/tabbar/find_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/find_on.png
--------------------------------------------------------------------------------
/images/tabbar/index_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/index_off.png
--------------------------------------------------------------------------------
/images/tabbar/index_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/index_on.png
--------------------------------------------------------------------------------
/images/tabbar/user_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/user_off.png
--------------------------------------------------------------------------------
/images/tabbar/user_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lxs24sxl/wechat-app-mi/8c184f943e75580fe5b7763f1ad719613bc199ad/images/tabbar/user_on.png
--------------------------------------------------------------------------------
/pages/cart/cart.js:
--------------------------------------------------------------------------------
1 | // pages/cart/cart.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 |
67 | })
--------------------------------------------------------------------------------
/pages/cart/cart.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents" : {
3 | "blank-box": "../../components/blankBox/blankBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#f9f9f9",
7 | "navigationBarTitleText": "购物车",
8 | "navigationBarTextStyle": "black",
9 | "backgroundColor": "#ebebeb"
10 | }
--------------------------------------------------------------------------------
/pages/cart/cart.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pages/cart/cart.wxss:
--------------------------------------------------------------------------------
1 | /* pages/cart/cart.wxss */
2 | .container {
3 | background-color: #ebebeb;
4 | display: flex;
5 | }
--------------------------------------------------------------------------------
/pages/category/category.js:
--------------------------------------------------------------------------------
1 | // pages/category/category.js
2 | // 定义定时器
3 | var scrollTimer = null;
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | categoryData: [ // 分类数据
11 | {
12 | name: "new",
13 | title: "新品",
14 | data: [
15 | {
16 | name: "phone",
17 | title: "手机",
18 | childData: [
19 | {
20 | id: 2010101,
21 | title: "红米5",
22 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm5.png"
23 | },
24 | {
25 | id: 2010102,
26 | title: "红米5 Plus",
27 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm5_plus.png"
28 | },
29 | {
30 | id: 2010103,
31 | title: "小米MIX 2",
32 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_mix2.png"
33 | },
34 | {
35 | id: 2010104,
36 | title: "小米Note 3",
37 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_note3.png"
38 | },
39 | {
40 | id: 2010105,
41 | title: "小米6",
42 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm6.png"
43 | },
44 | {
45 | id: 2010106,
46 | title: "小米5X",
47 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_5x.png"
48 | }
49 | ]
50 | },
51 | {
52 | name: "tv",
53 | title: "电视",
54 | childData: [
55 | {
56 | id: 2010201,
57 | title: "32英寸",
58 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/32yc.png"
59 | },
60 | {
61 | id: 2010202,
62 | title: "43英寸",
63 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/43yc.png"
64 | },
65 | {
66 | id: 2010203,
67 | title: "55英寸",
68 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/55yc.png"
69 | }
70 | ]
71 | },
72 | {
73 | name: "computer",
74 | title: "电脑",
75 | childData: [
76 | {
77 | id: 2010301,
78 | title: "笔记本Pro 15.6",
79 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bjb_pro_15.6.png"
80 | },
81 | {
82 | id: 2010202,
83 | title: '笔记本13.3" i7',
84 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bjb_13.3_i7.png"
85 | }
86 | ]
87 | }
88 | ]
89 | },
90 | {
91 | name: "phone",
92 | title: "手机",
93 | data: [
94 | {
95 | name: "xmphone",
96 | title: "小米手机",
97 | childData: [
98 | {
99 | id: 2020101,
100 | title: "小米Mix 2",
101 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_mix2.png"
102 | },
103 | {
104 | id: 2020102,
105 | title: "小米Note 3",
106 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_note3.png"
107 | },
108 | {
109 | id: 2020103,
110 | title: "小米6",
111 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm6.png"
112 | },
113 | {
114 | id: 2020104,
115 | title: "小米5X",
116 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_5x.png"
117 | },
118 | {
119 | id: 2020105,
120 | title: "小米Max 2",
121 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_max2.png"
122 | }
123 | ]
124 | },
125 | {
126 | name: "hmphone",
127 | title: "红米手机",
128 | childData:
129 | [
130 | {
131 | id: 2020201,
132 | title: "红米5",
133 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm5.png"
134 | },
135 | {
136 | id: 2020202,
137 | title: "红米5 Plus",
138 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm5_plus.png"
139 | },
140 | {
141 | id: 2020203,
142 | title: "红米5A",
143 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_5a.png"
144 | },
145 | {
146 | id: 2020204,
147 | title: "红米Note 5A",
148 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_note5a.png"
149 | },
150 | {
151 | id: 2020205,
152 | title: "红米Note 4X",
153 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_note4x.png"
154 | },
155 | {
156 | id: 2020206,
157 | title: "红米4X",
158 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_4x.png"
159 | },
160 | {
161 | id: 2020207,
162 | title: "红米4A",
163 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_4a.png"
164 | }
165 | ]
166 | },
167 | {
168 | name: "mobile4g",
169 | title: "移动4G+专区",
170 | childData: [
171 | {
172 | id: 2020301,
173 | title: "小米6",
174 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm6.png"
175 | },
176 | {
177 | id: 2020302,
178 | title: '红米Note 4X',
179 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_note4x.png"
180 | },
181 | {
182 | id: 2020303,
183 | title: '红米4X',
184 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hm_4x.png"
185 | },
186 | {
187 | id: 2020304,
188 | title: '小米5X',
189 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xm_5x.png"
190 | }
191 | ]
192 | },
193 | {
194 | name: "phoneAcce",
195 | title: "手机配件",
196 | childData: [
197 | {
198 | id: 2020401,
199 | title: "以旧换新",
200 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yjhx.png"
201 | },
202 | {
203 | id: 2020402,
204 | title: '定位电话',
205 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dwdh.png"
206 | },
207 | {
208 | id: 2020403,
209 | title: '贴膜',
210 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/tm.png"
211 | },
212 | {
213 | id: 2020204,
214 | title: '保护壳',
215 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bhk.png"
216 | },
217 | {
218 | id: 2020205,
219 | title: '充电器',
220 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cdq.png"
221 | },
222 | {
223 | id: 2020206,
224 | title: '数据线',
225 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sjx.jpg"
226 | },
227 | {
228 | id: 2020207,
229 | title: '存储卡',
230 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sdk.jpg"
231 | },
232 | {
233 | id: 2020208,
234 | title: '自拍杆',
235 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/zpg.jpg"
236 | },
237 | {
238 | id: 2020209,
239 | title: '手机支架',
240 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sjzj.png"
241 | }
242 | ]
243 | }
244 | ]
245 | },
246 | {
247 | name: "tv",
248 | title: "电视",
249 | data: [
250 | {
251 | name: "tv-tv",
252 | title: "电视",
253 | childData: [
254 | {
255 | id: 2030101,
256 | title: '32英寸',
257 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/32yc.png"
258 | },
259 | {
260 | id: 2030102,
261 | title: '43英寸',
262 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/43yc.png"
263 | },
264 | {
265 | id: 2030103,
266 | title: '49-50英寸',
267 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/49-50yc.png"
268 | },
269 | {
270 | id: 2030104,
271 | title: '55英寸',
272 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/55yc.png"
273 | },
274 | {
275 | id: 2030105,
276 | title: '65英寸',
277 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/65yc.png"
278 | }
279 | ]
280 | },
281 | {
282 | name: "tv-hz",
283 | title: "盒子",
284 | childData: [
285 | {
286 | id: 2030201,
287 | title: '盒子3s',
288 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hz3.jpg"
289 | },
290 | {
291 | id: 2030202,
292 | title: '盒子3c',
293 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hz3.jpg"
294 | },
295 | {
296 | id: 2030203,
297 | title: '盒子3加强版',
298 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hz3_pro.jpg"
299 | }
300 | ]
301 | },
302 | {
303 | name: "tv-yx",
304 | title: "音箱",
305 | childData: [
306 | {
307 | id: 2030301,
308 | title: '家庭音箱',
309 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/jtyx.png"
310 | },
311 | {
312 | id: 2030302,
313 | title: '蓝牙音箱',
314 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/lyyx.png"
315 | }
316 | ]
317 | },
318 | {
319 | name: "tv-vip",
320 | title: "电视配件及会员",
321 | childData: [
322 | {
323 | id: 2030301,
324 | title: '会员卡',
325 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/hyk.png"
326 | },
327 | {
328 | id: 2030302,
329 | title: '遥控器',
330 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/lyyx.png"
331 | },
332 | {
333 | id: 2030303,
334 | title: '线材转接器',
335 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xczjq.jpg"
336 | },
337 | {
338 | id: 2030304,
339 | title: '安装服务',
340 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/azfw.png"
341 | },
342 | {
343 | id: 2030305,
344 | title: '麦克风',
345 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mkf.png"
346 | }
347 | ]
348 | }
349 | ]
350 | },
351 | {
352 | name: "computer",
353 | title: "电脑",
354 | data: [
355 | {
356 | name: "computer-dn",
357 | title: "电脑",
358 | childData: [
359 | {
360 | id: 2040101,
361 | title: '笔记本12.5"',
362 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bjb_12.5.png"
363 | },
364 | {
365 | id: 2040102,
366 | title: '笔记本13.3"',
367 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bjb_13.3_i7.png"
368 | },
369 | {
370 | id: 2040103,
371 | title: '笔记本15.6"',
372 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bjb_pro_15.6.png"
373 | },
374 | ]
375 | },
376 | {
377 | name: "computer-acce",
378 | title: "电脑配件",
379 | childData: [
380 | {
381 | id: 2040201,
382 | title: '鼠标/鼠标垫',
383 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sb-sbd.jpg"
384 | },
385 | {
386 | id: 2040202,
387 | title: '机械键盘',
388 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/jxjp.png"
389 | },
390 | {
391 | id: 2040203,
392 | title: '平板保护类',
393 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/pbbhl.png"
394 | },
395 | {
396 | id: 2040204,
397 | title: '转接线/电源',
398 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xczjq.jpg"
399 | },
400 | {
401 | id: 2040205,
402 | title: '随身WiFi',
403 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sswifi.png"
404 | },
405 | ]
406 | },
407 | ]
408 | },
409 | {
410 | name: "appliances",
411 | title: "家电",
412 | data: [
413 | {
414 | name: "appliances-jd",
415 | title: "家电",
416 | childData: [
417 | {
418 | id: 2050101,
419 | title: '电饭煲',
420 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dfb.png"
421 | },
422 | {
423 | id: 2050102,
424 | title: '净水器',
425 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/jsq.png"
426 | },
427 | {
428 | id: 2050103,
429 | title: '净化器',
430 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/jhq.png"
431 | },
432 | {
433 | id: 2050104,
434 | title: '扫地机器人',
435 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sdjqr.png"
436 | },
437 | {
438 | id: 2050105,
439 | title: '米家投影仪',
440 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mjtyy.jpg"
441 | },
442 | {
443 | id: 2050106,
444 | title: '电水壶',
445 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dsh.png"
446 | },
447 | {
448 | id: 2050107,
449 | title: '灯具',
450 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dj.png"
451 | },
452 | {
453 | id: 2050108,
454 | title: '空调',
455 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/kt.jpg"
456 | },
457 | {
458 | id: 2050109,
459 | title: '电磁炉',
460 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dcl.jpg"
461 | }
462 | ]
463 | }
464 | ]
465 | },
466 | {
467 | name: "router",
468 | title: "路由",
469 | data: [
470 | {
471 | name: "router-ly",
472 | title: "路由",
473 | childData: [
474 | {
475 | id: 2060101,
476 | title: '路由器3A',
477 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/router3a.jpg"
478 | },
479 | {
480 | id: 2060102,
481 | title: '路由器3G',
482 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/router3g.jpg"
483 | },
484 | {
485 | id: 2060103,
486 | title: '路由器3',
487 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/router3.jpg"
488 | },
489 | {
490 | id: 2060104,
491 | title: '路由器3C',
492 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/router3c.png"
493 | },
494 | {
495 | id: 2060105,
496 | title: '路由器HD',
497 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/routerhd.png"
498 | },
499 | {
500 | id: 2060106,
501 | title: '路由器Pro',
502 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/routerhd.png"
503 | },
504 | {
505 | id: 2060107,
506 | title: 'WiFi放大器',
507 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/wifi_fdq.jpg"
508 | },
509 | {
510 | id: 2060108,
511 | title: '电力猫',
512 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dlm.png"
513 | },
514 | {
515 | id: 2060109,
516 | title: '线材',
517 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xc.png"
518 | }
519 | ]
520 | }
521 | ]
522 | },
523 | {
524 | name: "smart",
525 | title: "智能",
526 | data: [
527 | {
528 | name: "smart-zn",
529 | title: "智能",
530 | childData: [
531 | {
532 | id: 2070101,
533 | title: '剃须刀',
534 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/txd.jpg"
535 | },
536 | {
537 | id: 2070102,
538 | title: '智能家庭',
539 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/znjt.png"
540 | },
541 | {
542 | id: 2070103,
543 | title: 'VR眼镜',
544 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/vryj.png"
545 | },
546 | {
547 | id: 2070104,
548 | title: '摄像机',
549 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sxj.jpg"
550 | },
551 | {
552 | id: 2070105,
553 | title: '智能插排',
554 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/zncp.jpg"
555 | }
556 | ]
557 | },
558 | {
559 | name: "smart-jk",
560 | title: "健康",
561 | childData: [
562 | {
563 | id: 2070201,
564 | title: '手环',
565 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xmsh.png"
566 | },
567 | {
568 | id: 2070202,
569 | title: '血压计',
570 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xyj.png"
571 | },
572 | {
573 | id: 2070203,
574 | title: '秤',
575 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/c.png"
576 | },
577 | {
578 | id: 2070204,
579 | title: '体温计',
580 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/twj.png"
581 | }
582 | ]
583 | },
584 | {
585 | name: "smart-hw",
586 | title: "户外",
587 | childData: [
588 | {
589 | id: 2070301,
590 | title: '出行',
591 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cx.png"
592 | },
593 | {
594 | id: 2070302,
595 | title: '无人机',
596 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/wrj.png"
597 | },
598 | {
599 | id: 2070303,
600 | title: '对讲机',
601 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/djj.png"
602 | },
603 | {
604 | id: 2070304,
605 | title: '车载用品',
606 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/czyp.png"
607 | },
608 | {
609 | id: 2070305,
610 | title: '摄影摄像',
611 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sysx.png"
612 | },
613 | {
614 | id: 2070306,
615 | title: '智能硬件套装',
616 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/znyjtz.png"
617 | }
618 | ]
619 | },
620 | ]
621 | },
622 | {
623 | name: "child",
624 | title: "儿童",
625 | data: [
626 | {
627 | name: "child-et",
628 | title: "儿童",
629 | childData: [
630 | {
631 | id: 2080101,
632 | title: "儿童手表2",
633 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/etsb2.jpg"
634 | },
635 | {
636 | id: 2080101,
637 | title: "米兔智能积木",
638 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mtznjm.jpg"
639 | },
640 | {
641 | id: 2080103,
642 | title: "积木机器人",
643 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/jmjqr.jpg"
644 | },
645 | {
646 | id: 2080104,
647 | title: "故事机mini",
648 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/gsj_mini.jpg"
649 | },
650 | {
651 | id: 2080105,
652 | title: "70粒益智积木",
653 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/70_yzjm.jpg"
654 | },
655 | {
656 | id: 2080106,
657 | title: "米兔儿童书包",
658 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mtetsb.jpg"
659 | },
660 | {
661 | id: 2080107,
662 | title: "定位电话",
663 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dwdh.png"
664 | },
665 | {
666 | id: 2080108,
667 | title: "智能故事机",
668 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/zngsj.jpg"
669 | },
670 | ]
671 | }
672 | ]
673 | },
674 | {
675 | name: "power",
676 | title: "电源",
677 | data: [
678 | {
679 | name: "power-dy",
680 | title: "电源",
681 | childData: [
682 | {
683 | id: 2090101,
684 | title: "插线板",
685 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cxb.png"
686 | },
687 | {
688 | id: 2090101,
689 | title: "移动电源",
690 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yddy.jpg"
691 | },
692 | {
693 | id: 2090103,
694 | title: "智能插排",
695 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/zncp.jpg"
696 | },
697 | {
698 | id: 2090104,
699 | title: "电池",
700 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dc.png"
701 | },
702 | {
703 | id: 2090105,
704 | title: "电源配件",
705 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dypj.png"
706 | },
707 | {
708 | id: 2090106,
709 | title: "充电器",
710 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cdq.png"
711 | }
712 | ]
713 | }
714 | ]
715 | },
716 | {
717 | name: "headset",
718 | title: "耳机",
719 | data: [
720 | {
721 | name: "headset-ej",
722 | title: "耳机",
723 | childData: [
724 | {
725 | id: 2100101,
726 | title: "线控耳机",
727 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xkej.png"
728 | },
729 | {
730 | id: 2100101,
731 | title: "蓝牙耳机",
732 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/lyej.jpg"
733 | },
734 | {
735 | id: 2100103,
736 | title: "头戴式耳机",
737 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/tdsej.jpg"
738 | },
739 | {
740 | id: 2100104,
741 | title: "品牌耳机",
742 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/ppej.png"
743 | }
744 | ]
745 | }
746 | ]
747 | },
748 | {
749 | name: "speaker",
750 | title: "音箱",
751 | data: [
752 | {
753 | name: "speaker-yx",
754 | title: "音箱",
755 | childData: [
756 | {
757 | id: 2110101,
758 | title: "AI音箱",
759 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/aiyx.png"
760 | },
761 | {
762 | id: 2110101,
763 | title: "蓝牙音箱",
764 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/lyyx.png"
765 | },
766 | {
767 | id: 2110103,
768 | title: "电视音箱",
769 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/dsyx.jpg"
770 | },
771 | {
772 | id: 2110104,
773 | title: "音乐闹钟",
774 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yynz.jpg"
775 | },
776 | {
777 | id: 2110105,
778 | title: "网络音响",
779 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/wlyx.png"
780 | },
781 | {
782 | id: 2110106,
783 | title: "配件",
784 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/pj.png"
785 | }
786 | ]
787 | }
788 | ]
789 | },
790 | {
791 | name: "gift",
792 | title: "礼品",
793 | data: [
794 | {
795 | name: "gift-lp",
796 | title: "礼品",
797 | childData: [
798 | {
799 | id: 2120101,
800 | title: "送长辈",
801 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/szb.png"
802 | },
803 | {
804 | id: 2120101,
805 | title: "送孩子",
806 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/shz.png"
807 | },
808 | {
809 | id: 2120103,
810 | title: "送男生",
811 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sns.png"
812 | },
813 | {
814 | id: 2120104,
815 | title: "送女生",
816 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/snh.png"
817 | },
818 | {
819 | id: 2120105,
820 | title: "优惠套装",
821 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yhtz.png"
822 | },
823 | {
824 | id: 2120106,
825 | title: "新品",
826 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/xp.png"
827 | }
828 | ]
829 | }
830 | ]
831 | },
832 | {
833 | name: "life",
834 | title: "生活",
835 | data: [
836 | {
837 | name: "life-sh",
838 | title: "生活",
839 | childData: [
840 | {
841 | id: 2130101,
842 | title: "运动鞋",
843 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/ydx.png"
844 | },
845 | {
846 | id: 2130102,
847 | title: "服饰",
848 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/fs.jpg"
849 | },
850 | {
851 | id: 2130103,
852 | title: "旅行箱",
853 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/lxx.png"
854 | },
855 | {
856 | id: 2130104,
857 | title: "背包/收纳",
858 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bb-sn.png"
859 | },
860 | {
861 | id: 2130105,
862 | title: "眼镜",
863 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yj.png"
864 | },
865 | {
866 | id: 2130106,
867 | title: "口罩",
868 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/kz.jpg"
869 | },
870 | {
871 | id: 2130107,
872 | title: "雨伞",
873 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/ys.png"
874 | },
875 | {
876 | id: 2130108,
877 | title: "保温杯",
878 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bwb.png"
879 | }
880 | ]
881 | },
882 | {
883 | name: "life-jj",
884 | title: "居家",
885 | childData: [
886 | {
887 | id: 2130201,
888 | title: "牙刷",
889 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/ys.png"
890 | },
891 | {
892 | id: 2130202,
893 | title: "床垫",
894 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cd.png"
895 | },
896 | {
897 | id: 2130203,
898 | title: "毛巾",
899 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mj.jpg"
900 | },
901 | {
902 | id: 2130204,
903 | title: "枕头",
904 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/zt.png"
905 | },
906 | {
907 | id: 2130205,
908 | title: "工具",
909 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/gj.jpg"
910 | },
911 | {
912 | id: 2130206,
913 | title: "沙发",
914 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/sf.png"
915 | },
916 | {
917 | id: 2130207,
918 | title: "被子",
919 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/bz.png"
920 | }
921 | ]
922 | },
923 | {
924 | name: "life-wj",
925 | title: "文具",
926 | childData: [
927 | {
928 | id: 2130301,
929 | title: "笔",
930 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/b.jpg"
931 | },
932 | {
933 | id: 2130302,
934 | title: "米兔",
935 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/mt.jpg"
936 | },
937 | {
938 | id: 2130303,
939 | title: "印刷品",
940 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/ysp.png"
941 | }
942 | ]
943 | }
944 | ]
945 | },
946 | {
947 | name: "simCard",
948 | title: "米粉卡",
949 | data: [
950 | {
951 | name: "simCard-mfk",
952 | title: "米粉卡",
953 | childData: [
954 | {
955 | id: 2140101,
956 | title: "日租卡",
957 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/rzk.png"
958 | },
959 | {
960 | id: 2140102,
961 | title: "月租卡",
962 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/yzk.png"
963 | },
964 | {
965 | id: 2140103,
966 | title: "吃到饱",
967 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/cdb.jpg"
968 | },
969 | {
970 | id: 2140103,
971 | title: "任我行",
972 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/b2c-mimall-media/rwx.jpg"
973 | },
974 | ]
975 | }
976 | ]
977 | },
978 | ],
979 | _num: 0, // 初始化当前菜单位置
980 | toView: "new", // 初始化当前的锚点位置
981 | __res_height: [] // 各组件的top属性
982 | },
983 | categoryClick: function ( e ) {
984 | var num = e.currentTarget.dataset.num,
985 | data = this.data;
986 | this.setData({
987 | _num: num,
988 | toView: data.categoryData[ num ].name
989 | });
990 | // console.log( data.heightArr[ data._num ] );
991 | },
992 | /**
993 | * 生命周期函数--监听页面加载
994 | */
995 | onLoad: function (options) {
996 | // 局部变量: 创建一个selectorQuery对象实例
997 | var query = wx.createSelectorQuery().in(this);
998 | // 临时数组:存放各组件top属性
999 | var tempArr = [];
1000 | var that = this;
1001 | // 获取高度
1002 | query.selectAll('.cate-list').boundingClientRect(function (res) {
1003 | }).exec(function (res) {
1004 | let resArr = res[0];
1005 | // 遍历元素,存放top属性到临时数组
1006 | for (var i = 0, len = resArr.length; i < len; i++ ){
1007 | tempArr.push(resArr[i].top );
1008 | }
1009 | // 将临时数组赋值给__res_height变量
1010 | that.setData({
1011 | __res_height: tempArr
1012 | });
1013 | })
1014 | },
1015 | /**
1016 | * 生命周期函数--监听页面初次渲染完成
1017 | */
1018 | onReady: function () {
1019 | const that = this;
1020 | // 获取本地数据,判断是否已经缓存
1021 | wx.getStorage({
1022 | key: '_category_data',
1023 | success: function (res) {
1024 | // todo:发送请求获取数据,获得数据,判断数据的相同性进行缓存
1025 | console.log("_app_log: 已经获得缓存数据");
1026 | that.setData({
1027 | categoryData: res.data
1028 | });
1029 | },
1030 | fail: function (res) {
1031 | // 获取缓存失败,添加数据到本地缓存中
1032 | wx.setStorageSync("_category_data", that.data.categoryData);
1033 | console.log("_app_log: 未获得缓存数据");
1034 | }
1035 | })
1036 | },
1037 |
1038 | /**
1039 | * 生命周期函数--监听页面显示
1040 | */
1041 | onShow: function () {
1042 |
1043 | },
1044 |
1045 | /**
1046 | * 生命周期函数--监听页面隐藏
1047 | */
1048 | onHide: function () {
1049 |
1050 | },
1051 |
1052 | /**
1053 | * 生命周期函数--监听页面卸载
1054 | */
1055 | onUnload: function () {
1056 |
1057 | },
1058 |
1059 | /**
1060 | * 页面相关事件处理函数--监听用户下拉动作
1061 | */
1062 | onPullDownRefresh: function () {
1063 |
1064 | },
1065 |
1066 | /**
1067 | * 页面上拉触底事件的处理函数
1068 | */
1069 | onReachBottom: function () {
1070 |
1071 | },
1072 |
1073 | /**
1074 | * 用户点击右上角分享
1075 | */
1076 | onShareAppMessage: function () {
1077 |
1078 | },
1079 | // 滚动触顶事件
1080 | _toupperEvent: function () {
1081 | this.setData({
1082 | _num: 0
1083 | });
1084 | clearTimeout(scrollTimer);
1085 | },
1086 | // 滚动触底事件
1087 | _tolowerEvent: function () {
1088 | let len = this.data.categoryData.length;
1089 | this.setData({
1090 | _num: len - 1
1091 | });
1092 | clearTimeout(scrollTimer);
1093 | },
1094 | _scrollEvent: function ( e ) {
1095 | var that = this;
1096 | // 如果存在定时器则清除
1097 | if ( scrollTimer ) {
1098 | clearTimeout( scrollTimer );
1099 | }
1100 | // 定义定时器,滚动停止时,识别位置
1101 | scrollTimer = setTimeout( function () {
1102 | console.log("scrolling end...");
1103 | // 局部变量: 自定义组件高度数组
1104 | var heightArr = that.data.__res_height;
1105 | // 局部变量: 当前滚动条距离顶部的位置
1106 | var scrollTop = e.detail.scrollTop;
1107 | // 遍历数组
1108 | for (var i = 0, len = heightArr.length; i < len; i++ ) {
1109 | // 判断当前位置
1110 | if (scrollTop > heightArr[ i ] && scrollTop < heightArr[i+1] ) {
1111 | that.setData({
1112 | _num: i
1113 | });
1114 | }
1115 | }
1116 | }, 200);
1117 | }
1118 | })
--------------------------------------------------------------------------------
/pages/category/category.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "cate-list-box": "../../components/categoryListBox/categoryListBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#ececec",
7 | "navigationBarTitleText": "小米商城Lite",
8 | "navigationBarTextStyle": "black"
9 | }
--------------------------------------------------------------------------------
/pages/category/category.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{ item.title }}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/category/category.wxss:
--------------------------------------------------------------------------------
1 | /* pages/category/category.wxss */
2 | .container {
3 | display: flex;
4 | }
5 | .category-left {
6 | height: 100vh;
7 | width: 20vw;
8 | border-right: 2rpx solid #ebebeb;
9 | }
10 | .category-right {
11 | height: 100vh;
12 | width: 80vw;
13 | }
14 | .category-list {
15 | display: flex;
16 | flex-direction: column;
17 | /* justify-content: center; */
18 | align-items: center;
19 | }
20 | .category-item {
21 | flex: 1;
22 | width: 100%;
23 | text-align: center;
24 | padding: 26rpx 0;
25 | font-size: 30rpx;
26 | }
27 | .cur {
28 | font-size: 34rpx;
29 | color: #ff6700;
30 | }
31 |
32 | .cate-list {
33 | height:100%;
34 | }
--------------------------------------------------------------------------------
/pages/discovery/discovery.js:
--------------------------------------------------------------------------------
1 | // pages/discovery/discovery.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | navData: [ // 顶部导航数据
9 | {
10 | title: "新品预约",
11 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/news.png"
12 | },
13 | {
14 | title: "线下门店",
15 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/offline.png"
16 | },
17 | {
18 | title: "活动订阅",
19 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/action.png"
20 | },
21 | {
22 | title: "小米团购",
23 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/group.png"
24 | }
25 | ],
26 | discoveryData: [ // 当前呈现内容数据区
27 | {
28 | id: 3010101,
29 | title: "50元红包等你划分",
30 | typeTitle: "年货节",
31 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/new_year_bonus.png"
32 | },
33 | {
34 | id: 3010102,
35 | title: '"小米手机"公众号,领红包',
36 | typeTitle: "关注",
37 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/xm_subscription.png"
38 | },
39 | {
40 | id: 3010103,
41 | title: "2017,小米年!",
42 | typeTitle: "专题",
43 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/2017.png"
44 | },
45 | {
46 | id: 3010104,
47 | title: "小米2017感恩季",
48 | typeTitle: "活动",
49 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/giving_2017.png"
50 | },
51 | {
52 | id: 3010105,
53 | title: "12月7日 红米新品发布",
54 | typeTitle: "新品",
55 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/hm_5_plus.png"
56 | },
57 |
58 | ],
59 | loadingData: [ // 需要呈现的内容数据区
60 | {
61 | id: 3010106,
62 | title: "买手环2,送橙色腕带,限量哦!",
63 | typeTitle: "专享福利",
64 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/mi_band_2.png"
65 | },
66 | {
67 | id: 3010107,
68 | title: "红米5A 浅蓝色新版本 现货在售",
69 | typeTitle: "新品",
70 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/hm_5a.png"
71 | },
72 | {
73 | id: 3010108,
74 | title: "小米Note 3 4GB+64GB",
75 | typeTitle: "新品",
76 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/xm_note3.png"
77 | },
78 | {
79 | id: 3010109,
80 | title: "寒潮来袭 如何才能温暖这个冬天?",
81 | typeTitle: "专题",
82 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/winter.png"
83 | },
84 | {
85 | id: 3010110,
86 | title: "空气净化器2S,经典再升级",
87 | typeTitle: "新品",
88 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/air_cleaner_2s.png"
89 | },
90 | {
91 | id: 3010111,
92 | title: "小米11.11 返场特惠",
93 | typeTitle: "活动",
94 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/discovery/11-11.png"
95 | }
96 | ],
97 | contentHeight: 0, // 内容区的高度
98 | isInsertData: true // 是否可以插入数据
99 | },
100 |
101 | /**
102 | * 生命周期函数--监听页面加载
103 | */
104 | onLoad: function (options) {
105 | // 创建selectorQuery对象
106 | var query = wx.createSelectorQuery();
107 | // 局部变量
108 | var that = this;
109 | // 获得节点高度
110 | query.selectAll('.section').boundingClientRect(function (rect) {
111 |
112 | }).exec(function ( res ) {
113 | // 局部变量,获取节点信息数组
114 | var data = res[0];
115 | // 临时数字变量,储存整体高度
116 | var temp = 0;
117 | // 遍历节点信息数组,添加高度数据
118 | for ( var i = 0, len = data.length; i < len; i++ ) {
119 | temp += data[i].height;
120 | }
121 | // 设置属性
122 | that.setData({
123 | contentHeight: temp
124 | });
125 | });
126 | },
127 |
128 | /**
129 | * 生命周期函数--监听页面初次渲染完成
130 | */
131 | onReady: function () {
132 |
133 | },
134 |
135 | /**
136 | * 生命周期函数--监听页面显示
137 | */
138 | onShow: function () {
139 |
140 | },
141 |
142 | /**
143 | * 生命周期函数--监听页面隐藏
144 | */
145 | onHide: function () {
146 |
147 | },
148 |
149 | /**
150 | * 生命周期函数--监听页面卸载
151 | */
152 | onUnload: function () {
153 |
154 | },
155 |
156 | /**
157 | * 页面相关事件处理函数--监听用户下拉动作
158 | */
159 | onPullDownRefresh: function () {
160 |
161 | },
162 |
163 | /**
164 | * 页面上拉触底事件的处理函数
165 | */
166 | onReachBottom: function () {
167 |
168 | },
169 |
170 | /**
171 | * 用户点击右上角分享
172 | */
173 | onShareAppMessage: function () {
174 |
175 | },
176 | /**
177 | * page滚动事件
178 | * :懒加载数据
179 | */
180 | onPageScroll: function ( e ) {
181 | // 获取滚动条距离顶部的位置
182 | var scrollTop = e.scrollTop;
183 | // 局部变量
184 | var data = this.data;
185 | // 当滚动条的距离顶部的位置大于等于数据内容区的2分之一且允许插入数据时,插入数据
186 | if (data.isInsertData && e.scrollTop >= (data.contentHeight / 2)) {
187 | // 临时数组
188 | var temp = new Array();
189 | // 获取当前数据
190 | var discoveryData = data.discoveryData;
191 | // 获取懒加载的数据
192 | var loadingData = data.loadingData;
193 | // 连接当前数据数组,将值赋予临时数组
194 | temp = discoveryData.concat( loadingData );
195 | // 设置属性
196 | this.setData({
197 | isInsertData: false,
198 | discoveryData: temp
199 | });
200 | }
201 |
202 | }
203 | })
--------------------------------------------------------------------------------
/pages/discovery/discovery.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "cell-list-box": "../../components/cellListBox/cellListBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#ececec",
7 | "navigationBarTitleText": "小米商城Lite",
8 | "navigationBarTextStyle": "black",
9 | "enablePullDownRefresh": true,
10 | "onReachBottomDistance": 30
11 | }
--------------------------------------------------------------------------------
/pages/discovery/discovery.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{ item.title }}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 查看往期精彩发现
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pages/discovery/discovery.wxss:
--------------------------------------------------------------------------------
1 | /* pages/discovery/discovery.wxss */
2 | .container {
3 | display: -webkit-box;
4 | display: -webkit-flex;
5 | display: flex;
6 | -ms-flex-direction: column;
7 | flex-direction: column;
8 | background-color: #ebebeb;
9 | }
10 | .nav-boxes-outer {
11 | background-color: white;
12 | height: 160rpx;
13 | width: 100vw;
14 | display: -webkit-box;
15 | display: -webkit-flex;
16 | display: flex;
17 | -ms-flex-direction: row;
18 | flex-direction: row;
19 | }
20 | .nav-box-wrap {
21 | -webkit-box-flex: 1;
22 | -webkit-flex: 1;
23 | flex: 1;
24 | text-align: center;
25 | display: -webkit-box;
26 | display: -webkit-flex;
27 | display: flex;
28 | justify-content: center;
29 | align-items: center;
30 | -ms-flex-direction: column;
31 | flex-direction: column;
32 | }
33 | .nav-box {
34 | height: 100rpx;
35 | width: 100%;
36 | border-left: 1px solid #f6f6f6;
37 | }
38 | .nav-box-wrap:first-child .nav-box{
39 | border-left: none;
40 | }
41 | .nav-img-wrap{
42 | width: 100%;
43 | height: 60rpx;
44 | display: -webkit-box;
45 | display: -webkit-flex;
46 | display: flex;
47 | justify-content: center;
48 | align-items: center;
49 | }
50 | .nav-img {
51 | width: 60rpx;
52 | height: 60rpx;
53 | }
54 | .nav-title {
55 | color: #808080;
56 | font-size: 28rpx;
57 | }
58 | .cellList-boxes-outer {
59 | background-color: #ebebeb;
60 | }
61 | /*底部 */
62 | .discovery-bottom {
63 | height: 120rpx;
64 | width: 94vw;
65 | margin: 16rpx 3vw ;
66 | border-radius: 8rpx;
67 | display: -webkit-box;
68 | display: -webkit-flex;
69 | display: flex;
70 | justify-content: center;
71 | align-items: center;
72 | background-color: white;
73 | }
74 | .bottom-text {
75 | font-size: 30rpx;
76 | color: #a2a2a2;
77 | position: relative;
78 | }
79 | .bottom-text::after {
80 | content: "";
81 | position: absolute;
82 | right: -40rpx;
83 | top: 50%;
84 | width: 16rpx;
85 | height: 16rpx;
86 | border-left: 1px solid currentColor;
87 | border-top: 1px solid currentColor;
88 | transform: translate3d(0, -50%, 0 ) rotate( 135deg );
89 | -webkit-transform: translate3d(0, -50%, 0 ) rotate( 135deg );
90 | }
--------------------------------------------------------------------------------
/pages/error/error.js:
--------------------------------------------------------------------------------
1 | // pages/error/error.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | initData: {
9 | imgSrc: "../../images/common/error-network.png",
10 | backgroundColor: "#ebebeb",
11 | title: "网络无法连接",
12 | btnTitle: "返回首页",
13 | isSmallImg: false,
14 | isGray: true,
15 | isSmallBtn: false,
16 | isShowBtn: true
17 | }
18 | },
19 |
20 | /**
21 | * 生命周期函数--监听页面加载
22 | */
23 | onLoad: function (options) {
24 |
25 | },
26 |
27 | /**
28 | * 生命周期函数--监听页面初次渲染完成
29 | */
30 | onReady: function () {
31 |
32 | },
33 |
34 | /**
35 | * 生命周期函数--监听页面显示
36 | */
37 | onShow: function () {
38 |
39 | },
40 |
41 | /**
42 | * 生命周期函数--监听页面隐藏
43 | */
44 | onHide: function () {
45 |
46 | },
47 |
48 | /**
49 | * 生命周期函数--监听页面卸载
50 | */
51 | onUnload: function () {
52 |
53 | },
54 |
55 | /**
56 | * 页面相关事件处理函数--监听用户下拉动作
57 | */
58 | onPullDownRefresh: function () {
59 |
60 | },
61 |
62 | /**
63 | * 页面上拉触底事件的处理函数
64 | */
65 | onReachBottom: function () {
66 |
67 | },
68 |
69 | /**
70 | * 用户点击右上角分享
71 | */
72 | onShareAppMessage: function () {
73 |
74 | }
75 | })
--------------------------------------------------------------------------------
/pages/error/error.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "blank-box": "../../components/blankBox/blankBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#f9f9f9",
7 | "navigationBarTitleText": "小米商城Lite",
8 | "navigationBarTextStyle": "black",
9 | "backgroundColor": "#ebebeb"
10 | }
--------------------------------------------------------------------------------
/pages/error/error.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pages/error/error.wxss:
--------------------------------------------------------------------------------
1 | /* pages/error/error.wxss */
2 | .container {
3 | width: 100vw;
4 | height: 100vh;
5 | background-color: #ebebeb;
6 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 | var indexGlobalData = {}, // 首页中可视界面数据
5 | refreshGlobalData = [] // 需要动态加载的变量
6 | Page({
7 | data: {
8 | indexData: {
9 | id: 1000001,
10 | data: [
11 | {
12 | name: 'star',
13 | title: '明星单品',
14 | bannerSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/star_banner1.png',
15 | asBannerSrc: [],
16 | isShowBanner: true,
17 | child: [
18 | [
19 | {
20 | id: 1010101,
21 | index: 1,
22 | title: '小米5X 变焦双摄',
23 | desc: '5.5"大屏轻薄全金属',
24 | price: '1299元起',
25 | price_del: '',
26 | commodityType: '',
27 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/mi_5x.png'
28 | },
29 | {
30 | id: 1010102,
31 | index: 2,
32 | title: '红米5',
33 | desc: '千元全面屏,前置柔光自拍',
34 | price: '799元起',
35 | price_del: '',
36 | commodityType: '',
37 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/hm_5.png'
38 | }
39 | ],
40 | [
41 | {
42 | id: 1010103,
43 | index: 3,
44 | title: '小米移动电源高配版',
45 | desc: '轻薄设计,轻松出行',
46 | price: '149元',
47 | price_del: '',
48 | commodityType: '',
49 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/mi_powerpro.png'
50 | },
51 | {
52 | id: 1010104,
53 | index: 4,
54 | title: '小米电视4A 65"',
55 | desc: '4K超清大屏,64位处理器',
56 | price: '4999元',
57 | price_del: '',
58 | commodityType: '',
59 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/mi_tv_4a65.png'
60 | }
61 | ],
62 | [
63 | {
64 | id: 1010105,
65 | index: 5,
66 | title: '小米电视4A 49英寸"',
67 | desc: '全高清,HDR,64位处理器',
68 | price: '2399元',
69 | price_del: '',
70 | commodityType: '',
71 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/mi_tv_4a49.png'
72 | },
73 | {
74 | id: 1010106,
75 | index: 6,
76 | title: '小米空气净化器 2"',
77 | desc: '10分钟,房间空气焕然一新',
78 | price: '599元',
79 | price_del: '699元',
80 | commodityType: 'discount',
81 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/star/mi_air2.png'
82 | }
83 | ]
84 | ]
85 | }
86 | ]
87 | },
88 | refreshData: [
89 | {
90 | name: 'news',
91 | title: '新品上线',
92 | bannerSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/news_banner1.png',
93 | asBannerSrc: [],
94 | isShowBanner: true,
95 | child: [
96 | [
97 | {
98 | id: 1010201,
99 | index: 1,
100 | title: '小米降噪耳机',
101 | desc: '双动圈+动铁声学架构',
102 | price: '299元',
103 | price_del: '',
104 | commodityType: '',
105 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_earphone3-5.png'
106 | },
107 | {
108 | id: 1010202,
109 | index: 2,
110 | title: '小米笔记本Air 12.5',
111 | desc: '像杂志一般轻薄',
112 | price: '3599元起',
113 | price_del: '',
114 | commodityType: '',
115 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_air12.9.png'
116 | }
117 | ],
118 | [
119 | {
120 | id: 1010203,
121 | index: 3,
122 | title: '米家思维四控插线板',
123 | desc: '四位分控,随用随开',
124 | price: '89元',
125 | price_del: '',
126 | commodityType: '',
127 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_powerstrip-4k4.png'
128 | },
129 | {
130 | id: 1010204,
131 | index: 4,
132 | title: '霍尼韦尔新风口罩米家定制',
133 | desc: '高效防护,佩戴舒适',
134 | price: '249元',
135 | price_del: '',
136 | commodityType: '',
137 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_mask.png'
138 | }
139 | ],
140 | [
141 | {
142 | id: 1010205,
143 | index: 5,
144 | title: 'USB3.0至千兆网口多功能转接器',
145 | desc: '以一敌四,高效办公好搭档',
146 | price: '129元',
147 | price_del: '',
148 | commodityType: '',
149 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_usb3.0zjk.png'
150 | },
151 | {
152 | id: 1010206,
153 | index: 6,
154 | title: '70迈只能后视镜',
155 | desc: '大屏大视野,看得更清晰',
156 | price: '1299元',
157 | price_del: '',
158 | commodityType: '',
159 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/news/mi_mirror.png'
160 | }
161 | ]
162 | ]
163 | },
164 | {
165 | name: 'router',
166 | title: '米家智能',
167 | bannerSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/router/router_banner1.png',
168 | asBannerSrc: [],
169 | isShowBanner: true,
170 | child: []
171 | },
172 | {
173 | name: 'phone',
174 | title: '手机',
175 | bannerSrc: '',
176 | asBannerSrc: [
177 | 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/phone/phone_banner2.png'
178 | ],
179 | isShowBanner: false,
180 | child: [
181 | [
182 | {
183 | id: 1010501,
184 | index: 1,
185 | title: '小米MIX 2 全面屏2.0',
186 | desc: '5.99"大屏,4轴光学防抖',
187 | price: '3299元起',
188 | price_del: '',
189 | commodityType: '',
190 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/phone/mi_mix2.png'
191 | },
192 | {
193 | id: 1010502,
194 | index: 2,
195 | title: '小米Note 3 人脸解锁',
196 | desc: '1600万美颜自拍',
197 | price: '1999元起',
198 | price_del: '',
199 | commodityType: '',
200 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/phone/mi_note3.png'
201 | }
202 | ],
203 | ]
204 | },
205 | {
206 | name: 'tv',
207 | title: '电视',
208 | bannerSrc: '',
209 | asBannerSrc: [
210 | 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/tv/tv_banner2.png'
211 | ],
212 | isShowBanner: false,
213 | child: [
214 | [
215 | {
216 | id: 1010601,
217 | index: 1,
218 | title: '小米电视4C 55英寸',
219 | desc: '4K HDR 人工智能系统',
220 | price: '3099元',
221 | price_del: '',
222 | commodityType: '',
223 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/tv/mi_tv_4c55.png'
224 | },
225 | {
226 | id: 1010602,
227 | index: 2,
228 | title: '小米电视4A 49英寸',
229 | desc: '全高清,HDR,64位处理器',
230 | price: '2399元',
231 | price_del: '',
232 | commodityType: '',
233 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/tv/mi_tv_4a49.png'
234 | }
235 | ],
236 | [
237 | {
238 | id: 1010603,
239 | index: 3,
240 | title: '小米电视4 55英寸',
241 | desc: '无边框式沉浸设计',
242 | price: '4499元',
243 | price_del: '',
244 | commodityType: '',
245 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/tv/mi_tv4_55.png'
246 | },
247 | {
248 | id: 1010604,
249 | index: 4,
250 | title: '小米电视4A 55英寸',
251 | desc: '4K HDR,64位处理器',
252 | price: '2999元',
253 | price_del: '',
254 | commodityType: '',
255 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/tv/mi_tv_4a55.png'
256 | }
257 | ]
258 | ]
259 | },
260 | {
261 | name: 'smart',
262 | title: '智能',
263 | bannerSrc: '',
264 | asBannerSrc: [
265 | 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/smart_banner2.png'
266 | ],
267 | isShowBanner: false,
268 | child: [
269 | [
270 | {
271 | id: 1010701,
272 | index: 1,
273 | title: '米家扫地机器人',
274 | desc: '智商高,扫的干净扫得快',
275 | price: '1699元',
276 | price_del: '',
277 | commodityType: '',
278 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_roomrobot.png'
279 | },
280 | {
281 | id: 1010702,
282 | index: 2,
283 | title: '米家空气净化器Pro',
284 | desc: '大空间,快循环',
285 | price: '1299元',
286 | price_del: '1499元',
287 | commodityType: '',
288 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_airpro.png'
289 | }
290 | ],
291 | [
292 | {
293 | id: 1010703,
294 | index: 3,
295 | title: '小米路由器 3C',
296 | desc: '一款更轻快的好路由',
297 | price: '89元',
298 | price_del: '99元',
299 | commodityType: '',
300 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_router3C.png'
301 | },
302 | {
303 | id: 1010704,
304 | index: 4,
305 | title: '小米WiFi电力猫',
306 | desc: '有插座的地方 就有WiFi',
307 | price: '249元',
308 | price_del: '',
309 | commodityType: '',
310 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_plc.png'
311 | }
312 | ],
313 | [
314 | {
315 | id: 1010705,
316 | index: 5,
317 | title: '米家飞利浦智睿吸顶灯',
318 | desc: '色温颜色可调',
319 | price: '349元',
320 | price_del: '',
321 | commodityType: '',
322 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_philips_ceilinglamp.png'
323 | },
324 | {
325 | id: 1010706,
326 | index: 6,
327 | title: '小米手环 2',
328 | desc: 'OLED 显示屏, 触摸操作',
329 | price: '149元',
330 | price_del: '',
331 | commodityType: '',
332 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_shouhuan2.png'
333 | }
334 | ],
335 | [
336 | {
337 | id: 1010707,
338 | index: 7,
339 | title: '米家小白智能摄像机',
340 | desc: '360° 全景拍摄,红外夜视',
341 | price: '399元',
342 | price_del: '',
343 | commodityType: '',
344 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_smartcamera-v.png'
345 | },
346 | {
347 | id: 1010708,
348 | index: 8,
349 | title: '米家行车记录仪',
350 | desc: '晚上也可以拍清车牌',
351 | price: '349元',
352 | price_del: '',
353 | commodityType: '',
354 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_mj-carcorder.png'
355 | }
356 | ],
357 | [
358 | {
359 | id: 1010709,
360 | index: 9,
361 | title: '90分旅行箱 20寸',
362 | desc: '静态轮胎,内饰纺织布料',
363 | price: '169元',
364 | price_del: '',
365 | commodityType: '',
366 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_90trunk_20.png'
367 | },
368 | {
369 | id: 1010710,
370 | index: 10,
371 | title: '米家 LED 智能台灯',
372 | desc: '照明之上,光的艺术品',
373 | price: '169元',
374 | price_del: '',
375 | commodityType: '',
376 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/smart/mi_mjsmartlamp.png'
377 | }
378 | ]
379 | ]
380 | },
381 | {
382 | name: 'computer',
383 | title: '电脑',
384 | bannerSrc: '',
385 | asBannerSrc: [
386 | 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/computer/computer_banner2.png'
387 | ],
388 | isShowBanner: false,
389 | child: [
390 | [
391 | {
392 | id: 1010801,
393 | index: 1,
394 | title: '12.5"笔记本Air 128GB',
395 | desc: '超薄长续航',
396 | price: '3599元',
397 | price_del: '',
398 | commodityType: '',
399 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/computer/mi_mibookair-12.png'
400 | },
401 | {
402 | id: 1010802,
403 | index: 2,
404 | title: '15.6"笔记本i7 8GB',
405 | desc: '全新高性能独显',
406 | price: '6399元',
407 | price_del: '',
408 | commodityType: '',
409 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/computer/mi_mibookpro.png'
410 | }
411 | ],
412 | [
413 | {
414 | id: 1010803,
415 | index: 3,
416 | title: '13.3"笔记本i7 独显',
417 | desc: '轻薄全金属,超长续航',
418 | price: '5999元',
419 | price_del: '',
420 | commodityType: '',
421 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/computer/mi_mibookair.png'
422 | },
423 | {
424 | id: 1010804,
425 | index: 4,
426 | title: '15.6"笔记本i5 8GB',
427 | desc: '更强悍的专业笔记本',
428 | price: '5599元',
429 | price_del: '',
430 | commodityType: '',
431 | imgSrc: 'http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/computer/mi_mibookpro_i5.png'
432 | }
433 | ]
434 | ]
435 | }
436 | ],
437 | indexNavData: [
438 | {
439 | title: "手机",
440 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/cells/phone.png"
441 | },
442 | {
443 | title: "电视",
444 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/cells/tv.png"
445 | },
446 | {
447 | title: "电脑",
448 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/cells/computer.png"
449 | },
450 | {
451 | title: "智能",
452 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/cells/router.png"
453 | },
454 | {
455 | title: "新品",
456 | imgSrc: "http://github.com/lxs24sxl/readme_add_pic/raw/master/wx_mi_images/index/cells/news.png"
457 | }
458 | ],
459 | isLazyLoad: true
460 | },
461 | onLoad: function () {
462 | // 获得网络状态
463 | new Promise((resolve, reject) => {
464 | let req = wx.getNetworkType({
465 | success: function (res) {
466 | // 返回网络类型, 有效值:
467 | // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
468 | var networkType = res.networkType
469 | if (networkType == "none") {
470 | resolve(false);
471 | } else {
472 | resolve(true);
473 | }
474 | },
475 | fail: function (res) {
476 | reject(false);
477 | }
478 | })
479 | }).then(function (res) {
480 | if (!res) {
481 | wx.reLaunch({
482 | url: '/pages/error/error',
483 | })
484 | }
485 | });
486 | },
487 | /**
488 | * 上拉加载
489 | */
490 | onReachBottom: function () {
491 | // 删除并返回数组的第一个
492 | var temp = refreshGlobalData.shift();
493 | if ( temp ) {
494 | // 存放截取的数据
495 | indexGlobalData.data.push(temp);
496 | // 替换数据
497 | this.setData({
498 | indexData: indexGlobalData
499 | });
500 | }
501 |
502 | },
503 | /**
504 | * 生命周期函数--监听页面初次渲染完成
505 | */
506 | onReady: function () {
507 | var data = this.data;
508 | // 存储初始的数据
509 | indexGlobalData = data.indexData;
510 | // 存储需要刷新的数据
511 | refreshGlobalData = data.refreshData;
512 | },
513 | //下拉刷新
514 | onPullDownRefresh: function () {
515 | wx.showNavigationBarLoading() //在标题栏中显示加载
516 |
517 | //模拟加载
518 | setTimeout(function () {
519 | // complete
520 | wx.hideNavigationBarLoading() //完成停止加载
521 | wx.stopPullDownRefresh() //停止下拉刷新
522 | }, 1500);
523 | },
524 | // 跳转到搜索商品页面
525 | moveToSearch: function () {
526 | wx.navigateTo({
527 | url: '/pages/subPages/search/search',
528 | })
529 | },
530 | test1: function ( e ) {
531 | console.log( e );
532 | wx.previewImage({
533 | urls: [e.currentTarget.dataset.img ],
534 | })
535 | }
536 | })
537 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "brick-box": "../../components/brickBox/brickBox"
4 | },
5 | "enablePullDownRefresh": true,
6 | "onReachBottomDistance": 30,
7 | "backgroundColor": "#eee"
8 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
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 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | {{ item.title}}
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**首页样式**/
2 | .container {
3 | display: -webkit-box;
4 | display: -webkit-flex;
5 | display: flex;
6 | flex-direction: column;
7 | margin: 0;
8 | padding: 0;
9 | }
10 | .section {
11 | width: 100%;
12 | }
13 | /*搜索框 */
14 | .searchBox {
15 | position: relative;
16 | left: 0;
17 | top: 0;
18 | display: -webkit-box;
19 | display: -webkit-flex;
20 | display: flex;
21 | flex-direction: column;
22 | align-items: center;
23 | justify-content: center;
24 | height: 80rpx;
25 | background-color: #ff6700;
26 | line-height: 100rpx;
27 | }
28 |
29 | .search-outer {
30 | position: relative;
31 | left: 0;
32 | top: 0;
33 | width: 90%;
34 | height: 50rpx;
35 | border-radius: 50rpx;
36 | background-color: white;
37 | font-size: 26rpx;
38 | color: #666;
39 | }
40 | /*鼠标点击态 */
41 | .bind-search-area {
42 | background-color: #ececec;
43 | }
44 | .searchBox .search-inner {
45 | display: -webkit-box;
46 | display: -webkit-flex;
47 | display: flex;
48 | flex-direction: row;
49 | justify-content: center;
50 | align-items: center;
51 | position: absolute;
52 | left: 50%;
53 | top: 50%;
54 | -o-transform: translate( -50%, -50% );
55 | transform: translate( -50%, -50% );
56 | }
57 | /*搜索图标 */
58 | .searchBox .search-inner .icon-search {
59 | width: 50rpx;
60 | height: 50rpx;
61 | }
62 |
63 | /*轮播图区 */
64 | .section-banner {
65 | height: 380rpx;
66 | width: 100%;
67 | background-color: #ececec;
68 | }
69 | .banner-outer, .banner-inner {
70 | width: 100%;
71 | height: inherit;
72 | background-color: papayawhip;
73 | }
74 | .banner-images {
75 | width: 100%;
76 | height: inherit;
77 | border: 0;
78 | }
79 |
80 | /*列表导航区域 */
81 | .section-cells {
82 | height: 160rpx;
83 | /* background-color: #eee; */
84 | }
85 | .cells-list {
86 | width: 100%;
87 | display: -webkit-box;
88 | display: -webkit-flex;
89 | display: flex;
90 | justify-content: center;
91 | align-items: center;
92 | }
93 | .cells-item {
94 | -webkit-box-flex: 1;
95 | -webkit-flex: 1;
96 | flex: 1;
97 | display: -webkit-box;
98 | display: -webkit-flex;
99 | display: flex;
100 | flex-direction: column;
101 | align-items: center;
102 | }
103 | .item-images {
104 | margin: 16rpx 0 2rpx 0;
105 | width: 80rpx;
106 | height: 80rpx;
107 | }
108 | .item-text {
109 | font-size: 26rpx;
110 | color: #999999;
111 | }
112 | /*活动区域 */
113 | .section-main {
114 | height: 260rpx;
115 | width: 100%;
116 | padding: 14rpx 0;
117 | background-color: #ececec;
118 | }
119 | .main-list {
120 | height: inherit;
121 | width: 100%;
122 | display: -webkit-box;
123 | display: -webkit-flex;
124 | display: flex;
125 | flex-direction: row;
126 | justify-content: space-between;
127 | }
128 | .main-item {
129 | -webkit-box-flex: 1;
130 | -webkit-flex: 1;
131 | flex: 1;
132 | /* width: 49.33%; */
133 | padding-left: 10rpx;
134 | }
135 | .main-item:first-child {
136 | padding-left: 0;
137 | }
138 | .main-item .main-image {
139 | width: 100%;
140 | height: 280rpx;
141 | }
142 | /*记载中 */
143 | .loading-wrap {
144 | height: 100vh;
145 | width: 100vw;
146 | background-color: #ececec;
147 | }
148 | .loading-inner {
149 | margin-top: 10rpx;
150 | display: -webkit-box;
151 | display: -webkit-flex;
152 | display: flex;
153 | justify-content: center;
154 | align-items: center;
155 | height: 60rpx;
156 | width: 100vw;
157 | }
158 | .loading-img {
159 | width: 60rpx;
160 | height: 60rpx;
161 | background-color: white;
162 | border-radius: 50rpx;
163 | }
164 | .loading-title {
165 | background-color: #ececec;
166 | font-size: 28rpx;
167 | color: #666;
168 | }
169 | .loading-title::after {
170 | border: none;
171 | }
--------------------------------------------------------------------------------
/pages/subPages/coupon/coupon.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/coupon/coupon.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | curNav: 0,
9 | navData: [
10 | {
11 | title: "未使用",
12 | initData: {
13 | imgSrc: "../../images/common/coupon.png",
14 | backgroundColor: "#d4d4d4",
15 | title: "您没有 未使用 的优惠券",
16 | btnTitle: "到小米商城逛逛",
17 | isShowBtn: false,
18 | isSmallImg: true,
19 | isSmallBtn: true,
20 | },
21 | },
22 | {
23 | title: "已使用/已过期",
24 | initData: {
25 | imgSrc: "../../images/common/coupon.png",
26 | backgroundColor: "#d4d4d4",
27 | title: "您没有 已使用/已过期 的优惠券",
28 | btnTitle: "到小米商城逛逛",
29 | isShowBtn: false,
30 | isSmallImg: true,
31 | isSmallBtn: true,
32 | },
33 | }
34 | ]
35 | },
36 |
37 | /**
38 | * 生命周期函数--监听页面加载
39 | */
40 | onLoad: function (options) {
41 |
42 | },
43 |
44 | /**
45 | * 生命周期函数--监听页面初次渲染完成
46 | */
47 | onReady: function () {
48 |
49 | },
50 |
51 | /**
52 | * 生命周期函数--监听页面显示
53 | */
54 | onShow: function () {
55 |
56 | },
57 |
58 | /**
59 | * 生命周期函数--监听页面隐藏
60 | */
61 | onHide: function () {
62 |
63 | },
64 |
65 | /**
66 | * 生命周期函数--监听页面卸载
67 | */
68 | onUnload: function () {
69 |
70 | },
71 |
72 | /**
73 | * 页面相关事件处理函数--监听用户下拉动作
74 | */
75 | onPullDownRefresh: function () {
76 |
77 | },
78 |
79 | /**
80 | * 页面上拉触底事件的处理函数
81 | */
82 | onReachBottom: function () {
83 |
84 | },
85 |
86 | /**
87 | * 用户点击右上角分享
88 | */
89 | onShareAppMessage: function () {
90 |
91 | },
92 | /**
93 | * 改变菜单
94 | */
95 | _changeNav: function ( e ) {
96 | this.setData({
97 | curNav: e.currentTarget.dataset.num
98 | });
99 | }
100 | })
--------------------------------------------------------------------------------
/pages/subPages/coupon/coupon.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "blank-box": "../../../components/blankBox/blankBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#f9f9f9",
7 | "navigationBarTitleText": "我的优惠券",
8 | "navigationBarTextStyle": "black",
9 | "backgroundColor": "#ebebeb"
10 | }
--------------------------------------------------------------------------------
/pages/subPages/coupon/coupon.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ item.title }}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pages/subPages/coupon/coupon.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/coupon/coupon.wxss */
2 | .container {
3 | width: 100%;
4 | overflow-x: hidden;
5 | display: -webkit-box;
6 | display: -webkit-flex;
7 | display: flex;
8 | -ms-flex-direction: column;
9 | flex-direction: column;
10 | }
11 | .coupon-nav-list {
12 | width: 100%;
13 | height: 100rpx;
14 | background-color: #f9f9f9;
15 | display: -webkit-box;
16 | display: -webkit-flex;
17 | display: flex;
18 | }
19 | .nav-item {
20 | -webkit-box-flex: 1;
21 | -webkit-flex: 1 0 flex;
22 | flex: 1 0 auto;
23 | text-align: center;
24 | }
25 | .nav-item-title {
26 | display: inline-block;
27 | height: 100rpx;
28 | line-height: 100rpx;
29 | color: #888888;
30 | font-size: 28rpx;
31 | font-weight: 500;
32 | }
33 | .cur {
34 | color: #ff6700;
35 | border-bottom: 4rpx solid #ff6700;
36 | }
--------------------------------------------------------------------------------
/pages/subPages/detail/detail.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/detail/detail.js
2 | var data = require('../../../utils/detailData1.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | detailData: {
10 | id: 1010101,
11 | name: "小米5X 4GB+32GB",
12 | swiperImgurls: [
13 | "//i8.mifile.cn/v1/a1/2da996b7-4b5d-0b42-917d-fdb27db12dc9!720x792.webp",
14 | "//i8.mifile.cn/v1/a1/090d6b69-5d8b-2895-85f2-13c22577bede!720x792.webp",
15 | "//cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/16c29ae096d0d35eaa8a2139b6ed2bd1.jpg?thumb=1&w=720&h=792",
16 | "//cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/a5b5500ba1f1a1ed3eade6d83ccd64b4.jpg?thumb=1&w=720&h=792",
17 | "//i8.mifile.cn/v1/a1/ed954a23-2c30-98ca-4379-86818f95e75e.jpg"
18 | ],
19 | desc: "光学变焦双摄,拍人更美 / 5.5''大屏轻薄全金属 / 骁龙八核处理器 / 4GB大内存 ",
20 | price: "1299",
21 | promotions: {
22 | title: "促销",
23 | typeTitle: "赠品",
24 | desc: "无限流量米粉卡 含100元话费"
25 | },
26 | ptc: {
27 | title: "已选",
28 | desc: "小米5X 4GB+32GB 金色",
29 | num: 1
30 | },
31 | view_content: data.data.data.view_content
32 | },
33 | curNum: 0,
34 | tabContent: []
35 |
36 | },
37 |
38 | /**
39 | * 生命周期函数--监听页面加载
40 | */
41 | onLoad: function (options) {
42 | this.setData({
43 | tabContent: this.data.detailData.view_content.descTabsView.descTabsView[0].tabContent
44 | });
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面初次渲染完成
49 | */
50 | onReady: function () {
51 |
52 | },
53 |
54 | /**
55 | * 生命周期函数--监听页面显示
56 | */
57 | onShow: function () {
58 |
59 | },
60 |
61 | /**
62 | * 生命周期函数--监听页面隐藏
63 | */
64 | onHide: function () {
65 |
66 | },
67 |
68 | /**
69 | * 生命周期函数--监听页面卸载
70 | */
71 | onUnload: function () {
72 |
73 | },
74 |
75 | /**
76 | * 页面相关事件处理函数--监听用户下拉动作
77 | */
78 | onPullDownRefresh: function () {
79 |
80 | },
81 |
82 | /**
83 | * 页面上拉触底事件的处理函数
84 | */
85 | onReachBottom: function () {
86 |
87 | },
88 |
89 | /**
90 | * 用户点击右上角分享
91 | */
92 | onShareAppMessage: function () {
93 |
94 | },
95 | /**
96 | * 导航跳转
97 | */
98 | _changeTab: function ( e ) {
99 | // 导航当前下标
100 | var num = e.currentTarget.dataset.num;
101 | // 当前导航下的数据
102 | var tabContentData = this.data.detailData.view_content.descTabsView.descTabsView[ num ].tabContent;
103 | // 设置变量
104 | this.setData({
105 | curNum: num,
106 | tabContent: tabContentData
107 | });
108 | }
109 |
110 |
111 | })
--------------------------------------------------------------------------------
/pages/subPages/detail/detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "promotions-box": "../../../components/promotions/promotions",
4 | "product-section": "../../../components/productSection/productSection",
5 | "comment-box": "../../../components/commentBox/commentBox"
6 | },
7 | "backgroundTextStyle": "light",
8 | "navigationBarBackgroundColor": "#f9f9f9",
9 | "navigationBarTitleText": "商品详情",
10 | "navigationBarTextStyle": "black",
11 | "backgroundColor": "#ebebeb"
12 | }
--------------------------------------------------------------------------------
/pages/subPages/detail/detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{ detailData.name }}
13 | {{ detailData.desc }}
14 |
15 | {{ detailData.price }}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
70 |
71 |
--------------------------------------------------------------------------------
/pages/subPages/detail/detail.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/detail/detail.wxss */
2 | .container {
3 | background-color: #ebebeb;
4 | }
5 | .swiper-wrapper {
6 | width: 100%;
7 | height: 820rpx;
8 |
9 | }
10 | .swiper-silde {
11 | width: inherit;
12 | height: inherit;
13 | }
14 | .swiper-image {
15 | width: inherit;
16 | height: inherit;
17 | }
18 | /*信息区 */
19 | .overview {
20 | text-align: left;
21 | background-color: #fff;
22 | padding: 20rpx 32rpx 0;
23 | display: -webkit-box;
24 | display: -webkit-flex;
25 | display: flex;
26 | -ms-flex-direction: column;
27 | flex-direction: column;
28 | margin-bottom: 16rpx;
29 | }
30 | .goods-name {
31 | font-size: 32rpx;
32 | line-height: 44rpx;
33 | }
34 | .goods-desc {
35 | font-size: 26rpx;
36 | color: rgba(0,0,0,.54);
37 | line-height: 40rpx;
38 | }
39 | .goods-price-wrap {
40 | line-height: 60rpx;
41 | height: 60rpx;
42 | }
43 | .goods-price {
44 | position: relative;
45 | color: #ff6700;
46 | font-size: 40rpx;
47 | }
48 | .goods-price::after {
49 | content: "元";
50 | font-size: 36rpx;
51 | position: absolute;
52 | right: -42rpx;
53 | top: 50%;
54 | transform: translateY(-50%);
55 | }
56 | .product-box {
57 | margin-bottom: 16rpx;
58 | }
59 | /*留言区 */
60 | .comment-view {
61 | text-align: left;
62 | background-color: #fff;
63 | }
64 | .comment-info {
65 | margin: 0 30rpx;
66 | height: 80rpx;
67 | line-height: 80rpx;
68 | border-bottom: 2rpx solid #f3f3f3;
69 | }
70 | .box-flex {
71 | display: -webkit-box;
72 | display: -webkit-flex;
73 | display: flex;
74 | }
75 | .box-flex view, .box-flex text {
76 | -webkit-box-flex: 1;
77 | -webkit-flex: 1 1 auto;
78 | flex: 1 1 auto;
79 | }
80 |
81 | .comment-count {
82 | font-size: 30rpx;
83 | }
84 | .comment-degree {
85 | text-align: right;
86 | font-size: 26rpx;
87 | color: #a4a4a4;
88 | }
89 | .comment-reply {
90 | margin-bottom: 16rpx;
91 | }
92 |
93 | /*描述区 */
94 | .description-view {
95 | width: 100%;
96 | }
97 | .tab-header {
98 | height: 90rpx;
99 | width: 100%;
100 | display: -webkit-box;
101 | display: -webkit-flex;
102 | display: flex;
103 | line-height: 90rpx;
104 | }
105 | .tab-item {
106 | -webkit-box-flex: 1;
107 | -webkit-flex: 1 0 auto;
108 | flex: 1 0 auto;
109 | display: -webkit-box;
110 | display: -webkit-flex;
111 | display: flex;
112 | align-items: center;
113 | justify-content: center;
114 | background-color: #fff;
115 | }
116 | .cur {
117 | color: #ff6700;
118 | border-bottom: 6rpx solid #ff6700;
119 | }
120 | .tab-item .flex {
121 | font-size: 30rpx;
122 | }
123 | .tab-view {
124 | display: -webkit-box;
125 | display: -webkit-flex;
126 | display: flex;
127 | -ms-flex-direction: column;
128 | flex-direction: column;
129 | }
130 | .tab-view-item {
131 | width: 100%;
132 | }
133 | .tab-img {
134 | width: inherit;
135 | height: inherit;
136 | }
137 | /*底部区域 */
138 | .fixed-footer {
139 | position: fixed;
140 | left: 0;
141 | bottom: 0;
142 | height: 100rpx;
143 | width: 100%;
144 | background-color: #fff;
145 | display: -webkit-box;
146 | display: -webkit-flex;
147 | display: flex;
148 | }
149 | .btn-cart {
150 | width: 100rpx;
151 | height: 100rpx;
152 | background-color: #fff;
153 | display: -webkit-box;
154 | display: -webkit-flex;
155 | display: flex;
156 | justify-content: center;
157 | align-items: center;
158 | }
159 | .btn-cart-img {
160 | width: 50rpx;
161 | height: 50rpx;
162 | }
163 | .btn-buy {
164 | height: 100rpx;
165 | width: 330rpx;
166 | background-color: #ff6700;
167 | text-align: center;
168 | line-height: 100rpx;
169 | }
170 | .btn-buy-now {
171 | -webkit-box-flex: 1;
172 | -webkit-flex: 1 0 auto;
173 | flex: 1 0 auto;
174 | height: 100rpx;
175 | background-color: #ea5f39;
176 | text-align: center;
177 | line-height: 100rpx;
178 | }
179 | .footer-text {
180 | color: #fff;
181 | font-size: 34rpx;
182 | }
--------------------------------------------------------------------------------
/pages/subPages/fcode/fcode.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/fcode/fcode.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | initData: {
9 | imgSrc: "../../images/common/exclamation.png",
10 | backgroundColor: "red",
11 | title: "暂无可用F码",
12 | btnTitle: "到小米商城逛逛",
13 | isShowBtn: true,
14 | isSmallImg: true,
15 | isSmallBtn: true,
16 | }
17 | },
18 |
19 | /**
20 | * 生命周期函数--监听页面加载
21 | */
22 | onLoad: function (options) {
23 |
24 | },
25 |
26 | /**
27 | * 生命周期函数--监听页面初次渲染完成
28 | */
29 | onReady: function () {
30 |
31 | },
32 |
33 | /**
34 | * 生命周期函数--监听页面显示
35 | */
36 | onShow: function () {
37 |
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面隐藏
42 | */
43 | onHide: function () {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面卸载
49 | */
50 | onUnload: function () {
51 |
52 | },
53 |
54 | /**
55 | * 页面相关事件处理函数--监听用户下拉动作
56 | */
57 | onPullDownRefresh: function () {
58 |
59 | },
60 |
61 | /**
62 | * 页面上拉触底事件的处理函数
63 | */
64 | onReachBottom: function () {
65 |
66 | },
67 |
68 | /**
69 | * 用户点击右上角分享
70 | */
71 | onShareAppMessage: function () {
72 |
73 | }
74 | })
--------------------------------------------------------------------------------
/pages/subPages/fcode/fcode.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "blank-box": "../../../components/blankBox/blankBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#f9f9f9",
7 | "navigationBarTitleText": "我的F码",
8 | "navigationBarTextStyle": "black",
9 | "backgroundColor": "#ebebeb"
10 | }
--------------------------------------------------------------------------------
/pages/subPages/fcode/fcode.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pages/subPages/fcode/fcode.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/fcode/fcode.wxss */
--------------------------------------------------------------------------------
/pages/subPages/order/order.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/order/order.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | initData: {
9 | imgSrc: "../../images/common/order.png",
10 | backgroundColor: "#d4d4d4",
11 | title: "还没有在小程序下过单",
12 | btnTitle: "到小米商城逛逛",
13 | isShowBtn: true,
14 | isSmallImg: true,
15 | isSmallBtn: true,
16 | }
17 | },
18 |
19 | /**
20 | * 生命周期函数--监听页面加载
21 | */
22 | onLoad: function (options) {
23 |
24 | },
25 |
26 | /**
27 | * 生命周期函数--监听页面初次渲染完成
28 | */
29 | onReady: function () {
30 |
31 | },
32 |
33 | /**
34 | * 生命周期函数--监听页面显示
35 | */
36 | onShow: function () {
37 |
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面隐藏
42 | */
43 | onHide: function () {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面卸载
49 | */
50 | onUnload: function () {
51 |
52 | },
53 |
54 | /**
55 | * 页面相关事件处理函数--监听用户下拉动作
56 | */
57 | onPullDownRefresh: function () {
58 |
59 | },
60 |
61 | /**
62 | * 页面上拉触底事件的处理函数
63 | */
64 | onReachBottom: function () {
65 |
66 | },
67 |
68 | /**
69 | * 用户点击右上角分享
70 | */
71 | onShareAppMessage: function () {
72 |
73 | }
74 | })
--------------------------------------------------------------------------------
/pages/subPages/order/order.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "blank-box": "../../../components/blankBox/blankBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#f9f9f9",
7 | "navigationBarTitleText": "我的订单",
8 | "navigationBarTextStyle": "black",
9 | "backgroundColor": "#ebebeb"
10 | }
--------------------------------------------------------------------------------
/pages/subPages/order/order.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pages/subPages/order/order.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/order/order.wxss */
2 |
--------------------------------------------------------------------------------
/pages/subPages/search/search.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/search/search.js
2 | var tempArr = {
3 | title: "搜索历史", isVisible: false,data:[]};
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | isShowClear: false, // 是否显示清空图标
11 | inputValue: "", // 输入框值
12 | popularData: [ // 热门搜索数据
13 | {
14 | title: "红米5 新品"
15 | },
16 | {
17 | title: "电视32英寸"
18 | },
19 | {
20 | title: "净水器厨下"
21 | },
22 | {
23 | title: "小米MIX 2"
24 | },
25 | {
26 | title: "小米笔记本Pro"
27 | }
28 | ],
29 | historyData: { // 历史记录
30 | title: "搜索历史",
31 | isVisible: false,
32 | data: [
33 |
34 | ]
35 | },
36 | storageHistory: [], // 临时储存历史记录的数组
37 | searchKeyData: { // 关键字搜索数据
38 | data: [
39 | ]
40 | },
41 | hongKeyData: { // 关键字为"红"的数据
42 | value: "红",
43 | data: [
44 | {
45 | title: "小米5X 红色版"
46 | },
47 | {
48 | title: "红米5 16GB"
49 | },
50 | {
51 | title: "红米5 Plus"
52 | },
53 | {
54 | title: "红米5A"
55 | },
56 | {
57 | title: "红米Note 5A 移动4G+"
58 | },
59 | {
60 | title: "红米Note 5A 16GB"
61 | },
62 | {
63 | title: "红米Note 5A"
64 | },
65 | {
66 | title: "红米Note 4X"
67 | },
68 | {
69 | title: "红米Note 4X 64GB"
70 | },
71 | {
72 | title: "红米Note 4X"
73 | }
74 | ]
75 | },
76 | hmKeyData: { // 关键字为"红米"的数据
77 | value: "红米",
78 | data: [
79 | {
80 | title: "红米5 16GB"
81 | },
82 | {
83 | title: "红米5 Plus"
84 | },
85 | {
86 | title: "红米5A"
87 | },
88 | {
89 | title: "红米Note 5A 移动4G+"
90 | },
91 | {
92 | title: "红米Note 5A 16GB"
93 | },
94 | {
95 | title: "红米Note 5A"
96 | },
97 | {
98 | title: "红米Note 4X"
99 | },
100 | {
101 | title: "红米Note 4X 64GB"
102 | },
103 | {
104 | title: "红米4X 64GB"
105 | }
106 | ]
107 | },
108 | isShowSearchKey: false, // 是否显示关键字搜索结果展示区
109 | searchRetData: [ // 搜索返回结果
110 | {
111 | imgSrc: "../../../images/searchResult/hm5.jpg",
112 | name: "红米5 3GB+32GB",
113 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」千元全面屏 / 超长续航 / 前置柔光自拍 / 骁龙处理器",
114 | price: 899
115 | },
116 | {
117 | imgSrc: "../../../images/searchResult/hm5.jpg",
118 | name: "红米5 3GB+32GB",
119 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
120 | price: 899
121 | },
122 | {
123 | imgSrc: "../../../images/searchResult/hm5.jpg",
124 | name: "红米5 3GB+32GB",
125 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
126 | price: 899
127 | },
128 | {
129 | imgSrc: "../../../images/searchResult/hm5.jpg",
130 | name: "红米5 3GB+32GB",
131 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
132 | price: 899
133 | },
134 | {
135 | imgSrc: "../../../images/searchResult/hm5.jpg",
136 | name: "红米5 3GB+32GB",
137 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
138 | price: 899
139 | },
140 | {
141 | imgSrc: "../../../images/searchResult/hm5.jpg",
142 | name: "红米5 3GB+32GB",
143 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
144 | price: 899
145 | },
146 | {
147 | imgSrc: "../../../images/searchResult/hm5.jpg",
148 | name: "红米5 3GB+32GB",
149 | brief: "「小米年货节!赠小米活塞耳机,加送米粉卡,可享小米分期6期免息」",
150 | price: 899
151 | }
152 | ],
153 | isShowRetData: false // 是否显示返回数据结果展示区
154 | },
155 |
156 | /**
157 | * 生命周期函数--监听页面加载
158 | */
159 | onLoad: function (options) {
160 | // 页面加载完的时候,发送请求返回缓存数据
161 | try {
162 | // 获得缓存值(数组)
163 | var value = wx.getStorageSync('_history_search');
164 | // 当值存在时
165 | var valLen = value.length;
166 | // 但缓存值为数组且长度不等于之前的长度时
167 | if ( valLen && valLen != this.data.historyData.data.length) {
168 | // 初始化数组
169 | tempArr.data = [];
170 | // 显示历史记录盒子
171 | tempArr.isVisible = true;
172 | // 遍历 存放缓存数据
173 | for (var i = 0; i < valLen; i++ ) {
174 | tempArr.data.push(value[i]);
175 | }
176 | // 替换数据
177 | this.setData({
178 | historyData: tempArr
179 | });
180 | }
181 | } catch ( e ) {
182 | }
183 | },
184 |
185 | /**
186 | * 生命周期函数--监听页面初次渲染完成
187 | */
188 | onReady: function () {
189 |
190 | },
191 |
192 | /**
193 | * 生命周期函数--监听页面显示
194 | */
195 | onShow: function () {
196 |
197 | },
198 |
199 | /**
200 | * 生命周期函数--监听页面隐藏
201 | */
202 | onHide: function () {
203 |
204 | },
205 |
206 | /**
207 | * 生命周期函数--监听页面卸载
208 | */
209 | onUnload: function () {
210 |
211 | },
212 |
213 | /**
214 | * 页面相关事件处理函数--监听用户下拉动作
215 | */
216 | onPullDownRefresh: function () {
217 |
218 | },
219 |
220 | /**
221 | * 页面上拉触底事件的处理函数
222 | */
223 | onReachBottom: function () {
224 |
225 | },
226 |
227 | /**
228 | * 用户点击右上角分享
229 | */
230 | onShareAppMessage: function () {
231 |
232 | },
233 | // 输入绑定事件
234 | _beingInput: function ( e ) {
235 | let value = e.detail.value;
236 | let data = this.data;
237 | // 当值不为空时,显示清空图标,否则不显示清空图标
238 | switch ( value ) {
239 | case "红": // 关键字为"红"
240 | this.setData({
241 | searchKeyData: data.hongKeyData,
242 | isShowSearchKey: true,
243 | isShowClear: true,
244 | inputValue: value,
245 | isShowRetData: false
246 | });
247 | break;
248 | case "红米": // 关键字为"红米"
249 | this.setData({
250 | searchKeyData: data.hmKeyData,
251 | isShowSearchKey: true,
252 | isShowClear: true,
253 | inputValue: value,
254 | isShowRetData: false
255 | })
256 | break;
257 | case "": // 数据为空时
258 | this.setData({
259 | isShowClear: false,
260 | inputValue: value,
261 | searchKeyData: {
262 | data: []
263 | },
264 | isShowSearchKey: false,
265 | isShowRetData: false
266 | });
267 | break;
268 | default: // 默认情况下
269 | this.setData({
270 | searchKeyData: {
271 | data: []
272 | },
273 | isShowSearchKey: false,
274 | isShowClear: true,
275 | inputValue: value,
276 | isShowRetData: false
277 | })
278 | break;
279 | }
280 | },
281 | // 清除输入框内容
282 | _clearContent: function () {
283 | this.setData({
284 | inputValue: "",
285 | isShowSearchKey: false,
286 | isShowRetData: false
287 | });
288 | },
289 | // 发送搜索请求,并存储缓存
290 | _sendSearchReq: function () {
291 | try {
292 | // 获取输入的数据
293 | let value = this.data.inputValue;
294 | let that = this;
295 | if ( value ) {
296 | // 插入到临时数组的第一行
297 | tempArr.data.unshift({ "title": value });
298 | tempArr.isVisible = true;
299 | // 替换数据
300 | this.setData({
301 | historyData: tempArr
302 | })
303 | // 存放缓存数据
304 | wx.setStorageSync('_history_search', tempArr.data);
305 | // 当发送的记录为"红米"时
306 | if ( value == "红米" ) {
307 | wx.showLoading({
308 | title: '正在获取数据',
309 | mask: true
310 | })
311 | setTimeout(function () {
312 | wx.hideLoading();
313 | that.setData({
314 | isShowRetData: true,
315 | isShowSearchKey: false
316 | });
317 | }, 1500);
318 | }
319 | }
320 | } catch (e) {
321 | }
322 | },
323 | _clearHistory: function () {
324 | try {
325 | // 清空历史
326 | wx.removeStorageSync('_history_search');
327 | // 清空数组数据
328 | tempArr.data = [];
329 | // 隐藏历史记录盒子
330 | tempArr.isVisible = false;
331 | // 替换数据
332 | this.setData({
333 | historyData: tempArr
334 | });
335 | } catch (e) {
336 | // Do something when catch error
337 | }
338 | },
339 | _sendPopData: function ( e ) {
340 | let value = e.currentTarget.dataset.title;
341 | this.setData({
342 | inputValue: value,
343 | isShowClear: true
344 | });
345 | this._sendSearchReq();
346 | }
347 | })
--------------------------------------------------------------------------------
/pages/subPages/search/search.json:
--------------------------------------------------------------------------------
1 | {
2 | "backgroundTextStyle": "light",
3 | "navigationBarBackgroundColor": "#f9f9f9",
4 | "navigationBarTitleText": "小米商城Lite",
5 | "navigationBarTextStyle": "black",
6 | "backgroundColor": "#eeeeee"
7 | }
--------------------------------------------------------------------------------
/pages/subPages/search/search.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 搜索
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{ item.title }}
23 |
24 |
25 |
26 |
27 |
28 | {{ historyData.title }}
29 |
30 |
31 |
32 |
33 | {{ item.title }}
34 |
35 |
36 | 清除搜索历史
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {{ item.title }}
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | {{ item.name }}
59 | {{ item.brief }}
60 | {{ item.price }}
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/pages/subPages/search/search.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/search/search.wxss */
2 | Page {
3 | height: 100%;
4 | overflow-x: hidden;
5 | overflow-y: auto;
6 | }
7 | .container {
8 | background-color: #ebebeb;
9 | width: 100%;
10 | overflow-x: hidden;
11 | }
12 | .search-top-outer {
13 | height: 84rpx;
14 | width: 100vw;
15 | background-color: #ff6700;
16 | display: -webkit-box;
17 | display: -webkit-flex;
18 | display: flex;
19 | align-items: center;
20 | }
21 | .search-top-left {
22 | -webkit-box-flex: 1;
23 | -webkit-flex: 1 1 auto;
24 | flex: 1 1 auto;
25 | margin-left: 12rpx;
26 | height: 58rpx;
27 | background-color: #fff;
28 | display: -webkit-box;
29 | display: -webkit-flex;
30 | display: flex;
31 | -ms-flex-direction: row;
32 | flex-direction: row;
33 | align-items: center;
34 | border-radius: 6rpx;
35 | }
36 | .icon-search {
37 | margin:0 10rpx;
38 | }
39 | .search-input {
40 | font-size: 30rpx;
41 | -webkit-box-flex: 1;
42 | -webkit-flex: 1 1 auto;
43 | flex: 1 1 auto;
44 | }
45 | .icon-clear-wrap {
46 | height: inherit;
47 | width: 58rpx;
48 | display: -webkit-box;
49 | display: -webkit-flex;
50 | display: flex;
51 | align-items: center;
52 | justify-content: center;
53 | }
54 | .icon-clear {
55 | height: 50rpx;
56 | width: 50rpx;
57 | }
58 | /*顶部右边 */
59 | .search-top-right {
60 | height: 58rpx;
61 | width: 110rpx;
62 | display: -webkit-box;
63 | display: -webkit-flex;
64 | display: flex;
65 | justify-content: center;
66 | align-items: center;
67 | }
68 | .search-title {
69 | font-size: 30rpx;
70 | color: #fff;
71 |
72 | }
73 | /*热门搜索区域 */
74 | .popular-search-box {
75 | width: 100vw;
76 | margin: 32rpx 10rpx;
77 | }
78 | .popular-search-box::before, .popular-search-box::after {
79 | content: "";
80 | display: table;
81 | }
82 | .popular-search-box::after {
83 | clear: both;
84 | }
85 | .pop-search-wrap {
86 | float: left;
87 | height: 46rpx;
88 | width: auto;
89 | background-color: #fff;
90 | margin-left: 14rpx;
91 | margin-bottom: 14rpx;
92 | border: 1px solid #dadada;
93 | }
94 | .pop-search-title {
95 | padding: 10rpx 16rpx 16rpx;
96 | font-size: 24rpx;
97 | }
98 | /*搜索历史 */
99 | .xs-left {
100 | padding: 0 24rpx;
101 | }
102 | .popular-search-box {
103 | width: 100vw;
104 | }
105 | .box-hd {
106 | width: 100%;
107 | height: 60rpx;
108 | }
109 | .box-hd-title {
110 | line-height: 60rpx;
111 | font-size: 26rpx;
112 | color: #8c8c8c;
113 | }
114 | .box-bd {
115 | background-color: #fff;
116 | }
117 | .box-bd-item {
118 | height: 100rpx;
119 | border-bottom: 1px solid #f2f2f2;
120 | }
121 | .box-bd-title {
122 | line-height: 100rpx;
123 | height: inherit;
124 | font-size: 28rpx;
125 | color: #1d1d1d;
126 | }
127 | .box-bd-title.clear-history {
128 | color: #465c89;
129 | }
130 | .box-bd-item.clear-history-wrap {
131 | text-align: center;
132 | }
133 | /*关键字搜索区 */
134 | .search-key-list {
135 | position: absolute;
136 | left: 0;
137 | top: 84rpx;
138 | background-color: #fff;
139 | width: 100%;
140 | }
141 | .result-list {
142 | border-top: 2rpx solid #ebebeb;
143 | }
144 | .result-item {
145 | width: 94vw;
146 | height: 100rpx;
147 | margin:0 3vw ;
148 | border-top: 2rpx solid #e5e5e5;
149 | }
150 | .result-item:first-child {
151 | border-top: none;
152 | }
153 | .result-title {
154 | height: inherit;
155 | line-height: 100rpx;
156 | font-size: 28rpx;
157 | }
158 | /*搜索结果展示框 */
159 | .search-return-list {
160 | position: absolute;
161 | left: 0;
162 | top: 84rpx;
163 | background-color: #fff;
164 | width: 100%;
165 | }
166 | .return-list {
167 | border-top: 2rpx solid #ebebeb;
168 | }
169 | .return-item {
170 | width: 92vw;
171 | height: 164rpx;
172 | padding: 30rpx 0;
173 | margin: 0 4vw;
174 | border-top: 2rpx solid #e5e5e5;
175 | display: -webkit-box;
176 | display: -webkit-flex;
177 | display: flex;
178 | flex-direction: row;
179 | }
180 | .return-item:first-child {
181 | border-top: none;
182 | }
183 | .item-img-wrap {
184 | height: inherit;
185 | width: 164rpx;
186 | }
187 | .item-img {
188 | height: inherit;
189 | width: 164rpx;
190 | }
191 | .item-content-box {
192 | -webkit-box-flex: 1;
193 | -webkit-flex: 1;
194 | flex: 1;
195 | display: -webkit-box;
196 | display: -webkit-flex;
197 | display: flex;
198 | -ms-flex-direction: column;
199 | flex-direction: column;
200 | justify-content: space-around;
201 | margin-left: 12rpx;
202 | }
203 | .item-name {
204 | font-size: 30rpx;
205 | }
206 | .item-brief {
207 | font-size: 24rpx;
208 | color: #b4b4b4;
209 | line-height: 40rpx;
210 | overflow: hidden;
211 | -ms-text-overflow: ellipsis;
212 | -o-text-overflow: ellipsis;
213 | text-overflow: ellipsis;
214 | display: -webkit-box;
215 | -webkit-line-clamp: 2;
216 | -webkit-box-orient: vertical;
217 | }
218 | .item-price {
219 | position: relative;
220 | font-size: 34rpx;
221 | color: #ff6700;
222 | padding-left: 26rpx;
223 | }
224 | .item-price::before {
225 | content: "\A5";
226 | position: absolute;
227 | left: 0;
228 | top: 0;
229 | font-size: 36rpx;
230 | text-decoration: none;
231 | }
--------------------------------------------------------------------------------
/pages/subPages/setting/setting.js:
--------------------------------------------------------------------------------
1 | // pages/subPages/setting/setting.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/pages/subPages/setting/setting.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/subPages/setting/setting.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/subPages/setting/setting.wxml
3 |
--------------------------------------------------------------------------------
/pages/subPages/setting/setting.wxss:
--------------------------------------------------------------------------------
1 | /* pages/subPages/setting/setting.wxss */
--------------------------------------------------------------------------------
/pages/user/user.js:
--------------------------------------------------------------------------------
1 | // pages/user/user.js
2 | const app = getApp();
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | cellData: {
10 | user: {
11 | name: "user",
12 | title: "用户",
13 | childData: [
14 | {
15 | name: "order",
16 | title: "我的订单",
17 | imgSrc: "../../images/mine/icon_order.png"
18 | },
19 | {
20 | name: "coupon",
21 | title: "我的优惠券",
22 | imgSrc: "../../images/mine/icon_coupon.png"
23 | },
24 | {
25 | name: "fcode",
26 | title: "我的f码",
27 | imgSrc: "../../images/mine/icon_fcode.png"
28 | }
29 | ]
30 | },
31 | setting: {
32 | name: "setting",
33 | title: "设置",
34 | childData: [
35 | {
36 | name: "setting",
37 | title: "我的订单",
38 | imgSrc: "../../images/mine/icon_setting.png"
39 | }
40 | ]
41 | }
42 | },
43 | userInfo: null,
44 | qrcodeSrc: "../../images/common/qrcode.png",
45 | micode: 918473906
46 | },
47 |
48 | /**
49 | * 生命周期函数--监听页面加载
50 | */
51 | onLoad: function (options) {
52 | this.setData({
53 | userInfo: app.globalData.userInfo
54 | });
55 | },
56 |
57 | /**
58 | * 生命周期函数--监听页面初次渲染完成
59 | */
60 | onReady: function () {
61 |
62 | },
63 |
64 | /**
65 | * 生命周期函数--监听页面显示
66 | */
67 | onShow: function () {
68 |
69 | },
70 |
71 | /**
72 | * 生命周期函数--监听页面隐藏
73 | */
74 | onHide: function () {
75 |
76 | },
77 |
78 | /**
79 | * 生命周期函数--监听页面卸载
80 | */
81 | onUnload: function () {
82 |
83 | },
84 |
85 | /**
86 | * 页面相关事件处理函数--监听用户下拉动作
87 | */
88 | onPullDownRefresh: function () {
89 |
90 | },
91 |
92 | /**
93 | * 页面上拉触底事件的处理函数
94 | */
95 | onReachBottom: function () {
96 |
97 | },
98 |
99 | /**
100 | * 用户点击右上角分享
101 | */
102 | onShareAppMessage: function () {
103 |
104 | }
105 | })
--------------------------------------------------------------------------------
/pages/user/user.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "cell-box": "../../components/cellBox/cellBox"
4 | },
5 | "backgroundTextStyle": "light",
6 | "navigationBarBackgroundColor": "#ececec",
7 | "navigationBarTitleText": "小米商城Lite",
8 | "navigationBarTextStyle": "black"
9 | }
--------------------------------------------------------------------------------
/pages/user/user.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{ userInfo.nickName }}
10 | 小米账号:{{ micode }}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/pages/user/user.wxss:
--------------------------------------------------------------------------------
1 | /* pages/user/user.wxss */
2 | .container {
3 | display: -webkit-box;
4 | display: -webkit-flex;
5 | display: flex;
6 | flex-direction: column;
7 | background-color: #ebebeb;
8 | height: 100vh;
9 | }
10 | .line-top {
11 | padding-top: 16rpx;
12 | background-color: #ebebeb;
13 | }
14 | /*用户信息 */
15 | .userInfo-wrap {
16 | height: 160rpx;
17 | width: 90vw;
18 | padding:0 5vw;
19 | background-color: white;
20 | display: -webkit-box;
21 | display: -webkit-flex;
22 | display: flex;
23 | flex-direction: row;
24 | }
25 | .userInfo-img-wrap {
26 | display: -webkit-box;
27 | display: -webkit-flex;
28 | display: flex;
29 | justify-content: center;
30 | align-items: center;
31 | width: 160rpx;
32 | height: 160rpx;
33 | }
34 | .userInfo-img {
35 | width: 140rpx;
36 | height: 140rpx;
37 | background-color: gainsboro;
38 | }
39 | .userInfo-message {
40 | width: 60vw;
41 | margin-left: 40rpx;
42 | display: -webkit-box;
43 | display: -webkit-flex;
44 | display: flex;
45 | flex-direction: column;
46 | }
47 | .userInfo-name {
48 | margin-top: 34rpx;
49 | font-size: 36rpx;
50 | overflow: hidden;
51 | white-space: nowrap;
52 | -o-text-overflow: ellipsis;
53 | -ms-text-overflow: ellipsis;
54 | text-overflow: ellipsis;
55 | -moz-box-flex: 1;
56 | -webkit-box-flex: 1;
57 | flex: 1;
58 | }
59 | .userInfo-uid {
60 | font-size: 24rpx;
61 | color: #8d8d8d;
62 | overflow: hidden;
63 | white-space: nowrap;
64 | -o-text-overflow: ellipsis;
65 | -ms-text-overflow: ellipsis;
66 | text-overflow: ellipsis;
67 | -moz-box-flex: 1;
68 | -webkit-box-flex: 1;
69 | flex: 1;
70 | }
71 | .userInfo-qrcode-wrap {
72 | height: inherit;
73 | width: 64rpx;
74 | display: -webkit-box;
75 | display: -webkit-flex;
76 | display: flex;
77 | align-items: center;
78 | align-self: flex-end;
79 | }
80 | .userInfo-qrcode {
81 | height: 64rpx;
82 | width: 64rpx;
83 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": true,
5 | "es6": true,
6 | "postcss": true,
7 | "minified": true,
8 | "newFeature": true
9 | },
10 | "compileType": "miniprogram",
11 | "libVersion": "1.7.2",
12 | "appid": "wx4085cbd9e1b17bf8",
13 | "projectname": "wechat-app-mi",
14 | "condition": {
15 | "search": {
16 | "current": -1,
17 | "list": []
18 | },
19 | "conversation": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "game": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "miniprogram": {
28 | "current": 0,
29 | "list": [
30 | {
31 | "id": 0,
32 | "name": "我的页面",
33 | "pathName": "pages/subPages/detail/detail",
34 | "query": "",
35 | "scene": "1005"
36 | }
37 | ]
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/utils/detailData1.js:
--------------------------------------------------------------------------------
1 | var data = {
2 | "code": 0,
3 | "result": "ok",
4 | "description": "success",
5 | "data": {
6 | "activies": [],
7 | "buy_option": [{
8 | "list": [{
9 | "icon_color": "",
10 | "icon_img": "",
11 | "is_stock": true,
12 | "name": "金色",
13 | "price": "",
14 | "prop_desc": "",
15 | "prop_value_id": 232
16 | }, {
17 | "icon_color": "",
18 | "icon_img": "",
19 | "is_stock": true,
20 | "name": "黑色",
21 | "price": "",
22 | "prop_desc": "",
23 | "prop_value_id": 3
24 | }, {
25 | "icon_color": "",
26 | "icon_img": "",
27 | "is_stock": false,
28 | "name": "玫瑰金",
29 | "price": "",
30 | "prop_desc": "",
31 | "prop_value_id": 2
32 | }],
33 | "name": "颜色",
34 | "prop_cfg_id": 2
35 | }, {
36 | "list": [{
37 | "icon_color": "",
38 | "icon_img": "",
39 | "is_stock": false,
40 | "name": "32GB",
41 | "price": "",
42 | "prop_desc": "",
43 | "prop_value_id": 96
44 | }],
45 | "name": "容量",
46 | "prop_cfg_id": 8
47 | }],
48 | "coupon_info": {
49 | "act_name": "优惠券"
50 | },
51 | "default_goods_id": "2172800005",
52 | "goods_info": [{
53 | "action_button": {
54 | "button_title": "加入购物车",
55 | "is_bigtap": false,
56 | "occ_timeout": 5000,
57 | "sale_mode": "standard",
58 | "use_occ": false
59 | },
60 | "address_type": "common",
61 | "buy_limit": "5",
62 | "commodity_id": 1172800007,
63 | "goods_id": 2172800005,
64 | "image_share": "http://i8.mifile.cn/v1/a1/424aee87-f7a9-2c81-d65e-372a009c0c58!144x1440.jpg",
65 | "img_url": "//i8.mifile.cn/v1/a1/424aee87-f7a9-2c81-d65e-372a009c0c58!720x7200.jpg",
66 | "instalment": {
67 | "default_instal": "mifinanceinstal_m",
68 | "list": [{
69 | "bank": "antinstal_m",
70 | "desc": "花呗分期",
71 | "detail": [{
72 | "interest": "27.58",
73 | "rate": "2.30",
74 | "stage": 3,
75 | "stage_cost": "408.85",
76 | "stage_interest": "9.19",
77 | "total_cost": "1226.58"
78 | }, {
79 | "interest": "53.96",
80 | "rate": "4.50",
81 | "stage": 6,
82 | "stage_cost": "208.82",
83 | "stage_interest": "8.99",
84 | "total_cost": "1252.96"
85 | }, {
86 | "interest": "89.92",
87 | "rate": "7.50",
88 | "stage": 12,
89 | "stage_cost": "107.40",
90 | "stage_interest": "7.49",
91 | "total_cost": "1288.92"
92 | }],
93 | "title": "花呗分期"
94 | }, {
95 | "bank": "mifinanceinstal_m",
96 | "desc": "小米分期",
97 | "detail": [{
98 | "interest": "0",
99 | "rate": "0",
100 | "stage": 3,
101 | "stage_cost": "399.67",
102 | "stage_interest": "0",
103 | "total_cost": "1199.00"
104 | }, {
105 | "interest": "46.76",
106 | "rate": "3.90",
107 | "stage": 6,
108 | "stage_cost": "207.62",
109 | "stage_interest": "7.79",
110 | "total_cost": "1245.76"
111 | }, {
112 | "interest": "86.33",
113 | "rate": "7.20",
114 | "stage": 12,
115 | "stage_cost": "107.11",
116 | "stage_interest": "7.19",
117 | "total_cost": "1285.33"
118 | }],
119 | "title": "小米分期"
120 | }]
121 | },
122 | "insurance": {
123 | "list": [{
124 | "goods_id": "2173000013",
125 | "image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
126 | "market_price": "119",
127 | "name": "小米5X 意外保险",
128 | "price": "119",
129 | "short_name": "小米5X 意外保险",
130 | "sku": "16856",
131 | "type": "mi5s"
132 | }]
133 | },
134 | "is_sale": true,
135 | "is_stock": true,
136 | "market_price": "1299",
137 | "name": "小米5X 4GB+32GB 金色",
138 | "price": "1199",
139 | "prop_list": [{
140 | "prop_cfg_id": 2,
141 | "prop_value_id": 232
142 | }, {
143 | "prop_cfg_id": 8,
144 | "prop_value_id": 96
145 | }],
146 | "reduce_price": "直降100元",
147 | "service_bargins": [{
148 | "can_multi": false,
149 | "service_info": [{
150 | "act_diff": "",
151 | "act_id": "",
152 | "act_price": "",
153 | "goods_id": 2172800005,
154 | "goods_name": "小米5X 金色 32GB",
155 | "item_id": "",
156 | "service_goods_id": "2173000013",
157 | "service_image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
158 | "service_name": "小米5X 意外保险",
159 | "service_price": "119",
160 | "service_short_name": "手机意外保险",
161 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
162 | "source": "common"
163 | }],
164 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
165 | "type_name": "意外保险"
166 | }],
167 | "service_refound_policy": {
168 | "desc": "支持7天无理由退货",
169 | "is_support": true
170 | },
171 | "show_price_type": [],
172 | "stock_channel": "3"
173 | }, {
174 | "action_button": {
175 | "button_title": "加入购物车",
176 | "is_bigtap": false,
177 | "occ_timeout": 5000,
178 | "sale_mode": "standard",
179 | "use_occ": false
180 | },
181 | "address_type": "common",
182 | "buy_limit": "5",
183 | "commodity_id": 1172800006,
184 | "goods_id": 2172800004,
185 | "image_share": "http://i8.mifile.cn/v1/a1/533b82eb-666d-88d6-230a-234a3c0f1001!144x1440.jpg",
186 | "img_url": "//i8.mifile.cn/v1/a1/533b82eb-666d-88d6-230a-234a3c0f1001!720x7200.jpg",
187 | "instalment": {
188 | "default_instal": "mifinanceinstal_m",
189 | "list": [{
190 | "bank": "antinstal_m",
191 | "desc": "花呗分期",
192 | "detail": [{
193 | "interest": "27.58",
194 | "rate": "2.30",
195 | "stage": 3,
196 | "stage_cost": "408.85",
197 | "stage_interest": "9.19",
198 | "total_cost": "1226.58"
199 | }, {
200 | "interest": "53.96",
201 | "rate": "4.50",
202 | "stage": 6,
203 | "stage_cost": "208.82",
204 | "stage_interest": "8.99",
205 | "total_cost": "1252.96"
206 | }, {
207 | "interest": "89.92",
208 | "rate": "7.50",
209 | "stage": 12,
210 | "stage_cost": "107.40",
211 | "stage_interest": "7.49",
212 | "total_cost": "1288.92"
213 | }],
214 | "title": "花呗分期"
215 | }, {
216 | "bank": "mifinanceinstal_m",
217 | "desc": "小米分期",
218 | "detail": [{
219 | "interest": "0",
220 | "rate": "0",
221 | "stage": 3,
222 | "stage_cost": "399.67",
223 | "stage_interest": "0",
224 | "total_cost": "1199.00"
225 | }, {
226 | "interest": "46.76",
227 | "rate": "3.90",
228 | "stage": 6,
229 | "stage_cost": "207.62",
230 | "stage_interest": "7.79",
231 | "total_cost": "1245.76"
232 | }, {
233 | "interest": "86.33",
234 | "rate": "7.20",
235 | "stage": 12,
236 | "stage_cost": "107.11",
237 | "stage_interest": "7.19",
238 | "total_cost": "1285.33"
239 | }],
240 | "title": "小米分期"
241 | }]
242 | },
243 | "insurance": {
244 | "list": [{
245 | "goods_id": "2173000013",
246 | "image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
247 | "market_price": "119",
248 | "name": "小米5X 意外保险",
249 | "price": "119",
250 | "short_name": "小米5X 意外保险",
251 | "sku": "16856",
252 | "type": "mi5s"
253 | }]
254 | },
255 | "is_sale": true,
256 | "is_stock": true,
257 | "market_price": "1299",
258 | "name": "小米5X 4GB+32GB 黑色",
259 | "price": "1199",
260 | "prop_list": [{
261 | "prop_cfg_id": 2,
262 | "prop_value_id": 3
263 | }, {
264 | "prop_cfg_id": 8,
265 | "prop_value_id": 96
266 | }],
267 | "reduce_price": "直降100元",
268 | "service_bargins": [{
269 | "can_multi": false,
270 | "service_info": [{
271 | "act_diff": "",
272 | "act_id": "",
273 | "act_price": "",
274 | "goods_id": 2172800004,
275 | "goods_name": "小米5X 黑色 32GB",
276 | "item_id": "",
277 | "service_goods_id": "2173000013",
278 | "service_image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
279 | "service_name": "小米5X 意外保险",
280 | "service_price": "119",
281 | "service_short_name": "手机意外保险",
282 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
283 | "source": "common"
284 | }],
285 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
286 | "type_name": "意外保险"
287 | }],
288 | "service_refound_policy": {
289 | "desc": "支持7天无理由退货",
290 | "is_support": true
291 | },
292 | "show_price_type": [],
293 | "stock_channel": "3"
294 | }, {
295 | "action_button": {
296 | "button_title": "加入购物车",
297 | "is_bigtap": false,
298 | "occ_timeout": 5000,
299 | "sale_mode": "standard",
300 | "use_occ": false
301 | },
302 | "address_type": "common",
303 | "buy_limit": "5",
304 | "commodity_id": 1172800008,
305 | "goods_id": 2172800006,
306 | "image_share": "http://i8.mifile.cn/v1/a1/a177cd8d-d461-7a36-bb01-e67fef85f3a8!144x1440.jpg",
307 | "img_url": "//i8.mifile.cn/v1/a1/a177cd8d-d461-7a36-bb01-e67fef85f3a8!720x7200.jpg",
308 | "instalment": {
309 | "default_instal": "mifinanceinstal_m",
310 | "list": [{
311 | "bank": "antinstal_m",
312 | "desc": "花呗分期",
313 | "detail": [{
314 | "interest": "27.58",
315 | "rate": "2.30",
316 | "stage": 3,
317 | "stage_cost": "408.85",
318 | "stage_interest": "9.19",
319 | "total_cost": "1226.58"
320 | }, {
321 | "interest": "53.96",
322 | "rate": "4.50",
323 | "stage": 6,
324 | "stage_cost": "208.82",
325 | "stage_interest": "8.99",
326 | "total_cost": "1252.96"
327 | }, {
328 | "interest": "89.92",
329 | "rate": "7.50",
330 | "stage": 12,
331 | "stage_cost": "107.40",
332 | "stage_interest": "7.49",
333 | "total_cost": "1288.92"
334 | }],
335 | "title": "花呗分期"
336 | }, {
337 | "bank": "mifinanceinstal_m",
338 | "desc": "小米分期",
339 | "detail": [{
340 | "interest": "0",
341 | "rate": "0",
342 | "stage": 3,
343 | "stage_cost": "399.67",
344 | "stage_interest": "0",
345 | "total_cost": "1199.00"
346 | }, {
347 | "interest": "46.76",
348 | "rate": "3.90",
349 | "stage": 6,
350 | "stage_cost": "207.62",
351 | "stage_interest": "7.79",
352 | "total_cost": "1245.76"
353 | }, {
354 | "interest": "86.33",
355 | "rate": "7.20",
356 | "stage": 12,
357 | "stage_cost": "107.11",
358 | "stage_interest": "7.19",
359 | "total_cost": "1285.33"
360 | }],
361 | "title": "小米分期"
362 | }]
363 | },
364 | "insurance": {
365 | "list": [{
366 | "goods_id": "2173000013",
367 | "image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
368 | "market_price": "119",
369 | "name": "小米5X 意外保险",
370 | "price": "119",
371 | "short_name": "小米5X 意外保险",
372 | "sku": "16856",
373 | "type": "mi5s"
374 | }]
375 | },
376 | "is_sale": true,
377 | "is_stock": false,
378 | "market_price": "1299",
379 | "name": "小米5X 4GB+32GB 玫瑰金",
380 | "price": "1199",
381 | "prop_list": [{
382 | "prop_cfg_id": 2,
383 | "prop_value_id": 2
384 | }, {
385 | "prop_cfg_id": 8,
386 | "prop_value_id": 96
387 | }],
388 | "reduce_price": "直降100元",
389 | "service_bargins": [{
390 | "can_multi": false,
391 | "service_info": [{
392 | "act_diff": "",
393 | "act_id": "",
394 | "act_price": "",
395 | "goods_id": 2172800006,
396 | "goods_name": "小米5X 玫瑰金 32GB",
397 | "item_id": "",
398 | "service_goods_id": "2173000013",
399 | "service_image_url": "//i1.mifile.cn/a1/pms_1501144999.82492758.jpg",
400 | "service_name": "小米5X 意外保险",
401 | "service_price": "119",
402 | "service_short_name": "手机意外保险",
403 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
404 | "source": "common"
405 | }],
406 | "service_url": "https://cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/4a15d767c1fe.html",
407 | "type_name": "意外保险"
408 | }],
409 | "service_refound_policy": {
410 | "desc": "支持7天无理由退货",
411 | "is_support": true
412 | },
413 | "show_price_type": [],
414 | "stock_channel": "3"
415 | }],
416 | "product_info": {
417 | "activity_tips": {
418 | "action": { },
419 | "img_url": ""
420 | },
421 | "is_batched": false,
422 | "is_enable": true,
423 | "name": "小米5X 4GB+32GB",
424 | "price_tips": { },
425 | "product_desc": "\u003cfont color='#ff4a00'\u003e「小米年货节!全系直降100元,可享小米分期3期免息」\u003c/font\u003e光学变焦双摄,拍人更美 / 5.5''大屏轻薄全金属 / 骁龙八核处理器 / 4GB大内存 ",
426 | "product_gallery_icon": { },
427 | "product_id": 6260,
428 | "share_content": ""
429 | },
430 | "seo": {
431 | "description": "\u003cfont color='#ff4a00'\u003e「小米年货节!全系直降100元,可享小米分期3期免息」\u003c/font\u003e光学变焦双摄,拍人更美 / 5.5''大屏轻薄全金属 / 骁龙八核处理器 / 4GB大内存 ",
432 | "keywords": "小米5X,4GB+32GB,金色,黑色,玫瑰金",
433 | "title": "小米5X 4GB+32GB"
434 | },
435 | "server_time": 1517560726,
436 | "view_content": {
437 | "commentView": {
438 | "commentView": {
439 | "detail": {
440 | "comment_labels": null,
441 | "comments_bad": 3,
442 | "comments_general": 469,
443 | "comments_good": 12524,
444 | "comments_total": 12996,
445 | "five_star": 11569,
446 | "four_star": 955,
447 | "one_star": 3,
448 | "satisfy_per": "96.4",
449 | "three_star": 288,
450 | "two_star": 181
451 | },
452 | "list": [{
453 | "add_time": "2018-01-30",
454 | "average_grade": 5,
455 | "comment_content": "我感觉手机比客服妹子美啊!",
456 | "comment_full_images": ["//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/205abda3647029237da9871ae4d2fd58.webp", "//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/feef74ec3072012cf2bff96a7ad6c77a.webp"],
457 | "comment_grade": 1,
458 | "comment_id": "154482520",
459 | "comment_images": ["//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/205abda3647029237da9871ae4d2fd58.webp", "//cdn.cnbj0.fds.api.mi-img.com/b2c-data-mishop/feef74ec3072012cf2bff96a7ad6c77a.webp"],
460 | "comment_title": "",
461 | "down": false,
462 | "down_num": 0,
463 | "has_up_customer": false,
464 | "is_top": "1",
465 | "reply_content": "那妹子就负责任的告诉你:这,不是你的错觉(✿◡‿◡)感谢您对小米的支持。",
466 | "reply_time": "2018-01-30",
467 | "site_id": "101",
468 | "site_name": "小米移动商城",
469 | "up": false,
470 | "up_customer_num": 20,
471 | "up_num": 14,
472 | "up_rate": 100,
473 | "user_avatar": "//s1.mi-img.com/mfsv2/avatar/fdsc3/p0136e7Mzb7r/z7PFQfgQffxwcD_90.jpg",
474 | "user_id": "119***5273",
475 | "user_name": "那就这样吧",
476 | "user_reply_num": 0,
477 | "user_replys": []
478 | }],
479 | "total": 12998
480 | },
481 | "viewType": "commentView"
482 | },
483 | "descTabsView": {
484 | "descTabsView": [{
485 | "name": "概述",
486 | "tabContent": [{
487 | "plainView": {
488 | "content": "",
489 | "img": "//i8.mifile.cn/v1/a1/749cd8d8-c84a-1412-fb2c-151bd34d82cc.jpg?w=720\u0026h=1280\u0026s=113.4",
490 | "is_not_compress": "0",
491 | "title": ""
492 | },
493 | "viewType": "plainView"
494 | }, {
495 | "plainView": {
496 | "content": "",
497 | "img": "//i8.mifile.cn/v1/a1/c68d5359-a700-7aa5-5e6c-685d95054249.jpg?w=720\u0026h=1274\u0026s=138.1",
498 | "is_not_compress": "0",
499 | "title": ""
500 | },
501 | "viewType": "plainView"
502 | }, {
503 | "plainView": {
504 | "content": "",
505 | "img": "//i8.mifile.cn/v1/a1/2e20d974-4be0-f72c-c058-db6ee76cc520.jpg?w=720\u0026h=1286\u0026s=104",
506 | "is_not_compress": "0",
507 | "title": ""
508 | },
509 | "viewType": "plainView"
510 | }, {
511 | "plainView": {
512 | "content": "",
513 | "img": "//i8.mifile.cn/v1/a1/aa57a386-739f-8af1-b319-9a745f149e9b.jpg?w=720\u0026h=1283\u0026s=125.5",
514 | "is_not_compress": "0",
515 | "title": ""
516 | },
517 | "viewType": "plainView"
518 | }, {
519 | "plainView": {
520 | "content": "",
521 | "img": "//i8.mifile.cn/v1/a1/0dd51966-8c6e-cc3e-d01e-e5ba1edd5c50.jpg?w=720\u0026h=694\u0026s=80.9",
522 | "is_not_compress": "0",
523 | "title": ""
524 | },
525 | "viewType": "plainView"
526 | }, {
527 | "plainView": {
528 | "content": "",
529 | "img": "//i8.mifile.cn/v1/a1/49cadd22-5258-acae-5d57-4b695b81e114.jpg?w=720\u0026h=1276\u0026s=117.7",
530 | "is_not_compress": "0",
531 | "title": ""
532 | },
533 | "viewType": "plainView"
534 | }, {
535 | "plainView": {
536 | "content": "",
537 | "img": "//i8.mifile.cn/v1/a1/51cec16e-4a1d-51b2-7555-27245bc76f7c.jpg?w=720\u0026h=1282\u0026s=103.6",
538 | "is_not_compress": "0",
539 | "title": ""
540 | },
541 | "viewType": "plainView"
542 | }, {
543 | "plainView": {
544 | "content": "",
545 | "img": "//i8.mifile.cn/v1/a1/e0da78b9-43ed-a0bd-a0a9-6bba1df52653.jpg?w=720\u0026h=1284\u0026s=100",
546 | "is_not_compress": "0",
547 | "title": ""
548 | },
549 | "viewType": "plainView"
550 | }, {
551 | "plainView": {
552 | "content": "",
553 | "img": "//i8.mifile.cn/v1/a1/5fd88454-2ce0-4c04-40fb-643bc49d023c.jpg?w=720\u0026h=1274\u0026s=110.3",
554 | "is_not_compress": "0",
555 | "title": ""
556 | },
557 | "viewType": "plainView"
558 | }, {
559 | "plainView": {
560 | "content": "",
561 | "img": "//i8.mifile.cn/v1/a1/aa04fda5-79e1-95b2-486a-0123708f6c11.jpg?w=720\u0026h=383\u0026s=56",
562 | "is_not_compress": "0",
563 | "title": ""
564 | },
565 | "viewType": "plainView"
566 | }]
567 | }, {
568 | "name": "参数",
569 | "tabContent": [{
570 | "plainView": {
571 | "content": "",
572 | "img": "//i8.mifile.cn/v1/a1/9598c633-ef3c-2abd-b116-842a693207d4.jpg?w=720\u0026h=862\u0026s=78.1",
573 | "is_not_compress": "0",
574 | "title": ""
575 | },
576 | "viewType": "plainView"
577 | }, {
578 | "plainView": {
579 | "content": "",
580 | "img": "//i8.mifile.cn/v1/a1/9195687e-c747-0bee-a58a-c7badf1e3e52.jpg?w=720\u0026h=1913\u0026s=86.4",
581 | "is_not_compress": "0",
582 | "title": ""
583 | },
584 | "viewType": "plainView"
585 | }, {
586 | "plainView": {
587 | "content": "",
588 | "img": "//i8.mifile.cn/v1/a1/7652bda7-de3e-5309-b4c4-ed1af686139f.jpg?w=720\u0026h=1014\u0026s=57.7",
589 | "is_not_compress": "0",
590 | "title": ""
591 | },
592 | "viewType": "plainView"
593 | }, {
594 | "plainView": {
595 | "content": "",
596 | "img": "//i8.mifile.cn/v1/a1/6fffe3e6-5e73-4a57-147b-7e02852e37d9.jpg?w=720\u0026h=1282\u0026s=90.8",
597 | "is_not_compress": "0",
598 | "title": ""
599 | },
600 | "viewType": "plainView"
601 | }, {
602 | "plainView": {
603 | "content": "",
604 | "img": "//i8.mifile.cn/v1/a1/325e9f5d-8f40-2a61-029b-a7617873f0c6.jpg?w=720\u0026h=1047\u0026s=95.4",
605 | "is_not_compress": "0",
606 | "title": ""
607 | },
608 | "viewType": "plainView"
609 | }, {
610 | "plainView": {
611 | "content": "",
612 | "img": "//i8.mifile.cn/v1/a1/a5ecbd93-2fc3-3186-a024-13b59f8d6632.jpg?w=720\u0026h=680\u0026s=68.2",
613 | "is_not_compress": "0",
614 | "title": ""
615 | },
616 | "viewType": "plainView"
617 | }, {
618 | "plainView": {
619 | "content": "",
620 | "img": "//i8.mifile.cn/v1/a1/df09faad-66d0-c305-844d-2d0ddc8020a3.jpg?w=720\u0026h=845\u0026s=59",
621 | "is_not_compress": "0",
622 | "title": ""
623 | },
624 | "viewType": "plainView"
625 | }, {
626 | "plainView": {
627 | "content": "",
628 | "img": "//i8.mifile.cn/v1/a1/4d83efe8-2343-11b4-fbb8-659d19b493f7.jpg?w=720\u0026h=1360\u0026s=132.7",
629 | "is_not_compress": "0",
630 | "title": ""
631 | },
632 | "viewType": "plainView"
633 | }, {
634 | "plainView": {
635 | "content": "",
636 | "img": "//i8.mifile.cn/v1/a1/7db5717a-c586-2fc1-c102-b2eef3a62bd5.jpg?w=720\u0026h=1425\u0026s=65.7",
637 | "is_not_compress": "0",
638 | "title": ""
639 | },
640 | "viewType": "plainView"
641 | }, {
642 | "plainView": {
643 | "content": "",
644 | "img": "//i8.mifile.cn/v1/a1/c7bf51aa-253b-210f-e54b-19554d11bdd6.jpg?w=720\u0026h=1254\u0026s=116.4",
645 | "is_not_compress": "0",
646 | "title": ""
647 | },
648 | "viewType": "plainView"
649 | }, {
650 | "plainView": {
651 | "content": "",
652 | "img": "//i8.mifile.cn/v1/a1/7cadf167-b83d-e431-4710-e4582c1656a2.jpg?w=720\u0026h=1309\u0026s=103.4",
653 | "is_not_compress": "0",
654 | "title": ""
655 | },
656 | "viewType": "plainView"
657 | }]
658 | }, {
659 | "name": "意外险",
660 | "tabContent": [{
661 | "plainView": {
662 | "content": "",
663 | "img": "//i8.mifile.cn/v1/a1/fd83d023-0b76-b00c-353d-76fdb62d4d9f.jpg?w=1080\u0026h=540\u0026s=115.7",
664 | "is_not_compress": "0",
665 | "title": ""
666 | },
667 | "viewType": "plainView"
668 | }, {
669 | "plainView": {
670 | "content": "",
671 | "img": "//i8.mifile.cn/v1/a1/490ab746-7186-98da-7d63-78c5e97eee97.jpg?w=1080\u0026h=587\u0026s=122.2",
672 | "is_not_compress": "0",
673 | "title": ""
674 | },
675 | "viewType": "plainView"
676 | }, {
677 | "plainView": {
678 | "content": "",
679 | "img": "//i8.mifile.cn/v1/a1/f9399cd6-75a2-1bbb-3371-5fb81adda900.webp?w=1080\u0026h=592",
680 | "is_not_compress": "0",
681 | "title": ""
682 | },
683 | "viewType": "plainView"
684 | }]
685 | }],
686 | "viewType": "descTabsView"
687 | },
688 | "galleryView": {
689 | "galleryMediaView": {
690 | "is_front": false,
691 | "list": [{
692 | "img_url": "//i8.mifile.cn/v1/a1/ed954a23-2c30-98ca-4379-86818f95e75e.jpg",
693 | "img_url_webp": "",
694 | "middle_img_url": "//i8.mifile.cn/v1/a1/358962d3-9f0f-e612-0060-4cd3fa37a21d.jpg",
695 | "middle_img_url_webp": "",
696 | "small_img_url": "//i8.mifile.cn/v1/a1/2b828cce-3469-e9f2-a529-e33bba6991cb.jpg",
697 | "small_img_url_webp": "",
698 | "video_url": "//v.mifile.cn/b2c-mimall-media/4f5548d68cfc309e015cca112e6099bd.mp4",
699 | "view_type": "videoView"
700 | }]
701 | },
702 | "galleryView": ["//i8.mifile.cn/v1/a1/2da996b7-4b5d-0b42-917d-fdb27db12dc9.webp?bg=7F7E7D", "//i8.mifile.cn/v1/a1/090d6b69-5d8b-2895-85f2-13c22577bede.webp?bg=E6E2DD", "//cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/16c29ae096d0d35eaa8a2139b6ed2bd1.jpg?bg=FFFFFF", "//cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/a5b5500ba1f1a1ed3eade6d83ccd64b4.jpg?bg=FFFFFF"],
703 | "viewType": "galleryView"
704 | },
705 | "relatePackageView": {
706 | "relatePackageView": {
707 | "packages": [],
708 | "title": "精选套餐"
709 | },
710 | "viewType": "relatePackageView"
711 | },
712 | "relatePartsView": {
713 | "relatePartsView": {
714 | "desc": "",
715 | "parts": [],
716 | "title": "配件"
717 | },
718 | "viewType": "relatePartsView"
719 | },
720 | "titleView": {
721 | "titleView": {
722 | "adapt": [],
723 | "brief": "",
724 | "canJoinActs": [],
725 | "market_price": "1299",
726 | "name": "小米5X 4GB+32GB",
727 | "price": "1199",
728 | "product_desc": "\u003cfont color='#ff4a00'\u003e「小米年货节!全系直降100元,可享小米分期3期免息」\u003c/font\u003e光学变焦双摄,拍人更美 / 5.5''大屏轻薄全金属 / 骁龙八核处理器 / 4GB大内存 ",
729 | "share_content": ""
730 | },
731 | "viewType": "titleView"
732 | }
733 | }
734 | }
735 | }
736 |
737 | module.exports = {
738 | data: data
739 | }
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------