diff --git a/.gitignore b/.gitignore index e69de29..a98e9c4 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +unpackage/ +.hbuilderx/ +*.key +package-lock.json diff --git a/main.js b/main.js index 5f1f4be..f060fe9 100644 --- a/main.js +++ b/main.js @@ -27,27 +27,73 @@ export function createApp() { } // #endif + // ================== 全局请求拦截器 ================== // -// 在 main.js 中增强请求拦截器 uni.addInterceptor('request', { invoke(args) { + // 1. 添加认证信息 const token = uni.getStorageSync('uni_id_token') - console.log('[DEBUG] Current Token:', token) // 添加调试输出 - - args.header = { - ...args.header, - 'X-Cloud-Token': token, - 'X-Device-Id': uni.getSystemInfoSync().deviceId // 追加设备指纹 + if (token) { + args.header = { + ...args.header, + 'X-Cloud-Token': token, + // 异步获取设备信息(避免阻塞) + 'X-Device-Id': getApp().globalData.deviceId || 'unknown' + } } + + // 2. 添加请求超时配置 + if (!args.timeout) { + args.timeout = 10000 // 默认10秒超时 + } + + // 3. 生产环境移除调试输出 + if (process.env.NODE_ENV === 'development') { + console.log('[请求拦截]', args.url, args.header) + } + return args }, + fail(err) { - // 增加网络错误细分处理 - if (err.errMsg.includes('timeout')) { - uni.showToast({ title: '网络超时', icon: 'none' }) - } else if (err.errMsg.includes('token')) { - uni.removeStorageSync('uni_id_token') - uni.redirectTo({ url: '/pages/login?err=TOKEN_EXPIRED' }) + // 1. 网络错误处理 + if (err.errMsg.includes('fail abort')) { + uni.showToast({ title: '请求取消', icon: 'none' }) + } + // 2. 超时处理 + else if (err.errMsg.includes('timeout')) { + uni.showToast({ title: '网络超时,请重试', icon: 'none' }) + } + // 3. Token失效处理 + else if (err.errMsg.includes('401') || err.errMsg.includes('TOKEN')) { + handleTokenExpired() + } + // 4. 其他错误 + else { + uni.showToast({ title: '网络异常', icon: 'none' }) } } -}) \ No newline at end of file +}) + +// 独立处理Token过期的函数 +function handleTokenExpired() { + uni.showModal({ + title: '登录过期', + content: '请重新登录', + showCancel: false, + success: () => { + uni.removeStorageSync('uni_id_token') + uni.reLaunch({ url: '/pages/login' }) + } + }) +} + +// 在应用启动时预加载设备信息 +export function initDeviceInfo() { + uni.getSystemInfo({ + success: (res) => { + getApp().globalData = getApp().globalData || {} + getApp().globalData.deviceId = res.deviceId + } + }) +} diff --git a/package.json b/package.json index 54012a6..03a5224 100644 --- a/package.json +++ b/package.json @@ -20,5 +20,8 @@ "price": "0.00" } } + }, + "dependencies": { + "yarn": "^1.22.22" } -} \ No newline at end of file +} diff --git a/pages.json b/pages.json index 413f0c3..efa628e 100644 --- a/pages.json +++ b/pages.json @@ -9,36 +9,12 @@ "navigationBarTitleText" : "首页" } }, - { - "path" : "pages/articleContentDetail/articleContentDetail", - "style" : { - "navigationBarTitleText" : "鱼水情" - } - }, { "path" : "pages/my/my", "style" : { "navigationBarTitleText" : "个人中心" } }, - { - "path" : "pages/login/login", - "style" : { - "navigationBarTitleText" : "login" - } - }, - { - "path" : "pages/test/test", - "style" : { - "navigationBarTitleText" : "test" - } - }, - { - "path" : "uni_modules/uni-media-library/pages/index/index", - "style" : { - "navigationBarTitleText" : "媒体库" - } - }, { "path" : "uni_modules/uni-cms-article/pages/list/list", "style" : { @@ -73,43 +49,42 @@ "style" : { "navigationBarTitleText" : "" } - }, - { - "path" : "uni_modules/uni-pay/pages/success/success", - "style" : { - "backgroundColor" : "#F8F8F8", - "navigationBarTitleText" : "支付成功" - } - }, - { - "path" : "uni_modules/uni-pay/pages/ad-interactive-webview/ad-interactive-webview", - "style" : { - "backgroundColor" : "#F8F8F8", - "navigationBarTitleText" : "ad" - } - }, - { - "path" : "uni_modules/uni-pay/pages/pay-desk/pay-desk", - "style" : { - "backgroundColor" : "#F8F8F8", - "navigationBarTitleText" : "收银台" - } - }, - { - "path" : "uni_modules/zetank-personalpage/pages/personalpage/personalpage", - "style" : { - "app-plus" : { - "bounce" : "none" - }, - "enablePullDownRefresh" : false, - "mp-alipay" : { - "allowsBounceVertical" : "NO" - }, - "navigationBarTitleText" : "个人主页" - } } ], "subPackages" : [ + { + "root" : "pages/articleContentDetail", + "pages" : [ + { + "path" : "articleContentDetail", + "style" : { + "navigationBarTitleText" : "鱼水情" + } + } + ] + }, + { + "root" : "pages/login", + "pages" : [ + { + "path" : "login", + "style" : { + "navigationBarTitleText" : "login" + } + } + ] + }, + { + "root" : "pages/test", + "pages" : [ + { + "path" : "test", + "style" : { + "navigationBarTitleText" : "test" + } + } + ] + }, { "root" : "pages2", "easycom" : { @@ -222,6 +197,61 @@ } ] }, + { + "root" : "uni_modules/uni-media-library/pages/index", + "pages" : [ + { + "path" : "index", + "style" : { + "navigationBarTitleText" : "媒体库" + } + } + ] + }, + { + "root" : "uni_modules/uni-pay/pages", + "pages" : [ + { + "path" : "success/success", + "style" : { + "backgroundColor" : "#F8F8F8", + "navigationBarTitleText" : "支付成功" + } + }, + { + "path" : "ad-interactive-webview/ad-interactive-webview", + "style" : { + "backgroundColor" : "#F8F8F8", + "navigationBarTitleText" : "ad" + } + }, + { + "path" : "pay-desk/pay-desk", + "style" : { + "backgroundColor" : "#F8F8F8", + "navigationBarTitleText" : "收银台" + } + } + ] + }, + { + "root" : "uni_modules/zetank-personalpage/pages/personalpage", + "pages" : [ + { + "path" : "personalpage", + "style" : { + "app-plus" : { + "bounce" : "none" + }, + "enablePullDownRefresh" : false, + "mp-alipay" : { + "allowsBounceVertical" : "NO" + }, + "navigationBarTitleText" : "个人主页" + } + } + ] + }, { "root" : "pages3", "pages" : [ diff --git a/pages/my/my.scss b/pages/my/my.scss index b6c59f5..e69de29 100644 --- a/pages/my/my.scss +++ b/pages/my/my.scss @@ -1,116 +0,0 @@ -.page { - background: #f5f5f5; - min-height: 100vh; - - .action{ - display: flex; - justify-content: flex-end; - padding: 10rpx; - background: #4B79EC; - - view{ - padding: 10rpx; - margin: 0 10rpx; - border-radius: 8rpx; - width: 45rpx; - height: 45rpx; - - &:active{ - background: #ccc; - } - - image{ - width: 45rpx; - height: 45rpx; - } - } - } - - .user{ - display: flex; - align-items: center; - padding: 25rpx; - background: #4B79EC; - - &:active{ - background: #f0f0f0; - } - - .avatar{ - width: 120rpx; - height: 120rpx; - border-radius: 50%; - // border: 3px solid #3a5fb6; - } - - .right{ - width: 30rpx; - height: 30rpx; - } - - .name{ - flex-grow: 1; - display: flex; - flex-direction: column; - padding-left: 20rpx; - - text{ - color: #fff; - - &:nth-child(1){ - font-size: 16px; - font-weight: bold; - } - &:nth-child(2){ - font-size: 12px; - color: #f0f0f0; - } - } - } - } - - .card{ - background: #fff; - box-sizing: border-box; - width: 700rpx; - margin: auto; - padding: 15rpx; - margin-top: 20rpx; - border-radius: 12rpx; - - .menu{ - - .item{ - display: flex; - height: 100rpx; - align-items: center; - padding: 0 20rpx; - box-sizing: border-box; - width: 700rpx; - - &:active{ - background: #f0f0f0; - } - - image{ - height: 45rpx; - width: 45rpx; - } - - view{ - font-size: 14px; - color: #444; - padding-left: 15rpx; - box-sizing: border-box; - width: calc(100% - 100rpx); - } - - .arrow{ - width: 26rpx; - height: 26rpx; - } - } - } - } - -} \ No newline at end of file diff --git a/pages/my/my.vue b/pages/my/my.vue index 52e5460..785fc9d 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -1,59 +1,115 @@ \ No newline at end of file + @import './my.scss'; + diff --git a/pages2/arctcleCollectList/arctcleCollectList.vue b/pages2/arctcleCollectList/arctcleCollectList.vue index 0c0e49a..5f46ddd 100644 --- a/pages2/arctcleCollectList/arctcleCollectList.vue +++ b/pages2/arctcleCollectList/arctcleCollectList.vue @@ -93,6 +93,9 @@ userInfo() { return store.userInfo }, + queryUserId() { + return this.userInfo && this.userInfo._id ? this.userInfo._id : '__empty__' + }, realNameStatus() { if (!this.userInfo.realNameAuth) { return 0 @@ -113,7 +116,7 @@ return [ db.collection("cms-articles-collect") .where({ - user_id: this.userInfo._id, + user_id: this.queryUserId, }) .getTemp(), db.collection(articleDBName) @@ -256,6 +259,13 @@ return uniCloud.importObject("cms-articles-log").getHistory(this.userInfo._id); } }, + watch: { + 'userInfo._id'(val, oldVal) { + if (val && val !== oldVal && this.$refs.udb) { + this.refresh() + } + } + }, async onReady() { // #ifdef MP this.initNavBarSize() // 初始化导航栏大小 @@ -347,4 +357,4 @@ .pages .uni-list ::v-deep .uni-list--border:after { background-color: #f5f5f5; } - \ No newline at end of file + diff --git a/pages2/arctcleLikeList/arctcleLikeList.vue b/pages2/arctcleLikeList/arctcleLikeList.vue index 84bd4b0..705a44a 100644 --- a/pages2/arctcleLikeList/arctcleLikeList.vue +++ b/pages2/arctcleLikeList/arctcleLikeList.vue @@ -97,6 +97,9 @@ userInfo() { return store.userInfo }, + queryUserId() { + return this.userInfo && this.userInfo._id ? this.userInfo._id : '__empty__' + }, realNameStatus() { if (!this.userInfo.realNameAuth) { return 0 @@ -118,7 +121,7 @@ return [ db.collection("cms-articles-like") .where({ - user_id: this.userInfo._id, + user_id: this.queryUserId, }) .getTemp(), db.collection(articleDBName) @@ -258,6 +261,13 @@ return uniCloud.importObject("cms-articles-log").getHistory(this.userInfo._id); } }, + watch: { + 'userInfo._id'(val, oldVal) { + if (val && val !== oldVal && this.$refs.udb) { + this.refresh() + } + } + }, async onReady() { // #ifdef MP this.initNavBarSize() // 初始化导航栏大小 @@ -349,4 +359,4 @@ .pages .uni-list ::v-deep .uni-list--border:after { background-color: #f5f5f5; } - \ No newline at end of file + diff --git a/pages2/follow/follow.vue b/pages2/follow/follow.vue index 7dfa99b..fc73d10 100644 --- a/pages2/follow/follow.vue +++ b/pages2/follow/follow.vue @@ -125,7 +125,7 @@ import { follow } from "../../uniCloud-alipay/cloudfunctions/follow/index.obj"; return [ db.collection("follow") - .where(this.where) + .where(this.followWhere) .field("_id,fid,create_time") .getTemp(), db.collection("uni-id-users") @@ -133,6 +133,13 @@ import { follow } from "../../uniCloud-alipay/cloudfunctions/follow/index.obj"; .getTemp() ]; + }, + followWhere() { + return this.userInfo && this.userInfo._id ? { + uid: this.userInfo._id + } : { + uid: '__empty__' + } } }, data() { @@ -151,9 +158,7 @@ import { follow } from "../../uniCloud-alipay/cloudfunctions/follow/index.obj"; listData: [], // 列表数据 loadType: null, - followLst: [], - - where:{}, + followLst: [] } }, methods: { @@ -283,8 +288,6 @@ import { follow } from "../../uniCloud-alipay/cloudfunctions/follow/index.obj"; this.listHeight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - this .navBarHeight + 'px'; // 计算列表高度 - this.where = {uid: this.userInfo._id}; - console.log(this.where) this.$refs.udb.loadData(); }, @@ -476,4 +479,4 @@ import { follow } from "../../uniCloud-alipay/cloudfunctions/follow/index.obj"; background: #F8F8F8; } - \ No newline at end of file + diff --git a/pages2/historyList/historyList.vue b/pages2/historyList/historyList.vue index 12578d2..88e9260 100644 --- a/pages2/historyList/historyList.vue +++ b/pages2/historyList/historyList.vue @@ -106,6 +106,9 @@ userInfo() { return store.userInfo }, + queryUserId() { + return this.userInfo && this.userInfo._id ? this.userInfo._id : '__empty__' + }, realNameStatus() { if (!this.userInfo.realNameAuth) { return 0 @@ -127,8 +130,8 @@ return [ db.collection("cms-articles-log") .where({ - user_id: this.userInfo._id, - article_id: db.command.neq([]) + user_id: this.queryUserId, + article_id: db.command.exists(true) }) .getTemp(), db.collection(articleDBName) @@ -273,6 +276,13 @@ return uniCloud.importObject("cms-articles-log").getHistory(this.userInfo._id); } }, + watch: { + 'userInfo._id'(val, oldVal) { + if (val && val !== oldVal && this.$refs.udb) { + this.refresh() + } + } + }, async onReady() { // #ifdef MP this.initNavBarSize() // 初始化导航栏大小 @@ -418,4 +428,4 @@ margin-left: 14rpx; } } - \ No newline at end of file + diff --git a/pages2/replyCommentList/replyCommentList.vue b/pages2/replyCommentList/replyCommentList.vue index 345d8ee..3eba85d 100644 --- a/pages2/replyCommentList/replyCommentList.vue +++ b/pages2/replyCommentList/replyCommentList.vue @@ -127,6 +127,9 @@ userInfo() { return store.userInfo }, + queryUserId() { + return this.userInfo && this.userInfo._id ? this.userInfo._id : '__empty__' + }, realNameStatus() { if (!this.userInfo.realNameAuth) { return 0 @@ -147,7 +150,7 @@ return [ db.collection("comment") .where({ - parent_author_id: this.userInfo._id, + parent_author_id: this.queryUserId, }) .getTemp(), db.collection("uni-id-users") @@ -407,6 +410,13 @@ }) } }, + watch: { + 'userInfo._id'(val, oldVal) { + if (val && val !== oldVal && this.$refs.udb) { + this.refresh() + } + } + }, async onReady() { // #ifdef MP this.initNavBarSize() // 初始化导航栏大小 @@ -592,4 +602,4 @@ line-height: 12px; padding: 0 0 2px 5px; } - \ No newline at end of file + diff --git a/uni_modules/uni-cms-article/pages/detail/detail.vue b/uni_modules/uni-cms-article/pages/detail/detail.vue index 3b08fd7..cd2957e 100644 --- a/uni_modules/uni-cms-article/pages/detail/detail.vue +++ b/uni_modules/uni-cms-article/pages/detail/detail.vue @@ -33,228 +33,166 @@ - - - - - - {{ userInfo.nickname || '' }} - · - - {{ publishTime( data.publish_date) }} - - - + + + + + {{ userInfo.nickname || '' }} + · + + {{ publishTime( data.publish_date) }} + - - - - - - - + + + + + + + - - - - + + + - - - - - - - - - {{ item.vote.voteTitle }} - 截止时间:{{ item.vote.datetime }} - - - - - {{ radio.value }} - - - - - - - - - {{ - (selectVoteValue[item.vote.vote_id]. - all_data.selectValue[radio.value] || 0) - }} - - - - - - - - - - - - - + - - - + + + + + {{ item.vote.voteTitle }} + 截止时间:{{ item.vote.datetime }} + + + v-if="isSelectVoteValue[item.vote.vote_id] === true || isExpired(item.vote.datetime)" + v-for="(radio, radioIndex) in item.vote.voteLst"> + {{ radio.value }} - - - - - - - {{ - (selectVoteValue[item.vote.vote_id]. - all_data.selectValue[radio.value] || 0) - }} - + + + + {{ + (selectVoteValue[item.vote.vote_id]. + all_data.selectValue[radio.value] || 0) + }} + - - - - - - - - - - - + + + + + + + + + + + + {{ radio.value }} + + + + + + + + + {{ + (selectVoteValue[item.vote.vote_id]. + all_data.selectValue[radio.value] || 0) + }} + + + + + + + :key="checkboxIndex" :label="checkbox.value" :name="checkbox.value"> + + + + + + + + + + - - - - - - - - 已截止 - - - - 点击登录后投票 - - - - 你已投票 - - - - 点击投票 - - + + + - - + + + 你已投票 + + + 已截止 + + + 点击登录后投票 + + + + + + 点击投票 + + + + - + + @@ -262,7 +200,7 @@ {{ data.title }} - @@ -343,9 +281,8 @@ @replyAdd="replyAdd" @getTreeComment="getTreeComment" :deleteTip="'确认删除?'" :cmData="commentData" v-if="commentData" :user_name_color="temp.user_name_color" :btn_color="btn_color" :select_icon_color="select_icon_color" :icon_color="icon_color" - :btn_send_commends_color="btn_send_commends_color" - :btn_send_commends_font_color="btn_send_commends_font_color" - :icon_font_color="icon_font_color" + :btn_send_commends_color="btn_send_commends_color" + :btn_send_commends_font_color="btn_send_commends_font_color" :icon_font_color="icon_font_color" :select_font_color="select_font_color"> @@ -568,7 +505,7 @@ import mediaList from "@/components/image-grid/media-list.vue"; import uCheckboxGroup from "@/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue"; import uCheckbox from "@/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue"; - + import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'; import renderArticleDetail from "@/uni_modules/uni-cms-article/components/render-article-detail/index.vue"; import translatePublishTime from "@/uni_modules/uni-cms-article/common/publish-time"; @@ -672,12 +609,12 @@ temp: {}, isPlay: true, isSelectVoteValue: { - + }, selectVoteValue: { - + } - + } }, onShow() { @@ -754,14 +691,18 @@ return this.userInfo.realNameAuth.authStatus }, isLogin() { - return this.userInfo._id?true:false; + return this.userInfo._id ? true : false; }, where() { - return `_id =="${this.id}"` + return { + _id: this.id + } }, collection() { return [ - db.collection("uni-cms-articles").where(this.where).getTemp(), + db.collection("uni-cms-articles").where({ + _id: this.id + }).getTemp(), db.collection("uni-id-users").field('_id, nickname,avatar_file').getTemp() ] }, @@ -851,7 +792,7 @@ methods: { setVoteValue(vote_id, value) { this.selectVoteValue[vote_id].val = value; - + }, async isSelectVote(vote_id) { console.log(vote_id) @@ -867,7 +808,26 @@ } }, isExpired(voteEndTime) { - return new Date() > new Date(voteEndTime); + if (!voteEndTime) return false; // 处理 null/undefined + + const endTime = new Date(voteEndTime); + if (isNaN(endTime.getTime())) { + console.warn('Invalid voteEndTime:', voteEndTime); + return false; // 或根据业务需求返回 true + } + + return new Date() >= endTime; + }, + async safeToFixed(value, digits = 2) { + // 确保 value 是数字 + const num = Number(value); + + // 检查是否是有效数字 + if (typeof num !== 'number' || isNaN(num) || !isFinite(num)) { + return '0'.padEnd(digits + 1, '.0'); // 返回 "0.00" + } + + return num.toFixed(digits); }, isCheckboxDisabled(arr, name) { console.log(arr, name) @@ -880,32 +840,36 @@ console.log(this.selectVoteValue); console.log(e) }, - groupChange(n) { + groupChange(n) { console.log('groupChange', n); - }, - radioChange(n) { + }, + radioChange(n) { console.log('radioChange', n); - - }, - formatDate(date, format) { - const map = { - 'yyyy': date.getFullYear(), - 'MM': String(date.getMonth() + 1).padStart(2, '0'), - 'dd': String(date.getDate()).padStart(2, '0'), - 'HH': String(date.getHours()).padStart(2, '0'), - 'mm': String(date.getMinutes()).padStart(2, '0'), - 'ss': String(date.getSeconds()).padStart(2, '0') - }; - - return format.replace( - /yyyy|MM|dd|HH|mm|ss/g, - matched => map[matched] - ); - }, - // 时间格式化 - formatTime() { - return this.formatDate(new Date(), 'yyyy-MM-dd HH:mm'); - }, + + }, + formatDate(date, format) { + const map = { + 'yyyy': date.getFullYear(), + 'MM': String(date.getMonth() + 1).padStart(2, '0'), + 'dd': String(date.getDate()).padStart(2, '0'), + 'HH': String(date.getHours()).padStart(2, '0'), + 'mm': String(date.getMinutes()).padStart(2, '0'), + 'ss': String(date.getSeconds()).padStart(2, '0') + }; + + return format.replace( + /yyyy|MM|dd|HH|mm|ss/g, + matched => map[matched] + ); + }, + // 时间格式化 + formatTime() { + return this.formatDate(new Date(), 'yyyy-MM-dd HH:mm'); + }, + async ttt(item) { + console.log(item) + console.log(this.isExpired(item.vote.datetime)) + }, async monthlyGiftChartsListLoad(data) { console.log(data); @@ -1223,22 +1187,22 @@ }, async getVoteInfo(vote_id) { let user_id = this.userInfo._id; - + let query = { user_id: user_id, vote_id: vote_id }; - + const res = await uniCloud.importObject("cms-vote").getVoteInfo(query); - + if (res.code === 200) { this.selectVoteValue[vote_id] = { user_data: res.user_data, all_data: res.all_data }; } - - + + }, async loadData(data) { console.log(data); @@ -1250,7 +1214,7 @@ this.detail_music = data.music_url_id this.temp_id = data.temp_id if (data.edit_type === "mobile") { - for (let i = 0 ; i < data.cmsLst.length ; i++ ) { + for (let i = 0; i < data.cmsLst.length; i++) { if (data.cmsLst[i].type === "vote") { let vote_id = data.cmsLst[i].vote.vote_id; await this.isSelectVote(vote_id); @@ -1520,14 +1484,14 @@ selectValue: this.selectVoteValue[vote_id].val, type: item.vote.type } - + const res = await uniCloud.importObject("cms-vote").add_vote(query); - + if (res.code === 200) { await this.getVoteInfo(vote_id); this.isSelectVoteValue[vote_id] = true; } - + }, checkUrlProtocol(url) { try { @@ -2346,7 +2310,7 @@ font-size: 28rpx; color: #333; } - + .order-index { flex: 1; text-align: center; @@ -2356,7 +2320,7 @@ .avatar-column { flex: 1; - + display: flex; justify-content: center; } @@ -2370,7 +2334,7 @@ .nickname-column { flex: 4; - + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -2379,7 +2343,7 @@ .gift-value { flex: 2; - + text-align: right; color: #e6a23c; font-weight: 500; @@ -2400,40 +2364,45 @@ height: 64rpx; border-radius: 50%; } - + .grid-container { - display: flex; - gap: 10px; /* 列间距 */ - padding: 15px; - background: #f5f5f5; + display: flex; + gap: 10px; + /* 列间距 */ + padding: 15px; + background: #f5f5f5; } - + .grid-item { - flex: 1; /* 等分容器宽度 */ - min-width: 0; /* 防止内容溢出 */ - aspect-ratio: 1; /* 默认正方形 */ - background: white; - border-radius: 8px; - overflow: hidden; + flex: 1; + /* 等分容器宽度 */ + min-width: 0; + /* 防止内容溢出 */ + aspect-ratio: 1; + /* 默认正方形 */ + background: white; + border-radius: 8px; + overflow: hidden; } - + .page-container { - padding: 20rpx 0; + padding: 20rpx 0; } - + .rectangle-img { - width: 100%; - height: 100%; - object-fit: cover; - aspect-ratio: 16/9; /* 设置长方形比例 */ + width: 100%; + height: 100%; + object-fit: cover; + aspect-ratio: 16/9; + /* 设置长方形比例 */ } - + .meta { - + position: relative; z-index: 1; padding-top: 20rpx; - + .title { .text { font-size: 40rpx; @@ -2442,63 +2411,64 @@ color: #333; } } - + .excerpt { margin-top: 10rpx; - + .text { font-size: 26rpx; line-height: 40rpx; color: #999; } } - + .author { display: flex; align-items: center; justify-content: flex-start; flex-direction: row; margin-top: 20rpx; - + .at, .split, .date { font-size: 26rpx; color: #ccc; } - + .split { margin: 0 10rpx; } } } - + .body { padding: 20rpx; + .cms-body { display: flex; min-height: 60hv; width: 100wv; } } - + .v-preview { .img { width: 100%; } - + .btn-area { position: relative; top: -50rpx; } - + .red-btn-area { display: flex; justify-content: center; padding: 10rpx 0; margin: 0 40rpx 20rpx 40rpx; font-size: 20rpx; - + .red-btn { position: relative; color: #fff; @@ -2508,13 +2478,13 @@ line-height: 40rpx; margin: 0; background-image: linear-gradient(to bottom, #c11c1f, #5c0201); - + +.red-btn { margin-left: 20rpx; } } } - + .red-btn-plain-area { display: flex; justify-content: center; @@ -2529,16 +2499,16 @@ #b13636, #f44336bf, #fff) 1; - + .red-btn-plain { position: relative; color: #b13636; font-weight: 700; padding-left: 15rpx; - + +.red-btn-plain { margin-left: 10rpx; - + &::before { // border-left: 2px solid #f44336; content: ""; @@ -2554,68 +2524,75 @@ } } } - - + + .vote-container { - padding: 20rpx; + padding: 20rpx; } - + .vote-title { - font-size: 16px; - font-weight: bold; - color: #333; - display: block; - margin-bottom: 10rpx; + font-size: 16px; + font-weight: bold; + color: #333; + display: block; + margin-bottom: 10rpx; } - + .deadline { - font-size: 12px; - color: #999; - margin-bottom: 30rpx; - display: block; + font-size: 12px; + color: #999; + margin-bottom: 30rpx; + display: block; } - + .radio-group { - margin-bottom: 40rpx; + margin-bottom: 40rpx; } - + .option-item { - display: flex; - align-items: center; - margin: 15rpx 0; + display: flex; + align-items: center; + margin: 15rpx 0; } - + .option-label { - margin-left: 20rpx; - font-size: 14px; + margin-left: 20rpx; + font-size: 14px; } - + .vote-btn { - background-color: #2979FF; - color: white; - border-radius: 8rpx; - font-size: 14px; - margin-top: 30rpx; - - &[disabled] { - background-color: #CCCCCC; - } - } + background-color: #2979FF; + color: white; + border-radius: 8rpx; + font-size: 14px; + margin-top: 30rpx; + + &[disabled] { + background-color: #CCCCCC; + } + } + .progress-container { - display: flex; - align-items: center; /* 垂直居中 */ - width: 100%; /* 父容器宽度 */ + display: flex; + align-items: center; + /* 垂直居中 */ + width: 100%; + /* 父容器宽度 */ } .progress { - flex: 1; /* 占据剩余空间 */ - margin-right: 16rpx; /* 与右侧计数间隔 */ + flex: 1; + /* 占据剩余空间 */ + margin-right: 16rpx; + /* 与右侧计数间隔 */ } .count-text { - min-width: 80rpx; /* 防止数字换行 */ - text-align: right; - color: #666; /* 文字颜色 */ - font-size: 24rpx; + min-width: 80rpx; + /* 防止数字换行 */ + text-align: right; + color: #666; + /* 文字颜色 */ + font-size: 24rpx; } \ No newline at end of file diff --git a/uni_modules/uni-cms-article/pages/list/list.uvue b/uni_modules/uni-cms-article/pages/list/list.uvue index 5d89d29..fdd70d2 100644 --- a/uni_modules/uni-cms-article/pages/list/list.uvue +++ b/uni_modules/uni-cms-article/pages/list/list.uvue @@ -12,15 +12,15 @@ diff --git a/uni_modules/uni-cms-article/pages/list/slist.nvue b/uni_modules/uni-cms-article/pages/list/slist.nvue index 415947e..1d991fb 100644 --- a/uni_modules/uni-cms-article/pages/list/slist.nvue +++ b/uni_modules/uni-cms-article/pages/list/slist.nvue @@ -107,7 +107,7 @@ }, // 连表查询,返回两个集合的查询结果 colList() { - if (this.colList_flag === false) { + if (this.colList_flag === false || !this.tags_v || this.tags_v.length === 0) { return [ db.collection(articleDBName).where({ article_status: 1, @@ -118,7 +118,7 @@ return [ db.collection(articleDBName).where({ article_status: 1, - category_id: this.tags_v ? db.command.in(this.tags_v) : [] + category_id: db.command.in(this.tags_v) }).field('thumbnail,title,publish_date,user_id, excerpt').getTemp(), // 文章集合 db.collection(userDBName).field('_id,nickname').getTemp() // 用户集合 ] @@ -336,4 +336,4 @@ .pages .uni-list ::v-deep .uni-list--border:after { background-color: #f5f5f5; } - \ No newline at end of file + diff --git a/uni_modules/zetank-personalpage/pages/personalpage/personalpage.vue b/uni_modules/zetank-personalpage/pages/personalpage/personalpage.vue index df527cb..e956ac5 100644 --- a/uni_modules/zetank-personalpage/pages/personalpage/personalpage.vue +++ b/uni_modules/zetank-personalpage/pages/personalpage/personalpage.vue @@ -220,7 +220,7 @@ // 连表查询,返回两个集合的查询结果 colList() { return [ - db.collection(articleDBName).where(this.where).field( + db.collection(articleDBName).where(this.articleWhere).field( 'thumbnail,article_status,title,publish_date,user_id,excerpt').getTemp(), // 文章集合 db.collection(userDBName).field('_id,nickname').getTemp() // 用户集合 @@ -230,7 +230,7 @@ colList1() { return [ db.collection("cms-articles-collect") - .where(this.where) + .where(this.collectWhere) .getTemp(), db.collection(articleDBName) .field('_id,thumbnail,title,publish_date,user_id, excerpt, article_status') @@ -240,6 +240,20 @@ .getTemp() ]; + }, + articleWhere() { + return this.uid ? { + user_id: this.uid + } : { + user_id: '__empty__' + } + }, + collectWhere() { + return this.uid ? { + user_id: this.uid + } : { + user_id: '__empty__' + } } }, data() { @@ -269,9 +283,6 @@ }, where_flag: false, - where:{ - user_id: "" - }, Information: '本人性格热情开朗,待人友好,为人诚实谦虚。工作勤奋,认真负责,能吃苦耐劳,尽职 尽责,有耐心。具有亲和力,平易近人,善于与人沟通', membertype: '', showedit: true, //信息编辑按钮 @@ -384,14 +395,8 @@ this.uid = option.uid; if (this.uid) { // ID 不为空,则发起查询 console.log(this.uid); - this.where= { - user_id: this.uid - } - console.log(this.where) this.where_flag = true; - console.log(this.where) - const res = await uniCloud.importObject("user-info").get_user_info({ uid: this.uid }); @@ -762,4 +767,4 @@ .pages .uni-list ::v-deep .uni-list--border:after { background-color: #f5f5f5; } - \ No newline at end of file +