From bf41b08b35529b033a3c19ad7fe5b75f4077eea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= <1431128779@qq.com> Date: Mon, 28 Oct 2024 17:53:43 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BC=98=E5=8C=96=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=A8=A1=E6=8B=9F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 42 +- pages/index/index.vue | 5 + pages/tabbar/about/about.vue | 5 +- pages/tabbar/category/category.vue | 453 ++++++------ pages/tabbar/gallery/gallery.vue | 59 +- pages/tabbar/home/home.vue | 939 +++++++++++++------------ pages/tabbar/moments/moments.vue | 51 +- pagesA/archives/archives.vue | 1032 +++++++++++++++------------- store/config.js | 36 +- 9 files changed, 1461 insertions(+), 1161 deletions(-) diff --git a/config/index.js b/config/index.js index 2f902da..2c3726b 100644 --- a/config/index.js +++ b/config/index.js @@ -1,30 +1,50 @@ // 应用设置存储key值 export const _AppConfigKey = 'APP_GLOBAL_CONFIGS'; +export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON'; // 默认的应用设置 export const DefaultAppConfigs = { - loveConfig: {}, - imagesConfig: {}, - authorConfig: {}, - appConfig: {}, - pluginConfig: {}, - pageConfig:{} + loveConfig: {}, + imagesConfig: {}, + authorConfig: {}, + appConfig: {}, + pluginConfig: {}, + pageConfig: {} } /** * 获取应用设置 */ export const getAppConfigs = () => { - let configs = uni.getStorageSync(_AppConfigKey) - if (configs) return JSON.parse(configs) + let configs = uni.getStorageSync(_AppConfigKey) + if (configs) return JSON.parse(configs) - uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs)) - return DefaultAppConfigs; + uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs)) + return DefaultAppConfigs; } /** * 保存应用设置 */ export const setAppConfigs = (configs) => { - uni.setStorageSync(_AppConfigKey, JSON.stringify(configs)) + uni.setStorageSync(_AppConfigKey, JSON.stringify(configs)) +} + + +/** + * 获取应用模拟数据 + */ +export const getAppMockJson = () => { + let json = uni.getStorageSync(_AppMockJsonKey) + if (json) return JSON.parse(json) + + uni.setStorageSync(_AppMockJsonKey, JSON.stringify({})) + return {}; +} + +/** + * 保存应用模拟数据 + */ +export const setAppMockJson = (json) => { + uni.setStorageSync(_AppMockJsonKey, JSON.stringify(json)) } diff --git a/pages/index/index.vue b/pages/index/index.vue index e174190..a7bc6c0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -29,6 +29,11 @@ // #ifdef MP-WEIXIN // uni.$tm.vx.commit('setWxShare', res.shareConfig); // #endif + + // 获取mockjson + await uni.$tm.vx.actions('config/fetchMockJson') + + // 进入检查 this.fnCheckShowStarted(); }).catch((err) => { uni.switchTab({ diff --git a/pages/tabbar/about/about.vue b/pages/tabbar/about/about.vue index 155abf4..28844bb 100644 --- a/pages/tabbar/about/about.vue +++ b/pages/tabbar/about/about.vue @@ -190,7 +190,8 @@ path: '/pagesA/archives/archives', isAdmin: false, type: 'page', - show: !this.haloConfigs.basicConfig.auditModeEnabled + // show: !this.haloConfigs.basicConfig.auditModeEnabled + show: true }, { key: 'love', title: '恋爱日记', @@ -610,4 +611,4 @@ transform: initial; } } - \ No newline at end of file + diff --git a/pages/tabbar/category/category.vue b/pages/tabbar/category/category.vue index 1e09772..bc99fef 100644 --- a/pages/tabbar/category/category.vue +++ b/pages/tabbar/category/category.vue @@ -1,235 +1,258 @@ \ No newline at end of file +.load-text { + width: 100%; + text-align: center; +} + diff --git a/pages/tabbar/gallery/gallery.vue b/pages/tabbar/gallery/gallery.vue index 4c056b6..0a63398 100644 --- a/pages/tabbar/gallery/gallery.vue +++ b/pages/tabbar/gallery/gallery.vue @@ -94,6 +94,12 @@ export default { computed: { galleryConfig() { return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig; + }, + haloConfigs() { + return this.$tm.vx.getters().getConfigs; + }, + mockJson() { + return this.$tm.vx.getters().getMockJson; } }, watch: { @@ -114,6 +120,13 @@ export default { this.fnGetData(true); }, onReachBottom(e) { + if (this.haloConfigs.basicConfig.auditModeEnabled) { + uni.showToast({ + icon: 'none', + title: '没有更多数据了' + }); + return; + } if (this.hasNext) { this.queryParams.page += 1; this.isLoadMore = true; @@ -130,11 +143,15 @@ export default { this.fnResetSetAniWaitIndex(); this.queryParams.group = this.category.list[index].name; this.queryParams.page = 1; - this.fnToTopPage(); + this.fnToTopPage(); this.dataList = []; - this.fnGetData(true); + this.fnGetData(true); }, fnGetCategory() { + if (this.haloConfigs.basicConfig.auditModeEnabled) { + this.fnGetData(true); + return + } this.$httpApi.v2.getPhotoGroupList({ page: 1, size: 0 @@ -151,7 +168,37 @@ export default { } }); }, - fnGetData(isClearWallfull = false) { + fnGetData(isClearWaterfall = false) { + if (this.haloConfigs.basicConfig.auditModeEnabled) { + this.dataList = this.mockJson.gallery.list.map(item => { + return { + metadata: { + name: Date.now() * Math.random(), + }, + spec: { + url: this.$utils.checkImageUrl(item) + } + } + }) + + this.loading = 'success'; + + if (this.galleryConfig.useWaterfall) { + this.$nextTick(() => { + if (isClearWaterfall) { + this.$refs.wafll.clear() + } + setTimeout(() => { + this.$refs.wafll.pushData(this.dataList) + }, 50) + }) + } + this.loadMoreText = '呜呜,没有更多数据啦~'; + uni.hideLoading(); + uni.stopPullDownRefresh(); + return; + } + // 设置状态为加载中 if (!this.isLoadMore) { this.loading = 'loading'; @@ -174,9 +221,9 @@ export default { } if (this.galleryConfig.useWaterfall) { this.$nextTick(() => { - if(isClearWallfull){ - this.$refs.wafll.clear() - } + if (isClearWaterfall) { + this.$refs.wafll.clear() + } this.$refs.wafll.pushData(_list) }) } diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index af5f954..0c8f353 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -1,464 +1,549 @@ \ No newline at end of file + .ani-item { + width: 50%; + } +} + diff --git a/pages/tabbar/moments/moments.vue b/pages/tabbar/moments/moments.vue index f3f1481..21340a8 100644 --- a/pages/tabbar/moments/moments.vue +++ b/pages/tabbar/moments/moments.vue @@ -1,13 +1,13 @@