shish před 1 měsícem
rodič
revize
4c4c32095d

+ 35 - 1
hdApp/src/admin/home/components/purchase-ghs-panel.vue

@@ -235,6 +235,10 @@
             <text class="ghs-more-row__label">申请离职</text>
             <text class="ghs-more-row__arrow">›</text>
           </view>
+          <view class="ghs-more-row" @click="goLogoutFromMore()">
+            <text class="ghs-more-row__label">退出登录</text>
+            <text class="ghs-more-row__arrow">›</text>
+          </view>
         </view>
         <view class="ghs-more-footer">
           <view class="ghs-more-cancel" @click="closeWorkbenchMore()">取消</view>
@@ -279,7 +283,7 @@ import { consoleIndex } from "@/api/workbench";
 import { ghsList } from "@/api/purchase";
 import { changeDelStatus, hasMoreGhs, searchNearbyGhs } from "@/api/ghs";
 import { currentShop } from "@/api/shop";
-import { hasNotice } from "@/api/admin";
+import { hasNotice, clearLogin } from "@/api/admin";
 import permision from "@/utils/wa-permission_1.1/permission.js";
 import { iconSrc } from "@/utils/iconSrc";
 import { refreshPendingInviteState, getGhsProductQueryFromPending, buildGhsInviteSharePayload, hasPendingInvite, restorePendingInviteFromLegacy, expireInviteIfNeeded } from "@/utils/pendingGhsInvite";
@@ -490,6 +494,36 @@ export default {
       this.closeWorkbenchMore()
       this.$util.pageTo({ url: '/admin/staff/dimission' })
     },
+    /** 更多操作:退出登录 */
+    goLogoutFromMore() {
+      this.closeWorkbenchMore()
+      this.loginOut()
+    },
+    /** 确认后清除登录态并重启或回到工作台 */
+    loginOut() {
+      this.$util.confirmModal({ content: '确认退出?' }, () => {
+        const deviceId = uni.getStorageSync('deviceId')
+        clearLogin({ deviceId: deviceId }).then(res => {
+          if (res.code == 1) {
+            uni.clearStorage()
+            if (deviceId) {
+              uni.setStorageSync('deviceId', deviceId)
+            }
+            uni.setStorageSync('manualLogout', '1')
+            this.$store.commit('setLoginInfo', {})
+            this.$store.commit('setMyShopInfo', {})
+
+            // #ifdef APP-PLUS
+            plus.runtime.restart()
+            // #endif
+
+            // #ifdef MP-WEIXIN
+            uni.reLaunch({ url: '/admin/home/workbench' })
+            // #endif
+          }
+        })
+      })
+    },
     getMall(){
       this.$util.pageTo({ url: '/pagesPurchase/open' })
     },