fix
This commit is contained in:
parent
e7ed00472d
commit
37c099ebf8
@ -1,8 +1,13 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {},
|
onLaunch: function () {
|
||||||
|
const token = window?.plus?.storage.getItem("token");
|
||||||
|
uni.setStorageSync("token", token);
|
||||||
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
console.log("App Show");
|
console.log("App Show");
|
||||||
|
const token = window?.plus?.storage.getItem("token");
|
||||||
|
uni.setStorageSync("token", token);
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
console.log("App Hide");
|
console.log("App Hide");
|
||||||
|
@ -120,12 +120,12 @@ onLoad((options) => {
|
|||||||
console.log("options", options);
|
console.log("options", options);
|
||||||
state.id = options.id;
|
state.id = options.id;
|
||||||
state.pid = options.pid;
|
state.pid = options.pid;
|
||||||
const token =
|
const token = window?.plus?.storage.getItem("token");
|
||||||
window?.plus?.storage.getItem("token") ||
|
if (!uni.setStorageSync("token", token)) {
|
||||||
uni.getStorageSync("store-token");
|
uni.setStorageSync("token", token);
|
||||||
console.log("token", token);
|
}
|
||||||
// 已经登录了
|
// 已经登录了
|
||||||
if (token) {
|
if (uni.getStorageSync("token") || uni.getStorageSync("store-token")) {
|
||||||
paintingDetail();
|
paintingDetail();
|
||||||
getBtngetRules();
|
getBtngetRules();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@ import Request from "./request/index.js";
|
|||||||
import useToast from "@/hooks/toast/useToast.js";
|
import useToast from "@/hooks/toast/useToast.js";
|
||||||
import { OAorMc } from "../index.js";
|
import { OAorMc } from "../index.js";
|
||||||
const { showMessage } = useToast();
|
const { showMessage } = useToast();
|
||||||
console.log(window?.plus?.storage.getItem("token"));
|
console.log(
|
||||||
|
"token",
|
||||||
|
window?.plus?.storage.getItem("token"),
|
||||||
|
uni.getStorageSync("token")
|
||||||
|
);
|
||||||
const request = new Request({
|
const request = new Request({
|
||||||
baseURL:
|
baseURL:
|
||||||
OAorMc() === "MC"
|
OAorMc() === "MC"
|
||||||
@ -18,9 +22,7 @@ const request = new Request({
|
|||||||
: "application/json";
|
: "application/json";
|
||||||
|
|
||||||
const token =
|
const token =
|
||||||
window?.plus?.storage.getItem("token") ||
|
uni.getStorageSync("token") || uni.getStorageSync("store-token") || "";
|
||||||
uni.getStorageSync("store-token") ||
|
|
||||||
"";
|
|
||||||
if (config.isFormData) {
|
if (config.isFormData) {
|
||||||
config.headers["Content-Type"] = "multipart/form-data";
|
config.headers["Content-Type"] = "multipart/form-data";
|
||||||
config.headers["Authorization"] = token;
|
config.headers["Authorization"] = token;
|
||||||
|
Loading…
Reference in New Issue
Block a user