From 3702cb161884a97c32ce30496c05d58105649dcc 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: Fri, 9 Dec 2022 00:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E5=8D=9A=E4=B8=BB=E9=A1=B5=E9=9D=A2=E9=A1=B6=E9=83=A8=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=8C=89=E9=92=AE=EF=BC=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E5=A4=8D=20=E9=BB=98=E8=AE=A4=E5=B0=81?= =?UTF-8?q?=E9=9D=A2=E5=9B=BE=E3=80=81=E9=BB=98=E8=AE=A4=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E3=80=81=E9=BB=98=E8=AE=A4=E5=A4=B4=E5=83=8F=E5=9C=A8=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=9A=8F=E6=9C=BAapi=E6=97=B6=E5=80=99=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=98=BE=E7=A4=BA=E7=9A=84BUG;=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=8F=91=E5=B8=83=E5=A4=B1=E8=B4=A5BUG;=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=9A=E5=8E=BB=E9=99=A4=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E5=8D=9A=E4=B8=BB=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84=20?= =?UTF-8?q?=E8=81=94=E7=B3=BB=E5=8D=9A=E4=B8=BB=20=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=9B=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=AF=B9=E5=8F=8B?= =?UTF-8?q?=E9=93=BE=E9=A1=B5=E9=9D=A2=E8=BF=9B=E8=A1=8C=E9=87=8D=E5=86=99?= =?UTF-8?q?=EF=BC=9B=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=AF=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E5=92=8C=E5=8A=9F=E8=83=BD=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BC=98=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/admin/posts.js | 1 + pages.json | 4 +- pages/tabbar/about/about.vue | 2 +- pages/tabbar/gallery/gallery.vue | 46 +++++++++++-------- pages/tabbar/home/home.vue | 15 +++++-- pages/tabbar/links/links.vue | 21 ++++++--- pagesA/category-detail/category-detail.vue | 2 +- pagesA/contact/contact.vue | 24 ++-------- pagesA/leaving/leaving.vue | 15 +++++-- pagesA/setting/setting.vue | 28 ++++++++---- pagesB/articles/article-edit.vue | 8 ++-- pagesB/articles/article-setting.vue | 43 +++++++++++------- utils/app.js | 2 +- utils/halo.logs.js | 51 ++++++++++++++++++++++ utils/index.js | 30 +++++++++++-- 15 files changed, 200 insertions(+), 92 deletions(-) create mode 100644 utils/halo.logs.js diff --git a/api/admin/posts.js b/api/admin/posts.js index dc87f99..a9d6023 100644 --- a/api/admin/posts.js +++ b/api/admin/posts.js @@ -24,6 +24,7 @@ const createOrEditModel = { "value": "string" }], "originalContent": "string", + "formatContent": "", "password": "string", "slug": "string", "status": "DRAFT", diff --git a/pages.json b/pages.json index 8aba0e9..1185180 100644 --- a/pages.json +++ b/pages.json @@ -201,8 +201,7 @@ "path": "contact/contact", "style": { "navigationBarTitleText": "联系博主", - "enablePullDownRefresh": false, - "navigationStyle": "custom" + "enablePullDownRefresh": false } }, { "path": "about/about", @@ -216,7 +215,6 @@ "navigationBarTitleText": "设置", "enablePullDownRefresh": false } - }] }, { diff --git a/pages/tabbar/about/about.vue b/pages/tabbar/about/about.vue index f5b5a55..997c07d 100644 --- a/pages/tabbar/about/about.vue +++ b/pages/tabbar/about/about.vue @@ -5,7 +5,7 @@ {{ bloggerInfo.nickname }} - {{ bloggerInfo.description || '一个爱凑热闹的、喜欢捣鼓前端的博主。' }} + {{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }} diff --git a/pages/tabbar/gallery/gallery.vue b/pages/tabbar/gallery/gallery.vue index e4ebe3e..cfd1470 100644 --- a/pages/tabbar/gallery/gallery.vue +++ b/pages/tabbar/gallery/gallery.vue @@ -16,10 +16,10 @@ - + - + @@ -227,26 +227,32 @@ export default { this.$httpApi .getPhotoListByPage(this.queryParams) .then(res => { - this.loading = 'success'; - this.result = res.data; - if (res.data.content.length != 0) { - const _list = res.data.content.map((item, index) => { - item['image'] = this.$utils.checkImageUrl(item.thumbnail); - item['model'] = 'text'; - item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY'); - return item; - }); - this.fnCacheDataList(_list); - if (this.globalAppSettings.gallery.useWaterfull) { - this.dataList = _list; - this.$nextTick(() => { - this.$refs.wafll.pushData(_list); + if (res.status == 200) { + this.loading = 'success'; + this.result = res.data; + if (res.data.content.length != 0) { + const _list = res.data.content.map((item, index) => { + item['image'] = this.$utils.checkImageUrl(item.thumbnail); + item['model'] = 'text'; + item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY'); + return item; }); - } else { - this.dataList = this.dataList.concat(_list); + this.fnCacheDataList(_list); + if (this.globalAppSettings.gallery.useWaterfull) { + this.dataList = _list; + this.$nextTick(() => { + this.$refs.wafll.pushData(_list); + }); + } else { + this.dataList = this.dataList.concat(_list); + } } + this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~'; + } else { + this.loading = 'error'; + this.waterfall.loading = 'finish'; + this.loadMoreText = ''; } - this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~'; }) .catch(err => { console.error(err); @@ -301,6 +307,7 @@ export default { } } .content { + box-sizing: border-box; padding: 0 24rpx; padding-top: 24rpx; @@ -312,6 +319,7 @@ export default { } } .loading-wrap { + box-sizing: border-box; padding: 24rpx; } diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index 108b4fb..30a6046 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -196,7 +196,10 @@ export default { this.$httpApi .getCategoryList({ more: true }) .then(res => { - this.categoryList = res.data; + this.categoryList = res.data.sort((a, b) => { + return b.postCount - a.postCount; + }); + setTimeout(() => { this.loading = 'success'; }, 500); @@ -216,12 +219,16 @@ export default { fnGetBanner() { const _this = this; const _format = function(list, type) { - return list.map(item => { + return list.map((item, index) => { switch (type) { case 'list': return { - id: '', - src: item + id: index, + nickname: _this.bloggerInfo.nickname, + avatar: _this.bloggerInfo.avatar, + address: item.href || '', + title: item.title, + image: _this.$utils.checkImageUrl(item.thumbnail) }; case 'article': return { diff --git a/pages/tabbar/links/links.vue b/pages/tabbar/links/links.vue index 18e091f..68b1cc1 100644 --- a/pages/tabbar/links/links.vue +++ b/pages/tabbar/links/links.vue @@ -7,9 +7,9 @@ - + - + @@ -190,7 +190,7 @@ export default { }; }); - this.result = _result.reverse(); + // this.result = _result.reverse(); setTimeout(() => { this.loading = 'success'; }, 500); @@ -245,17 +245,24 @@ export default { min-height: 100vh; display: flex; flex-direction: column; + background-color: #fafafd; } .loading-wrap { padding: 24rpx; min-height: 100vh; } -.empty { - width: 100vw; - height: 60vh; -} +.content { + padding: 0 24rpx; + padding-top: 24rpx; + .content-empty { + height: 60vh; + display: flex; + align-items: center; + justify-content: center; + } +} .link-card { border-bottom: 2rpx solid #f5f5f5; background-color: #ffffff; diff --git a/pagesA/category-detail/category-detail.vue b/pagesA/category-detail/category-detail.vue index e1d6ad2..0a94510 100644 --- a/pagesA/category-detail/category-detail.vue +++ b/pagesA/category-detail/category-detail.vue @@ -16,7 +16,7 @@ {{ loadMoreText }} - + diff --git a/pagesA/contact/contact.vue b/pagesA/contact/contact.vue index 9f3624c..9240433 100644 --- a/pagesA/contact/contact.vue +++ b/pagesA/contact/contact.vue @@ -2,12 +2,9 @@ - - - - + {{ bloggerInfo.nickname }} - {{ bloggerInfo.description }} + {{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }} @@ -19,7 +16,7 @@ - + 在线客服联系 访问PC端博客 @@ -129,7 +126,7 @@ export default { } }, onLoad() { - this.fnSetPageTitle('❤'); + this.fnSetPageTitle('联系博主'); }, created() { this.fnGetData(); @@ -185,19 +182,6 @@ export default { border: 6rpx solid #fff; box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07); overflow: hidden; - .icon { - width: 42rpx; - height: 42rpx; - position: absolute; - right: 6rpx; - bottom: 0rpx; - border-radius: 50%; - color: #fff; - box-sizing: border-box; - background-color: #03b0fd; - border: 4rpx solid #fff; - z-index: 2; - } &-img { width: 100%; height: 100%; diff --git a/pagesA/leaving/leaving.vue b/pagesA/leaving/leaving.vue index c621059..a1ca853 100644 --- a/pagesA/leaving/leaving.vue +++ b/pagesA/leaving/leaving.vue @@ -6,10 +6,10 @@ - + - + @@ -28,9 +28,9 @@ - {{ loadMoreText }} + @@ -164,6 +164,7 @@ export default { .then(res => { if (res.status == 200) { this.loading = 'success'; + // return; this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~'; // 处理数据 this.result = res.data; @@ -252,12 +253,18 @@ export default { width: 100vw; display: flex; flex-direction: column; + background-color: #fafafd; } .app-page-content { box-sizing: border-box; - box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05); + // box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05); +} +.content-empty { + width: 100%; + height: 60vh; } .loading-wrap { + box-sizing: border-box; padding: 24rpx; } diff --git a/pagesA/setting/setting.vue b/pagesA/setting/setting.vue index 663a171..41451d7 100644 --- a/pagesA/setting/setting.vue +++ b/pagesA/setting/setting.vue @@ -148,6 +148,8 @@ export default { isBlackTheme: false, loading: true, appSettings: {}, + isSaved: true, + firstLoad: true, homeLayout: { list: [{ name: '一行一列', value: 'h_row_col1' }, { name: '一行两列', value: 'h_row_col2' }], selectDefault: ['一行一列'], @@ -169,15 +171,17 @@ export default { dotPositionList: [{ name: '右边', value: 'right', checked: true }, { name: '下边', value: 'bottom', checked: false }] }; }, - computed: { - // 获取设置 - _appSettings() { - return uni.$tm.vx.getters().setting.getSettings; - } - }, + watch: { - _appSettings(val) { - this.appSettings = val; + appSettings: { + deep: true, + handler() { + if (this.firstLoad) { + this.firstLoad = false; + } else { + this.isSaved = false; + } + } } }, @@ -185,7 +189,7 @@ export default { this.fnSetPageTitle('应用设置'); }, created() { - this.appSettings = this._appSettings; + this.appSettings = uni.$tm.vx.getters().setting.getSettings; this.fnHandleFormatSelect(); uni.showLoading({ title: '加载中...', @@ -242,6 +246,7 @@ export default { }, // 保存 fnOnSave() { + this.isSaved = true; this.$tm.vx.commit('setting/setSettings', this.appSettings); uni.$tm.toast('保存成功,部分设置在重启后生效!'); }, @@ -257,12 +262,16 @@ export default { confirmColor: '#03a9f4' }) .then(res => { + this.isSaved = true; uni.$tm.vx.actions('setting/updateDefaultAppSettings'); uni.$tm.toast('系统设置已恢复为默认配置,部分设置在重启后生效!'); }) .catch(err => {}); }, fnOnBack() { + if (this.isSaved) { + uni.navigateBack(); + } uni.$eShowModal({ title: '提示', content: '您当前可能有未保存的数据,确定返回吗?', @@ -274,6 +283,7 @@ export default { }) .then(res => { uni.navigateBack(); + this.isSaved = true; }) .catch(err => {}); } diff --git a/pagesB/articles/article-edit.vue b/pagesB/articles/article-edit.vue index 057bc11..544c167 100644 --- a/pagesB/articles/article-edit.vue +++ b/pagesB/articles/article-edit.vue @@ -151,7 +151,8 @@ export default { form: { content: '', keepRaw: true, - sourceContent: '', + originalContent: '', + formatContent: '', type: 'PUBLIC' }, modal: null, @@ -532,9 +533,10 @@ export default { return uni.$tm.toast('请输入内容!'); } this.form.content = _content; - this.form.sourceContent = this.$refs.markdown.getText(); + this.form.formatContent = _content; + this.form.originalContent = this.$refs.markdown.getText(); uni.setStorageSync('posts-content', _content); - uni.setStorageSync('posts-content-source', this.form.sourceContent); + uni.setStorageSync('posts-content-source', this.form.originalContent); if (this.form.id) { this.$Router.push({ path: '/pagesB/articles/article-setting', diff --git a/pagesB/articles/article-setting.vue b/pagesB/articles/article-setting.vue index b2d58b2..f3a3442 100644 --- a/pagesB/articles/article-setting.vue +++ b/pagesB/articles/article-setting.vue @@ -151,7 +151,7 @@ 立即保存 - 保存并返回 + 保存并返回