From e7a83ab7a795861d8c4677766e0b654d3a77ca5e Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Mon, 23 Jun 2025 15:17:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(store):=20=E6=B7=BB=E5=8A=A0logoutFn?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=94=A8=E4=BA=8E=E6=B8=85=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=92=8Ctoken=20feat(config):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AC=E5=9C=B0=E7=8E=AF=E5=A2=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B9=B6=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=BAlocal=20feat(api):=20=E5=9C=A8bookshelf?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=B7=BB=E5=8A=A0isAddBook=E5=92=8CdeleteBoo?= =?UTF-8?q?kshelfByBookId=E6=8E=A5=E5=8F=A3=20feat(api):=20=E5=9C=A8commen?= =?UTF-8?q?t=E6=A8=A1=E5=9D=97=E6=B7=BB=E5=8A=A0getMyReplyCommentList?= =?UTF-8?q?=E5=92=8CdeleteComment=E6=8E=A5=E5=8F=A3=20fix(http):=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3token=E8=BF=87=E6=9C=9F=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B9=B6=E8=B0=83=E7=94=A8logoutFn=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20feat(api):=20=E5=9C=A8achievement=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0getAchievementByBookId=E6=8E=A5=E5=8F=A3=20st?= =?UTF-8?q?yle(chapterPopup):=20=E4=BC=98=E5=8C=96=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E6=96=87=E6=9C=AC=20fix(Ti?= =?UTF-8?q?pping):=20=E4=BF=AE=E6=AD=A3=E6=8E=92=E8=A1=8C=E6=A6=9C?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E5=92=8C=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=20feat(myCommentItem):=20=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=8A=9F=E8=83=BD=20feat(createNovel):=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E5=88=86=E7=B1=BB=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95=E5=A4=84=E7=90=86?= =?UTF-8?q?=20feat(category):=20=E6=B7=BB=E5=8A=A0=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E5=B9=B6=E4=BC=98=E5=8C=96=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E9=80=BB=E8=BE=91=20feat(bookList):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=B1=BB=E7=AD=9B=E9=80=89=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20feat(readnovels):=20=E6=B7=BB=E5=8A=A0=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E4=B9=A6=E6=9E=B6=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=20fix(Walletflow)?= =?UTF-8?q?:=20=E4=BF=AE=E6=AD=A3=E9=87=91=E9=A2=9D=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=92=8C=E7=A9=BA=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=20feat(m?= =?UTF-8?q?yComment):=20=E9=87=8D=E6=9E=84=E8=AF=84=E8=AE=BA=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=88=91=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=92=8C=E5=9B=9E=E5=A4=8D=E6=88=91=E7=9A=84=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20feat(novelDetail):=20=E6=B7=BB=E5=8A=A0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B9=A6=E6=9E=B6=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=AD=89=E7=BA=A7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/http.js | 4 +- api/model/achievement.js | 8 ++- api/model/bookshelf.js | 11 +++ api/model/comment.js | 10 +++ config.js | 5 +- pages/index/category.vue | 24 +++++-- pages_order/author/createNovel.vue | 14 +++- pages_order/comment/myComment.vue | 88 ++++++++++++++++-------- pages_order/components/comment/myCommentItem.vue | 32 ++++++++- pages_order/components/novel/chapterPopup.vue | 4 +- pages_order/mine/Walletflow.vue | 15 ++-- pages_order/novel/Tipping.vue | 3 +- pages_order/novel/bookList.vue | 50 +++++++++++++- pages_order/novel/novelDetail.vue | 66 ++++++++++++++---- pages_order/novel/readnovels.vue | 27 +++++++- store/store.js | 5 ++ 16 files changed, 295 insertions(+), 71 deletions(-) diff --git a/api/http.js b/api/http.js index d9dc4a4..96d5eb7 100644 --- a/api/http.js +++ b/api/http.js @@ -35,9 +35,9 @@ function http(uri, data, callback, method = 'GET', showLoading, title) { if(res.statusCode == 401 || res.data.message == '操作失败,token非法无效!' || res.data.message == '操作失败,用户不存在!'){ - store.commit('logout', '登录过期了,你可以停留在此页面或去重新登录') + store.commit('logoutFn') console.error('登录过期'); - // utils.toLogin() + utils.toLogin() } if(res.statusCode == 200 && res.data.code != 200 diff --git a/api/model/achievement.js b/api/model/achievement.js index 47fb595..016a35b 100644 --- a/api/model/achievement.js +++ b/api/model/achievement.js @@ -6,12 +6,18 @@ const api = { method: 'POST', auth: true, }, - // 根据用户标识和书籍标识查询该用户的成就等级 + // 获取作者设置的成就等级 getAchievement: { url: '/all_achievement/getAchievement', method: 'GET', auth: true, }, + // 根据用户标识和书籍标识查询该用户的成就等级 + getAchievementByBookId: { + url: '/all_achievement/getAchievementByBookId', + method: 'GET', + auth: true, + }, // 获取读者成就列表 getAchievementList: { url: '/all_achievement/getAchievementList', diff --git a/api/model/bookshelf.js b/api/model/bookshelf.js index 9981784..d8e6ef8 100644 --- a/api/model/bookshelf.js +++ b/api/model/bookshelf.js @@ -31,6 +31,17 @@ const api = { method: 'POST', auth: true, }, + // 查询这本书是否加入书架 + isAddBook: { + url: '/all_book/isAddBook', + method: 'GET', + }, + // 根据书籍id删除书架 + deleteBookshelfByBookId: { + url: '/all_book/deleteBookshelfByBookId', + method: 'POST', + auth: true, + }, } export default api \ No newline at end of file diff --git a/api/model/comment.js b/api/model/comment.js index 75e7b05..b17ddef 100644 --- a/api/model/comment.js +++ b/api/model/comment.js @@ -41,6 +41,16 @@ url: '/my_comment/getCommentDetail', method: 'POST', }, + // 获取回复我的评论 + getMyReplyCommentList: { + url: '/my_comment/getMyReplyCommentList', + method: 'GET', + }, + // 删除评论信息 + deleteComment: { + url: '/my_comment/deleteComment', + method: 'GET', + }, } export default api \ No newline at end of file diff --git a/config.js b/config.js index 605ed19..f0c99bc 100644 --- a/config.js +++ b/config.js @@ -8,11 +8,14 @@ import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI); // 当前环境 -const type = 'prod' +const type = 'local' // 环境配置 const config = { + local : { + baseUrl : 'http://127.0.0.1:8002/novel-admin', + }, dev : { baseUrl : 'http://h5.xzaiyp.top/novel-admin', }, diff --git a/pages/index/category.vue b/pages/index/category.vue index a6a1c55..8154678 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -37,6 +37,7 @@ @@ -116,17 +117,28 @@ this.getData() }, beforeGetData(){ - return { - shopCion : this.categoryList[this.currentChildren].id, - shopClass : this.category[this.current].id, + let data = {} + + if(this.categoryList[this.currentChildren].id){ + data.shopCion = this.categoryList[this.currentChildren].id + } + if(this.category[this.current].id){ + data.shopClass = this.category[this.current].id } + + return data }, async getCategoryList() { // const data = await this.$fetch('getCategoryList') // this.category = data let [data1, data2] = await Promise.all([this.$fetch('getCategoryList'), this.$fetch('getBookAreaList')]) - this.category = data1 + this.category = [ + { + title : '全部' + }, + ...data1, + ] this.categoryList = data2 this.mixinsListApi = 'getRecommendList' @@ -139,6 +151,10 @@ const data = await this.$fetch('getBookAreaList') this.categoryList = data }, + navigateToDetail(id) { + // 跳转到小说详情页 + this.$utils.navigateTo(`/pages_order/novel/novelDetail?id=${id}`) + }, } } diff --git a/pages_order/author/createNovel.vue b/pages_order/author/createNovel.vue index 7d3ef62..f8ef004 100644 --- a/pages_order/author/createNovel.vue +++ b/pages_order/author/createNovel.vue @@ -56,7 +56,7 @@ v-for="(item, index) in categoryList" :key="index" class="category-tag" - :class="{ active: formData.shopClass == item.id }" + :class="{ active: classList.includes(item.id) }" @click="selectCategory(item)" > {{item.title}} @@ -124,6 +124,7 @@ details: '', status: '0' // 默认连载 }, + classList : [], id: 0, // showCategoryPicker: false, categoryList: [], @@ -146,6 +147,8 @@ id : this.id }).then(res => { this.formData = res + + this.classList = res.shopClass ? res.shopClass.split(',') : [] }) }, @@ -172,7 +175,12 @@ // 选择分类 selectCategory(item) { - this.formData.shopClass = item.id + let index = this.classList.indexOf(item.id) + if(index != -1){ + this.classList.splice(index, 1) + }else{ + this.classList.push(item.id) + } }, // 提交表单 @@ -203,7 +211,7 @@ const workData = { name: this.formData.name, image: this.formData.image, - shopClass: this.formData.shopClass, + shopClass: this.classList.join(','), details: this.formData.details, status: this.formData.status || 0, } diff --git a/pages_order/comment/myComment.vue b/pages_order/comment/myComment.vue index 22169d8..4a4f5d5 100644 --- a/pages_order/comment/myComment.vue +++ b/pages_order/comment/myComment.vue @@ -1,34 +1,39 @@ @@ -44,18 +49,41 @@ return { mixinsListApi : 'getMyCommentList', unreadComments: [], + tabs: [ + { + name: '我的评论' + }, + { + name: '回复我的' + }, + ], + current : 0, + apiList : [ + 'getMyCommentList', + 'getMyReplyCommentList' + ], } }, onLoad() { this.queryParams.type = 'Y' + this.mixinsListApi = this.apiList[this.current] }, onShow() { this.getList() }, methods: { + //点击tab栏 + clickTabs({ index }) { + this.queryParams.pageSize = 10 + this.current = index + + this.mixinsListApi = this.apiList[this.current] + + this.getData() + }, //获取未读 getList(){ - this.$fetch('getMyCommentList', { + this.$fetch('getMyReplyCommentList', { type : 'N', pageNo: 1, pageSize: 100000 diff --git a/pages_order/components/comment/myCommentItem.vue b/pages_order/components/comment/myCommentItem.vue index 700cf2f..df3cdca 100644 --- a/pages_order/components/comment/myCommentItem.vue +++ b/pages_order/components/comment/myCommentItem.vue @@ -9,9 +9,21 @@ {{ item.comment }} {{ item.createTime }} - + + + + 删除 + + + 回复 + + @@ -19,7 +31,7 @@ diff --git a/pages_order/components/novel/chapterPopup.vue b/pages_order/components/novel/chapterPopup.vue index 9a61bee..ec23f61 100644 --- a/pages_order/components/novel/chapterPopup.vue +++ b/pages_order/components/novel/chapterPopup.vue @@ -7,7 +7,9 @@ 目录 - 倒序 + + {{ orderAsc ? '倒序' : '正序' }} + {{ item.title || item.type || '充值' }} {{ formatDate(item.createTime) }} - +{{ item.num }} + +{{ item.money }} - 暂无充值记录 + 暂无记录 @@ -51,13 +51,12 @@ {{ item.title || item.type || '支付' }} {{ formatDate(item.createTime) }} - -{{ item.num }} + -{{ item.money }} - 暂无支付记录 + 暂无记录 加载中... - 没有更多了 @@ -82,11 +81,11 @@ pageSize: 20, tabList: [ { - name: '充值', + name: '收入', value: 0 }, { - name: '支付', + name: '支出', value: 1 } ] @@ -140,7 +139,7 @@ this.$fetch('getMyMoneyLogPage', { pageNo: this.pageNo, pageSize: this.pageSize, - status: logType // 0-充值记录,1-支付记录 + type: logType // 0-充值记录,1-支付记录 }).then(res => { const records = res.records || []; diff --git a/pages_order/novel/Tipping.vue b/pages_order/novel/Tipping.vue index 75a95ac..acde3c1 100644 --- a/pages_order/novel/Tipping.vue +++ b/pages_order/novel/Tipping.vue @@ -52,7 +52,7 @@ && topList[2].hanHaiMember.headImage" mode="aspectFill"> - + {{ topList[2].name }} {{ topList[2].num }} 亲密值 @@ -225,6 +225,7 @@ export default { font-size: 30rpx; color: #FFFFFF; font-weight: bold; + text-align: center; } .score { diff --git a/pages_order/novel/bookList.vue b/pages_order/novel/bookList.vue index 8f2e480..338d221 100644 --- a/pages_order/novel/bookList.vue +++ b/pages_order/novel/bookList.vue @@ -13,6 +13,18 @@ showAction="false"> + + + diff --git a/pages_order/novel/novelDetail.vue b/pages_order/novel/novelDetail.vue index daee5b8..bbbe042 100644 --- a/pages_order/novel/novelDetail.vue +++ b/pages_order/novel/novelDetail.vue @@ -69,24 +69,32 @@ 我的等级 - + + + - + + :src="bookLevel.hanHaiMember + && bookLevel.hanHaiMember.headImage" + style="width: 40rpx;height: 40rpx;border-radius: 50%;margin-right: 4rpx;" + mode="aspectFill"> - 周海 + {{ (bookLevel.hanHaiMember + && bookLevel.hanHaiMember.nickName) || '_' }} - - + - 6785452 + {{ bookLevel.num || 0}} 亲密值 - 护书使者 五级 + {{ bookLevel.commonBookAchievement + && (bookLevel.commonBookAchievement.oldName || bookLevel.commonBookAchievement.title)}} @@ -145,9 +153,22 @@ - + + + + + + + 删除书架 + + + - + 加入书架 @@ -157,7 +178,7 @@ --> - + 互动打赏 @@ -205,6 +226,8 @@ catalog: {}, //最后一个章节 fastCatalog: {}, //第一章节 chapterList : [],//章节列表 + + isBooshelf : false, } }, computed: {}, @@ -217,6 +240,7 @@ onShow() { this.getDateil() this.getBookCatalogList() + this.isAddBook() if(this.isLogin){ this.getAchievement() } @@ -238,8 +262,8 @@ }) }, getAchievement() { - this.$fetch('getAchievement', { - id: this.id + this.$fetch('getAchievementByBookId', { + bookId: this.id }).then(res => { this.bookLevel = res }) @@ -292,6 +316,7 @@ image: this.novelData.image, novelId : this.fastCatalog && this.fastCatalog.id }).then(res => { + this.isBooshelf = true uni.showToast({ title: '已加入书架', icon: 'success' @@ -308,6 +333,11 @@ url: `/pages_order/novel/Giftbox?id=${this.id}` }) }, + async isAddBook(){ + this.isBooshelf = await this.$fetch('isAddBook', { + bookId: this.id + }) + }, toRead() { if (!this.fastCatalog) { uni.showToast({ @@ -342,6 +372,14 @@ this.getAchievement(); } }, + // 删除书架 + deleteBookshelfByBookId(){ + this.$fetch('deleteBookshelfByBookId', { + bookId : this.id + }).then(res => { + this.isBooshelf = false + }) + }, } } diff --git a/pages_order/novel/readnovels.vue b/pages_order/novel/readnovels.vue index 78d7dfe..2d59a5f 100644 --- a/pages_order/novel/readnovels.vue +++ b/pages_order/novel/readnovels.vue @@ -38,7 +38,7 @@ - + 加入书架 @@ -104,6 +104,8 @@ // 是否需要购买 isPay : false, + + isBooshelf : false, } }, computed: { @@ -127,6 +129,7 @@ }, onShow() { this.getBookCatalogList() + this.isAddBook() }, mounted() { // 初始设置为全屏模式 @@ -140,6 +143,13 @@ this.novelData = res }) }, + async isAddBook(){ + this.$fetch('isAddBook', { + bookId: this.id + }).then(res => { + this.isBooshelf = res + }) + }, async getBookCatalogDetail() { this.isPay = await this.$fetch('getMyShopNovel', { @@ -228,7 +238,20 @@ this.isFullScreen = true this.getBookCatalogDetail() }, - + addToBookshelf() { + this.$fetch('addReadBook', { + shopId: this.id, + name: this.novelData.name, + image: this.novelData.image, + novelId : this.fastCatalog && this.fastCatalog.id + }).then(res => { + this.isBooshelf = true + uni.showToast({ + title: '已加入书架', + icon: 'success' + }) + }) + }, // 更新阅读进度到书架 updateReadProgress() { if (!this.id || !this.cid) return; diff --git a/store/store.js b/store/store.js index 5709b01..265cbc3 100644 --- a/store/store.js +++ b/store/store.js @@ -116,6 +116,11 @@ const store = new Vuex.Store({ } }) }, + logoutFn(state){ + state.userInfo = {} + state.isLogin = false + uni.removeStorageSync('token') + }, }, actions: {}, })