diff --git a/jiuyi2/api/news.js b/jiuyi2/api/news.js index ce8609ac..f3235eaf 100644 --- a/jiuyi2/api/news.js +++ b/jiuyi2/api/news.js @@ -120,30 +120,16 @@ export const news = { url: `/im/token/getUserAppToken`, method: 'get', query: param - }) }, - /** - * 商品列表 - * @param {Object} param - */ - sendRedBag(param) { + // 发红包 + sendRedPacket(param) { return util.request({ - url: `/home/sendRedBag`, + url: `/user/sendRedPacket`, method: 'POST', data: param.data, - - }) - }, - - // 抢红包 - grabred(param) { - return util.request({ - url: `/home/grabred`, - method: 'POST', - data: param.data, - + query: param.query, }) }, @@ -156,7 +142,8 @@ export const news = { }) }, - // + + // 红包记录 grabredLog(param) { return util.request({ url: `/home/grabredLog`, diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js index adc6dd22..9975719c 100644 --- a/jiuyi2/api/shop.js +++ b/jiuyi2/api/shop.js @@ -163,6 +163,18 @@ const shop = { query: param.query, }) }, + + /** + * 保存商品信息 + * @param {Object} param + */ + saveProduct(param) { + return util.request({ + url: `/shopify//webProduct/saveProduct`, + method: 'POST', + data: param.data, + }) + }, } diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js index e81ab24c..3e6d6123 100644 --- a/jiuyi2/api/video.js +++ b/jiuyi2/api/video.js @@ -9,8 +9,8 @@ const video = { */ homeVideo(param) { return util.request({ - // url: `/video/video/list`, - url: `/video/api/queryVideoByPage`, + url: `/video/video/list`, + // url: `/video/api/queryVideoByPage`, query: param.query, method: 'GET', }) @@ -22,8 +22,8 @@ const video = { */ saveVideo(param) { return util.request({ - // url: `/video/video/add`, - url: `/video/api/saveVideo`, + url: `/video/video/add`, + // url: `/video/api/saveVideo`, data: param.data, method: 'POST', }) @@ -158,14 +158,14 @@ const video = { }, /** - * 我的收藏列表 + * 查询收藏夹 * @param {Object} param */ getCollectList(param) { return util.request({ - url: `/collect/getCollectList`, + url: `/video/collection/getfavorite`, query: param.query, - method: 'POST', + method: 'GET', }) }, @@ -175,7 +175,7 @@ const video = { */ saveCollectList(param) { return util.request({ - url: `/collect/saveCollectList`, + url: `/video/collection/addfavorite`, query: param.query, method: 'POST', load: true, diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index a27ced0a..bad3fe0a 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -5,8 +5,8 @@ const config = { host: 'http://localhost:5173', // #endif // #ifndef H5 - host: 'http://13859d41.r22.cpolar.top', - // host: 'http://192.168.1.236:8080', + // host: 'http://1641c8e0.r22.cpolar.top', + host: 'http://192.168.0.129:8080', // #endif // 上传文件二级路径 uploadFilePath: "/homecommon/file/preview?fileName=", diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 078578d8..89dbe01c 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -1730,6 +1730,7 @@ const util = { name: option.name, msgId: option.msgId, type: option.type, + num: option.num, }) }) }, diff --git a/jiuyi2/components/index/collectList.vue b/jiuyi2/components/index/collectList.vue index e8f2b6bf..53d8598c 100644 --- a/jiuyi2/components/index/collectList.vue +++ b/jiuyi2/components/index/collectList.vue @@ -101,6 +101,7 @@ pageSize: listProperty.pageSize, } }).then(rs => { + console.log('collect', rs) if (rs.code === 200) { const result = rs.rows // 如果是第一页 @@ -197,7 +198,8 @@ - + diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index 7445f47d..00f52e62 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -386,11 +386,11 @@ }).then(rs => { if (rs.confirm) emit('like', { index, - isLike: 3, + isLike: 2, }) else emit('like', { index, - isLike: 0 + isLike: 1 }) }) }).catch(() => { @@ -516,14 +516,14 @@ + v-else-if="item.likeStatus == 1" @click="handleLike(index, 0)" /> + v-else-if="item.likeStatus == 2" @click="handleLike(index, 0)" /> {{ item.publicLikeCount }} diff --git a/jiuyi2/components/mine/payPwd.vue b/jiuyi2/components/mine/payPwd.vue index 137d9615..58467b8e 100644 --- a/jiuyi2/components/mine/payPwd.vue +++ b/jiuyi2/components/mine/payPwd.vue @@ -36,9 +36,7 @@ // 密码 const pwd = ref('') // 用户信息 - const userinfo = computed(() => { - return store.state.userinfo - }) + const userinfo = computed(() => store.state.userinfo) // 打开弹窗 function open() { diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index b0b185a3..fde325d7 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -605,6 +605,7 @@ videoId: item.id, } }).then(rs => { + console.log('request', rs) if (rs.code == 200) { uni.$emit('updateVideo', rs.data) return diff --git a/jiuyi2/pages/news/chat/chat.vue b/jiuyi2/pages/news/chat/chat.vue index 80cd9fb5..62af4714 100644 --- a/jiuyi2/pages/news/chat/chat.vue +++ b/jiuyi2/pages/news/chat/chat.vue @@ -46,8 +46,10 @@ const msg = reactive({ // 聊天对象 id: '', - // 聊天类型 + // 聊天类型 C2C单聊 GROUP群聊 type: '', + // 群人数 + num: '', }) // 输入的内容 const content = ref('') @@ -83,15 +85,23 @@ const videoContext = ref(null) onLoad(option => { - // 用户昵称 - if (option.name) uni.setNavigationBarTitle({ - title: option.name - }) - - // 用户id - if (option.msgId) msg.id = option.msgId + // 标题 + let title = '' // 聊天类型 if (option.type) msg.type = option.type + // 标题 + if (option.name) title = option.name + // 用户id + if (option.msgId) msg.id = option.msgId + // 如果是群组 + if (option.type == 'GROUP') { + msg.num = option.num + title = `(${option.num})${option.name}` + } + // 标题 + if (title) uni.setNavigationBarTitle({ + title, + }) // 开启消息监听 addListener() // 获取历史消息 @@ -130,12 +140,13 @@ // 开启监听消息 function addListener() { let onMessageReceived = function(event) { - console.log('TencentCloudChat.EVENT.MESSAGE_RECEIVED', event) - return - // 获取历史记录 - getHistory() - // - list.data.push(...event.data) + setTimeout(() => { + // 获取历史记录 + getHistory({ + msgId: '', + limit: 1, + }) + }, 200) } uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived); @@ -169,22 +180,14 @@ }, 200); return } - - // 如果没有msgId - // if(!param.msgId) - if (loading.value) { - // 提示加载中 - util.showToastAndRedirect("加载中") - return - } - // loading.value = true // 获取单聊聊天记录 let request = api.news.getUserMsgHistory // 如果是群聊 获取群聊聊天记录 - if (msg.type === 'GROUP') api.news.getGroupMsgHistory + if (msg.type == 'GROUP') request = api.news.getGroupMsgHistory + console.log('getHistory') // 获取历史记录 request({ @@ -192,19 +195,29 @@ msgId: param.msgId || '', fromId: userinfo.value.id, toId: msg.id, + groupId: msg.id, limit: param.limit || list.limit, }, }).then(res => { if (res.code === 200) { - // 价格 + // 结果 const result = res.data - // 追加 - list.data.unshift(...result.list.map(item => { - item.callbackData = JSON.parse(item.callbackJson) - return item - })) + + // 如果是最新消息 + if (param.limit == 1) { + list.data.push(...result.list.map(item => { + item.callbackData = JSON.parse(item.callbackJson) + return item + })) + } else { + // 追加 + list.data.unshift(...result.list.map(item => { + item.callbackData = JSON.parse(item.callbackJson) + return item + })) + } // 总数 - list.total = result.totalCount + list.total = result.total console.log('list', list.data) nextTick(() => { param.callback && param.callback() @@ -215,6 +228,8 @@ content: res.msg, showCancel: false, }) + }).catch(rs => { + console.log('err', rs) }).finally(() => { loading.value = false }) @@ -257,6 +272,7 @@ // 发送消息 sendMsg({ query: { + formId: userinfo.value.id, toUserId: msg.id, msgType: TencentCloudChat.TYPES.MSG_TEXT, }, @@ -284,9 +300,9 @@ */ function sendMsg(param) { // - const request = api.news.sendUserMsg + let request = api.news.sendUserMsg // - if (msg.type == 'group') request = api.news.sendGroupMsg + if (msg.type == 'GROUP') request = api.news.sendGroupMsg // 发送消息 request({ query: param.query, @@ -294,10 +310,6 @@ }).then((rs) => { if (rs.code == 200) { param.success ? param.success() : '' - // - getHistory({ - callback: scrollToBottom, - }) return } util.alert({ @@ -446,7 +458,8 @@ - + diff --git a/jiuyi2/pages/news/chat/components/news-temp/index.vue b/jiuyi2/pages/news/chat/components/news-temp/index.vue index 12d7f3bc..f3250247 100644 --- a/jiuyi2/pages/news/chat/components/news-temp/index.vue +++ b/jiuyi2/pages/news/chat/components/news-temp/index.vue @@ -30,15 +30,8 @@ } from 'vuex' const store = useStore() const emit = defineEmits(['openRedBag', 'viewVideo']) - // - const formatData = computed(() => { - let result = props.item.payload.data - // console.log('computed formatData', { - // ...result - // }) - return result - }) - + // 格式化 + const formatData = computed(() => props.item.callbackData.callback_json[0]) //音频 const innerAudioContext = uni.createInnerAudioContext(); // 播放语音 @@ -79,20 +72,20 @@