Эх сурвалжийг харах

feat: 配置极光注册id

liangan 2 долоо хоног өмнө
parent
commit
81d9a57722

+ 5 - 0
src/App.vue

@@ -1,5 +1,6 @@
 <script setup>
 import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
+import { bindUser } from '@/api/common'
 import { usePageAuth } from '@/hooks/usePageAuth'
 import { t } from '@/locale'
 import { useUserStore } from '@/store'
@@ -40,6 +41,10 @@ onLaunch(() => {
     const connectEnable = result.connectEnable
     uni.$emit('connectStatusChange', connectEnable)
   })
+  mtpushModule.getRegistrationID((result) => {
+    uni.setStorageSync('registerID', result.registerID)
+    bindUser({ jpushDeviceId: result.registerID })
+  })
 
   // mtpushModule.addNotificationListener((result) => {
   //   const notificationEventType = result.notificationEventType

+ 5 - 0
src/api/common.ts

@@ -87,3 +87,8 @@ export function readAllNotice() {
 export function noticeDel(id: number) {
   return http.delete<any>(`${pre}/app/notice/delete/${id}`)
 }
+
+// 绑定registerID
+export function bindUser(data: any) {
+  return http.post<any>(`${pre1}/app/jpush/bindUser`, data)
+}

+ 4 - 3
src/pages/myOrders/orderDetail.vue

@@ -522,13 +522,14 @@ onUnmounted(() => {
               </view>
             </view>
           </view>
-          <view v-if="detail?.status !== 1" class="flex items-center justify-between border-b-1 border-b-#e8e8e8 border-b-solid py-24rpx">
-            <view class="text-28rpx">
+          <view v-if="detail?.status !== 1" class="border-b-1 border-b-#e8e8e8 border-b-solid py-24rpx">
+            <view class="mb-12rpx text-28rpx">
               {{ t('orderDetail.payment.title') }}
             </view>
             <view class="flex flex-col gap-16rpx text-#3A444C">
               <view class="flex items-center justify-between text-24rpx">
-                <text>{{ $t('orderDetail.bandhuBuyWallet') }}</text>
+                <text>{{ detail.payType }}</text>
+                <text>৳{{ formatNumber(detail.payPrice) }}</text>
               </view>
             </view>
           </view>

+ 3 - 0
src/store/user.ts

@@ -1,5 +1,6 @@
 import { defineStore } from 'pinia'
 import { ref } from 'vue'
+import { bindUser } from '@/api/common'
 import { getUserInfo as _getUserInfo, login as _login } from '@/api/login'
 import { toPage } from '@/utils/page'
 import { toast } from '@/utils/toast'
@@ -60,6 +61,8 @@ export const useUserStore = defineStore(
         if (res.code === '200' && res.data && res.data.token) {
           token.value = res.data.token
           uni.setStorageSync('token', res.data.token)
+          // 绑定到用户需要调用的
+          bindUser({ jpushDeviceId: uni.getStorageSync('registerID') })
           // 获取用户信息
           await getUserInfo()
         }