diff --git a/.env.dev b/.env.dev index 516231d..cfbcf3b 100644 --- a/.env.dev +++ b/.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 \ No newline at end of file diff --git a/.env.prod b/.env.prod index 490aa6a..83882ba 100644 --- a/.env.prod +++ b/.env.prod @@ -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/ \ No newline at end of file diff --git a/src/api/login.js b/src/api/login.js index 795f5ad..4619b90 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -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, + }); +}; diff --git a/src/main.js b/src/main.js index 5b5fea5..a771cd7 100644 --- a/src/main.js +++ b/src/main.js @@ -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, diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 595283d..bacf723 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -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 }); + } +};