diff --git a/.gitignore b/.gitignore
index 5d630ad2..b95ecdaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/jiuyi2/unpackage
/jiuyi/unpackage
/jiuyi2/.hbuilderx
-/jiuyi/.hbuilderx
\ No newline at end of file
+/jiuyi/.hbuilderx
+unpackage
diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js
index d2718d85..0ee5c6a3 100644
--- a/jiuyi2/api/video.js
+++ b/jiuyi2/api/video.js
@@ -301,9 +301,9 @@ const video = {
*/
hotVideos(param) {
return util.request({
- url: `/home/hotVideos`,
+ url: `/video/search/getHot`,
// query: param.query,
- method: 'POST',
+ method: 'GET',
})
},
@@ -325,8 +325,8 @@ const video = {
*/
videoSearch(param) {
return util.request({
- url: `/home/videoSearch`,
- query: param.query,
+ url: `/video/search/searchData`,
+ data: param.query,
method: 'POST',
})
},
diff --git a/jiuyi2/components/news/msgList.vue b/jiuyi2/components/news/msgList.vue
index 637dc962..f1ae14a0 100644
--- a/jiuyi2/components/news/msgList.vue
+++ b/jiuyi2/components/news/msgList.vue
@@ -110,8 +110,7 @@ function getList() {
uni.$emit('updateNum', {})
uni.$chat.getConversationList().then(rs => {
- let res = rs.data.conversationList
- console.log(res);
+ let res = rs.data.conversationList
let arr = []
res.forEach(item => {
let obj = {}
diff --git a/jiuyi2/pages/index/search.vue b/jiuyi2/pages/index/search.vue
index 07bfcb69..e1e491f7 100644
--- a/jiuyi2/pages/index/search.vue
+++ b/jiuyi2/pages/index/search.vue
@@ -1,265 +1,286 @@
@@ -292,10 +313,12 @@
历史记录
+
- {{item.search}}
+ {{ item }}
暂无搜索记录
@@ -308,7 +331,8 @@
- 电商
+ 电商
+
@@ -316,19 +340,20 @@
热门搜索
-
- {{index + 1}}
+
+ {{ index + 1 }}
- {{item.title}}
-
- 热
- 新
+ {{ item.topic }}
+
+ 热
+ 新
- 热度{{item.play}}
+ 热度{{ item.play }}
@@ -343,8 +368,9 @@
-
- {{item.name}}
+
+ {{ item.name }}
@@ -353,7 +379,8 @@
-
+
@@ -361,13 +388,13 @@
- {{item.userName}}
- {{item.createTime}}
+ {{ item.userNickname }}
+ {{ item.createTime }}
- {{item.title}}
+ {{ item.title }}
@@ -378,21 +405,22 @@
+ 暂无更多
-
+
- {{item.userNickname}}
- 粉丝:{{item.userFans}}
+ {{ item.userNickname }}
+ 粉丝:{{ item.userFans }}
- 取消关注
+ 取消关注
关注
+ 暂无更多
@@ -446,114 +477,114 @@
\ No newline at end of file
diff --git a/service/.hbuilderx/launch.json b/service/.hbuilderx/launch.json
new file mode 100644
index 00000000..8ae452a8
--- /dev/null
+++ b/service/.hbuilderx/launch.json
@@ -0,0 +1,9 @@
+{
+ "version" : "1.0",
+ "configurations" : [
+ {
+ "playground" : "standard",
+ "type" : "uni-app:app-android"
+ }
+ ]
+}
diff --git a/service/common/js/config.js b/service/common/js/config.js
index ee740762..7cf5c6e1 100644
--- a/service/common/js/config.js
+++ b/service/common/js/config.js
@@ -6,7 +6,7 @@ const config = {
// #endif
// #ifndef H5
// host: 'http://91f.xyz:8080',
- host: 'https://b433d23.r24.cpolar.top/',
+ host: 'https://1a880cd5.r24.cpolar.top/',
// #endif
// 支付方式配置
payType: {
diff --git a/service/common/js/util.js b/service/common/js/util.js
index 6e6972fc..480d9e81 100644
--- a/service/common/js/util.js
+++ b/service/common/js/util.js
@@ -1425,16 +1425,17 @@ const util = {
value: userinfo
})
- uni.reLaunch({
- url: '/pages/index/index'
- })
+ setTimeout(() => {
+ util.loginTencent(userinfo)
+ uni.reLaunch({
+ url: '/pages/index/index'
+ })
+ }, 500)
},
// 登录腾讯聊天
loginTencent(userinfo) {
api.login.getIMToken({}).then(rs => {
- console.log(rs);
-
const imSig = rs.msg
uni.$chat.login({
@@ -1444,22 +1445,6 @@ const util = {
console.log('im login success', rs)
})
- // // #ifdef APP
- // // 音视频登录
- // const loginParams = {
- // SDKAppID: util.config.TChat.SDKAppID,
- // userID: userinfo.id + '',
- // userSig: imSig,
- // }
- // uni.$TUICallKit.login(loginParams, res => {
- // if (res.code === 0) {
- // console.log('[TUICallKit] login success.');
- // } else {
- // console.error('[TUICallKit] login failed, failed message = ', res.msg, params);
- // }
- // })
- // // #endif
-
})
},
diff --git a/service/pages/chat/chat.vue b/service/pages/chat/chat.vue
index 9fe69568..018c612b 100644
--- a/service/pages/chat/chat.vue
+++ b/service/pages/chat/chat.vue
@@ -86,7 +86,7 @@ const videoContext = ref(null)
// 红包对象
const redPacket = reactive({})
-onLoad(option => {
+onLoad(option => {
// 标题
let title = ''
// 聊天类型
@@ -142,6 +142,10 @@ onUnload(() => {
videoContext.value.stop()
})
+onUnmounted(() => {
+ removeListener()
+})
+
// 开启监听消息
function addListener() {
let onMessageReceived = function (event) {
@@ -160,7 +164,7 @@ function addListener() {
// 移除监听消息
function removeListener() {
- uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED);
+ uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, () => { });
}
// 获取更多消息记录
diff --git a/service/pages/index/index.vue b/service/pages/index/index.vue
index 22c28fa7..6c17fcbc 100644
--- a/service/pages/index/index.vue
+++ b/service/pages/index/index.vue
@@ -60,73 +60,66 @@ function addListener() {
// 移除监听
function removeListener() {
- uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED);
+ uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, () => { });
}
// 获取消息列表
function getList() {
- api.news.getMessageList({
- query: {
- userId: userinfo.serviceId,
- }
- }).then(rs => {
- if (rs.code == 200) {
- chatList.push(...rs.data.map(item => {
- item.callbackData = JSON.parse(item.callbackJson)
+ // 验证sdk是否准备完毕
+ let isReady = uni.$chat.isReady();
+ if (!isReady) {
+ setTimeout(function () {
+ getList();
+ }, 800);
+ return
+ }
- if (item.callbackData.callback_json.length) {
- let msgType = item.callbackData.callback_json[0].MsgType;
- if (msgType == TencentCloudChat.TYPES.MSG_TEXT) {
- item.chatText = item.callbackData.callback_json[0].MsgContent.Text
- } else if (msgType == TencentCloudChat.TYPES.MSG_IMAGE) {
- item.chatText = '[图片]'
- } else if (msgType == TencentCloudChat.TYPES.MSG_AUDIO) {
- item.chatText = '[语音]'
- } else if (msgType == TencentCloudChat.TYPES.MSG_VIDEO) {
- item.chatText = '[视频]'
- } else if (msgType == TencentCloudChat.TYPES.MSG_CUSTOM) {
- if (item.callbackData.callback_json[0].businessType == 'redPacket') {
- item.chatText = `[红包] ${item.callbackData.blessing}`
- }
- }
- }
- return item
- }))
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
+ uni.$chat.getConversationList().then(rs => {
+ let res = rs.data.conversationList
+ let arr = []
+ res.forEach(item => {
+ let obj = {}
+ obj.type = item.type;
+ obj.chatText = item.lastMessage.messageForShow;
+ obj.lastTime = handleDate(item.lastMessage.lastTime);
+ obj.unreadCount = item.unreadCount;
+
+ if (item.type == 'C2C') {
+ obj.avatar = item.userProfile.avatar;
+ obj.name = item.userProfile.nick;
+ obj.userID = item.userProfile.userID;
+ }
+ arr.push(obj)
})
+
+ chatList.data = arr;
+
})
+ // api.news.getMessageList({
+ // query: {
+ // userId: userinfo.serviceId,
+ // }
+ // }).then(rs => {
+ // if (rs.code == 200) {
+ // chatList.push(...rs.data.map(item => {
+ // item.callbackData = JSON.parse(item.callbackJson)
+ // return item
+ // }))
+ // return
+ // }
+ // util.alert({
+ // content: rs.msg,
+ // showCancel: false,
+ // })
+ // })
}
-// /**
-// * 去聊天
-// * @param {Number} item 聊天对象
-// */
-// function handleChat(item) {
-// //
-// }
-
-// /**
-// * 跳转
-// * @param {String} url 路由地址
-// */
-// function link(url) {
-// uni.navigateTo({
-// url,
-// })
-// }
-
-
// 退出登录
function handleLogout() {
util.alert({
content: '确认退出登录吗?',
}).then(rs => {
if (!rs.confirm) return
-
util.logout(() => {
// #ifdef APP
plus.runtime.restart()
@@ -135,22 +128,16 @@ function handleLogout() {
})
}
-
-
-
/**
* 去聊天
* @param {Object} item
*/
function handleChat(item) {
- console.log(111111111, item);
-
let param = {
type: 'C2C',
name: `${item.callbackData.from_name}`,
msgId: `${item.callbackData.from_id}`
};
- console.log(22222222, param);
util.toChat(param)
}
@@ -176,7 +163,7 @@ function delMsg(item) {
return
}
- let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
+ let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.deleteConversation(conversationId).then(rs => {
getList()
@@ -194,7 +181,7 @@ function setRead(item) {
return
}
- let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
+ let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.setMessageRead({
conversationID: conversationId,
}).then(rs => {
@@ -228,60 +215,25 @@ function setRead(item) {
商家订单管理
-
-
-
-
+
-
-
-
-
-
-
-
+
{{ item.unreadCount
}}
-
- {{ item.callbackJson.from_name }}
-
-
- {{ item.groupChatDTO.name }}
-
+ {{ item.name }}
- {{ util.formatTime('MM-dd HH:mm', item.createTime) }}
+ {{ util.formatTime('MM-dd HH:mm', item.lastTime) }}
{{ item.chatText }}
diff --git a/service/vite.config.js b/service/vite.config.js
index 16dcc2ec..f8b2f750 100644
--- a/service/vite.config.js
+++ b/service/vite.config.js
@@ -4,7 +4,7 @@ import {
import uni from '@dcloudio/vite-plugin-uni';
// let target = 'http://91f.xyz:8080'
-let target = 'https://b433d23.r24.cpolar.top/'
+let target = 'https://1a880cd5.r24.cpolar.top/'
export default defineConfig({
plugins: [uni()],