This commit is contained in:
Aiden 2024-10-30 11:33:36 +08:00
parent 04331f8098
commit 5c31c88caf
4 changed files with 285 additions and 137 deletions

View File

@ -10,89 +10,98 @@ const state = reactive({
});
const loading = ref(false);
export default {
onLaunch: function () {
const params = new URLSearchParams(window.location.search); // URL
state.id = params.get("id");
state.pid = params.get("pid");
console.log(state);
// onLaunch: function () {
// const params = new URLSearchParams(window.location.search); // URL
// state.id = params.get("id");
// state.pid = params.get("pid");
// console.log(state);
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.redirectTo({
url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
plus.navigator.closeSplashscreen();
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
} else {
if (
res.data.boxRelBucketStatus == 3 &&
res.data.locateAddress == "公司内"
) {
uni.redirectTo({
url: "/pages/painting/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
plus.navigator.closeSplashscreen();
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
} else {
uni.setStorageSync("data", res.data);
console.log();
uni.redirectTo({
url:
"/pages/detail/index?id=" +
state.id +
"&pid=" +
state.pid +
"&boxRelBucketStatus=" +
state.boxRelBucketStatus,
// 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.redirectTo({
// url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
// success: () => {
// loading.value = false;
// plus.navigator.closeSplashscreen();
// },
// fail: () => {
// loading.value = false;
// showMessage({ type: "default", message: "" });
// },
// });
// } else {
// if (
// res.data.boxRelBucketStatus == 3 &&
// res.data.locateAddress == ""
// ) {
// uni.redirectTo({
// url: "/pages/painting/index?id=" + state.id + "&pid=" + state.pid,
// success: () => {
// loading.value = false;
// plus.navigator.closeSplashscreen();
// },
// fail: () => {
// loading.value = false;
// showMessage({ type: "default", message: "" });
// },
// });
// } else {
// uni.setStorageSync("data", res.data);
// console.log();
// uni.redirectTo({
// url:
// "/pages/detail/index?id=" +
// state.id +
// "&pid=" +
// state.pid +
// "&boxRelBucketStatus=" +
// state.boxRelBucketStatus,
success: () => {
loading.value = false;
plus.navigator.closeSplashscreen();
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
}
}
}
};
setTimeout(() => {
if (window.plus) {
if (plus?.webview.getWebviewById("wv").tokenScan) {
paintingDetail();
}
} else {
if (uni.getStorageSync("store-token")) {
paintingDetail();
}
}
}, 200);
},
// success: () => {
// loading.value = false;
// plus.navigator.closeSplashscreen();
// },
// fail: () => {
// loading.value = false;
// showMessage({ type: "default", message: "" });
// },
// });
// }
// }
// }
// };
// setTimeout(() => {
// if (window.plus) {
// if (plus?.webview.getWebviewById("wv").tokenScan) {
// paintingDetail();
// }
// } else {
// if (uni.getStorageSync("store-token")) {
// paintingDetail();
// }
// }
// }, 200);
// if (window.plus) {
// if (plus?.webview.getWebviewById("wv").tokenScan) {
// paintingDetail();
// }
// } else {
// if (uni.getStorageSync("store-token")) {
// paintingDetail();
// }
// }
// },
onShow: function () {},
onHide: function () {
console.log("App Hide");

View File

@ -66,11 +66,16 @@
>
<up-image
:show-loading="true"
:src="painting.HdPic"
:src="painting.HdPic ? painting.HdPic : '../../static/pic.png'"
width="100px"
height="100px"
@click="enlarge(painting.HdPic)"
></up-image>
:lazy-load="true"
>
<template v-slot:loading>
<up-loading-icon></up-loading-icon>
</template>
</up-image>
<span
style="
display: flex;
@ -149,8 +154,10 @@ import { closeWebview, hasPermission } from "../../../utils/index";
const { showMessage } = useToast();
const loading = ref(false);
const loadingPage = ref(false);
const showNoResultImage = ref(false);
const isButtonDisabled = ref(false);
const hasMore = ref(true);
const buttonText = ref("确认");
const state = reactive({
id: "",
@ -187,6 +194,8 @@ const groupChange = (e) => {
};
//
const paintingList = async (param) => {
uni.showLoading({ title: "加载中...", mask: true });
try {
loading.value = true;
const res = await creChangepainting({
Tfnum: "",
@ -201,13 +210,15 @@ const paintingList = async (param) => {
loading.value = false;
if (res.status === 0) {
if (res.data.Data !== null) {
if (res.data.Data.length < state.pageSize) {
hasMore.value = false;
}
state.tableData = res.data.Data.map((item) => {
return {
...item,
checked: "",
};
});
console.log(1111, state.tableData);
showNoResultImage.value = false;
} else {
state.tableData = [];
@ -217,6 +228,13 @@ const paintingList = async (param) => {
} else {
showMessage({ type: "error", message: res.msg });
}
} catch (e) {
hasMore.value = false;
showMessage({ type: "error", message: e.msg });
} finally {
loadingPage.value = false;
uni.hideLoading();
}
};
//
@ -258,6 +276,11 @@ const doneSet = async () => {
};
//
const scrolltolower = async () => {
if (loadingPage.value || !hasMore.value) return;
loadingPage.value = true;
try {
uni.showLoading({ title: "加载中...", mask: true });
state.page = state.page + 1;
const res = await creChangepainting({
Tfnum: "",
@ -270,6 +293,9 @@ const scrolltolower = async () => {
});
if (res.status === 0) {
if (res.data.Data !== null) {
if (res.data.Data.length < state.pageSize) {
hasMore.value = false;
}
const newData = res.data.Data.map((item) => {
return {
...item,
@ -286,6 +312,13 @@ const scrolltolower = async () => {
} else {
showMessage({ type: "error", message: res.msg });
}
} catch (e) {
hasMore.value = false;
showMessage({ type: "error", message: e.msg });
} finally {
loadingPage.value = false;
uni.hideLoading();
}
};
//
const enlarge = (src) => {

View File

@ -5,7 +5,113 @@
</div>
</template>
<script setup></script>
<script setup>
import { ref, reactive } from "vue";
import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app";
import { userLogin, userSend, pbDetail, getRules } from "@/api/login.js";
const state = reactive({
TelNum: "",
Password: "",
id: "",
pid: "",
code: "",
});
const { showMessage } = useToast();
const loading = ref(false);
const isCode = ref(false);
const haveCode = ref(false);
onLoad((options) => {
if (options.id && options.pid) {
state.id = options.id;
state.pid = options.pid;
//
setTimeout(() => {
if (window.plus) {
if (plus?.webview.getWebviewById("wv").tokenScan) {
paintingDetail();
getBtngetRules();
}
} else {
if (uni.getStorageSync("store-token")) {
paintingDetail();
getBtngetRules();
} else {
uni.redirectTo({
url: "/pages/login/index?id=" + options.id + "&pid=" + options.pid,
});
}
}
}, 200);
}
});
const paintingDetail = async () => {
loading.value = true;
const res = await pbDetail({
id: state.id,
pid: state.pid,
});
if (res.status === 0) {
state.boxRelBucketStatus = res.data.boxRelBucketStatus;
console.log("boxRelBucketStatus", state.boxRelBucketStatus);
if (res.data.pbStatus == 1) {
uni.redirectTo({
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.redirectTo({
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);
uni.redirectTo({
url:
"/pages/detail/index?id=" +
state.id +
"&pid=" +
state.pid +
"&boxRelBucketStatus=" +
state.boxRelBucketStatus,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
}
}
}
};
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
</script>
<style lang="scss" scoped>
page {

BIN
src/static/pic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB