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 @@ 立即保存 - 保存并返回 + 保存并返回