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

View File

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

View File

@ -5,7 +5,113 @@
</div> </div>
</template> </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> <style lang="scss" scoped>
page { page {

BIN
src/static/pic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB