fix
This commit is contained in:
parent
511a73f92f
commit
16ca2ab84f
1
.env.dev
1
.env.dev
@ -1,2 +1,3 @@
|
||||
VITE_APP_MODE = 'dev'
|
||||
VITE_API_URL = http://114.218.158.24:9020
|
||||
VITE_API_OA_URL=http://114.218.158.24:9020
|
@ -1,3 +1,4 @@
|
||||
mode = prod
|
||||
VITE_APP_MODE = 'prod'
|
||||
VITE_API_URL = https://erpapi.fontree.cn/
|
||||
VITE_API_OA_URL=https://erp-out.szjixun.cn/
|
@ -1,36 +1,36 @@
|
||||
import request from "../../utils/service/index";
|
||||
//登录
|
||||
export const userLogin = (data) => {
|
||||
return request({
|
||||
url: "/user/v2/login",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//验证码
|
||||
return request({
|
||||
url: "/user/v2/login",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//验证码
|
||||
export const userSend = (data) => {
|
||||
return request({
|
||||
url: "/user/send",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//扫码查看画桶详情
|
||||
export const pbDetail = (data) => {
|
||||
return request({
|
||||
url: "/containeradm/v1/painting_bucket/get_by_id",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//查询可放画桶的空闲货架孔
|
||||
export const freebox = (data) => {
|
||||
return request({
|
||||
url: "/containeradm/v1/box_rel_bucket/freebox",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
return request({
|
||||
url: "/user/send",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//扫码查看画桶详情
|
||||
export const pbDetail = (data) => {
|
||||
return request({
|
||||
url: "/containeradm/v1/painting_bucket/get_by_id",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//查询可放画桶的空闲货架孔
|
||||
export const freebox = (data) => {
|
||||
return request({
|
||||
url: "/containeradm/v1/box_rel_bucket/freebox",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
//出库
|
||||
export const outbound = (data) => {
|
||||
return request({
|
||||
@ -79,3 +79,10 @@ export const cancel = (data) => {
|
||||
data,
|
||||
});
|
||||
};
|
||||
export const getRules = (data) => {
|
||||
return request({
|
||||
url: "/rule/rules",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
@ -3,12 +3,15 @@ import App from "./App.vue";
|
||||
import uviewPlus from "uview-plus";
|
||||
import globalComponents from "./components";
|
||||
import VConsole from "vconsole";
|
||||
import permission from "../utils/permission.js";
|
||||
|
||||
if (import.meta.env.VITE_APP_MODE === "dev") {
|
||||
new VConsole();
|
||||
}
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App);
|
||||
globalComponents(app);
|
||||
permission(app);
|
||||
app.use(uviewPlus);
|
||||
return {
|
||||
app,
|
||||
|
@ -103,7 +103,7 @@
|
||||
import { ref, reactive } from "vue";
|
||||
import useToast from "@/hooks/toast/useToast.js";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { userLogin, userSend, pbDetail } from "@/api/login.js";
|
||||
import { userLogin, userSend, pbDetail, getRules } from "@/api/login.js";
|
||||
const state = reactive({
|
||||
TelNum: "",
|
||||
Password: "",
|
||||
@ -125,15 +125,16 @@ onLoad((options) => {
|
||||
// 已经登录了
|
||||
if (token && userInfo) {
|
||||
paintingDetail();
|
||||
getBtngetRules();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
1.先调用options的对应接口
|
||||
2.判断是是否有没有登录
|
||||
3如果登录了判断状态去相应页面
|
||||
4.没有登录让他登录,然后根据状态判断去相应页面
|
||||
|
||||
|
||||
**/
|
||||
});
|
||||
const paintingDetail = async () => {
|
||||
@ -199,7 +200,7 @@ const paintingDetail = async () => {
|
||||
// };
|
||||
const toCode = () => {
|
||||
isCode.value = true;
|
||||
state.Password= "";
|
||||
state.Password = "";
|
||||
};
|
||||
//获取验证码
|
||||
const obtainCode = async () => {
|
||||
@ -237,9 +238,20 @@ const logining = async () => {
|
||||
uni.setStorageSync("token", res.data.Token);
|
||||
uni.setStorageSync("userInfo", res.data.AccountInfo);
|
||||
await paintingDetail();
|
||||
await getBtngetRules();
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
const getBtngetRules = async () => {
|
||||
const res = await getRules();
|
||||
if (res.status === 0) {
|
||||
const ruleBtn =
|
||||
res.data.data.MyButtonAuths?.map((button) => button.Url) || [];
|
||||
uni.setStorageSync("ruleBtn", ruleBtn);
|
||||
} else {
|
||||
showMessage({ type: "error", message: res.msg });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -15,3 +15,12 @@ export const closeWebview = () => {
|
||||
return () => {};
|
||||
}
|
||||
};
|
||||
|
||||
// 判断是oa还是墨册
|
||||
export const OAorMc = () => {
|
||||
try {
|
||||
return plus.webview.currentWebview().type;
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
22
utils/permission.js
Normal file
22
utils/permission.js
Normal file
@ -0,0 +1,22 @@
|
||||
export default (app) => {
|
||||
// 按钮权限/show-btn
|
||||
app.directive("permission", {
|
||||
beforeMount(el, binding) {
|
||||
const btnList = uni.getStorageSync("ruleBtn")
|
||||
? uni.getStorageSync("ruleBtn")
|
||||
: [];
|
||||
if (
|
||||
(binding.value &&
|
||||
btnList.length > 0 &&
|
||||
!btnList.includes(binding.value)) ||
|
||||
btnList.length == 0
|
||||
) {
|
||||
// 解决进入页面按钮会闪一下再消失问题
|
||||
el.style.display = "none";
|
||||
setTimeout(() => {
|
||||
el.parentNode.removeChild(el);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
@ -1,8 +1,12 @@
|
||||
import Request from "./request/index.js";
|
||||
import useToast from "@/hooks/toast/useToast.js";
|
||||
import { OAorMc } from "../index.js";
|
||||
const { showMessage } = useToast();
|
||||
const request = new Request({
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
baseURL:
|
||||
OAorMc() === "MC"
|
||||
? import.meta.env.VITE_API_URL
|
||||
: import.meta.env.VITE_API_OA_URL,
|
||||
timeout: 1000 * 60 * 5,
|
||||
interceptors: {
|
||||
//实例的请求拦截器
|
||||
@ -12,7 +16,10 @@ const request = new Request({
|
||||
? "application/x-www-form-urlencoded"
|
||||
: "application/json";
|
||||
|
||||
const token = uni.getStorageSync("token") || "";
|
||||
const token =
|
||||
window?.plus?.storage.getItem("token") ||
|
||||
uni.getStorageSync("token") ||
|
||||
"";
|
||||
if (config.isFormData) {
|
||||
config.headers["Content-Type"] = "multipart/form-data";
|
||||
config.headers["Authorization"] = token;
|
||||
|
Loading…
Reference in New Issue
Block a user