Commit fcb436f86dbf22128dc5fc30abaae20d33a52be2
Exists in
master
s
Showing
21 changed files
Show diff stats
src/App.vue
1 | -<script lang="ts"> | |
1 | +<script> | |
2 | 2 | import Vue from 'vue'; |
3 | + import store from '@/store'; | |
4 | + | |
3 | 5 | export default Vue.extend({ |
4 | 6 | mpType: 'app', |
5 | - onLaunch() { | |
6 | - console.log('App Launch') | |
7 | + onLaunch(options) { | |
8 | + const option = options || {}; | |
9 | + // 获取用户来源 | |
10 | + console.log('软件启动,输出转来的参数:', option); | |
11 | + console.log('场景值------------------:', option.scene); | |
12 | + let loginQueryInfo = option ? option.query : {}; | |
13 | + loginQueryInfo = loginQueryInfo || {}; | |
14 | + console.log('loginQueryInfo onShow===>', loginQueryInfo); | |
15 | + const scene = decodeURIComponent(loginQueryInfo.scene); | |
16 | + console.log('decodeURIComponent scense====>', scene); | |
17 | + let fromInfo = {}; | |
18 | + | |
19 | + if(scene.length > 0 ) { | |
20 | + const getQueryString = { | |
21 | + uid: undefined, | |
22 | + sid: undefined, | |
23 | + pid: undefined | |
24 | + }; | |
25 | + const strB = scene.split('&'); | |
26 | + | |
27 | + for(let i = 0; i < strB.length; i += 1) { | |
28 | + getQueryString[strB[i].split('=')[0]] = unescape(strB[i].split('=')[1]); | |
29 | + } | |
30 | + fromInfo = { | |
31 | + loginQueryInfo, | |
32 | + fromuid: getQueryString.uid, | |
33 | + fromsid: getQueryString.sid, | |
34 | + frompid: getQueryString.pid, | |
35 | + scene: option.scene, | |
36 | + } | |
37 | + store.dispatch('user/setFrom', fromInfo); | |
38 | + console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString); | |
39 | + } else { | |
40 | + console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo); | |
41 | + if (loginQueryInfo.hasOwnProperty('sid') == false) { | |
42 | + loginQueryInfo.sid = 0; | |
43 | + } | |
44 | + if (loginQueryInfo.hasOwnProperty('pid') == false) { | |
45 | + loginQueryInfo.pid = 0; | |
46 | + } | |
47 | + if (loginQueryInfo.hasOwnProperty('uid') == false) { | |
48 | + loginQueryInfo.uid = 0; | |
49 | + } | |
50 | + fromInfo = { | |
51 | + loginQueryInfo, | |
52 | + fromuid: loginQueryInfo.uid, | |
53 | + fromsid: loginQueryInfo.sid, | |
54 | + frompid: loginQueryInfo.pid, | |
55 | + scene: option.scene, | |
56 | + } | |
57 | + store.dispatch('user/setFrom', fromInfo) | |
58 | + } | |
59 | + | |
60 | + // 登陆 | |
61 | + const openId = uni.getStorageSync('openid') || ""; | |
62 | + if(openId.length <= 10) { | |
63 | + uni.clearStorageSync() | |
64 | + store.dispatch("user/login", fromInfo); | |
65 | + } else { | |
66 | + store.dispatch("user/getUserInfo", fromInfo); | |
67 | + } | |
7 | 68 | }, |
8 | 69 | onShow() { |
9 | 70 | |
... | ... | @@ -11,6 +72,8 @@ |
11 | 72 | }, |
12 | 73 | onHide() { |
13 | 74 | console.log('App Hide') |
75 | + }, | |
76 | + methods: { | |
14 | 77 | } |
15 | 78 | }); |
16 | 79 | </script> | ... | ... |
src/common/data.js
... | ... | @@ -37,6 +37,8 @@ |
37 | 37 | */ |
38 | 38 | // 以下演示数据中,我故意把value设置成跟name一样,只是为了方便演示,使示例更加易懂,实际使用时候value应该是一个标识,给后台识别所用的. |
39 | 39 | // 数据较长,请仔细查看。 |
40 | + | |
41 | + | |
40 | 42 | export default [ |
41 | 43 | { |
42 | 44 | "name":'综合', |
... | ... | @@ -52,8 +54,8 @@ export default [ |
52 | 54 | "name":'品牌', |
53 | 55 | "type": 'filter', |
54 | 56 | "submenu": [{ |
55 | - "name": '品牌', | |
56 | - "value": "品牌", | |
57 | + // "name": '品牌', | |
58 | + // "value": "品牌", | |
57 | 59 | "submenu": [{ |
58 | 60 | "name": "帕森", |
59 | 61 | "value": "帕森", |
... | ... | @@ -70,20 +72,19 @@ export default [ |
70 | 72 | "name":'功能', |
71 | 73 | "type": 'filter', |
72 | 74 | "submenu": [{ |
73 | - "name": "智能排序", | |
74 | - "value": "智能排序" | |
75 | - }, | |
76 | - { | |
77 | - "name": "离我最近", | |
78 | - "value": "离我最近" | |
79 | - }, | |
80 | - { | |
81 | - "name": "人均从高到低", | |
82 | - "value": "人均从高到低" | |
83 | - }, | |
84 | - { | |
85 | - "name": "人均从低到高", | |
86 | - "value": "人均从低到高" | |
75 | + "submenu": [{ | |
76 | + "name": "满减活动", | |
77 | + "value": "满减活动" | |
78 | + }, | |
79 | + { | |
80 | + "name": "打折优惠", | |
81 | + "value": "打折优惠" | |
82 | + }, | |
83 | + { | |
84 | + "name": "会员专享", | |
85 | + "value": "会员专享" | |
86 | + } | |
87 | + ] | |
87 | 88 | } |
88 | 89 | ] |
89 | 90 | }, | ... | ... |
src/components/CommodityCard/CommodityCard.vue
1 | 1 | <template> |
2 | - <view class="card" @tap="toGoods(goods.goods_id,goods.goodType)"> | |
3 | - <image mode="widthFix" :src="goods.img" ></image> | |
2 | + <view class="card" @tap="toGoods(goods.id,goods.goodType)"> | |
3 | + <image mode="widthFix" :src="goods.imgurl" ></image> | |
4 | 4 | <view class="name">{{goods.name}}</view> |
5 | 5 | <view class="info"> |
6 | 6 | <view class="priceBox"> |
7 | 7 | <view class="price">{{goods.price}}</view> |
8 | 8 | <view class="originCost"> |
9 | - {{goods.originCost}} | |
9 | + {{goods.rsSon.Max_Price}} | |
10 | 10 | </view> |
11 | 11 | </view> |
12 | - <view class="slogan">{{goods.slogan}}</view> | |
12 | + <view class="trade_num">{{goods.trade_num}}人购买</view> | |
13 | 13 | </view> |
14 | 14 | </view> |
15 | 15 | </template> |
... | ... | @@ -21,18 +21,19 @@ |
21 | 21 | * 商品数据 |
22 | 22 | */ |
23 | 23 | goods: { |
24 | - goods_id: Number, | |
25 | - img: String, | |
24 | + id: Number, | |
25 | + imgurl: String, | |
26 | 26 | name: String, |
27 | + rsSon:Object, | |
27 | 28 | originCost:String, |
28 | 29 | price: String, |
29 | - slogan:String, | |
30 | + trade_num:String, | |
30 | 31 | goodType:String, |
31 | 32 | } |
32 | 33 | |
33 | 34 | }, |
34 | 35 | created() { |
35 | - console.log(this.goods) | |
36 | + // console.log(this.goods) | |
36 | 37 | }, |
37 | 38 | data() { |
38 | 39 | return { |
... | ... | @@ -40,9 +41,14 @@ |
40 | 41 | }; |
41 | 42 | }, |
42 | 43 | methods:{ |
43 | - toGoods(id,type){ | |
44 | - // console.log('toGoods =====> id======>', id) | |
45 | - // console.log(type) | |
44 | + toGoods(id,type){ | |
45 | + uni.navigateTo({ | |
46 | + url: `../frameDetail/frameDetail?oderId=`+id, | |
47 | + success: res => {}, | |
48 | + fail: () => {}, | |
49 | + complete: () => {} | |
50 | + }); | |
51 | + console.log('toGoods =====> id:'+id +"======>type:"+type) | |
46 | 52 | switch(type){ |
47 | 53 | case 1: |
48 | 54 | uni.navigateTo({ |
... | ... | @@ -124,9 +130,9 @@ |
124 | 130 | } |
125 | 131 | |
126 | 132 | } |
127 | - .slogan{ | |
133 | + .trade_num{ | |
128 | 134 | color: #999999; |
129 | 135 | font-size: 20rpx; |
130 | 136 | } |
131 | 137 | } |
132 | -</style> | |
138 | +</style> | |
133 | 139 | \ No newline at end of file | ... | ... |
src/components/HMFilterDropdown/HMFilterDropdown.vue
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | </scroll-view> |
46 | 46 | </block> |
47 | 47 | </block> |
48 | - <block v-if="page.type=='filter'"> | |
48 | + <block v-if="page.type=='filter'||page.type=='checkbox'"> | |
49 | 49 | <view class="filter"> |
50 | 50 | <scroll-view class="menu-box" :scroll-y="true"> |
51 | 51 | <view class="box" v-for="(box,box_index) in page.submenu" :key="box_index"> |
... | ... | @@ -343,6 +343,7 @@ |
343 | 343 | }); |
344 | 344 | }else{ |
345 | 345 | let submenu = this.subData[i].submenu[item[0]]; |
346 | + // console.log(this.subData[i]) | |
346 | 347 | value[i][0] = submenu.value; |
347 | 348 | if(value[i].length>=2 && item[1]!=null){ |
348 | 349 | if(submenu.submenu.length>0){ |
... | ... | @@ -710,10 +711,15 @@ |
710 | 711 | border-radius: 2px; |
711 | 712 | margin-right: 15px; |
712 | 713 | margin-top: 8px; |
714 | + padding: 0 16rpx; | |
715 | + box-sizing: border-box; | |
713 | 716 | font-size: 12px; |
714 | 717 | flex-direction: row; |
715 | 718 | justify-content: center; |
716 | 719 | align-items: center; |
720 | + overflow: hidden; | |
721 | + white-space: nowrap; | |
722 | + text-overflow: ellipsis; | |
717 | 723 | &:nth-child(4n) { |
718 | 724 | margin-right: 0; |
719 | 725 | } |
... | ... | @@ -723,7 +729,7 @@ |
723 | 729 | } |
724 | 730 | .btn-box { |
725 | 731 | flex-shrink: 0; |
726 | - width: 698rpx; | |
732 | + width: 100%; | |
727 | 733 | height: 75px; |
728 | 734 | flex-direction: row !important; |
729 | 735 | align-items: center; | ... | ... |
src/components/UniSliper/UniSliper.vue
... | ... | @@ -167,7 +167,7 @@ |
167 | 167 | |
168 | 168 | <style scoped lang="scss"> |
169 | 169 | .c-progress { |
170 | - $width: 300px; | |
170 | + $width: 400rpx; | |
171 | 171 | $radius: 5px; |
172 | 172 | display: flex; |
173 | 173 | align-items: center; |
... | ... | @@ -187,9 +187,9 @@ |
187 | 187 | align-items: center; |
188 | 188 | |
189 | 189 | .c-progress-inner { |
190 | - width: 100px; | |
190 | + width: 100rpx; | |
191 | 191 | height: 10px; |
192 | - background: #409EFF; | |
192 | + background: #FF6B4A ; | |
193 | 193 | } |
194 | 194 | |
195 | 195 | .c-progress-slider { |
... | ... | @@ -197,7 +197,7 @@ |
197 | 197 | height: 20px; |
198 | 198 | border-radius: 50%; |
199 | 199 | background: #fff; |
200 | - border: 1px solid #409EFF; | |
200 | + border: 1px solid #FF6B4A ; | |
201 | 201 | position: absolute; |
202 | 202 | z-index: 10; |
203 | 203 | left: 10px; | ... | ... |
src/pages.json
1 | -{ | |
2 | - "pages": [ | |
3 | - { | |
4 | - "path": "pages/index/index", | |
5 | - "style": { | |
6 | - "navigationBarTitleText": "商城一览" | |
7 | - } | |
8 | - }, | |
9 | - { | |
10 | - "path" : "pages/myOrder/myOrder", | |
11 | - "style" : { | |
12 | - "navigationBarTitleText": "我的订单"} | |
13 | - }, | |
14 | - { | |
15 | - "path": "pages/frameDetail/frameDetail", | |
16 | - "style": { | |
17 | - "navigationBarTitleText": "产品详情" | |
18 | - } | |
19 | - }, | |
20 | - { | |
21 | - "path": "pages/lensDetails/lensDetails", | |
22 | - "style": { | |
23 | - "navigationBarTitleText": "产品详情" | |
24 | - } | |
25 | - }, | |
26 | - { | |
27 | - "path": "pages/cart/cart", | |
28 | - "style": { | |
29 | - "navigationBarTitleText": "购物车" | |
30 | - } | |
31 | - }, | |
32 | - { | |
33 | - "path" : "pages/purchaseLenses/purchaseLenses", | |
34 | - "style" : { | |
35 | - "navigationBarTitleText": "产品选购" | |
36 | - } | |
37 | - }, | |
38 | - { | |
39 | - "path" : "pages/refundProgress/refundProgress", | |
40 | - "style": { | |
41 | - "navigationBarTitleText": "申请退款" | |
42 | - } | |
43 | - }, | |
44 | - { | |
45 | - "path": "pages/addAddress/addAddress", | |
46 | - "style": { | |
47 | - "navigationBarTitleText": "新增地址" | |
48 | - } | |
49 | - }, | |
50 | - { | |
51 | - "path" : "pages/confirmOrder/confirmOrder", | |
52 | - "style" : { | |
53 | - "navigationBarTitleText": "确认订单" | |
54 | - } | |
55 | - }, | |
56 | - { | |
57 | - "path": "pages/user/user", | |
58 | - "style": { | |
59 | - "navigationBarTitleText": "我的" | |
60 | - } | |
61 | - }, | |
62 | - { | |
63 | - "path": "pages/refundment/refundWays" | |
64 | - }, | |
65 | - { | |
66 | - "path": "pages/refundment/refundment" | |
67 | - }, | |
68 | - { | |
69 | - "path": "pages/predelivery/predelivery" | |
70 | - }, | |
71 | - { | |
72 | - "path": "pages/customerService/customerService", | |
73 | - "style":{ | |
74 | - "navigationBarTitleText" : "在线客服" | |
75 | - } | |
76 | - }, | |
77 | - { | |
78 | - "path": "pages/myOrderPaying/myOrderPaying", | |
79 | - "style":{ | |
80 | - "navigationBarTitleText" : "我的订单" | |
81 | - } | |
82 | - }, | |
83 | - { | |
84 | - "path": "pages/detailsChoiceArgs/detailsChoiceArgs", | |
85 | - "style":{ | |
86 | - "navigationBarTitleText" : "镜片名称名称" | |
87 | - } | |
88 | - }, | |
89 | - { | |
90 | - "path" : "pages/detailStandard/detailStandard_sun", | |
91 | - "style": { | |
92 | - "navigationBarTitleText": "太阳镜选购页" | |
93 | - } | |
94 | - }, | |
95 | - { | |
96 | - "path" : "pages/detailStandard/detailStandard_k", | |
97 | - "style": { | |
98 | - "navigationBarTitleText": "镜框选购页" | |
99 | - } | |
100 | - } | |
101 | - | |
102 | - ], | |
103 | - "globalStyle": { | |
104 | - "navigationBarTextStyle": "black", | |
105 | - "navigationBarTitleText": "uni-app", | |
106 | - "navigationBarBackgroundColor": "#F8F8F8", | |
107 | - "backgroundColor": "#F8F8F8" | |
108 | - }, | |
109 | - "tabBar": { | |
110 | - "color": "#C0C4CC", | |
111 | - "selectedColor": "#fa436a", | |
112 | - "borderStyle": "black", | |
113 | - "backgroundColor": "#ffffff", | |
114 | - "list": [{ | |
115 | - "pagePath": "pages/index/index", | |
116 | - "iconPath": "static/tab-home.png", | |
117 | - "selectedIconPath": "static/tab-home-current.png", | |
118 | - "text": "首页" | |
119 | - }, | |
120 | - { | |
121 | - "pagePath": "pages/cart/cart", | |
122 | - "iconPath": "static/tab-cart.png", | |
123 | - "selectedIconPath": "static/tab-cart-current.png", | |
124 | - "text": "购物车" | |
125 | - }, | |
126 | - { | |
127 | - "pagePath": "pages/user/user", | |
128 | - "iconPath": "static/tab-my.png", | |
129 | - "selectedIconPath": "static/tab-my-current.png", | |
130 | - "text": "我的" | |
131 | - } | |
132 | - ] | |
133 | - }, | |
134 | - "condition" : { //模式配置,仅开发期间生效 | |
135 | - "current": 0, //当前激活的模式(list 的索引项) | |
136 | - "list": [ | |
137 | - { | |
138 | - "name": "", //模式名称 | |
139 | - "path": "", //启动页面,必选 | |
140 | - "query": "" //启动参数,在页面的onLoad函数里面得到 | |
141 | - } | |
142 | - ] | |
143 | - } | |
144 | -} | |
145 | 1 | \ No newline at end of file |
2 | +{ | |
3 | + "pages" : [ | |
4 | + { | |
5 | + "path" : "pages/index/index", | |
6 | + "style" : { | |
7 | + "navigationBarTitleText" : "商城一览" | |
8 | + } | |
9 | + }, | |
10 | + { | |
11 | + "path" : "pages/myOrder/myOrder", | |
12 | + "style" : { | |
13 | + "navigationBarTitleText" : "我的订单" | |
14 | + } | |
15 | + }, | |
16 | + { | |
17 | + "path" : "pages/cart/cart", | |
18 | + "style" : { | |
19 | + "navigationBarTitleText" : "购物车" | |
20 | + } | |
21 | + }, | |
22 | + { | |
23 | + "path" : "pages/frameDetail/frameDetail", | |
24 | + "style" : { | |
25 | + "navigationBarTitleText" : "产品详情" | |
26 | + } | |
27 | + }, | |
28 | + { | |
29 | + "path" : "pages/lensDetails/lensDetails", | |
30 | + "style" : { | |
31 | + "navigationBarTitleText" : "产品详情" | |
32 | + } | |
33 | + }, | |
34 | + { | |
35 | + "path" : "pages/purchaseLenses/purchaseLenses", | |
36 | + "style" : { | |
37 | + "navigationBarTitleText" : "产品选购" | |
38 | + } | |
39 | + }, | |
40 | + { | |
41 | + "path" : "pages/refundProgress/refundProgress", | |
42 | + "style" : { | |
43 | + "navigationBarTitleText" : "申请退款" | |
44 | + } | |
45 | + }, | |
46 | + { | |
47 | + "path" : "pages/addAddress/addAddress", | |
48 | + "style" : { | |
49 | + "navigationBarTitleText" : "新增地址" | |
50 | + } | |
51 | + }, | |
52 | + { | |
53 | + "path" : "pages/confirmOrder/confirmOrder", | |
54 | + "style" : { | |
55 | + "navigationBarTitleText" : "确认订单" | |
56 | + } | |
57 | + }, | |
58 | + { | |
59 | + "path" : "pages/user/user", | |
60 | + "style" : { | |
61 | + "navigationBarTitleText" : "我的" | |
62 | + } | |
63 | + }, | |
64 | + { | |
65 | + "path" : "pages/refundment/refundWays" | |
66 | + }, | |
67 | + { | |
68 | + "path" : "pages/refundment/refundment" | |
69 | + }, | |
70 | + { | |
71 | + "path" : "pages/predelivery/predelivery" | |
72 | + }, | |
73 | + { | |
74 | + "path" : "pages/customerService/customerService", | |
75 | + "style" : { | |
76 | + "navigationBarTitleText" : "在线客服" | |
77 | + } | |
78 | + }, | |
79 | + { | |
80 | + "path" : "pages/myOrderPaying/myOrderPaying", | |
81 | + "style" : { | |
82 | + "navigationBarTitleText" : "我的订单" | |
83 | + } | |
84 | + }, | |
85 | + { | |
86 | + "path" : "pages/detailsChoiceArgs/detailsChoiceArgs", | |
87 | + "style" : { | |
88 | + "navigationBarTitleText" : "镜片名称名称" | |
89 | + } | |
90 | + }, | |
91 | + { | |
92 | + "path" : "pages/detailStandard/detailStandard_sun", | |
93 | + "style" : { | |
94 | + "navigationBarTitleText" : "太阳镜选购页" | |
95 | + } | |
96 | + }, | |
97 | + { | |
98 | + "path" : "pages/detailStandard/detailStandard_k", | |
99 | + "style" : { | |
100 | + "navigationBarTitleText" : "镜框选购页" | |
101 | + } | |
102 | + } | |
103 | + ], | |
104 | + "globalStyle" : { | |
105 | + "navigationBarTextStyle" : "black", | |
106 | + "navigationBarTitleText" : "uni-app", | |
107 | + "navigationBarBackgroundColor" : "#F8F8F8", | |
108 | + "backgroundColor" : "#F8F8F8" | |
109 | + }, | |
110 | + "tabBar" : { | |
111 | + "color" : "#C0C4CC", | |
112 | + "selectedColor" : "#fa436a", | |
113 | + "borderStyle" : "black", | |
114 | + "backgroundColor" : "#ffffff", | |
115 | + "list" : [ | |
116 | + { | |
117 | + "pagePath" : "pages/index/index", | |
118 | + "iconPath" : "static/tab-home.png", | |
119 | + "selectedIconPath" : "static/tab-home-current.png", | |
120 | + "text" : "首页" | |
121 | + }, | |
122 | + { | |
123 | + "pagePath" : "pages/cart/cart", | |
124 | + "iconPath" : "static/tab-cart.png", | |
125 | + "selectedIconPath" : "static/tab-cart-current.png", | |
126 | + "text" : "购物车" | |
127 | + }, | |
128 | + { | |
129 | + "pagePath" : "pages/user/user", | |
130 | + "iconPath" : "static/tab-my.png", | |
131 | + "selectedIconPath" : "static/tab-my-current.png", | |
132 | + "text" : "我的" | |
133 | + } | |
134 | + ] | |
135 | + }, | |
136 | + "condition" : { | |
137 | + //模式配置,仅开发期间生效 | |
138 | + "current" : 0, //当前激活的模式(list 的索引项) | |
139 | + "list" : [ | |
140 | + { | |
141 | + "name" : "", //模式名称 | |
142 | + "path" : "", //启动页面,必选 | |
143 | + "query" : "" //启动参数,在页面的onLoad函数里面得到 | |
144 | + } | |
145 | + ] | |
146 | + } | |
147 | +} | ... | ... |
src/pages/cart/cart.vue
... | ... | @@ -3,7 +3,6 @@ |
3 | 3 | |
4 | 4 | <view class="card"> |
5 | 5 | <view class="cardHeader"> |
6 | - <!-- <MyCheckbox :isOpenProp="controlCheck.partent" ></MyCheckbox> --> | |
7 | 6 | <block v-if="pIsoPen"> |
8 | 7 | <view class="partentChecked" @click="pChange(pIsoPen)"> |
9 | 8 | <span class="status correct"></span> |
... | ... | @@ -17,7 +16,6 @@ |
17 | 16 | </view> |
18 | 17 | |
19 | 18 | <view class="cardBody"> |
20 | - <!-- <MyCheckbox :isOpenProp="controlCheck.child1"></MyCheckbox> --> | |
21 | 19 | <template v-if="childIsOpen.child1"> |
22 | 20 | <view class="partentChecked" @click="cChange(childIsOpen.child1,'child1')"> |
23 | 21 | <span class="status correct"></span> |
... | ... | @@ -33,7 +31,7 @@ |
33 | 31 | <view class="infoRight"> |
34 | 32 | <text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text> |
35 | 33 | <view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text> |
36 | - <!-- <text class="icon">></text> --> | |
34 | + <view class="icon"></view> | |
37 | 35 | </view> |
38 | 36 | <view class="priceBox"> |
39 | 37 | <view class="price">¥{{198}}</view> |
... | ... | @@ -64,7 +62,7 @@ |
64 | 62 | <view class="infoRight"> |
65 | 63 | <text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text> |
66 | 64 | <view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text> |
67 | - <!-- <text class="icon">></text> --> | |
65 | + <view class="icon"></view> | |
68 | 66 | </view> |
69 | 67 | <view class="priceBox"> |
70 | 68 | <view class="price">¥198</view> |
... | ... | @@ -93,6 +91,8 @@ |
93 | 91 | </template> |
94 | 92 | |
95 | 93 | <script> |
94 | + import store from '@/store'; | |
95 | + | |
96 | 96 | export default { |
97 | 97 | |
98 | 98 | data() { |
... | ... | @@ -107,10 +107,18 @@ |
107 | 107 | }, |
108 | 108 | } |
109 | 109 | }, |
110 | - onLoad() { | |
111 | - | |
112 | - } | |
113 | - , | |
110 | + computed:{ | |
111 | + cartList() { | |
112 | + // 也可以从 getters 获取 | |
113 | + console.log('cart-list', this.$store.state.cart.cartList); | |
114 | + return this.$store.state.cart.cartList; | |
115 | + } | |
116 | + }, | |
117 | + onLoad: function() { | |
118 | + store.dispatch('cart/getCartList',{ | |
119 | + uid: 1, //用户id | |
120 | + }); | |
121 | + }, | |
114 | 122 | methods: { |
115 | 123 | counter(isadd){ |
116 | 124 | if(isadd){ |
... | ... | @@ -251,6 +259,9 @@ |
251 | 259 | font-size: 20rpx; |
252 | 260 | color: #999999; |
253 | 261 | background: #F2F2F2; |
262 | + display: flex; | |
263 | + justify-content: center; | |
264 | + align-items: center; | |
254 | 265 | text{ |
255 | 266 | text-overflow: -o-ellipsis-lastline; |
256 | 267 | overflow: hidden; |
... | ... | @@ -262,7 +273,33 @@ |
262 | 273 | } |
263 | 274 | // .icon{ |
264 | 275 | // transform: rotate(90deg); |
276 | + // height: 13px; | |
277 | + // width: 20px; | |
278 | + | |
265 | 279 | // } |
280 | + .icon{ | |
281 | + width: 0; | |
282 | + height: 0; | |
283 | + border-left: 5px transparent; | |
284 | + border-right: 5px transparent; | |
285 | + border-top: 5px #979797; | |
286 | + border-bottom: 0 transparent; | |
287 | + border-style: solid; | |
288 | + position: relative; | |
289 | + margin-left: 10px; | |
290 | + // transform: scaleY(-1); | |
291 | + } | |
292 | + .icon::after{ | |
293 | + content: ''; | |
294 | + position: absolute; | |
295 | + top: -6.5px; | |
296 | + left: -5px; | |
297 | + border-left: 5px transparent; | |
298 | + border-right: 5px transparent; | |
299 | + border-top: 5px #FFFFFF; | |
300 | + border-bottom: 0 transparent; | |
301 | + border-style: solid; | |
302 | + } | |
266 | 303 | } |
267 | 304 | .priceBox{ |
268 | 305 | display: flex; | ... | ... |
src/pages/detailStandard/detailStandard_k.vue
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | </view> |
11 | 11 | <view class="choose"> |
12 | 12 | <view class="colour"> |
13 | - <view class="colour1"><span>框架颜色</span><image src="/static/img/detail/xiala2.png"></image></view> | |
13 | + <view class="colour1"><span>框架颜色</span><image src="/static/img/detail/xiala.png"></image></view> | |
14 | 14 | <view class="colour_exp">*黑色 BHL192345</view> |
15 | 15 | <view class="colour2"> |
16 | 16 | <view v-for="(colours) in colour" :key="colours.key"><image v-bind:src="colours.img"></image></view> |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <view class="size"> |
21 | 21 | <view class="size1"> |
22 | 22 | <view class="size1_1">框架尺寸</view> |
23 | - <view><span>+¥20</span><image src="/static/img/detail/xiala2.png"></image></view> | |
23 | + <view><span>+¥20</span><image src="/static/img/detail/xiala.png"></image></view> | |
24 | 24 | </view> |
25 | 25 | <view class="size2"> |
26 | 26 | <view>通用</view> |
... | ... | @@ -31,13 +31,13 @@ |
31 | 31 | <view><image class="D3_image" v-bind:src = "item.img"></image></view> |
32 | 32 | <view class="D3_list_jDu"> |
33 | 33 | <!-- uni-sliper插件 --> |
34 | - <c-progress class="c-progress" | |
34 | + <!-- <c-progress class="c-progress" | |
35 | 35 | :percent="item.percent" |
36 | 36 | :show-slider="false" :width="190" |
37 | 37 | :standard="item.standard_l" |
38 | 38 | :stand_width="item.slength" |
39 | 39 | progressColor="#FF6B4A" |
40 | - /> | |
40 | + /> --> | |
41 | 41 | <view>{{item.standard}}</view> |
42 | 42 | </view> |
43 | 43 | </view> |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | <view class="part"> |
48 | 48 | <view class="size1"> |
49 | 49 | <view class="size1_1">配件</view> |
50 | - <view><span>+¥0.00</span><image src="/static/img/detail/xiala2.png"></image></view> | |
50 | + <view><span>+¥0.00</span><image src="/static/img/detail/xiala.png"></image></view> | |
51 | 51 | </view> |
52 | 52 | <view class="colour_exp">*0290</view> |
53 | 53 | <view class="part_som"> |
... | ... | @@ -69,11 +69,9 @@ |
69 | 69 | </template> |
70 | 70 | <script> |
71 | 71 | import CProgress from '../../components/UniSliper/UniSliper' |
72 | +import store from '@/store' | |
72 | 73 | |
73 | 74 | export default { |
74 | - components: { | |
75 | - CProgress | |
76 | - }, | |
77 | 75 | data(){ |
78 | 76 | return{ |
79 | 77 | detail:{ |
... | ... | @@ -112,7 +110,17 @@ export default { |
112 | 110 | {key: 7,img:'/static/img/detail/Kuang/g2.png'}, |
113 | 111 | ], |
114 | 112 | } |
115 | - } | |
113 | + }, | |
114 | + | |
115 | + components: { | |
116 | + detailStandard_k(){ | |
117 | + console.log(detailStandard_k) | |
118 | + return this.$store.state.detailStandard_k.detailStandardList | |
119 | + } | |
120 | + }, | |
121 | + onLoad:function(){ | |
122 | + store.dispatch('detailStandard_k/getList') | |
123 | + }, | |
116 | 124 | } |
117 | 125 | </script> |
118 | 126 | ... | ... |
src/pages/detailsChoiceArgs/compoents/MyCollapse.vue
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | <view class="noRange"> |
23 | 23 | <block v-for="(item,index) in funList2" :key="item.key"> |
24 | 24 | <view v-bind:class="item.isChioce?'boxChoiced-C':'boxChoice-C'" |
25 | - :style="colorList[index]" @click="choice2(index,item.key-1,item.isChioce)"></view> | |
25 | + :style="colorList[index]" @click="choice2(index,item.isChioce)"></view> | |
26 | 26 | </block> |
27 | 27 | </view> |
28 | 28 | </block> |
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | <view class="noRange" style="max-width: 624rpx"> |
40 | 40 | <block v-for="(item,index) in funList2" :key="item.key"> |
41 | 41 | <view v-bind:class="item.isChioce?'boxChoiced':'boxChoice'" |
42 | - @click="choice2(index,item.key-1,item.isChioce)">{{item.name}}</view> | |
42 | + @click="choice2(index,item.isChioce)">{{item.name}}</view> | |
43 | 43 | </block> |
44 | 44 | </view> |
45 | 45 | </block> |
... | ... | @@ -103,21 +103,49 @@ |
103 | 103 | this.isOpen = !isopen |
104 | 104 | }, |
105 | 105 | choice(index,isChoice){ |
106 | - this.funList[index].isChioce = !isChoice | |
107 | - if(!isChoice){ | |
108 | - this.funContent[index] = this.funList[index].name | |
106 | + if(this.funList[index].type==="fun"){ | |
107 | + this.funList[index].isChioce = !isChoice | |
108 | + if(!isChoice){ | |
109 | + this.funContent[index] = this.funList[index].name | |
110 | + } | |
111 | + else{ | |
112 | + this.funContent[index] = '' | |
113 | + } | |
109 | 114 | } |
110 | - else{ | |
111 | - this.funContent[index] = '' | |
115 | + else if(this.funList[index].type==="kind"){ | |
116 | + for(let i=0;i<this.funList.length;i++){ | |
117 | + this.funList[i].isChioce = false | |
118 | + } | |
119 | + this.funList[index].isChioce = !isChoice | |
120 | + this.funContent[0]=this.funList[index].name | |
121 | + }else { | |
122 | + for(let i=0;i<this.funList.length;i++){ | |
123 | + this.funList[i].isChioce = false | |
124 | + } | |
125 | + for(let i=0;i<this.funList2.length;i++){ | |
126 | + this.funList2[i].isChioce = false | |
127 | + } | |
128 | + this.funList[index].isChioce = !isChoice | |
129 | + this.funContent[0]=this.funList[index].name | |
112 | 130 | } |
113 | 131 | }, |
114 | - choice2(index,conIndex,isChoice){ | |
115 | - this.funList2[index].isChioce = !isChoice | |
116 | - if(!isChoice){ | |
117 | - this.funContent[conIndex] = this.funList2[index].name | |
132 | + choice2(index,isChoice){ | |
133 | + if(this.funList2[index].type==="kind"){ | |
134 | + for(let i=0;i<this.funList2.length;i++){ | |
135 | + this.funList2[i].isChioce = false | |
136 | + } | |
137 | + this.funList2[index].isChioce = !isChoice | |
138 | + this.funContent[1] = this.funList2[index].name | |
118 | 139 | } |
119 | 140 | else{ |
120 | - this.funContent[conIndex] = '' | |
141 | + for(let i=0;i<this.funList.length;i++){ | |
142 | + this.funList[i].isChioce = false | |
143 | + } | |
144 | + for(let i=0;i<this.funList2.length;i++){ | |
145 | + this.funList2[i].isChioce = false | |
146 | + } | |
147 | + this.funList2[index].isChioce = !isChoice | |
148 | + this.funContent[0]=this.funList2[index].name | |
121 | 149 | } |
122 | 150 | } |
123 | 151 | } | ... | ... |
src/pages/detailsChoiceArgs/detailsChoiceArgs.vue
... | ... | @@ -177,27 +177,27 @@ |
177 | 177 | // 实用功能参数 |
178 | 178 | funIsOpen:true, // 默认myCollapse开启 |
179 | 179 | funList: [ |
180 | - {"name":"防紫外线","isChioce": false,"key":1}, | |
181 | - {"name":"防蓝光","isChioce": false,"key":2}, | |
182 | - {"name":"智能变色","isChioce": false,"key":3}, | |
183 | - {"name":"易清洁","isChioce": false,"key":4}, | |
184 | - {"name":"防辐射","isChioce": false,"key":5}, | |
185 | - {"name":"抗疲劳","isChioce": false,"key":6}, | |
180 | + {"name":"防紫外线","isChioce": false,"key":1,"type": "fun"}, | |
181 | + {"name":"防蓝光","isChioce": false,"key":2,"type": "fun"}, | |
182 | + {"name":"智能变色","isChioce": false,"key":3,"type": "fun"}, | |
183 | + {"name":"易清洁","isChioce": false,"key":4,"type": "fun"}, | |
184 | + {"name":"防辐射","isChioce": false,"key":5,"type": "fun"}, | |
185 | + {"name":"抗疲劳","isChioce": false,"key":6,"type": "fun"}, | |
186 | 186 | ], |
187 | 187 | funContent:[], |
188 | 188 | |
189 | 189 | // 镜片种类参数 |
190 | 190 | kindIsOpen:true, |
191 | 191 | kindList1: [ |
192 | - {"name":"染色","isChioce":false,key:1}, | |
193 | - {"name":"渐变","isChioce":false,key:2}, | |
192 | + {"name":"染色","isChioce":false,key:1,"type": "kind"}, | |
193 | + {"name":"渐变","isChioce":false,key:2,"type": "kind"}, | |
194 | 194 | ], |
195 | 195 | kindList2: [ |
196 | - {"name":"JB234759","isChioce":false,key:3}, | |
197 | - {"name":"JB234759","isChioce":false,key:4}, | |
198 | - {"name":"JB234759","isChioce":false,key:5}, | |
199 | - {"name":"JB234759","isChioce":false,key:6}, | |
200 | - {"name":"JB234759","isChioce":false,key:7}, | |
196 | + {"name":"JB234759","isChioce":false,key:3,"type": "kind"}, | |
197 | + {"name":"JB234759","isChioce":false,key:4,"type": "kind"}, | |
198 | + {"name":"JB234759","isChioce":false,key:5,"type": "kind"}, | |
199 | + {"name":"JB234759","isChioce":false,key:6,"type": "kind"}, | |
200 | + {"name":"JB234759","isChioce":false,key:7,"type": "kind"}, | |
201 | 201 | ], |
202 | 202 | kindContent:[], |
203 | 203 | // 材质选择 | ... | ... |
src/pages/frameDetail/frameDetail.vue
... | ... | @@ -159,6 +159,7 @@ |
159 | 159 | </template> |
160 | 160 | |
161 | 161 | <script> |
162 | +import store from '@/store'; | |
162 | 163 | export default { |
163 | 164 | data(){ |
164 | 165 | return { |
... | ... | @@ -214,12 +215,17 @@ export default { |
214 | 215 | }, |
215 | 216 | onLoad:function(option){ |
216 | 217 | this.goodType = option.goodType |
217 | - console.log(this.updateGoodType) | |
218 | + // console.log(this.updateGoodType) | |
219 | + store.dispatch('read/fetch'); | |
218 | 220 | }, |
219 | 221 | computed:{ |
220 | 222 | updateGoodType(){ |
221 | 223 | return this.goodType |
222 | - } | |
224 | + }, | |
225 | + goodInfo() { | |
226 | + console.log(this.$store.state.read.goodInfo) | |
227 | + return this.$store.state.read.goodInfo; | |
228 | + }, | |
223 | 229 | }, |
224 | 230 | methods:{ |
225 | 231 | goPerchase(){ | ... | ... |
src/pages/index/index.vue
... | ... | @@ -105,30 +105,85 @@ export default { |
105 | 105 | loadingText: "~~到底了~~", |
106 | 106 | filterDropdownValue: [], |
107 | 107 | filterData: [], |
108 | - goodsList:[ | |
109 | - { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
110 | - { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | |
111 | - { goods_id: 2, img: '/static/img/goods/p3.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | |
112 | - { goods_id: 3, img: '/static/img/goods/p4.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | |
113 | - { goods_id: 4, img: '/static/img/goods/p5.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
114 | - { goods_id: 5, img: '/static/img/goods/p6.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | |
115 | - { goods_id: 6, img: '/static/img/goods/p7.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | |
116 | - { goods_id: 7, img: '/static/img/goods/p8.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | |
117 | - { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
118 | - { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 } | |
119 | - ], | |
108 | + // goodsList:[ | |
109 | + // { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
110 | + // { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | |
111 | + // { goods_id: 2, img: '/static/img/goods/p3.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | |
112 | + // { goods_id: 3, img: '/static/img/goods/p4.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | |
113 | + // { goods_id: 4, img: '/static/img/goods/p5.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
114 | + // { goods_id: 5, img: '/static/img/goods/p6.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | |
115 | + // { goods_id: 6, img: '/static/img/goods/p7.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | |
116 | + // { goods_id: 7, img: '/static/img/goods/p8.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | |
117 | + // { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | |
118 | + // { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 } | |
119 | + // ], | |
120 | 120 | }; |
121 | 121 | }, |
122 | 122 | computed: { |
123 | - // goodsList() { | |
124 | - // // 也可以从 getters 获取 | |
125 | - // console.log('list', this.$store.state.test.list); | |
126 | - // return this.$store.state.test.list; | |
127 | - // }, | |
128 | - // categoryList(){ | |
129 | - // console.log(this.$store.state.categoryOrder.categoryList); | |
130 | - // this.filterData = this.$store.state.categoryOrder.categoryList | |
131 | - // } | |
123 | + goodsList() { | |
124 | + // 也可以从 getters 获取 | |
125 | + return this.$store.state.test.list; | |
126 | + }, | |
127 | + categoryList(){ | |
128 | + // console.log(this.$store.state.categoryOrder.categoryList); | |
129 | + const categoryList = this.$store.state.categoryOrder.categoryList | |
130 | + let newData = [ | |
131 | + { | |
132 | + "name":'产品', | |
133 | + "type": 'filter', | |
134 | + "submenu": [{ | |
135 | + "submenu": [ | |
136 | + | |
137 | + ] | |
138 | + }, | |
139 | + ], | |
140 | + }, | |
141 | + { | |
142 | + "name":'品牌', | |
143 | + "type": 'filter', | |
144 | + "submenu": [{ | |
145 | + "submenu": [ | |
146 | + ] | |
147 | + }, | |
148 | + ] | |
149 | + }, | |
150 | + { | |
151 | + "name":'使用场景', | |
152 | + "type": 'filter', | |
153 | + "submenu": [{ | |
154 | + "submenu": [ | |
155 | + ] | |
156 | + } | |
157 | + ] | |
158 | + }, | |
159 | + { | |
160 | + "name":'材质', | |
161 | + "type": 'filter', | |
162 | + "submenu": [{ | |
163 | + "submenu": [ | |
164 | + ] | |
165 | + } | |
166 | + ] | |
167 | + }, | |
168 | + { | |
169 | + "name":'筛选', | |
170 | + "type": 'filter', | |
171 | + "submenu": [{ | |
172 | + // "name": "折扣(多选)", | |
173 | + "submenu": [ | |
174 | + ] | |
175 | + } | |
176 | + ] | |
177 | + } | |
178 | + ] | |
179 | + // newData[0].submenu[0].submenu = categoryList[0].submenu | |
180 | + // newData[1].submenu[0].submenu = categoryList[3].submenu[5].submenu | |
181 | + // newData[2].submenu[0].submenu = categoryList[3].submenu[2].submenu | |
182 | + // newData[3].submenu[0].submenu = categoryList[3].submenu[4].submenu | |
183 | + // newData[4].submenu[0] = categoryList[3] | |
184 | + this.filterData = newData; | |
185 | + // this.filterData = categoryList; | |
186 | + } | |
132 | 187 | |
133 | 188 | }, |
134 | 189 | filters: { |
... | ... | @@ -139,19 +194,10 @@ export default { |
139 | 194 | onLoad: function() { |
140 | 195 | store.dispatch('test/fetch'); |
141 | 196 | store.dispatch('categoryOrder/fetch') |
142 | - | |
143 | - //定时器模拟ajax异步请求数据 | |
144 | - setTimeout(()=>{ | |
145 | - //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null | |
146 | - // this.filterDropdownValue = [ | |
147 | - // [1,1,0], //第0个菜单选中 一级菜单的第1项,二级菜单的第1项,三级菜单的第3项 | |
148 | - // [null,null], //第1个菜单选中 都不选中 | |
149 | - // [1], //第2个菜单选中 一级菜单的第1项 | |
150 | - // [[0],[1,2,7],[1,0]], //筛选菜单选中 第一个筛选的第0项,第二个筛选的第1,2,7项,第三个筛选的第1,0项 | |
151 | - // [[0],[1],[1]], //单选菜单选中 第一个筛选的第0项,第二个筛选的第1项,第三个筛选的第1项 | |
152 | - // ]; | |
153 | - // this.filterData = data; | |
154 | - },100); | |
197 | + | |
198 | + // 登陆 | |
199 | + // store.dispatch('user/login') | |
200 | + | |
155 | 201 | }, |
156 | 202 | methods: { |
157 | 203 | showDrawer(e) { | ... | ... |
src/pages/myOrderPaying/myOrderPaying.vue
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | </view> |
18 | 18 | <view class="order-user-body"> |
19 | 19 | <image src="../../static/myorder-paying-location.png"></image> |
20 | - <text class="p3">四川省 德阳市 旌阳区</br>黄河西路碧桂园3期 4单元 202</text> | |
20 | + <text class="p3">四川省 德阳市 旌阳区\n黄河西路碧桂园3期 4单元 202</text> | |
21 | 21 | </view> |
22 | 22 | </view> |
23 | 23 | <view class="order-info"> | ... | ... |
src/pages/user/user.vue
1 | 1 | <template> |
2 | 2 | <view class="wrap"> |
3 | - <view class="content"> | |
3 | + <view v-if="isAuth" class="content"> | |
4 | 4 | <view class="userInfo"> |
5 | 5 | <view class="info"> |
6 | - <image src="../../static/img/detail/d10.png" mode="aspectFill"></image> | |
6 | + <image :src="headerphoto" mode="aspectFill"></image> | |
7 | 7 | <view class="infoText"> |
8 | - <text class="userName">{{userName}}</text> | |
9 | - <text class="nickName">用户名:骆驼不死的祥子</text> | |
8 | + <text class="userName">{{nickName}}</text> | |
10 | 9 | </view> |
11 | 10 | </view> |
12 | 11 | <view class="service"> |
... | ... | @@ -27,7 +26,7 @@ |
27 | 26 | <text>待付款</text> |
28 | 27 | </view> |
29 | 28 | <view class="item waitDeliver" @click="toPredelivery" > |
30 | - <image src="../../static/waitDeliver.png" mode="aspectFill"></image> | |
29 | + <image src="../../static/waitPay.png" mode="aspectFill"></image> | |
31 | 30 | <text>待发货</text> |
32 | 31 | </view> |
33 | 32 | <view class="item waitReceive" @click="torefunProgress"> |
... | ... | @@ -49,7 +48,7 @@ |
49 | 48 | <!-- 商品列表 --> |
50 | 49 | <view class="goods-list"> |
51 | 50 | <view class="product-list"> |
52 | - <view class="product" v-for="(goods) in goodsList" :key="goods.goods_id" @tap="toGoods(goods.goods_id)"> | |
51 | + <view class="product" v-for="(goods) in goodsList" :key="goods.goods_id" > | |
53 | 52 | <Card :goods = "goods"></Card> |
54 | 53 | </view> |
55 | 54 | </view> |
... | ... | @@ -57,19 +56,30 @@ |
57 | 56 | </view> |
58 | 57 | </view> |
59 | 58 | </view> |
60 | - | |
59 | + <view v-else class="auth"> | |
60 | + <view class="icon"></view> | |
61 | + <view class="divider"></view> | |
62 | + <view class="title">申请获取以下权限</view> | |
63 | + <view class="text">获得您的公开信息(昵称、头像等)</view> | |
64 | + <button | |
65 | + type="primary" | |
66 | + open-type="getUserInfo" | |
67 | + @getuserinfo="onGotUserInfo" | |
68 | + >授权登陆</button> | |
69 | + </view> | |
61 | 70 | </view> |
62 | 71 | </template> |
63 | 72 | |
64 | 73 | <script> |
65 | - import Card from "@/components/CommodityCard/CommodityCard.vue" | |
74 | + import Card from "@/components/CommodityCard/CommodityCard.vue"; | |
75 | + import store from '@/store'; | |
76 | + | |
66 | 77 | export default { |
67 | 78 | components: { |
68 | 79 | 'Card':Card |
69 | 80 | }, |
70 | 81 | data() { |
71 | 82 | return { |
72 | - | |
73 | 83 | //商品数据 |
74 | 84 | goodsList:[ |
75 | 85 | { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' }, |
... | ... | @@ -83,14 +93,52 @@ |
83 | 93 | { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' }, |
84 | 94 | { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' } |
85 | 95 | ], |
86 | - headerphoto:'', | |
87 | - userName:'Adam' | |
96 | + isAuth: true, // 是否显示授权页面 | |
88 | 97 | } |
89 | 98 | }, |
90 | 99 | onLoad() { |
91 | - | |
100 | + // 判断是否授权 | |
101 | + uni.getSetting({ | |
102 | + success(res) { | |
103 | + console.log('authSetting',res.authSetting) | |
104 | + if(res.authSetting['scope.userInfo'] === true) { | |
105 | + this.isAuth = true | |
106 | + } else { | |
107 | + this.isAuth = false | |
108 | + } | |
109 | + } | |
110 | + }) | |
111 | + }, | |
112 | + computed: { | |
113 | + nickName() { | |
114 | + console.log('nickName', this.$store.state.user.userInfo) | |
115 | + return this.$store.state.user.userInfo.nickName; | |
116 | + }, | |
117 | + headerphoto() { | |
118 | + return this.$store.state.user.userInfo.headerphoto; | |
119 | + }, | |
120 | + userRecommandList() { | |
121 | + console.log('recommandList', this.$store.state.userRecommand.recommandList); | |
122 | + return this.$store.state.userRecommand.recommandList; | |
123 | + } | |
124 | + }, | |
125 | + onLoad: function() { | |
126 | + store.dispatch('userRecommand/getRecommandList', { | |
127 | + uid: 2, | |
128 | + }); | |
92 | 129 | }, |
93 | 130 | methods: { |
131 | + // 授权 | |
132 | + onGotUserInfo(e) { | |
133 | + console.log('anthInfo', e); | |
134 | + if(e.detail.errMsg == 'getUserInfo:ok') { | |
135 | + const { fromInfo } = this.$store.state.user; | |
136 | + console.log('=====la', fromInfo) | |
137 | + // 用户授权成功 | |
138 | + store.dispatch('user/getUserInfo', fromInfo); | |
139 | + this.isAuth = true | |
140 | + } | |
141 | + }, | |
94 | 142 | toMyOrder(){ |
95 | 143 | uni.navigateTo({ |
96 | 144 | url: '../myOrder/myOrder?current=0', |
... | ... | @@ -181,6 +229,7 @@ |
181 | 229 | } |
182 | 230 | } |
183 | 231 | .service{ |
232 | + margin-top: 20rpx; | |
184 | 233 | image{ |
185 | 234 | height: 36rpx; |
186 | 235 | width: 36rpx; |
... | ... | @@ -296,5 +345,42 @@ |
296 | 345 | } |
297 | 346 | } |
298 | 347 | } |
348 | + .auth { | |
349 | + height: 100vh; | |
350 | + display: flex; | |
351 | + flex-direction: column; | |
352 | + align-items: center; | |
353 | + .icon { | |
354 | + width: 140rpx; | |
355 | + height: 140rpx; | |
356 | + border-radius: 50%; | |
357 | + margin-top: 100rpx; | |
358 | + background-color: grey; | |
359 | + } | |
360 | + .divider { | |
361 | + height: 1rpx; | |
362 | + width: 600rpx; | |
363 | + margin-top: 80rpx; | |
364 | + background-color: #E6E3E3; | |
365 | + } | |
366 | + .title { | |
367 | + width: 600rpx; | |
368 | + margin-top: 50rpx; | |
369 | + text-align: left; | |
370 | + } | |
371 | + .text { | |
372 | + width: 600rpx; | |
373 | + margin-top: 30rpx; | |
374 | + text-align: left; | |
375 | + color: #E6E3E3; | |
376 | + } | |
377 | + button { | |
378 | + width: 450rpx; | |
379 | + height: 80rpx; | |
380 | + line-height: 80rpx; | |
381 | + margin-top: 80rpx; | |
382 | + border-radius: 30rpx; | |
383 | + } | |
384 | + } | |
299 | 385 | |
300 | 386 | </style> | ... | ... |
src/store/index.js
src/store/modules/cart.js
... | ... | @@ -0,0 +1,43 @@ |
1 | +import urlAlias from '../url'; | |
2 | +import request from '../request'; | |
3 | + | |
4 | +const { cartList } = urlAlias; | |
5 | + | |
6 | +const state = { | |
7 | + cartList: [], | |
8 | +}; | |
9 | + | |
10 | +const mutations = { | |
11 | + INIT: (state, cartList) => { | |
12 | + state.cartList = cartList; | |
13 | + }, | |
14 | +}; | |
15 | + | |
16 | + | |
17 | + | |
18 | +const actions = { | |
19 | + | |
20 | + getCartList({ commit }, param) { | |
21 | + request({ | |
22 | + url: cartList, | |
23 | + success: (res) => { | |
24 | + | |
25 | + commit('INIT', res.data.data) | |
26 | + }, | |
27 | + fail: (res) => { | |
28 | + console.log("fail status === > ", res); | |
29 | + }, | |
30 | + complete: (res) => { | |
31 | + console.log("complete status === > ", res); | |
32 | + }, | |
33 | + }) | |
34 | + } | |
35 | + | |
36 | +} | |
37 | + | |
38 | +export default { | |
39 | + namespaced: true, | |
40 | + state, | |
41 | + mutations, | |
42 | + actions, | |
43 | +}; | |
0 | 44 | \ No newline at end of file | ... | ... |
src/store/modules/detailStandard_k.js
... | ... | @@ -0,0 +1,42 @@ |
1 | +import urlAlias from '../url'; | |
2 | +import request from '../request'; | |
3 | + | |
4 | +const { | |
5 | + detailStandardList | |
6 | +} = urlAlias | |
7 | + | |
8 | +const state = { | |
9 | + list:[], | |
10 | +}; | |
11 | + | |
12 | +const mutations = { | |
13 | + INIT: (state, detailStandardList) => { | |
14 | + state.detailStandardList = detailStandardList; | |
15 | + }, | |
16 | +}; | |
17 | + | |
18 | +const actions = { | |
19 | + getList({ commit }, param){ | |
20 | + request({ | |
21 | + detailStandardList, | |
22 | + success: (res) => { | |
23 | + | |
24 | + commit('INIT', res.data.data) | |
25 | + console,log('success') | |
26 | + }, | |
27 | + fail: (res) => { | |
28 | + console.log("detail status === > ", res); | |
29 | + }, | |
30 | + complete: (res) => { | |
31 | + console.log("detail compete status === > ", res); | |
32 | + }, | |
33 | + }) | |
34 | + } | |
35 | +} | |
36 | + | |
37 | +export default { | |
38 | + namespaced: true, | |
39 | + state, | |
40 | + mutations, | |
41 | + actions, | |
42 | +} | |
0 | 43 | \ No newline at end of file | ... | ... |
src/store/modules/read.js
... | ... | @@ -0,0 +1,40 @@ |
1 | + import urlAlias from '../url'; | |
2 | + import request from '../request'; | |
3 | + | |
4 | + const { | |
5 | + read | |
6 | + } = urlAlias; | |
7 | + | |
8 | +const state = { | |
9 | + goodInfo: [], | |
10 | +}; | |
11 | + | |
12 | +const mutations = { | |
13 | + INIT: (state, goodInfo) => { | |
14 | + state.goodInfo = goodInfo; | |
15 | + }, | |
16 | +}; | |
17 | + | |
18 | +const actions = { | |
19 | + fetch({ commit }, param) { | |
20 | + request({ | |
21 | + url: read, | |
22 | + success: (res) => { | |
23 | + commit('INIT', res.data.data) | |
24 | + }, | |
25 | + fail: (res) => { | |
26 | + console.log("fail status === > ", res); | |
27 | + }, | |
28 | + complete: (res) => { | |
29 | + console.log("complete status === > ", res); | |
30 | + }, | |
31 | + }) | |
32 | + }, | |
33 | +}; | |
34 | + | |
35 | +export default { | |
36 | + namespaced: true, | |
37 | + state, | |
38 | + mutations, | |
39 | + actions, | |
40 | +}; | ... | ... |
src/store/modules/user.js
... | ... | @@ -0,0 +1,132 @@ |
1 | +import urlAlias from '../url'; | |
2 | +import request from '../request'; | |
3 | + | |
4 | +const { | |
5 | + login, | |
6 | + getUserInfo, | |
7 | +} = urlAlias; | |
8 | + | |
9 | +const state = { | |
10 | + fromInfo: { | |
11 | + loginQueryInfo: {}, | |
12 | + fromuid: 0, | |
13 | + fromsid: 0, | |
14 | + frompid: 0, | |
15 | + scene: 1001, | |
16 | + }, | |
17 | + userInfo: { | |
18 | + uid: 1, | |
19 | + openid: '', | |
20 | + nickName: '', | |
21 | + headerphoto: '', | |
22 | + } | |
23 | +}; | |
24 | + | |
25 | +const mutations = { | |
26 | + FROM: (state, data) => { | |
27 | + state.formInfo = data; | |
28 | + }, | |
29 | + UPDATE: (state, data) => { | |
30 | + state.userInfo = data; | |
31 | + } | |
32 | +}; | |
33 | + | |
34 | +const actions = { | |
35 | + // 登陆 | |
36 | + login({ commit }, param) { | |
37 | + const { | |
38 | + frompid = undefined, | |
39 | + fromsid = undefined, | |
40 | + fromuid = undefined, | |
41 | + scene = 1001 , | |
42 | + } = param || {}; | |
43 | + uni.login({ | |
44 | + provider: 'weixin', | |
45 | + success: function (loginRes) { | |
46 | + console.log('login',loginRes); | |
47 | + request({ | |
48 | + url: login, | |
49 | + data: { | |
50 | + app_uid: 2020, | |
51 | + code: loginRes.code, | |
52 | + frompid, | |
53 | + fromsid, | |
54 | + fromuid, | |
55 | + | |
56 | + }, | |
57 | + success: (res) => { | |
58 | + const { data: { session_key, openid} } = res; | |
59 | + console.log('res', res) | |
60 | + // 写入缓存 | |
61 | + uni.setStorageSync('session_key', session_key); | |
62 | + uni.setStorageSync('openid', openid); | |
63 | + request({ | |
64 | + url: getUserInfo, | |
65 | + data: { | |
66 | + app_uid: 2020, | |
67 | + frompid, | |
68 | + fromsid, | |
69 | + fromuid, | |
70 | + openid, | |
71 | + scene, | |
72 | + }, | |
73 | + success: (res) => { | |
74 | + console.log('userInfo=====', res); | |
75 | + const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; | |
76 | + const userInfo = { | |
77 | + uid, | |
78 | + openid, | |
79 | + nickName, | |
80 | + headerphoto, | |
81 | + } | |
82 | + commit("UPDATE", userInfo) | |
83 | + } | |
84 | + }) | |
85 | + } | |
86 | + }) | |
87 | + } | |
88 | + }); | |
89 | + }, | |
90 | + setFrom({ commit }, param) { | |
91 | + commit("FROM", param); | |
92 | + }, | |
93 | + getUserInfo( { commit }, param) { | |
94 | + const { | |
95 | + frompid = undefined, | |
96 | + fromsid = undefined, | |
97 | + fromuid = undefined, | |
98 | + scene = 1001 , | |
99 | + } = param || {}; | |
100 | + // 写入缓存 | |
101 | + const openid = uni.getStorageSync('openid', openid); | |
102 | + request({ | |
103 | + url: getUserInfo, | |
104 | + data: { | |
105 | + app_uid: 2020, | |
106 | + frompid, | |
107 | + fromsid, | |
108 | + fromuid, | |
109 | + openid, | |
110 | + scene, | |
111 | + }, | |
112 | + success: (res) => { | |
113 | + console.log('userInfo=====', res); | |
114 | + const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; | |
115 | + const userInfo = { | |
116 | + uid, | |
117 | + openid, | |
118 | + nickName, | |
119 | + headerphoto, | |
120 | + } | |
121 | + commit("UPDATE", userInfo) | |
122 | + } | |
123 | + }) | |
124 | + }, | |
125 | +} | |
126 | + | |
127 | +export default { | |
128 | + namespaced: true, | |
129 | + state, | |
130 | + mutations, | |
131 | + actions, | |
132 | +} | |
0 | 133 | \ No newline at end of file | ... | ... |
src/store/modules/userRecommand.js
... | ... | @@ -0,0 +1,41 @@ |
1 | + import urlAlias from '../url'; | |
2 | + import request from '../request'; | |
3 | + | |
4 | + const { | |
5 | + recommandList | |
6 | + } = urlAlias; | |
7 | + | |
8 | +const state = { | |
9 | + recommandList: [], | |
10 | +}; | |
11 | + | |
12 | +const mutations = { | |
13 | + INIT: (state, list) => { | |
14 | + state.recommandList = list; | |
15 | + }, | |
16 | +}; | |
17 | + | |
18 | +const actions = { | |
19 | + getRecommandList({ commit }, param) { | |
20 | + request({ | |
21 | + url: recommandList, | |
22 | + success: (res) => { | |
23 | + console.log(res.data) | |
24 | + commit('INIT', res.data.data) | |
25 | + }, | |
26 | + fail: (res) => { | |
27 | + console.log("fail status === > ", res); | |
28 | + }, | |
29 | + complete: (res) => { | |
30 | + console.log("complete status === > ", res); | |
31 | + }, | |
32 | + }) | |
33 | + }, | |
34 | +}; | |
35 | + | |
36 | +export default { | |
37 | + namespaced: true, | |
38 | + state, | |
39 | + mutations, | |
40 | + actions, | |
41 | +}; | |
0 | 42 | \ No newline at end of file | ... | ... |
src/store/url.js
1 | 1 | const urlAlias = { |
2 | 2 | // 获取首页商品列表 |
3 | - shopList: '/app/prod/list', | |
4 | - | |
5 | - // 获取首页商品列表 | |
6 | - category: '/app/prod/category', | |
3 | + shopList: '/app/prod/list', | |
4 | + | |
5 | + // 获取首页商品列表 | |
6 | + category: '/app/prod/category2', | |
7 | + // 获取商品信息 | |
8 | + read: '/app/prod/read', | |
9 | + | |
10 | + // 首页 | |
11 | + shopList: '/app/prod/list', // 获取首页商品列表 | |
12 | + category: '/app/prod/category', // 获取首页商品分类 | |
13 | + | |
14 | + // 登陆 | |
15 | + login: '/app/glass/getOpenId', // 登陆 | |
16 | + getUserInfo: '/app/glass/userinfo', // 获取用户信息 | |
17 | + | |
18 | + // 我的订单 | |
19 | + orderList: '/app/order/list', // 获取订单列表 | |
20 | + | |
21 | + // 购物车 | |
22 | + cartList: '/app/cart/list', // 获取购物车列表 | |
23 | + | |
24 | + // 我的 | |
25 | + recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品 | |
26 | + | |
27 | + // 镜框选购页 | |
28 | + detailStandardList: '/app/prod/read', //获取商品的详细信息 | |
29 | + | |
7 | 30 | } |
8 | 31 | |
9 | 32 | export default urlAlias; | ... | ... |