lrf402788946 5 年之前
父節點
當前提交
c55e4c666b
共有 1 個文件被更改,包括 14 次插入12 次删除
  1. 14 12
      store/login.js

+ 14 - 12
store/login.js

@@ -17,7 +17,7 @@ const state = () => ({});
 const mutations = {};
 const mutations = {};
 
 
 const actions = {
 const actions = {
-  async login({ commit }, { user, router, path = '/', needReturn = false, typeCheck = true, isWx = false }) {
+  async login({ commit }, { user, router, path = '/', needReturn = false, typeCheck = true, isWx = false, needNotice = true }) {
     let res;
     let res;
     //wx登陆,openid存在,user中是openid和qrcode;正常登陆,user中是mobile和passwd
     //wx登陆,openid存在,user中是openid和qrcode;正常登陆,user中是mobile和passwd
     if (isWx) res = await this.$axios.$post(`${api.wxLogin}`, user);
     if (isWx) res = await this.$axios.$post(`${api.wxLogin}`, user);
@@ -35,20 +35,22 @@ const actions = {
       }
       }
       if (user.type == process.env.VUE_APP_USER_TYPE) {
       if (user.type == process.env.VUE_APP_USER_TYPE) {
         setUser(user, commit);
         setUser(user, commit);
-        Notification({
-          title: '登录成功',
-          message: `欢迎,${user.name}`,
-          type: 'success',
-          duration: 2000,
-        });
+        if (needNotice)
+          Notification({
+            title: '登录成功',
+            message: `欢迎,${user.name}`,
+            type: 'success',
+            duration: 2000,
+          });
         if (needReturn) return res;
         if (needReturn) return res;
         else router.push(path);
         else router.push(path);
       } else {
       } else {
-        Notification({
-          title: '请重新登陆',
-          message: `原因:非当前端用户,需要重新登陆`,
-          type: 'warning',
-        });
+        if (needNotice)
+          Notification({
+            title: '请重新登陆',
+            message: `原因:非当前端用户,需要重新登陆`,
+            type: 'warning',
+          });
         console.warn('非当前端用户,需要重新登陆');
         console.warn('非当前端用户,需要重新登陆');
       }
       }
     } else {
     } else {