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: {}, })