Basil преди 3 години
родител
ревизия
d99ce35370

+ 1 - 1
.env.development

@@ -1 +1 @@
1
-VITE_GLOB_API_URL = 'https://app.bjtdba.com'
1
+VITE_GLOB_API_URL = 'https://test.bjtdba.com'

+ 1 - 1
.env.production

@@ -1 +1 @@
1
-VITE_GLOB_API_URL = 'https://app.bjtdba.com'
1
+VITE_GLOB_API_URL = 'https://test.bjtdba.com'

+ 3 - 0
changelog.md

@@ -0,0 +1,3 @@
1
+- 产品详情页产品图片调整为1:1
2
+- 一键登录增加 Loding
3
+- 

+ 10 - 1
src/apis/common.ts

@@ -46,7 +46,16 @@ enum API {
46 46
     // 获取热门搜索关键词
47 47
     HOT_KEYWORD = '/api/common/hot_keyword',
48 48
 
49
-    HOME_BANNER = '/api/newhome/nologin/banner/home_banner_new'
49
+    HOME_BANNER = '/api/newhome/nologin/banner/home_banner_new',
50
+
51
+    GET_PRODUCT_SHARE = '/api/get_product_share',
52
+    // /api/get_product_share
53
+}
54
+
55
+export function getProductShare() {
56
+    return defHttp.get({
57
+        url: API.GET_PRODUCT_SHARE
58
+    })
50 59
 }
51 60
 
52 61
 /**

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
src/pages.json


+ 38 - 14
src/pages/dacang/list/index.vue

@@ -7,6 +7,9 @@ import type {DcProductModel} from "~/apis/model/dacang.model";
7 7
 import {useDacangStore} from "~/stores/dacangStore";
8 8
 import {CDN_URL} from "~/config/app";
9 9
 import DacangHeader from "~/pages/dacang/list/components/dacang-header.vue";
10
+import {getProductShare} from "~/apis/common";
11
+import {useUserStore} from "~/stores/userStore";
12
+import Cache from "~/utils/cache";
10 13
 const headerImage = CDN_URL + `/static/assets/banner-dacang.png`
11 14
 const usePageStore = usePageStoreWidthOut()
12 15
 
@@ -26,21 +29,9 @@ const state = reactive({
26 29
 })
27 30
 
28 31
 const dacangStore = useDacangStore()
29
-onShareAppMessage(() => {
30
-  return {
31
-    title: `消费储蓄 保障未来`,
32
-    path: '/pages/dacang/list/index',
33
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
34
-  }
35
-})
32
+const userStore = useUserStore()
36 33
 
37
-onShareTimeline(() => {
38
-  return {
39
-    title: `消费储蓄 保障未来`,
40
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png',
41
-  }
42
-})
43
-onLoad(async () => {
34
+onLoad(async (option) => {
44 35
   state.tabs = [{store_category_id: '-1', cate_name: '全部'}]
45 36
   const classifyRes = await getDcProductClassify()
46 37
   state.tabs.push(...classifyRes)
@@ -50,9 +41,42 @@ onLoad(async () => {
50 41
       url:  '/pages/dacang/list/index'
51 42
     }
52 43
   })
44
+
45
+  if (option && option.shareId) {
46
+    userStore.setShareId(option.shareId)
47
+  }
48
+  getProductShare().then(res => {
49
+    if (res) {
50
+      userStore.setShareId(res.share_id)
51
+    }
52
+  }).catch(message => {
53
+    // console.log(message)
54
+  })
55
+  userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
56
+
57
+
53 58
 })
54 59
 
55 60
 
61
+onShareAppMessage(() => {
62
+  const shareId = Cache.get('SHARE_ID')
63
+
64
+  return {
65
+    title: `消费储蓄 保障未来`,
66
+    path: `/pages/dacang/list/index?shareId=${shareId}`,
67
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
68
+  }
69
+})
70
+
71
+onShareTimeline(() => {
72
+  const shareId = Cache.get('SHARE_ID')
73
+  return {
74
+    title: `消费储蓄 保障未来`,
75
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png',
76
+    query: `from=share&shareId=${shareId}`
77
+  }
78
+})
79
+
56 80
 onShow(async (options) => {
57 81
   usePageStore.setPageConfig({
58 82
     currentPage: {

+ 88 - 32
src/pages/home/index.vue

@@ -7,7 +7,7 @@ import Announcement from "~/pages/home/components/announcement.vue";
7 7
 import Banner from "~/pages/home/components/banner.vue";
8 8
 import Header from "~/pages/home/components/header.vue";
9 9
 import ProductList from "~/pages/home/components/product-list.vue";
10
-import {getHomeBanner, getHomeQuickLink, getLocal, getNoticeList} from "~/apis/common";
10
+import {getHomeBanner, getHomeQuickLink, getLocal, getNoticeList, getProductShare} from "~/apis/common";
11 11
 import {useUserStore} from "~/stores/userStore";
12 12
 import CXBDialogSIgnIn from "~/components/CXBDialogSignIn/CXBDialogSIgnIn.vue";
13 13
 import CXBDialogSIgnInSucceed from "~/components/CXBDialogSignInSucceed/CXBDialogSIgnInSucceed.vue";
@@ -16,6 +16,8 @@ import CXBPrivacyPopup from "~/components/CXBPrivacyPopup/CXBPrivacyPopup.vue";
16 16
 import {getShareId} from "~/apis/product";
17 17
 // import CXBDialogSIgnIn from "~/components/CXBDialogSignIn/CXBDialogSIgnIn.vue";
18 18
 // import CXBDialogSIgnInSucceed from "~/components/CXBDialogSignInSucceed/CXBDialogSIgnInSucceed.vue";
19
+import Cache from "~/utils/cache";
20
+
19 21
 const userStore = useUserStore()
20 22
 const usePageStore = usePageStoreWidthOut()
21 23
 usePageStore.setPageConfig({
@@ -25,23 +27,12 @@ usePageStore.setPageConfig({
25 27
   }
26 28
 })
27 29
 
28
-onShareAppMessage(() => {
29
-  return {
30
-    title: `消费储蓄 保障未来`,
31
-    path: '/pages/home/index',
32
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
33
-  }
34
-})
35 30
 
36
-onShareTimeline(() => {
37
-  return {
38
-    title: `消费储蓄 保障未来`,
39
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
40
-  }
41
-})
42 31
 // const list = ref([])
43 32
 const state = reactive({
33
+  shareId: '',
44 34
   yanglaojine: {},
35
+  isEject: 0,
45 36
   page: 1,
46 37
   limit: 10,
47 38
   currentPage: 1,
@@ -81,9 +72,31 @@ onShow(() => {
81 72
       state.all_yanglao = res.all_yanglao
82 73
     })
83 74
   }
75
+  if (userStore.uid && state.isEject === 1) {
76
+    // 2 检查用户签到信息
77
+    getNewSignInInfo().then(res => {
78
+      console.log(res)
79
+      const {today, day} = res
80
+      state.signToday = today
81
+      if (today === 0) {
82
+        state.isShowSignIn = true
83
+      }
84
+      state.day = day
85
+
86
+      // // if (today === 0) {
87
+      //   2.1 弹出签到窗口
88
+      // }
89
+    }).catch(error => {
90
+      console.error(error + '->GetNewsSignInInfo')
91
+    })
92
+  }
84 93
 
85 94
 })
86
-onLoad(() => {
95
+onLoad((option) => {
96
+  if (option && option.shareId) {
97
+    userStore.setShareId(option.shareId)
98
+  }
99
+  getIsShow()
87 100
   getLocal()
88 101
   getHomeBanner().then(res => {
89 102
     console.log(res)
@@ -99,28 +112,43 @@ onLoad(() => {
99 112
   })
100 113
   state.page = 1
101 114
   loadProductList()
115
+
116
+  getProductShare().then(res => {
117
+    if (res) {
118
+      userStore.setShareId(res.share_id)
119
+    }
120
+  }).catch(message => {
121
+    // console.log(message)
122
+  })
123
+  userStore.setRedirectPage(`/pages/home/index`, 'tab')
124
+
102 125
 })
103
-onShow(() => {
104
-  if (userStore.uid) {
105
-    // 2 检查用户签到信息
106
-    getNewSignInInfo().then(res => {
107
-      console.log(res)
108
-      const {today, day} = res
109
-      state.signToday = today
110
-      if (today === 0) {
111
-        state.isShowSignIn = true
112
-      }
113
-      state.day = day
114 126
 
115
-      // // if (today === 0) {
116
-      //   2.1 弹出签到窗口
117
-      // }
118
-    }).catch(error => {
119
-      console.error(error + '->GetNewsSignInInfo')
120
-    })
127
+onShareAppMessage(() => {
128
+  const shareId = Cache.get('SHARE_ID')
129
+
130
+  return {
131
+    title: `消费储蓄 保障未来`,
132
+    path: `/pages/home/index?shareId=${shareId}`,
133
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
121 134
   }
135
+})
136
+
137
+onShareTimeline(() => {
138
+  const shareId = Cache.get('SHARE_ID')
122 139
 
140
+  return {
141
+    title: `消费储蓄 保障未来`,
142
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png',
143
+    query: `from=share&shareId=${shareId}`
144
+    // imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
145
+  }
123 146
 })
147
+
148
+
149
+// onShow(() => {
150
+//
151
+// })
124 152
 watch(() => state.isShowSignIn, (val) => {
125 153
   val ? uni.hideTabBar() : uni.showTabBar()
126 154
 })
@@ -176,6 +204,34 @@ function handleBannerClick(item) {
176 204
   }
177 205
 }
178 206
 
207
+function getIsShow(){
208
+  //首先获取是否执行过
209
+  uni.getStorage({
210
+    key: 'today',
211
+    success: function(res) {
212
+      //成功的话 说明之前执行过,再判断时间是否是当天
213
+      if (res.data && res.data != new Date().toLocaleDateString()) {
214
+        // getApp().globalData.isEject = 0; //自定义要更改的变量 或者方法
215
+        state.isEject = 0
216
+        uni.setStorageSync("today", new Date().toLocaleDateString()); //把新得日期更新到本地
217
+      }else{
218
+        // getApp().globalData.isEject = 1;  //自定义要更改的变量 或者方法
219
+        state.isEject = 1
220
+      }
221
+    },
222
+    fail: function(res) {
223
+      //没有执行过的话 先存一下当前的执行时间
224
+      console.log(res);
225
+      state.isEject = 1
226
+      // getApp().globalData.isEject = 0; //自定义要更改的变量 或者方法
227
+      let today = new Date().toLocaleDateString();
228
+      uni.setStorageSync('today', today)
229
+    }
230
+  })
231
+
232
+}
233
+
234
+
179 235
 
180 236
 </script>
181 237
 <template>

+ 2 - 2
src/pages/payment/index.vue

@@ -101,8 +101,8 @@ function handleConfirm() {
101 101
       OrderLists: state.orderList,
102 102
       type: 'tdbaspzf'
103 103
     },
104
-    // envVersion: 'trial', // develop(开发版),trial(体验版),release(正式版)
105
-    envVersion: 'release', // develop(开发版),trial(体验版),release(正式版)
104
+    envVersion: 'trial', // develop(开发版),trial(体验版),release(正式版)
105
+    // envVersion: 'release', // develop(开发版),trial(体验版),release(正式版)
106 106
     success(res) {
107 107
       // 打开成功
108 108
       uni.showToast({

+ 0 - 24
src/pages/product/test.json

@@ -1,24 +0,0 @@
1
-{
2
-  "status": 200,
3
-  "message": "success",
4
-  "data": {
5
-    "address_id": "339",
6
-    "uid": "420",
7
-    "real_name": "石头",
8
-    "phone": "15357047038",
9
-    "province": "北京",
10
-    "city": "北京市",
11
-    "city_id": "67449",
12
-    "district": "顺义区",
13
-    "village": "光明街道",
14
-    "village_id": "493",
15
-    "detail": "临河悦园8号楼一单元1203",
16
-    "post_code": "0",
17
-    "longitude": "0",
18
-    "latitude": "0",
19
-    "is_default": "1",
20
-    "is_del": "0",
21
-    "create_time": "2023-09-26 14:40:40",
22
-    "code_list": "1,67449,35,493"
23
-  }
24
-}

+ 0 - 22
src/pages/product/test1.json

@@ -1,22 +0,0 @@
1
-{
2
-  "status": 200,
3
-  "message": "success",
4
-  "data": {
5
-    "address_id": "31",
6
-    "uid": "420",
7
-    "real_name": "记得记得",
8
-    "phone": "15810674432",
9
-    "province": "北京",
10
-    "city": "北京市",
11
-    "city_id": "2",
12
-    "district": "顺义区",
13
-    "detail": "记得记得",
14
-    "post_code": "0",
15
-    "longitude": "0",
16
-    "latitude": "0",
17
-    "is_default": "1",
18
-    "is_del": "0",
19
-    "create_time": "2022-12-08 11:54:49",
20
-    "code_list": "1,67449,35,493"
21
-  }
22
-}

+ 29 - 3
src/pages/store/home/index.vue

@@ -10,7 +10,11 @@ import {searchProductList} from "~/apis/product";
10 10
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
11 11
 import FSearch from "~/components/FSearch/FSearch.vue";
12 12
 import {usePageStoreWidthOut} from "~/stores/page";
13
+import {getProductShare} from "~/apis/common";
14
+import {useUserStore} from "~/stores/userStore";
15
+import Cache from "~/utils/cache";
13 16
 const usePageStore = usePageStoreWidthOut()
17
+const userStore = useUserStore()
14 18
 
15 19
 
16 20
 let merchant: Ref<MerchantModel> = ref<MerchantModel>({
@@ -48,6 +52,11 @@ let productList = ref<any>([])
48 52
 const categoryList = ref<Array<MerchantCategoryModel>>()
49 53
 
50 54
 onLoad((options: any) => {
55
+  console.log(options)
56
+  if (options && options.shareId) {
57
+    userStore.setShareId(options.shareId)
58
+  }
59
+
51 60
   if (options.id) {
52 61
     // console.log(options.id)
53 62
     id.value = options.id
@@ -68,21 +77,38 @@ onLoad((options: any) => {
68 77
 
69 78
     loadList('reload')
70 79
     // getStoreProductList()
80
+    if (options && options.shareId) {
81
+      userStore.setShareId(options.shareId)
82
+    }
83
+    getProductShare().then(res => {
84
+      if (res) {
85
+        userStore.setShareId(res.share_id)
86
+      }
87
+    }).catch(message => {
88
+      // console.log(message)
89
+    })
90
+    userStore.setRedirectPage(`/pages/store/home/index?id=${id.value}`, 'page')
91
+
71 92
   }
72 93
 })
73 94
 onShareAppMessage(() => {
95
+  const shareId = Cache.get('SHARE_ID')
96
+
74 97
   return {
75 98
     title: `消费储蓄 保障未来`,
76
-    path: '/pages/store/home/index?id=' + id.value,
99
+    path: `/pages/store/home/index?id=${id.value}&shareId=${shareId}`,
77 100
     imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
78 101
   }
79 102
 })
80 103
 
81 104
 onShareTimeline(() => {
105
+  const shareId = Cache.get('SHARE_ID')
106
+
82 107
   return {
83 108
     title: `消费储蓄 保障未来`,
84
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png',
85
-    query: `id=${id.value}`
109
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png',
110
+    // imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png',
111
+    query: `id=${id.value}&shareId=${shareId}`
86 112
 
87 113
   }
88 114
 })

+ 38 - 14
src/pages/store/nearby/index.vue

@@ -4,22 +4,13 @@ import type {StoreResult} from "~/apis/model/storeModel";
4 4
 import {StoreParams} from "~/apis/model/storeModel";
5 5
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
6 6
 import {USER_LATITUDE, USER_LONGITUDE} from "~/constants";
7
+import {getProductShare} from "~/apis/common";
8
+import {useUserStore} from "~/stores/userStore";
9
+import Cache from "~/utils/cache";
7 10
 const usePageStore = usePageStoreWidthOut()
11
+const userStore = useUserStore()
8 12
 
9
-onShareAppMessage(() => {
10
-  return {
11
-    title: `消费储蓄 保障未来`,
12
-    path: '/pages/store/nearby/index',
13
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
14
-  }
15
-})
16 13
 
17
-onShareTimeline(() => {
18
-  return {
19
-    title: `消费储蓄 保障未来`,
20
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
21
-  }
22
-})
23 14
 const state = reactive({
24 15
   // 列表高度
25 16
   scrollHeight: 0,
@@ -62,16 +53,49 @@ const searchValue = ref('')
62 53
 const {windowHeight} = uni.getSystemInfoSync()
63 54
 state.scrollHeight = windowHeight - 45
64 55
 
65
-onLoad(() => {
56
+onLoad((option) => {
57
+  if (option && option.shareId) {
58
+    userStore.setShareId(option.shareId)
59
+  }
66 60
   // getMerchantCategory()
67 61
   getSelectMerchantSort().then(res => {
68 62
     state.merchantCategory = res.merchantCategory
69 63
   })
70 64
   loadAll()
65
+  getProductShare().then(res => {
66
+    if (res) {
67
+      userStore.setShareId(res.share_id)
68
+    }
69
+  }).catch(message => {
70
+    // console.log(message)
71
+  })
72
+  userStore.setRedirectPage(`/pages/store/nearby/index`, 'tab')
73
+
71 74
 
72 75
   // loadSelectMerchant('reload')
73 76
 })
77
+onShareAppMessage(() => {
78
+  const shareId = Cache.get('SHARE_ID')
79
+
80
+  // const shareId = userStore.shareId
81
+  return {
82
+    title: `消费储蓄 保障未来`,
83
+    path: `/pages/store/nearby/index?shareId=${shareId}`,
84
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
85
+  }
86
+})
74 87
 
88
+onShareTimeline(() => {
89
+  const shareId = Cache.get('SHARE_ID')
90
+
91
+  return {
92
+    title: `消费储蓄 保障未来`,
93
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png',
94
+    query: `from=share&shareId=${shareId}`
95
+
96
+    // imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
97
+  }
98
+})
75 99
 onShow(() => {
76 100
   usePageStore.setPageConfig({
77 101
     currentPage: {

+ 4 - 3
src/pages/store/product/detail.vue

@@ -105,6 +105,7 @@ onLoad((option: any) => {
105 105
 
106 106
   getShareId({ pid: state.id, type: 1}).then(res => {
107 107
     state.shareId = res.share_id
108
+    userStore.setRedirectPage(`/pages/store/product/detail?id=${state.id}&from=share&shareID=${state.shareId}`)
108 109
   })
109 110
 
110 111
 })
@@ -456,7 +457,7 @@ function handleShowCustomer() {
456 457
 <template>
457 458
   <div class="flex flex-col gap-3 pb-20" v-if="detail">
458 459
     <div class="bg-white ">
459
-      <div class="w-screen h-50">
460
+      <div class="w-screen h-94">
460 461
         <swiper
461 462
             v-if="detail && detail.slider_image"
462 463
             :indicator-dots="state.indicatorDots"
@@ -465,7 +466,7 @@ function handleShowCustomer() {
465 466
             :circular="state.circular"
466 467
             :interval="state.interval"
467 468
             :duration="state.duration"
468
-            class="w-full h-full"
469
+            class="w-full h-94"
469 470
         >
470 471
           <swiper-item v-for="(item, index) in detail.slider_image" :key="index">
471 472
             <image :src="item" @tap="previewImage(index)" class="!w-full !h-full" mode="aspectFill"/>
@@ -818,5 +819,5 @@ button::after {
818 819
 <route lang="yaml">
819 820
 style:
820 821
   navigationBarTitleText: 商品详情
821
-  enablePullDownRefresh: true
822
+  enablePullDownRefresh: false
822 823
 </route>

+ 8 - 2
src/pages/store/product/other.vue

@@ -267,11 +267,11 @@ function handleBuyNow() {
267 267
       console.log(detail.value?.platform)
268 268
       let platformName = ''
269 269
       let clipboardData = ''
270
-      if (detail.value?.platform === 5) {
270
+      if (detail.value?.platform == 5) {
271 271
         platformName = '淘宝'
272 272
         clipboardData = detail.value?.spreadUrl
273 273
       }
274
-      if (detail.value?.platform === 9) {
274
+      if (detail.value?.platform == 9) {
275 275
         platformName = '抖音'
276 276
         clipboardData = detail.value?.dyZlink
277 277
       }
@@ -292,6 +292,12 @@ function handleBuyNow() {
292 292
             title: `链接已复制,去【${platformName}】打开即可。`,
293 293
             icon: 'none'
294 294
           })
295
+        },
296
+        fail(res) {
297
+          return uni.showToast({
298
+            title: '请更新隐私协议',
299
+            icon: 'none'
300
+          })
295 301
         }
296 302
       })
297 303
 

+ 70 - 48
src/pages/user/login/index.vue

@@ -40,9 +40,9 @@ function handleViewXieyi(type: number) {
40 40
 }
41 41
 
42 42
 async function handleWexinLogin() {
43
-  // uni.showLoading({
44
-  //   title: '加载中'
45
-  // });
43
+  await uni.showLoading({
44
+    title: '登录中'
45
+  });
46 46
   uni.login({
47 47
     provider: 'weixin',
48 48
     univerifyStyle: {
@@ -55,64 +55,86 @@ async function handleWexinLogin() {
55 55
         source: 'cxb'
56 56
       }).then(unionRes => {
57 57
         console.log(unionRes)
58
-        const shareId = Cache.get('SHARE_ID')
58
+        // const shareId = Cache.get('SHARE_ID')
59
+        let redirectPageObj: {page: string, type: 'page' | 'tab'}
60
+        if (Cache.get('SHARE_REDIRECT_PAGE')) {
61
+          redirectPageObj = JSON.parse(Cache.get('SHARE_REDIRECT_PAGE'))
62
+        }
59 63
 
60
-        if (shareId) {
61
-          params.share_id = shareId
64
+        // if (shareId) {
65
+          // params.share_id = shareId
62 66
           // params = Object.assign({}, params, { shareId })
63
-        }
67
+        // }
64 68
         wechatCheck(unionRes.unionid).then(checkRes => {
65 69
           // console.log(checkRes)
66 70
           userStore.login(checkRes.token, checkRes.exp)
67 71
           userStore.setUID(checkRes.user.uid)
68 72
           userStore.setUserInfo(checkRes.user)
69 73
           console.log(checkRes)
74
+          uni.hideLoading();
70 75
 
71
-          switch (state.key) {
72
-            case '10': {
73
-              uni.switchTab({
74
-                url: '/pages/user/index'
75
-              })
76
-              break;
77
-            }
78
-            case '4': {
79
-              uni.navigateBack({
80
-                delta: 1
81
-              })
82
-              break;
83
-            }
84
-            case '1': {
85
-              uni.switchTab({
86
-                url: '/pages/order_addcart/order_addcart'
87
-              })
88
-              break;
89
-            }
90
-            case undefined: {
91
-              uni.switchTab({
92
-                url: '/pages/user/index'
93
-              })
94
-              break;
95
-            }
96
-            case '30': {
97
-              uni.switchTab({
98
-                url: '/pages/home/index'
99
-              })
100
-              break;
101
-            }
102
-            default: {
103
-              uni.switchTab({
104
-                url: '/pages/home/index'
105
-              })
106
-            }
107
-          }
108
-
109
-          setTimeout(() => {
110 76
             uni.showToast({
111 77
               title: '登录成功'
78
+            }).then(() => {
79
+              setTimeout(() => {
80
+
81
+                if (redirectPageObj) {
82
+                  if (redirectPageObj.type === 'page') {
83
+                    return uni.redirectTo({
84
+                      url: redirectPageObj.page
85
+                    })
86
+                  }
87
+                   if (redirectPageObj.type === 'tab') {
88
+                    return uni.switchTab({
89
+                      url: redirectPageObj.page
90
+                    })
91
+                  }
92
+                } else {
93
+                  switch (state.key) {
94
+                    case '10': {
95
+                      uni.switchTab({
96
+                        url: '/pages/user/index'
97
+                      })
98
+                      break;
99
+                    }
100
+                    case '4': {
101
+                      uni.navigateBack({
102
+                        delta: 1
103
+                      })
104
+                      break;
105
+                    }
106
+                    case '1': {
107
+                      uni.switchTab({
108
+                        url: '/pages/order_addcart/order_addcart'
109
+                      })
110
+                      break;
111
+                    }
112
+                    case undefined: {
113
+                      uni.switchTab({
114
+                        url: '/pages/user/index'
115
+                      })
116
+                      break;
117
+                    }
118
+                    case '30': {
119
+                      uni.switchTab({
120
+                        url: '/pages/home/index'
121
+                      })
122
+                      break;
123
+                    }
124
+                    default: {
125
+                      uni.switchTab({
126
+                        url: '/pages/home/index'
127
+                      })
128
+                    }
129
+                  }
130
+                }
131
+              }, 100);
132
+
133
+
112 134
             })
113
-          }, 1000);
114
-          uni.hideLoading();
115 135
         }).catch(err => {
136
+          uni.hideLoading();
137
+
116 138
           console.log(err)
117 139
           if (err === '请绑定手机号') {
118 140
             uni.showToast({

+ 1 - 1
src/pages/user/login/other-phone.vue

@@ -111,7 +111,7 @@ function handleLogin() {
111 111
     sms_code: state.code,
112 112
     // share_id:
113 113
   }
114
-  if (shareId) {
114
+  if (shareId && shareId !== '') {
115 115
     params.share_id = shareId
116 116
   }
117 117
   authSmsLogin({

+ 43 - 25
src/pages/vip/index.vue

@@ -117,32 +117,22 @@ import {computed} from "vue";
117 117
 import {getVipAreaList} from "~/apis/merchant";
118 118
 import {CDN_URL} from "~/config/app";
119 119
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
120
-import {getHomeBanner} from "~/apis/common";
120
+import {getHomeBanner, getProductShare} from "~/apis/common";
121
+import {useUserStore} from "~/stores/userStore";
122
+import Cache from "~/utils/cache";
121 123
 
122 124
 const homeBanner = CDN_URL + '/static/assets/home-banner.png'
123 125
 
124 126
 const systemInfo = uni.getSystemInfoSync()
125 127
 const statusBarHeight = systemInfo.statusBarHeight ?? 0
126 128
 
129
+const userStore = useUserStore()
127 130
 const navBarStyle = computed(() => {
128 131
   return {
129 132
     paddingTop: `${statusBarHeight}px`,
130 133
   }
131 134
 })
132
-onShareAppMessage(() => {
133
-  return {
134
-    title: `消费储蓄 保障未来`,
135
-    path: '/pages/vip/index',
136
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
137
-  }
138
-})
139 135
 
140
-onShareTimeline(() => {
141
-  return {
142
-    title: `消费储蓄 保障未来`,
143
-    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png',
144
-  }
145
-})
146 136
 const state = reactive({
147 137
   currentPage: 1,
148 138
   pageSize: 10,
@@ -160,24 +150,52 @@ const state = reactive({
160 150
 })
161 151
 const list = ref()
162 152
 
163
-onLoad(() => {
164
-  // getVipAreaList({
165
-  //   page: 1,
166
-  //   limit: 20
167
-  // }).then(res => {
168
-  //   // console.log(res.list)
169
-  //   console.log(res.list)
170
-  //   if (res) {
171
-  //     list.value = res.list
172
-  //   }
173
-  // })
153
+onLoad((option) => {
154
+  if (option && option.shareId) {
155
+    userStore.setShareId(option.shareId)
156
+  }
157
+  getProductShare().then(res => {
158
+    if (res) {
159
+      userStore.setShareId(res.share_id)
160
+    }
161
+  }).catch(message => {
162
+    // console.log(message)
163
+  })
164
+  userStore.setRedirectPage(`/pages/vip/index`, 'page')
165
+
174 166
   getHomeBanner().then(res => {
175 167
     console.log(res)
176 168
     state.banners = res
177 169
   })
178 170
   loadList('reload')
171
+
172
+
179 173
 })
180 174
 
175
+
176
+onShareAppMessage(() => {
177
+  const shareId = Cache.get('SHARE_ID')
178
+
179
+  return {
180
+    title: `消费储蓄 保障未来`,
181
+    path: `/pages/vip/index?shareId=${shareId}`,
182
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
183
+  }
184
+})
185
+
186
+onShareTimeline(() => {
187
+  const shareId = Cache.get('SHARE_ID')
188
+
189
+  return {
190
+    title: `消费储蓄 保障未来`,
191
+    query: `from=share&shareId=${shareId}`,
192
+    imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png'
193
+    // imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
194
+  }
195
+})
196
+
197
+
198
+
181 199
 function loadList(action: 'page' | 'reload', callback?: (items) => void) {
182 200
   // console.log(state.keyword)
183 201
   const params = {

+ 6 - 0
src/stores/userStore.ts

@@ -12,6 +12,7 @@ interface UserStoreState {
12 12
     mer_id: number
13 13
     permissionList: Array<string> | null
14 14
     yanglao: number,
15
+    redirectPage: string | null,
15 16
     shareId: string | null
16 17
 }
17 18
 
@@ -25,12 +26,17 @@ export const useUserStore = defineStore('userStore', {
25 26
         mer_id: 0, // 店铺 ID
26 27
         yanglao: 0,
27 28
         shareId: null,
29
+        redirectPage: null,
28 30
         permissionList: null // 权限列表
29 31
     }) as UserStoreState,
30 32
     actions: {
31 33
         // getYanglaojinStatistics().then(res => {
32 34
         //     state.all_yanglao = res.all_yanglao
33 35
         // })
36
+        setRedirectPage(page: string, type: 'page' | 'tab') {
37
+            this.redirectPage = page
38
+            Cache.set('SHARE_REDIRECT_PAGE', JSON.stringify({page, type}))
39
+        },
34 40
         setShareId(shareId: string) {
35 41
             this.shareId = shareId
36 42
             Cache.set('SHARE_ID', shareId)