li.shaoyi 2 سال پیش
والد
کامیت
79ddfac45d
2فایلهای تغییر یافته به همراه25 افزوده شده و 23 حذف شده
  1. 24 22
      src/business/login/index.ts
  2. 1 1
      src/packages/mobile/views/mine/order/detail/purchasetrade/index.vue

+ 24 - 22
src/business/login/index.ts

@@ -59,13 +59,30 @@ export function useLogin() {
         eventBus.$emit('LoginNotify') // 登录成功通知
     }
 
-    const autoLogin = () => {
-        const encryptedData = localData.getValue('autoLoginEncryptedData')
-        if (encryptedData) {
-            const decryptedString = decryptAES(encryptedData)
-            return loginAction(JSON.parse(decryptedString))
-        } else {
-            return Promise.reject('自动登录失败')
+    // 初始化业务数据
+    const initBaseData = async (autoLogin = false) => {
+        logining.value = true
+        try {
+            // 等待加载业务数据
+            await loadBaseData()
+            // 自动登录
+            if (autoLogin) {
+                const encryptedData = localData.getValue('autoLoginEncryptedData')
+                if (encryptedData) {
+                    try {
+                        const decryptedString = decryptAES(encryptedData)
+                        return await loginAction(JSON.parse(decryptedString))
+                    } catch (err) {
+                        console.error(err)
+                        eventBus.$emit('LogoutNotify')
+                    }
+                }
+            }
+            if (token.value) {
+                await loadUserData()
+            }
+        } finally {
+            logining.value = false
         }
     }
 
@@ -97,21 +114,6 @@ export function useLogin() {
         callback && callback()
     }
 
-    // 初始化业务数据
-    const initBaseData = async (enableAutoLogin = false) => {
-        logining.value = true
-        try {
-            await loadBaseData() // 等待加载业务数据
-            if (enableAutoLogin) {
-                await autoLogin()
-            } else if (token.value) {
-                await loadUserData()
-            }
-        } finally {
-            logining.value = false
-        }
-    }
-
     return {
         logining,
         formData,

+ 1 - 1
src/packages/mobile/views/mine/order/detail/purchasetrade/index.vue

@@ -41,7 +41,7 @@
         <template #footer>
             <div class="g-form__footer" v-if="detail">
                 <Button block round type="primary"
-                    v-if="detail.buyuserid === detail.firstbuyuserid && detail.availabletime > 0"
+                    v-if="detail.buyuserid === detail.firstbuyuserid && detail.availabletime > 0 && detail.presalestatus === 2 && detail.orderstatus === 1"
                     @click="spotPricingSubmit">点价</Button>
                 <Button block round type="primary"
                     v-if="detail.thjdeliverymode === 1 && detail.presalestatus === 2 && detail.orderstatus === 1"