From 0455590dfecbc9861f5c315e9a94f630c858a66b Mon Sep 17 00:00:00 2001 From: xuminyui <576362016@qq.com> Date: Thu, 24 Oct 2024 15:21:06 +0800 Subject: [PATCH] fix --- src/pages/login/index.vue | 1 - utils/index.js | 6 +++--- utils/service/index.js | 12 +++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 4a26403..ad8bafb 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -141,7 +141,6 @@ onLoad((options) => { }); const paintingDetail = async () => { loading.value = true; - const res = await pbDetail({ id: state.id, pid: state.pid, diff --git a/utils/index.js b/utils/index.js index cdc9328..3262a71 100644 --- a/utils/index.js +++ b/utils/index.js @@ -18,11 +18,11 @@ export const closeWebview = () => { // 判断是oa还是墨册 export const OAorMc = () => { - try { + if (window.plus) { const currentWebView = plus.webview.getWebviewById("wv"); - console.log('currentWebView.type',currentWebView.type) + console.log("currentWebView.type", currentWebView.type); return currentWebView.type; - } catch (e) { + } else { return "MC"; } }; diff --git a/utils/service/index.js b/utils/service/index.js index 6f8c23e..6d9722d 100644 --- a/utils/service/index.js +++ b/utils/service/index.js @@ -3,7 +3,7 @@ import useToast from "@/hooks/toast/useToast.js"; import { OAorMc } from "../index.js"; const { showMessage } = useToast(); -console.log(123123, OAorMc()); +console.log("OAorMc", OAorMc(), import.meta.env.VITE_API_URL); const request = new Request({ baseURL: OAorMc() === "MC" @@ -18,16 +18,16 @@ const request = new Request({ ? "application/x-www-form-urlencoded" : "application/json"; - const token = ""; - try { + let token = ""; + if (window.plus) { token = plus?.webview.getWebviewById("wv").tokenScan; - } catch (e) { + } else { token = uni.getStorageSync("store-token"); } console.log("tokenServer", token); if (config.isFormData) { config.headers["Content-Type"] = "multipart/form-data"; - config.headers["Authorization"] = token; + config.headers["Authorization"] = token || ""; } else { config.headers["Authorization"] = token; } @@ -66,8 +66,6 @@ const request = new Request({ }); const fontRequest = (config) => { - console.log(import.meta); - if (["get", "GET"].includes(config.method)) { config.params = config.data; }