store-management-app/src/App.vue

97 lines
2.8 KiB
Vue
Raw Normal View History

2024-08-26 03:15:07 +00:00
<script>
2024-10-23 08:42:29 +00:00
import { onLoad } from "@dcloudio/uni-app";
import { pbDetail } from "@/api/login.js";
import useToast from "@/hooks/toast/useToast.js";
import { ref, reactive } from "vue";
const { showMessage } = useToast();
const state = reactive({
id: "",
pid: "",
});
const loading = ref(false);
2024-08-26 03:15:07 +00:00
export default {
2024-10-22 03:24:54 +00:00
onLaunch: function () {},
2024-08-26 03:15:07 +00:00
onShow: function () {
2024-10-24 05:50:22 +00:00
console.log("2222222");
2024-10-23 08:42:29 +00:00
// const token = window?.plus?.storage.getItem("token");
// uni.setStorageSync("token", token);
// console.log("App Show", uni.getStorageSync("token"));
2024-10-24 07:26:16 +00:00
const params = new URLSearchParams(window.location.search); //属性包含当前 URL 的查询字符串部分
state.id = params.get("id");
state.pid = params.get("pid");
console.log(state);
2024-10-23 08:42:29 +00:00
2024-10-24 07:26:16 +00:00
const paintingDetail = async () => {
loading.value = true;
console.log("state", state);
const res = await pbDetail({
id: state.id,
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.data.boxRelBucketStatus == 3 &&
res.data.locateAddress == "公司内"
) {
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,
2024-10-23 08:42:29 +00:00
2024-10-24 07:26:16 +00:00
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
}
}
}
};
paintingDetail();
2024-08-26 03:15:07 +00:00
},
onHide: function () {
2024-10-09 07:43:03 +00:00
console.log("App Hide");
2024-08-26 03:15:07 +00:00
},
2024-10-09 07:43:03 +00:00
};
2024-08-26 03:15:07 +00:00
</script>
<style>
/*每个页面公共css */
</style>