This commit is contained in:
Aiden 2024-10-24 13:50:22 +08:00
parent d10f2b6c1d
commit 487f7f7e47
2 changed files with 71 additions and 65 deletions

View File

@ -12,74 +12,78 @@ const loading = ref(false);
export default { export default {
onLaunch: function () {}, onLaunch: function () {},
onShow: function () { onShow: function () {
console.log('2222222') console.log("2222222");
// const token = window?.plus?.storage.getItem("token"); // const token = window?.plus?.storage.getItem("token");
// uni.setStorageSync("token", token); // uni.setStorageSync("token", token);
// console.log("App Show", uni.getStorageSync("token")); // console.log("App Show", uni.getStorageSync("token"));
const params = new URLSearchParams(window.location.search); // URL const params = new URLSearchParams(window.location.search); // URL
state.id = params.get("id"); state.id = params.get("id");
state.pid = params.get("pid"); state.pid = params.get("pid");
console.log(state) console.log(state);
const paintingDetail = async () => { const paintingDetail = async () => {
loading.value = true; loading.value = true;
console.log("state", state); console.log("state", state);
const res = await pbDetail({ const res = await pbDetail({
id: state.id, id: state.id,
pid: state.pid, pid: state.pid,
});
if (res.status === 0) {
console.log("成功拉1");
state.boxRelBucketStatus = res.data.boxRelBucketStatus;
console.log("boxRelBucketStatus", state.boxRelBucketStatus);
if (res.data.pbStatus == 1) {
console.log("成功拉2");
uni.navigateTo({
url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
}); });
} else { if (res.status === 0) {
if ( console.log("成功拉1");
res.data.boxRelBucketStatus == 3 && state.boxRelBucketStatus = res.data.boxRelBucketStatus;
res.data.locateAddress == "公司内" console.log("boxRelBucketStatus", state.boxRelBucketStatus);
) { if (res.data.pbStatus == 1) {
uni.navigateTo({ console.log("成功拉2");
url: "/pages/painting/index?id=" + state.id + "&pid=" + state.pid, uni.navigateTo({
success: () => { url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
loading.value = false; success: () => {
}, loading.value = false;
fail: () => { },
loading.value = false; fail: () => {
showMessage({ type: "default", message: "跳转失败" }); loading.value = false;
}, showMessage({ type: "default", message: "跳转失败" });
}); },
} else { });
uni.setStorageSync('data',res.data) } else {
console.log() if (
uni.navigateTo({ res.data.boxRelBucketStatus == 3 &&
url: res.data.locateAddress == "公司内"
"/pages/detail/index?id="+ state.id + "&pid=" + state.pid+'&boxRelBucketStatus='+state.boxRelBucketStatus, ) {
uni.navigateTo({
url: "/pages/painting/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
} else {
uni.setStorageSync("data", res.data);
console.log();
uni.navigateTo({
url:
"/pages/detail/index?id=" +
state.id +
"&pid=" +
state.pid +
"&boxRelBucketStatus=" +
state.boxRelBucketStatus,
success: () => { success: () => {
loading.value = false; loading.value = false;
}, },
fail: () => { fail: () => {
loading.value = false; loading.value = false;
showMessage({ type: "default", message: "跳转失败" }); showMessage({ type: "default", message: "跳转失败" });
}, },
}); });
}
}
} }
} };
} paintingDetail();
};
paintingDetail()
}, },
onHide: function () { onHide: function () {
console.log("App Hide"); console.log("App Hide");

View File

@ -18,10 +18,12 @@ const request = new Request({
? "application/x-www-form-urlencoded" ? "application/x-www-form-urlencoded"
: "application/json"; : "application/json";
const token = const token = "";
window?.plus?.webview.getWebviewById("wv").tokenScan || try {
uni.getStorageSync("store-token") || token = plus?.webview.getWebviewById("wv").tokenScan;
""; } catch (e) {
token = uni.getStorageSync("store-token");
}
console.log("tokenServer", token); console.log("tokenServer", token);
if (config.isFormData) { if (config.isFormData) {
config.headers["Content-Type"] = "multipart/form-data"; config.headers["Content-Type"] = "multipart/form-data";