diff --git a/src/App.vue b/src/App.vue
index 506cd68..c0e7377 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -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");
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index f56ba5f..f2728b1 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -66,11 +66,16 @@
>
+ :lazy-load="true"
+ >
+
+
+
+
{
};
// 获取可添加的画作列表
const paintingList = async (param) => {
- loading.value = true;
- const res = await creChangepainting({
- Tfnum: "",
- ArtworkName: "",
- Tnum: "",
- ArtistName: "",
- page: state.page,
- pageSize: state.pageSize,
- keywords: state.searchValue,
- ...param,
- });
- loading.value = false;
- if (res.status === 0) {
- if (res.data.Data !== null) {
- state.tableData = res.data.Data.map((item) => {
- return {
- ...item,
- checked: "",
- };
- });
- console.log(1111, state.tableData);
- showNoResultImage.value = false;
+ uni.showLoading({ title: "加载中...", mask: true });
+ try {
+ loading.value = true;
+ const res = await creChangepainting({
+ Tfnum: "",
+ ArtworkName: "",
+ Tnum: "",
+ ArtistName: "",
+ page: state.page,
+ pageSize: state.pageSize,
+ keywords: state.searchValue,
+ ...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: "",
+ };
+ });
+ showNoResultImage.value = false;
+ } else {
+ state.tableData = [];
+ showNoResultImage.value = true;
+ showMessage({ type: "error", message: "查询失败,暂无画作!" });
+ }
} else {
- state.tableData = [];
- showNoResultImage.value = true;
- showMessage({ type: "error", message: "查询失败,暂无画作!" });
+ showMessage({ type: "error", message: res.msg });
}
- } 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,33 +276,48 @@ const doneSet = async () => {
};
//下拉刷新数据
const scrolltolower = async () => {
- state.page = state.page + 1;
- const res = await creChangepainting({
- Tfnum: "",
- ArtworkName: "",
- Tnum: "",
- ArtistName: "",
- page: state.page,
- pageSize: state.pageSize,
- keywords: state.searchValue,
- });
- if (res.status === 0) {
- if (res.data.Data !== null) {
- const newData = res.data.Data.map((item) => {
- return {
- ...item,
- checked: "",
- };
- });
- const uniqueData = newData.filter((newItem) => {
- return !state.tableData.some(
- (existingItem) => existingItem.ArtworkUuid === newItem.ArtworkUuid
- );
- });
- state.tableData = state.tableData.concat(uniqueData);
+ 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: "",
+ ArtworkName: "",
+ Tnum: "",
+ ArtistName: "",
+ page: state.page,
+ pageSize: state.pageSize,
+ keywords: state.searchValue,
+ });
+ 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,
+ checked: "",
+ };
+ });
+ const uniqueData = newData.filter((newItem) => {
+ return !state.tableData.some(
+ (existingItem) => existingItem.ArtworkUuid === newItem.ArtworkUuid
+ );
+ });
+ state.tableData = state.tableData.concat(uniqueData);
+ }
+ } else {
+ showMessage({ type: "error", message: res.msg });
}
- } else {
- showMessage({ type: "error", message: res.msg });
+ } catch (e) {
+ hasMore.value = false;
+ showMessage({ type: "error", message: e.msg });
+ } finally {
+ loadingPage.value = false;
+ uni.hideLoading();
}
};
//点击照片预览
diff --git a/src/pages/start/index.vue b/src/pages/start/index.vue
index 6a3e533..54e784e 100644
--- a/src/pages/start/index.vue
+++ b/src/pages/start/index.vue
@@ -5,7 +5,113 @@
-
+