From 0e41ae5428a8bad222505a1d775d48b00c8fdbd4 Mon Sep 17 00:00:00 2001 From: zengBin Date: Sun, 29 Sep 2024 15:50:45 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/https.js | 3 +- src/pages/dynamic/issue.wpy | 6 +- src/pages/home/information.wpy | 10 +-- src/pages/home/searchUsers.wpy | 15 ---- src/pages/home/singleSquare.wpy | 15 ---- src/pages/news/chitchat.wpy | 132 ++++++------------------------- src/pages/news/groupChitchat.wpy | 26 +++--- src/pages/news/visitor.wpy | 35 ++++---- src/pages/tabBar/news.wpy | 10 +-- src/utils/im.js | 2 +- 10 files changed, 71 insertions(+), 183 deletions(-) diff --git a/src/mixins/https.js b/src/mixins/https.js index 3810024..c489a13 100644 --- a/src/mixins/https.js +++ b/src/mixins/https.js @@ -96,8 +96,7 @@ export default { resolve({statusCode, ...data}) } else if (data.code === 1) { // resolve({statusCode, ...data}) - console.error(data.message) - // console.log(this.$app.$options.globalData) + reject(new Error(`error ${data.message}`)) if (this.$is == 'pages/service/GroupChatPage' && data.message.includes('已断开连接')) { let vm = this wx.showModal({ // 使用模态框提示用户进行操作 diff --git a/src/pages/dynamic/issue.wpy b/src/pages/dynamic/issue.wpy index 1b2e570..70ed525 100644 --- a/src/pages/dynamic/issue.wpy +++ b/src/pages/dynamic/issue.wpy @@ -327,7 +327,7 @@ wepy.page({ mixins: [https, base], data: { - id: '', + id: 0, title: '', hot: 0, value: '', @@ -345,11 +345,11 @@ wepy.page({ saveIssue() { let vm = this let data = { - topic_id: vm.id, + topic_id: vm.id * 1, content: vm.value, photos: vm.imgList, address: vm.address, - is_hot: vm.hot + is_hot: vm.hot * 1 } if (vm.throttle) { vm.throttle = false diff --git a/src/pages/home/information.wpy b/src/pages/home/information.wpy index 3833060..bdf8c86 100644 --- a/src/pages/home/information.wpy +++ b/src/pages/home/information.wpy @@ -612,7 +612,7 @@ page { - + 想要隐身访问Ta? @@ -620,9 +620,9 @@ page { 开启隐身访问 - + - + 取消{{userInfo.base_profile.sex == 1?'他':'她'}}为好友 @@ -638,7 +638,7 @@ page { - + @@ -649,7 +649,7 @@ page { - + diff --git a/src/pages/home/searchUsers.wpy b/src/pages/home/searchUsers.wpy index c271b21..3b449f0 100644 --- a/src/pages/home/searchUsers.wpy +++ b/src/pages/home/searchUsers.wpy @@ -328,7 +328,6 @@ wepy.page({ if (vm.list.length < 15 || data.data.length < 15) { vm.no_more = true } - vm.record(data.data) setTimeout(() => { vm.loading = true }, 500) @@ -340,20 +339,6 @@ wepy.page({ console.log(err) }) }, - // 记录用户浏览过的数据 - record(e) { - let vm = this - let list = [] - e.forEach((item) => { - list.push(item.id) - }) - let data = { - user_ids: list.toString() - } - vm.$post({url: `${service.host}/users/browse`, data}).then(() => { - }).catch(() => { - }) - }, // 初始化列表数据 initData() { let vm = this diff --git a/src/pages/home/singleSquare.wpy b/src/pages/home/singleSquare.wpy index 73b71e1..6ca5be6 100644 --- a/src/pages/home/singleSquare.wpy +++ b/src/pages/home/singleSquare.wpy @@ -169,7 +169,6 @@ wepy.page({ if (vm.list.length < 15 || data.data.length < 15) { vm.no_more = true } - vm.record(data.data) setTimeout(() => { vm.loading = true }, 500) @@ -181,20 +180,6 @@ wepy.page({ console.log(err) }) }, - // 记录用户浏览过的数据 - record(e) { - let vm = this - let list = [] - e.forEach((item) => { - list.push(item.id) - }) - let data = { - user_ids: list.toString() - } - vm.$post({url: `${service.host}/users/browse`, data}).then(() => { - }).catch(() => { - }) - }, // 去申请上专区推荐 getRecommend() { let vm = this diff --git a/src/pages/news/chitchat.wpy b/src/pages/news/chitchat.wpy index 7d0cd67..00faffc 100644 --- a/src/pages/news/chitchat.wpy +++ b/src/pages/news/chitchat.wpy @@ -589,16 +589,16 @@ page { - + - + {{item.audioDur+ '"'}} {{audioTime + '"'}} - + @@ -1062,11 +1062,7 @@ wepy.page({ vm.$showLoading('') vm.$get({url: `${service.host}/chat/user/${vm.otherUserId}/message/list`, data}).then(({code, data}) => { if (code === 0) { - console.log(data, '-------------------') if (data && data.length > 0) { - // if (vm.msgList && vm.msgList.length == 0) { - // vm.sendMsgReceipt(data[0]) - // } data.forEach((item, index) => { item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime() item.attach = item.attach ? JSON.parse(item.attach) : '' @@ -1076,7 +1072,7 @@ wepy.page({ data[index].showTime = false data[index - 1].showTime = true } - if (item.content_type == 'text' && /\[[^\]]+\]/.test(item.content)) { + if ((item.content_type == 'text' || item.content_type == 'TEXT') && /\[[^\]]+\]/.test(item.content)) { item.body = vm.transitionMsg(item.content) } else { item.body = item.content @@ -1098,15 +1094,15 @@ wepy.page({ avatar: item.is_mine == 0 ? vm.otherAvatar : vm.myAvatar, time: item.timing, showTime: item.showTime, - videoDur: item.content_type == 'video' ? getVideoTime(item.attach.dur) : '', - audioDur: item.content_type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '', + videoDur: item.content_type == 'video' || item.content_type == 'VIDEO' ? getVideoTime(item.attach.dur) : '', + audioDur: item.content_type == 'audio' || item.content_type == 'AUDIO' ? (item.attach.dur / 1000).toFixed(0) : '', name: item.fromNick, isSend: 1, userId: item.from, msgType: item.content_type }) }) - console.log(vm.msgList, data[0].time, '88888888888888888') + console.log(vm.msgList) vm.$nextTick(() => { vm.toView = `id_${data[0].time}` if (vm.msgList.length > 15) { @@ -1133,83 +1129,6 @@ wepy.page({ wx.hideLoading() console.log(err) }) - // let data = {} - // if (vm.uploadState || vm.videoState) { - // return - // } - // if (!vm.lastMsgId) { - // data = { - // scene: 'p2p', - // to: vm.otherUserId, - // limit: 15 - // } - // } else { - // data = { - // scene: 'p2p', - // to: vm.otherUserId, - // limit: 15, - // reverse: false, - // endTime: vm.beginTime, - // lastMsgId: vm.lastMsgId - // } - // } - // if (vm.finished) { - // return - // } - // vm.$showLoading('') - // app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => { - // console.log(object, '222222222222222222') - // if (object && object.length > 0) { - // if (vm.msgList && vm.msgList.length == 0) { - // vm.sendMsgReceipt(object[0]) - // } - // object.forEach((item, index) => { - // item.showTime = timeContrast(format(item.time), vm.lastTime) - // item.timing = getTime(format(item.time)) - // if (item.showTime && index > 0) { - // object[index].showTime = false - // object[index - 1].showTime = true - // } - // if (item.type == 'text' && /\[[^\]]+\]/.test(item.body)) { - // item.body = vm.transitionMsg(item.body) - // } - // vm.lastTime = format(item.time) - // }) - // - // vm.lastMsgId = object[object.length - 1].idServer - // vm.beginTime = object[object.length - 1].time - // - // setTimeout(() => { - // object.forEach((item) => { - // vm.msgList.unshift({ - // text: item.body, - // attach: vm.calculatePic(item.attach, item.type), - // id: `id_${item.time}`, - // timestamp: item.time, - // isSelf: item.flow == 'in' ? false : true, - // avatar: item.flow == 'in' ? vm.otherAvatar : vm.myAvatar, - // time: item.timing, - // showTime: item.showTime, - // videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '', - // audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '', - // name: item.fromNick, - // isSend: 1, - // userId: item.from, - // msgType: item.type - // }) - // }) - // console.log(vm.msgList, '88888888888888888') - // vm.toView = `id_${object[0].time}` - // vm.loading = true - // }) - // } else { - // vm.loading = true - // } - // if (object && object.length < 15) { - // vm.finished = true - // } - // wx.hideLoading() - // }) }, // 删除好友 deleteFriends() { @@ -1471,9 +1390,9 @@ wepy.page({ return '' } let wRatio = 0 - if (type == 'video' && e.url && e.url.includes('?')) { + if ((type == 'video' || type == 'VIDEO') && e.url && e.url.includes('?')) { e.poster = `${e.url}&vframe` - } else if (type == 'video' && e.url) { + } else if ((type == 'video' || type == 'VIDEO') && e.url) { e.poster = `${e.url}?vframe` } if (e.w > e.h) { @@ -1485,6 +1404,7 @@ wepy.page({ e.w = e.w / wRatio e.h = 200 } + console.log(e, '8988888') return e }, // 更多操作 @@ -1622,24 +1542,24 @@ wepy.page({ }) // 底部输入框高度 vm.changeInputHeight(true) - vm.$nextTick(() => { - setTimeout(() => { - // 获取历史消息 - vm.getHistoryMsg() - // 实时获取对方发送的消息 - app.globalData.nim.on('msg', function (e) { - vm.reception(e) - }) - }, 3000) - }) // vm.$nextTick(() => { - // // 获取历史消息 - // vm.getHistoryMsg() - // // 实时获取对方发送的消息 - // app.globalData.nim.on('msg', function (e) { - // vm.reception(e) - // }) + // setTimeout(() => { + // // 获取历史消息 + // vm.getHistoryMsg() + // // 实时获取对方发送的消息 + // app.globalData.nim.on('msg', function (e) { + // vm.reception(e) + // }) + // }, 3000) // }) + vm.$nextTick(() => { + // 获取历史消息 + vm.getHistoryMsg() + // 实时获取对方发送的消息 + app.globalData.nim.on('msg', function (e) { + vm.reception(e) + }) + }) wx.setNavigationBarTitle({ title: vm.otherUserName, success: function () {} diff --git a/src/pages/news/groupChitchat.wpy b/src/pages/news/groupChitchat.wpy index 8ec3a51..aa1d283 100644 --- a/src/pages/news/groupChitchat.wpy +++ b/src/pages/news/groupChitchat.wpy @@ -541,9 +541,8 @@ page { - - + {{item.tips}} @@ -553,22 +552,22 @@ page { - {{item.name}} + {{item.name}} - + - + - + {{item.audioDur+ '"'}} {{audioTime + '"'}} - + @@ -802,8 +801,8 @@ wepy.page({ isSend: 0, onSendBefore: function (msg) { console.log('get msg before', msg) - if (/\[[^\]]+\]/.test(data.content)) { - data.content = vm.transitionMsg(data.content) + if (/\[[^\]]+\]/.test(vm.msg)) { + vm.msg = vm.transitionMsg(vm.msg) } msgNewObj = { text: vm.msg, @@ -996,6 +995,7 @@ wepy.page({ app.globalData.nim.user.getUsersNameCardFromServer({ accounts: [e.from] }).then((res) => { + console.log(res, e, '777222') vm.msgList.push({ text: e.body, attach: vm.calculatePic(e.attach, e.type), @@ -1071,13 +1071,13 @@ wepy.page({ attach: vm.calculatePic(item.body_arr, item.type), id: `id_${item.time}`, timestamp: item.time, - isSelf: item.is_mine == 'in' ? false : true, - avatar: item.is_mine == 'in' ? item.photo : vm.myAvatar, + isSelf: item.is_mine == 0 ? false : true, + avatar: item.is_mine == 0 ? item.photo : vm.myAvatar, time: item.timing, showTime: item.showTime, videoDur: item.type == '3' && item.body_arr.dur ? getVideoTime(item.body_arr.dur) : '', audioDur: item.type == '2' && item.body_arr.dur ? (item.body_arr.dur / 1000).toFixed(0) : '', - name: item.fromNick, + name: item.from_nick, userId: item.from, msgType: item.type, tips: vm.groupNotification(item) @@ -1323,7 +1323,7 @@ wepy.page({ }, // 图片大小计算 calculatePic(e, type) { - if (!e.url) { + if (!e || !e.url) { return '' } let wRatio = 0 diff --git a/src/pages/news/visitor.wpy b/src/pages/news/visitor.wpy index c0102eb..4e4f4da 100644 --- a/src/pages/news/visitor.wpy +++ b/src/pages/news/visitor.wpy @@ -133,6 +133,10 @@ page { overflow: hidden; } } + + .ui-filter{ + filter: blur(4px) contrast(.8); + } } .m_fans_lst { @@ -284,29 +288,26 @@ page { - + - + - {{item.other_user.nickname}} - - - {{item.other_user.year}} - - - - {{item.other_user.age}} + {{item.nickname}} + + + + {{item.year}} - {{item.other_user.stature || ''}} {{item.other_user.city || ''}} + {{item.stature || ''}} {{item.city || ''}} {{item.created_at}} - 来访{{item.count}}次 + 来访{{item.count}}次 @@ -319,7 +320,7 @@ page { - + {{item.nickname}} @@ -514,10 +515,10 @@ wepy.page({ // 跳转用户详情,没有vip时点击第四个用户弹框提示 jumpPath(e, index) { let vm = this - if (index >= 3 && vm.userInfo.rank_id == 0) { - vm.pic = e.photo || e.avatar || e.other_user.photo || e.other_user.avatar - vm.city = e.city || e.other_user.city - vm.age = e.year || e.other_user.year + if (index >= 3 && !vm.userInfo.rank_id) { + vm.pic = e.photo + vm.city = e.city + vm.age = e.year vm.tipsShow = true return } diff --git a/src/pages/tabBar/news.wpy b/src/pages/tabBar/news.wpy index eac4406..21483d5 100644 --- a/src/pages/tabBar/news.wpy +++ b/src/pages/tabBar/news.wpy @@ -296,7 +296,6 @@ wepy.page({ setTimeout(() => { vm.loading = true }, 500) - vm.page++ } wx.hideLoading() }).catch(err => { @@ -322,7 +321,7 @@ wepy.page({ } if ((notice_count + groupCount) > 0) { wx.setTabBarBadge({ - index: 0, + index: 2, text: `${notice_count + groupCount}` }) } else { @@ -478,6 +477,7 @@ wepy.page({ onReachBottom() { let vm = this if (!vm.no_more) { + vm.page++ vm.getList() } }, @@ -491,11 +491,9 @@ wepy.page({ onShow() { let vm = this vm.getNewCount() - }, - onLoad() { - let vm = this vm.getList() - } + }, + onLoad() {} }) diff --git a/src/utils/im.js b/src/utils/im.js index aae35bf..f520344 100644 --- a/src/utils/im.js +++ b/src/utils/im.js @@ -148,7 +148,7 @@ const IM = (account, token) => { } if ((notice_count + groupCount) > 0) { wx.setTabBarBadge({ - index: 0, + index: 2, text: `${notice_count + groupCount}` }) } else {