瀏覽代碼

退出功能

shish 2 年之前
父節點
當前提交
a990622af7
共有 3 個文件被更改,包括 35 次插入13 次删除
  1. 17 6
      hdApp/src/admin/home/me.vue
  2. 14 7
      hdApp/src/admin/home/workbench.vue
  3. 4 0
      hdApp/src/api/admin/index.js

+ 17 - 6
hdApp/src/admin/home/me.vue

@@ -113,11 +113,10 @@
             <tui-list-cell @click="closeApp()" class="line-cell" :hover="false" :arrow="true" v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentShopId > 0">
               <view class="tui-title">关闭APP</view>
             </tui-list-cell>
-
+            <!-- #endif -->
             <tui-list-cell @click="loginOut()" class="line-cell" :hover="false" :arrow="true" v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentShopId > 0">
               <view class="tui-title">退出账号</view>
             </tui-list-cell>
-            <!-- #endif -->
 
           </view>
         </view>
@@ -144,6 +143,7 @@ import { selectShop } from "@/mixins";
 import { list } from "@/mixins";
 import { mapGetters } from "vuex";
 import NotLogin from "@/components/not-login";
+import { clearLogin } from "@/api/admin";
 export default {
   name: "me",
   components: {
@@ -232,15 +232,26 @@ export default {
     closeAccount(){
       this.$util.pageTo({ url: '/admin/home/close'})
     },
-    // #ifdef APP-PLUS
     loginOut(){
         let that = this
         that.$util.confirmModal({content:'确认退出?'},() => {
-              uni.clearStorage()
-              that.$store.commit("setLoginInfo", {})
-              plus.runtime.restart()
+            // #ifdef APP-PLUS
+            uni.clearStorage()
+            that.$store.commit("setLoginInfo", {})
+            plus.runtime.restart()
+            // #endif
+            // #ifdef MP-WEIXIN
+            clearLogin().then(res=>{
+              if(res.code == 1){
+                uni.clearStorage()
+                that.$store.commit("setLoginInfo", {})
+                uni.reLaunch({url:'/admin/home/workbench'})
+              }
+            })
+            // #endif
         })
     },
+    // #ifdef APP-PLUS
     closeApp(){
         let that = this
         that.$util.confirmModal({content:'确认关闭?'},() => {

+ 14 - 7
hdApp/src/admin/home/workbench.vue

@@ -235,7 +235,7 @@
           <block v-else>
             <view class="button_6 flex-col" @click="fillCg(ghsInfo)"><text class="text_13">录采购单</text></view>
           </block>
-          <text style="position:absolute;left:690upx;top:4upx;color:#CCCCCC;" @click.stop="getMore(ghsInfo)">更多</text>
+          <text style="position:absolute;left:670upx;top:4upx;color:#CCCCCC;" @click.stop="getMore(ghsInfo)">更多</text>
         </view>
     </view>
 
@@ -278,6 +278,7 @@ import { ghsList } from "@/api/purchase";
 import { changeDelStatus } from "@/api/ghs";
 import {currentShop} from "@/api/shop";
 import { openPfFn } from "@/api/apply";
+import { clearLogin } from "@/api/admin";
 export default {
   name: "workbench",
   components: { NotLogin,emptyComponent },
@@ -422,16 +423,22 @@ export default {
             that.$util.pageTo({url:'/admin/shop/password'})
           }
           if(res.tapIndex == 5){
-            // #ifdef APP-PLUS
             that.$util.confirmModal({content:'确认退出?'},() => {
+              // #ifdef APP-PLUS
+              uni.clearStorage()
+              that.$store.commit("setLoginInfo", {})
+              plus.runtime.restart()
+              // #endif
+              // #ifdef MP-WEIXIN
+              clearLogin().then(res=>{
+                if(res.code == 1){
                   uni.clearStorage()
                   that.$store.commit("setLoginInfo", {})
-                  plus.runtime.restart()
+                  uni.reLaunch({url:'/admin/home/workbench'})
+                }
+              })
+              // #endif
             })
-            // #endif
-            // #ifdef MP-WEIXIN
-            that.$msg('开发中')
-            // #endif
           }
         }
       });

+ 4 - 0
hdApp/src/api/admin/index.js

@@ -1,5 +1,9 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
+export const clearLogin = data => {
+	return https.get("/admin/clear-login", data);
+};
+
 export const getInfo = data => {
 	return https.get("/admin/info", data);
 };