From b07032764eed543bc9dfc340bf8c924821f23594 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Tue, 7 Jan 2025 21:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/news.js | 4 +- jiuyi2/api/video.js | 13 ++- jiuyi2/components/news/book.vue | 87 ++++++++------ jiuyi2/pages.json | 20 ++-- jiuyi2/pages/mine/feedback.vue | 13 --- jiuyi2/pages/mine/homepage.vue | 2 +- jiuyi2/pages/mine/setting/feedback.vue | 16 ++- jiuyi2/pages/news/addFriend.vue | 11 +- jiuyi2/pages/news/chatGroup.vue | 154 +++++++++++++++++++++++++ jiuyi2/pages/news/news.vue | 4 - jiuyi2/pages/release/video.vue | 5 +- jiuyi2/vite.config.js | 4 + 12 files changed, 253 insertions(+), 80 deletions(-) delete mode 100644 jiuyi2/pages/mine/feedback.vue create mode 100644 jiuyi2/pages/news/chatGroup.vue diff --git a/jiuyi2/api/news.js b/jiuyi2/api/news.js index 82cf6a6c..2bc8f439 100644 --- a/jiuyi2/api/news.js +++ b/jiuyi2/api/news.js @@ -44,9 +44,9 @@ export const news = { */ deleteFriend(param) { return util.request({ - url: `/user/friend/deleteFriend`, + url: `/user/chat/relation/deleteFriend`, method: 'POST', - path: param.path, + data: param.data, }) }, diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js index 65726982..32164d12 100644 --- a/jiuyi2/api/video.js +++ b/jiuyi2/api/video.js @@ -9,19 +9,21 @@ const video = { */ homeVideo(param) { return util.request({ - url: `/video/api/queryVideoByPage`, + url: `/video/video/list`, + // url: `/video/api/queryVideoByPage`, query: param.query, method: 'GET', }) }, /** - * 发布作品 + * 发布视频 * @param {Object} param */ saveVideo(param) { return util.request({ - url: `/video/api/saveVideo`, + url: `/video/video/add`, + // url: `/video/api/saveVideo`, data: param.data, method: 'POST', }) @@ -57,7 +59,8 @@ const video = { */ getLabel(param) { return util.request({ - url: `/video/api/getTagsByPage`, + url: `/video/tag/list`, + // url: `/video/api/getTagsByPage`, data: param.data, method: 'GET', load: true, @@ -90,6 +93,7 @@ const video = { load: true, }) }, + /** * 展播量推送 * @param {Object} param @@ -102,6 +106,7 @@ const video = { load: true, }) }, + /** * 他人用户主页 * @param {Object} param diff --git a/jiuyi2/components/news/book.vue b/jiuyi2/components/news/book.vue index a7193767..f6d841e5 100644 --- a/jiuyi2/components/news/book.vue +++ b/jiuyi2/components/news/book.vue @@ -18,10 +18,8 @@ import util from '@/common/js/util.js' // 腾讯云聊天 import TencentCloudChat from '@tencentcloud/chat'; - // - import api from '@/api/index.js' // api - import newsApi from '@/api/news.js' + import api from '@/api/index.js' import pinyin from 'js-pinyin' const { proxy @@ -214,48 +212,33 @@ function getFriendList() { // 验证sdk是否准备完毕 let isReady = uni.$chat.isReady(); - console.log('isReady', isReady) if (!isReady) { setTimeout(function() { getFriendList() - }, 1000); + }, 500); return } - newsApi.getFriendList().then(rs => { + api.news.getFriendList().then(rs => { if (rs.code == 200) { - viewData.value = rs.data; - // 这里可以将好友列表传递给book组件进行展示 - console.log('好友列表:', viewData.value); - return - } - util.alert({ - content: rs.msg, - showCancel: false, - }) - }) - - return - - uni.$chat.getFriendList().then(rs => { - console.log('friend', rs) - if (rs.code == 0) { const result = rs.data - // - userList.data.push(...result.map(item => { + userList.data.push(...result.rows.map(item => { // 取拼音 - let char = pinyin.getCamelChars(item.remark || item.profile.nick); + let char = pinyin.getCamelChars(item.remark || item.userNickname); return { key: char.charAt(0), letter: char.charAt(0), child: [item] } })) - console.log('userList.data', userList.data) - // console.log('friend list', list) + return } + util.alert({ + content: rs.msg, + showCancel: false, + }) }) } @@ -311,9 +294,7 @@ * @param {Object} user 用户信息 */ function handleSwipeAction(ev, user) { - // ev.content.fn(user) - // proxy.$refs.swipeAction.closeAll() } @@ -324,18 +305,26 @@ function delFriend(user) { new Promise((resolve, reject) => { util.alert({ - content: `确认删除好友${user.profile.nick}?` + content: `确认删除好友${user.remark || user.userNickname}?` }).then(res => { if (!res.confirm) return return resolve() }) }).then(rs => { - uni.$chat.deleteFriend({ - userIDList: [user.userID], - type: TencentCloudChat.TYPES.SNS_DELETE_TYPE_BOTH + api.news.deleteFriend({ + data: { + toUserId: user.userId, + }, }).then(rs => { - // 获取朋友列表 - getFriendList() + if (rs.code === 200) { + // 获取朋友列表 + getFriendList() + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) }) }) } @@ -380,18 +369,40 @@ * @param {Object} user 当前用户信息 */ function handleUser(user) { - console.log('handleUser', user) util.toChat({ name: user.remark || user.profile.nick, msgId: user.userID, type: 'C2C', }) } + + /** + * 跳转 + * @param {Object} url + */ + function link(url) { + uni.navigateTo({ + url, + }) + }