|
@@ -46,17 +46,28 @@ const mutations = {
|
|
|
};
|
|
|
|
|
|
const actions = {
|
|
|
- login({ commit }) {
|
|
|
+ login({ commit, dispatch }) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
eduGet()
|
|
|
.then((response) => {
|
|
|
console.log(response);
|
|
|
var _user = response.data[0][0];
|
|
|
- commit("SET_ID", _user.userid);
|
|
|
- commit("SET_TOKEN", _user.userid);
|
|
|
- setToken(_user.userid);
|
|
|
- // dispatch('getInfo')
|
|
|
- resolve(_user.userid);
|
|
|
+ const allowedIds = [
|
|
|
+ "0abcb118-9110-11eb-80ad-005056b86db5",
|
|
|
+ "b7ccc834-aae5-11ea-a8d4-52540005ab01",
|
|
|
+ "a77e9404-efec-11e9-96f9-028edca3b798",
|
|
|
+ "0e8d50c3-50b5-2f1c-9f1a-bd346a0bf817",
|
|
|
+ "5943e08c-b7d4-11ed-8d51-005056b86db5"
|
|
|
+ ];
|
|
|
+ if (allowedIds.includes(_user.userid)) {
|
|
|
+ commit("SET_ID", _user.userid);
|
|
|
+ commit("SET_TOKEN", _user.userid);
|
|
|
+ setToken(_user.userid);
|
|
|
+ resolve(_user.userid);
|
|
|
+ } else {
|
|
|
+ reject("该用户ID不允许登录");
|
|
|
+ dispatch('logout');
|
|
|
+ }
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
// var _user = { userid: "6c56ec0e-2c74-11ef-bee5-005056b86db5" };
|