|
@@ -693,71 +693,67 @@
|
693
|
693
|
mask: true,
|
694
|
694
|
});
|
695
|
695
|
|
696
|
|
- get("/auth/getSysNameAndLogo").then((resultLog) => {
|
697
|
|
- let data = {
|
698
|
|
- username: this.username.trim(),
|
699
|
|
- password: this.password.trim(),
|
700
|
|
- type: 'APP'
|
701
|
|
- };
|
702
|
|
- if(resultLog.project !== 'tongji'){
|
703
|
|
- data = {
|
704
|
|
- k: this.encryptByEnAESLogin(JSON.stringify(data))
|
705
|
|
- };
|
706
|
|
- }
|
707
|
|
- post("/auth/login", data).then((res) => {
|
708
|
|
- uni.hideLoading();
|
709
|
|
- if (res.status == 200) {
|
710
|
|
- //获取角色信息
|
711
|
|
- let role = res.user.user.role;
|
712
|
|
- // 配药师和配送人员才能登录
|
713
|
|
- let workerFlag = role.some((item) => item.rolecode === "worker");
|
714
|
|
- let pharmacistFlag = role.some((item) => item.rolecode === "pharmacist");
|
715
|
|
- if (!workerFlag && !pharmacistFlag) {
|
716
|
|
- uni.showToast({
|
717
|
|
- icon: "none",
|
718
|
|
- title: "暂无权限登录!",
|
719
|
|
- });
|
720
|
|
- return;
|
721
|
|
- }
|
722
|
|
- if (this.savePassword[0].checked) {
|
723
|
|
- //记住密码
|
724
|
|
- uni.setStorageSync("username", this.encryptByEnAES(this.username)); //存储用户名
|
725
|
|
- uni.setStorageSync("password", this.encryptByEnAES(this.password)); //存储密码
|
726
|
|
- uni.setStorageSync("savePasswordTime", Date.now()); //存储当前时间戳
|
727
|
|
- } else {
|
728
|
|
- uni.removeStorageSync('username');
|
729
|
|
- uni.removeStorageSync('password');
|
730
|
|
- uni.removeStorageSync('savePasswordTime');
|
731
|
|
- }
|
732
|
|
- uni.setStorageSync("userData", res.user);
|
733
|
|
- this.getWorkScheme(false, res.user.user.currentHospital.id); //获取当前启动中的工作分配方案
|
734
|
|
- this.getHistorys(res.user.user.id); //获取上班历史记录
|
735
|
|
- this.offWork("app", this.ip);
|
736
|
|
- if (workerFlag) { //有配药师角色
|
737
|
|
- if (!res.user.user.online) {
|
738
|
|
- this.online = false;
|
739
|
|
- } else {
|
740
|
|
- this.online = true;
|
741
|
|
- // 建立websocket连接
|
742
|
|
- webHandle("receiptpage", "app", this.ip);
|
743
|
|
- }
|
744
|
|
- } else {
|
745
|
|
- webHandle("pharmacy", "app", this.ip);
|
746
|
|
- }
|
747
|
|
- } else if (!res.status && !res.remarks) {
|
748
|
|
- //如果乱填写域名或ip
|
|
696
|
+ let data = {
|
|
697
|
+ username: this.username.trim(),
|
|
698
|
+ password: this.password.trim(),
|
|
699
|
+ type: 'APP'
|
|
700
|
+ };
|
|
701
|
+ data = {
|
|
702
|
+ k: this.encryptByEnAESLogin(JSON.stringify(data))
|
|
703
|
+ };
|
|
704
|
+ post("/auth/login", data).then((res) => {
|
|
705
|
+ uni.hideLoading();
|
|
706
|
+ if (res.status == 200) {
|
|
707
|
+ //获取角色信息
|
|
708
|
+ let role = res.user.user.role;
|
|
709
|
+ // 配药师和配送人员才能登录
|
|
710
|
+ let workerFlag = role.some((item) => item.rolecode === "worker");
|
|
711
|
+ let pharmacistFlag = role.some((item) => item.rolecode === "pharmacist");
|
|
712
|
+ if (!workerFlag && !pharmacistFlag) {
|
749
|
713
|
uni.showToast({
|
750
|
714
|
icon: "none",
|
751
|
|
- title: "服务器连接失败!请检查输入的域名(IP)及端口号",
|
|
715
|
+ title: "暂无权限登录!",
|
752
|
716
|
});
|
|
717
|
+ return;
|
|
718
|
+ }
|
|
719
|
+ if (this.savePassword[0].checked) {
|
|
720
|
+ //记住密码
|
|
721
|
+ uni.setStorageSync("username", this.encryptByEnAES(this.username)); //存储用户名
|
|
722
|
+ uni.setStorageSync("password", this.encryptByEnAES(this.password)); //存储密码
|
|
723
|
+ uni.setStorageSync("savePasswordTime", Date.now()); //存储当前时间戳
|
753
|
724
|
} else {
|
754
|
|
- uni.showToast({
|
755
|
|
- icon: "none",
|
756
|
|
- title: res.remarks || "接口获取数据失败!",
|
757
|
|
- });
|
|
725
|
+ uni.removeStorageSync('username');
|
|
726
|
+ uni.removeStorageSync('password');
|
|
727
|
+ uni.removeStorageSync('savePasswordTime');
|
758
|
728
|
}
|
759
|
|
- });
|
760
|
|
- })
|
|
729
|
+ uni.setStorageSync("userData", res.user);
|
|
730
|
+ this.getWorkScheme(false, res.user.user.currentHospital.id); //获取当前启动中的工作分配方案
|
|
731
|
+ this.getHistorys(res.user.user.id); //获取上班历史记录
|
|
732
|
+ this.offWork("app", this.ip);
|
|
733
|
+ if (workerFlag) { //有配药师角色
|
|
734
|
+ if (!res.user.user.online) {
|
|
735
|
+ this.online = false;
|
|
736
|
+ } else {
|
|
737
|
+ this.online = true;
|
|
738
|
+ // 建立websocket连接
|
|
739
|
+ webHandle("receiptpage", "app", this.ip);
|
|
740
|
+ }
|
|
741
|
+ } else {
|
|
742
|
+ webHandle("pharmacy", "app", this.ip);
|
|
743
|
+ }
|
|
744
|
+ } else if (!res.status && !res.remarks) {
|
|
745
|
+ //如果乱填写域名或ip
|
|
746
|
+ uni.showToast({
|
|
747
|
+ icon: "none",
|
|
748
|
+ title: "服务器连接失败!请检查输入的域名(IP)及端口号",
|
|
749
|
+ });
|
|
750
|
+ } else {
|
|
751
|
+ uni.showToast({
|
|
752
|
+ icon: "none",
|
|
753
|
+ title: res.remarks || "接口获取数据失败!",
|
|
754
|
+ });
|
|
755
|
+ }
|
|
756
|
+ });
|
761
|
757
|
|
762
|
758
|
},
|
763
|
759
|
// 微信登录公用方法
|