|
@@ -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 {
|