Commit 600d4968f3ddf579b41a2e35c1c089e29a3dcb23
Exists in
master
修改冲突
Showing
13 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/components/CommodityCard/CommodityCard.vue
1 | -<template> | |
2 | - <view class="card" @tap="toGoods(goods.goods_id,goods.goodType)"> | |
3 | - <image mode="widthFix" :src="goods.img" ></image> | |
4 | - <view class="name">{{goods.name}}</view> | |
5 | - <view class="info"> | |
6 | - <view class="priceBox"> | |
7 | - <view class="price">{{goods.price}}</view> | |
8 | - <view class="originCost"> | |
9 | - {{goods.originCost}} | |
10 | - </view> | |
11 | - </view> | |
12 | - <view class="slogan">{{goods.slogan}}</view> | |
13 | - </view> | |
14 | - </view> | |
15 | -</template> | |
16 | - | |
17 | -<script> | |
18 | - export default { | |
19 | - props: { | |
20 | - /** | |
21 | - * 商品数据 | |
22 | - */ | |
23 | - goods: { | |
24 | - goods_id: Number, | |
25 | - img: String, | |
26 | - name: String, | |
27 | - originCost:String, | |
28 | - price: String, | |
29 | - slogan:String, | |
30 | - goodType:String, | |
31 | - } | |
32 | - | |
33 | - }, | |
34 | - created() { | |
35 | - console.log(this.goods) | |
36 | - }, | |
37 | - data() { | |
38 | - return { | |
39 | - | |
40 | - }; | |
41 | - }, | |
42 | - methods:{ | |
43 | - toGoods(id,type){ | |
44 | - // console.log('toGoods =====> id======>', id) | |
45 | - // console.log(type) | |
46 | - switch(type){ | |
47 | - case 1: | |
48 | - uni.navigateTo({ | |
49 | - url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
50 | - success: res => {}, | |
51 | - fail: () => {}, | |
52 | - complete: () => {} | |
53 | - }); | |
54 | - break; | |
55 | - case 2: | |
56 | - uni.navigateTo({ | |
57 | - url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
58 | - success: res => {}, | |
59 | - fail: () => {}, | |
60 | - complete: () => {} | |
61 | - }); | |
62 | - break; | |
63 | - case 3: | |
64 | - uni.navigateTo({ | |
65 | - url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
66 | - success: res => {}, | |
67 | - fail: () => {}, | |
68 | - complete: () => {} | |
69 | - }); | |
70 | - break; | |
71 | - case 4: | |
72 | - uni.navigateTo({ | |
73 | - url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
74 | - success: res => {}, | |
75 | - fail: () => {}, | |
76 | - complete: () => {} | |
77 | - }); | |
78 | - break; | |
79 | - default : | |
80 | - break | |
81 | - } | |
82 | - } | |
83 | - } | |
84 | - } | |
85 | -</script> | |
86 | - | |
87 | -<style lang="scss"> | |
88 | - image{ | |
89 | - width: 100%; | |
90 | - height: 120rpx; | |
91 | - } | |
92 | - .name{ | |
93 | - width: 92%; | |
94 | - height: 54rpx; | |
95 | - padding: 5px 4%; | |
96 | - display: -webkit-box; | |
97 | - -webkit-box-orient: vertical; | |
98 | - -webkit-line-clamp: 2; | |
99 | - text-align: justify; | |
100 | - overflow: hidden; | |
101 | - font-size: 24rpx; | |
102 | - color: #333333; | |
103 | - } | |
104 | - .info{ | |
105 | - display: flex; | |
106 | - justify-content: space-between; | |
107 | - align-items: center; | |
108 | - width: 92%; | |
109 | - padding: 5px 4% 5px 4%; | |
110 | - .priceBox{ | |
111 | - display: flex; | |
112 | - justify-content: space-between; | |
113 | - align-items: center; | |
114 | - .price{ | |
115 | - color: #EB5D3B; | |
116 | - font-size: 28rpx; | |
117 | - font-weight: 600; | |
118 | - margin-right: 10rpx; | |
119 | - } | |
120 | - .originCost{ | |
121 | - text-decoration:line-through; | |
122 | - color: #999999; | |
123 | - font-size: 20rpx; | |
124 | - } | |
125 | - | |
126 | - } | |
127 | - .slogan{ | |
128 | - color: #999999; | |
129 | - font-size: 20rpx; | |
130 | - } | |
131 | - } | |
132 | -</style> | |
1 | +<template> | |
2 | + <view class="card" @tap="toGoods(goods.goods_id,goods.goodType)"> | |
3 | + <image mode="widthFix" :src="goods.img" ></image> | |
4 | + <view class="name">{{goods.name}}</view> | |
5 | + <view class="info"> | |
6 | + <view class="priceBox"> | |
7 | + <view class="price">{{goods.price}}</view> | |
8 | + <view class="originCost"> | |
9 | + {{goods.originCost}} | |
10 | + </view> | |
11 | + </view> | |
12 | + <view class="slogan">{{goods.slogan}}</view> | |
13 | + </view> | |
14 | + </view> | |
15 | +</template> | |
16 | + | |
17 | +<script> | |
18 | + export default { | |
19 | + props: { | |
20 | + /** | |
21 | + * 商品数据 | |
22 | + */ | |
23 | + goods: { | |
24 | + goods_id: Number, | |
25 | + img: String, | |
26 | + name: String, | |
27 | + originCost:String, | |
28 | + price: String, | |
29 | + slogan:String, | |
30 | + goodType:String, | |
31 | + } | |
32 | + | |
33 | + }, | |
34 | + created() { | |
35 | + console.log(this.goods) | |
36 | + }, | |
37 | + data() { | |
38 | + return { | |
39 | + | |
40 | + }; | |
41 | + }, | |
42 | + methods:{ | |
43 | + toGoods(id,type){ | |
44 | + // console.log('toGoods =====> id======>', id) | |
45 | + // console.log(type) | |
46 | + switch(type){ | |
47 | + case 1: | |
48 | + uni.navigateTo({ | |
49 | + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
50 | + success: res => {}, | |
51 | + fail: () => {}, | |
52 | + complete: () => {} | |
53 | + }); | |
54 | + break; | |
55 | + case 2: | |
56 | + uni.navigateTo({ | |
57 | + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
58 | + success: res => {}, | |
59 | + fail: () => {}, | |
60 | + complete: () => {} | |
61 | + }); | |
62 | + break; | |
63 | + case 3: | |
64 | + uni.navigateTo({ | |
65 | + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
66 | + success: res => {}, | |
67 | + fail: () => {}, | |
68 | + complete: () => {} | |
69 | + }); | |
70 | + break; | |
71 | + case 4: | |
72 | + uni.navigateTo({ | |
73 | + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type, | |
74 | + success: res => {}, | |
75 | + fail: () => {}, | |
76 | + complete: () => {} | |
77 | + }); | |
78 | + break; | |
79 | + default : | |
80 | + break | |
81 | + } | |
82 | + } | |
83 | + } | |
84 | + } | |
85 | +</script> | |
86 | + | |
87 | +<style lang="scss"> | |
88 | + image{ | |
89 | + width: 100%; | |
90 | + height: 120rpx; | |
91 | + } | |
92 | + .name{ | |
93 | + width: 92%; | |
94 | + height: 54rpx; | |
95 | + padding: 5px 4%; | |
96 | + display: -webkit-box; | |
97 | + -webkit-box-orient: vertical; | |
98 | + -webkit-line-clamp: 2; | |
99 | + text-align: justify; | |
100 | + overflow: hidden; | |
101 | + font-size: 24rpx; | |
102 | + color: #333333; | |
103 | + } | |
104 | + .info{ | |
105 | + display: flex; | |
106 | + justify-content: space-between; | |
107 | + align-items: center; | |
108 | + width: 92%; | |
109 | + padding: 5px 4% 5px 4%; | |
110 | + .priceBox{ | |
111 | + display: flex; | |
112 | + justify-content: space-between; | |
113 | + align-items: center; | |
114 | + .price{ | |
115 | + color: #EB5D3B; | |
116 | + font-size: 28rpx; | |
117 | + font-weight: 600; | |
118 | + margin-right: 10rpx; | |
119 | + } | |
120 | + .originCost{ | |
121 | + text-decoration:line-through; | |
122 | + color: #999999; | |
123 | + font-size: 20rpx; | |
124 | + } | |
125 | + | |
126 | + } | |
127 | + .slogan{ | |
128 | + color: #999999; | |
129 | + font-size: 20rpx; | |
130 | + } | |
131 | + } | |
132 | +</style> | |
133 | 133 | \ No newline at end of file | ... | ... |
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/myOrder/myOrder", | |
6 | + "style" : { | |
7 | + "navigationBarTitleText" : "我的订单" | |
8 | + } | |
9 | + }, | |
10 | + { | |
11 | + "path" : "pages/cart/cart", | |
12 | + "style" : { | |
13 | + "navigationBarTitleText" : "购物车" | |
14 | + } | |
15 | + }, | |
16 | + { | |
17 | + "path" : "pages/index/index", | |
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/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/index/index.vue
... | ... | @@ -138,8 +138,10 @@ export default { |
138 | 138 | }, |
139 | 139 | onLoad: function() { |
140 | 140 | store.dispatch('test/fetch'); |
141 | - store.dispatch('categoryOrder/fetch') | |
142 | - | |
141 | + store.dispatch('categoryOrder/fetch') | |
142 | + // 登陆 | |
143 | + // store.dispatch('user/login') | |
144 | + | |
143 | 145 | //定时器模拟ajax异步请求数据 |
144 | 146 | setTimeout(()=>{ |
145 | 147 | //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null | ... | ... |
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/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/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 | - // 获取首页商品列表 | |
3 | - shopList: '/app/prod/list', | |
4 | - | |
5 | - // 获取首页商品列表 | |
6 | - category: '/app/prod/category', | |
2 | + | |
3 | + // 首页 | |
4 | + shopList: '/app/prod/list', // 获取首页商品列表 | |
5 | + category: '/app/prod/category', // 获取首页商品分类 | |
6 | + | |
7 | + // 登陆 | |
8 | + login: '/app/glass/getOpenId', // 登陆 | |
9 | + getUserInfo: '/app/glass/userinfo', // 获取用户信息 | |
10 | + | |
11 | + // 我的订单 | |
12 | + orderList: '/app/order/list', // 获取订单列表 | |
13 | + | |
14 | + // 购物车 | |
15 | + cartList: '/app/cart/list', // 获取购物车列表 | |
16 | + | |
17 | + // 我的 | |
18 | + recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品 | |
7 | 19 | } |
8 | 20 | |
9 | 21 | export default urlAlias; | ... | ... |