代客下单修改,登录页面修改,部分页面调整,请求封装调整
This commit is contained in:
47
stores/account.js
Normal file
47
stores/account.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { shopStaffInfo } from "@/http/yskApi/account/shopStaff";
|
||||
import { login, getCodeImg } from "@/http/yskApi/login.js";
|
||||
|
||||
export const useAccountStore = defineStore("account", {
|
||||
state: () => {
|
||||
return {
|
||||
shopInfo: {},
|
||||
//员工信息
|
||||
shopStaff: {},
|
||||
//员工账号
|
||||
staffUserName: "",
|
||||
loginInfo: {},
|
||||
tokenInfo: {},
|
||||
shopId: "",
|
||||
loginType: "",
|
||||
};
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
//获取员工信息
|
||||
async getShopStaffInfo() {
|
||||
const res = await shopStaffInfo();
|
||||
if (res) {
|
||||
this.shopStaffInfo = res;
|
||||
}
|
||||
},
|
||||
async login(params) {
|
||||
const res = await login(params);
|
||||
if (res) {
|
||||
this.loginInfo = res;
|
||||
this.shopInfo = res.shopInfo;
|
||||
this.tokenInfo = res.tokenInfo;
|
||||
this.shopId = res.shopInfo.id;
|
||||
this.loginType = res.loginType;
|
||||
this.shopStaff = res.shopStaff;
|
||||
this.staffUserName = params.staffUserName
|
||||
uni.setStorageSync("shopInfo", res.shopInfo);
|
||||
uni.setStorageSync("tokenInfo", res.tokenInfo);
|
||||
uni.setStorageSync("shopId", res.shopInfo.id);
|
||||
uni.setStorageSync("loginType", res.loginType);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
},
|
||||
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||
});
|
||||
Reference in New Issue
Block a user