Commit 757b8e6e authored by 罗超's avatar 罗超

切换登录方式

parent 1d696b4c
......@@ -2,7 +2,7 @@
"name": "confucius",
"version": "0.0.1",
"description": "jiahe japen school system",
"productName": "甲鹤日语教育系统",
"productName": "甲鹤教育教育系统",
"author": "alex",
"private": true,
"scripts": {
......
......@@ -43,4 +43,28 @@ export function logout() {
method: 'post',
data: {}
})
}
export function loginByWeChat({ AutoLoginWorkId, AutoLoginOpenId }) {
return request({
url: '/login/login',
method: "post",
// header,
data: {
Account: '',
Password: '',
AccountType: 1,
AutoLoginId: 0,
AutoLoginWorkId,
AutoLoginOpenId
}
});
}
export function setUserCodeCallBack(data) {
return request({
url: '/QYWeChat/SetUserCodeCallBack',
method: 'post',
data
})
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@ const getters = {
if (state.app.name) {
return state.app.name
}
return '甲鹤日语'
return '甲鹤教育'
},
// 权限
allAuth: state => state.user.allAuth,
......
import { login, logout } from "../../api/login";
import { login, logout, loginByWeChat } from "../../api/login";
import { adminUsersRead } from "../../api/personCenter/personCenter";
import { addAuth, removeAuth } from "../../utils/auth";
import Lockr from "lockr";
......@@ -8,7 +8,7 @@ const user = {
userInfo: null, // 用户信息
//TODO 用户权限
allAuth: ['/home', '/school/manager'],
actionList:[]
actionList: []
},
mutations: {
......@@ -47,7 +47,30 @@ const user = {
});
});
},
setUserUpdate({commit},u){
WeChatToLogin({ commit }, userInfo) {
return new Promise((resolve, reject) => {
loginByWeChat(userInfo)
.then(data => {
let r = data.Data
let token = r.Token
delete r.Token
Lockr.set("Token", token);
Lockr.set("loginUserInfo", r);
//Lockr.set("authList", data.auth);
addAuth(token);
commit("SET_USERINFO", r);
// commit('SET_ALLAUTH', data.auth)
// TODO 完成登录 读取权限
resolve(data);
})
.catch(error => {
reject(error);
});
});
},
setUserUpdate({ commit }, u) {
commit("SET_USERINFO", u);
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment