diff --git a/jiuyi2/App.vue b/jiuyi2/App.vue index 98b15d27..00251bb7 100644 --- a/jiuyi2/App.vue +++ b/jiuyi2/App.vue @@ -31,10 +31,11 @@ value: userinfo }) - // 腾讯im登录 - util.loginTencent(userinfo) // - util.getUserinfo() + util.getUserinfo().then(rs => { + // 腾讯im登录 + util.loginTencent(userinfo) + }) } } diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js index 26a6d83e..4d0e3609 100644 --- a/jiuyi2/api/video.js +++ b/jiuyi2/api/video.js @@ -137,32 +137,19 @@ const video = { getCollectList(param) { return util.request({ url: `/video/collection/getfavorite`, - query: param.query, - method: 'GET', + data: param.data, + method: 'POST', }) }, /** - * 新建收藏夹 + * 添加 / 修改 收藏夹 * @param {Object} param */ - saveCollectList(param) { + addfavorite(param) { return util.request({ url: `/video/collection/addfavorite`, - query: param.query, - method: 'POST', - load: true, - }) - }, - - /** - * 编辑收藏夹 - * @param {Object} param - */ - updateCollectList(param) { - return util.request({ - url: `/collect/updateCollectList`, - query: param.query, + data: param.data, method: 'POST', load: true, }) @@ -172,49 +159,49 @@ const video = { * 删除收藏夹 * @param {Object} param */ - deleteCollect(param) { + deletefavorite(param) { return util.request({ - url: `/collect/deleteCollect`, + url: `/video/collection/deletefavorite`, query: param.query, load: true, - method: 'POST', + method: 'DELETE', }) }, /** - * 我的收藏视频列表 + * 查询收藏夹视频 * @param {Object} param */ - getCollectVideoList(param) { + getFavoriteVideo(param) { return util.request({ - url: `/collect/getCollectVideoList`, + url: `/video/collection/getFavoriteVideo`, query: param.query, load: true, - method: 'POST', + method: 'GET', }) }, /** - * 收藏视频 + * 往收藏夹添加视频 * @param {Object} param */ collectVideo(param) { return util.request({ - url: `/collect/collectVideo`, - query: param.query, + url: `/video/collection/addVideo`, + data: param.data, method: 'POST', load: true, }) }, /** - * 取消收藏 + * 取消收藏夹中的视频 * @param {Object} param */ - cancelCollect(param) { + deleteVideo(param) { return util.request({ - url: `/collect/cancelCollect`, - query: param.query, + url: `/video/collection/deleteVideo`, + data: param.data, method: 'POST', load: true, }) @@ -253,7 +240,7 @@ const video = { url: `/video/comment/getcomment`, query: param.query, data: param.data, - method: 'GET', + method: 'POST', }) }, @@ -273,10 +260,10 @@ const video = { * 发表评论 * @param {Object} param */ - comment(param) { + savecomment(param) { return util.request({ - url: `/home/comment`, - query: param.query, + url: `/video/comment/savecomment`, + data: param.data, method: 'POST', }) }, diff --git a/jiuyi2/components/index/collect.vue b/jiuyi2/components/index/collect.vue index 7a78e6f7..a307e043 100644 --- a/jiuyi2/components/index/collect.vue +++ b/jiuyi2/components/index/collect.vue @@ -73,25 +73,25 @@ /** * 收藏视频 - * @param {Object} collects 收藏夹对象 + * @param {Object} item 收藏夹对象 */ - function collectVideo(collects) { + function collectVideo(item) { // api.video.collectVideo({ - query: { + data: { // 视频id - videoId: detail.value.videoId, + videoId: detail.value.id, // 收藏夹id - collectId: collects.id, - isPrivate: collects.isPrivate, + folderId: item.id, } }).then(rs => { + console.log('collect result', rs) if (rs.code == 200) { proxy.$refs.collect.close() - - detail.value.isCollect = true - detail.value.collect++ - uni.$emit('updateVideo', detail.value) + uni.$emit('updateVideo', { + ...detail.value, + ...rs.data, + }) // 打开收藏弹窗 collectResult.value = true diff --git a/jiuyi2/components/index/collectAdd.vue b/jiuyi2/components/index/collectAdd.vue index fb295df2..aa75f010 100644 --- a/jiuyi2/components/index/collectAdd.vue +++ b/jiuyi2/components/index/collectAdd.vue @@ -17,16 +17,16 @@ const { proxy } = getCurrentInstance() - + // 收藏夹类 class Form { - // 收藏夹名称 - collectName = '' - // 0公开1私密 - isPrivate = 0 - // 图片地址 - pic = '' // 收藏id - collectId = '' + folderId = '' + // 收藏夹名称 + folderName = '' + // 0公开1私密 + isLock = 0 + // 图片地址 + photographUrl = '' } // @@ -35,10 +35,11 @@ const paddingHeight = ref(0) onMounted(() => { - // + // #ifdef APP uni.onKeyboardHeightChange((rs) => { paddingHeight.value = rs.height }) + // #endif }) onBeforeUnmount(() => { @@ -54,10 +55,10 @@ function open(value) { // 如果是编辑 if (value) { - form.collectName = value.collectName - form.isPrivate = value.isPrivate - form.collectId = value.id - form.pic = value.formatPic + form.folderName = value.folderName + form.isLock = value.isLock + form.folderId = value.id + form.photographUrl = value.photographUrl } proxy.$refs.addCollectRef.open() } @@ -70,44 +71,37 @@ // 上传图片 function upImage() { util.upload_image({ - value: form.pic, type: 1, success: rs => { // 修改图片 - form.pic = rs.value + form.photographUrl = rs.value + console.log('upload rs', rs, form) } }) } // 切换是否公开收藏夹 function handlePrivate() { - form.isPrivate = form.isPrivate == 0 ? 1 : 0 + form.isLock = form.isLock == 0 ? 1 : 0 } - // 提交 + // 提交表单 function handleSubmit() { const data = { ...form, } // 验证 - if (!form.collectName) { - util.alert('请输入收藏夹名称') - return - } - if (!form.pic) { + if (!form.photographUrl) { util.alert('请上传封面图') return } - - // 剔除路径 - data.pic = util.replace_url(data.pic) - - let requestApi = 'saveCollectList' - if (form.collectId) requestApi = 'updateCollectList' - + if (!form.folderName) { + util.alert('请输入收藏夹名称') + return + } // - api.video[requestApi]({ - query: data, + api.video.addfavorite({ + data: data, }).then(rs => { if (rs.code == 200) { // 收藏视频 @@ -147,23 +141,23 @@ - + - + - 是否公开收藏夹 + 是否快捷收藏夹 - + diff --git a/jiuyi2/components/index/collectList.vue b/jiuyi2/components/index/collectList.vue index 53d8598c..705b19d8 100644 --- a/jiuyi2/components/index/collectList.vue +++ b/jiuyi2/components/index/collectList.vue @@ -96,7 +96,8 @@ function getList() { // 获取收藏列表 api.video.getCollectList({ - query: { + data: { + isLock: '', pageNum: listProperty.pageNum, pageSize: listProperty.pageSize, } @@ -116,7 +117,10 @@ listProperty.total = rs.total return } - util.alert(rs.msg) + util.alert({ + content: rs.msg, + showCancel: false, + }) }).finally(() => { // 关闭加载 showLoad.value = false @@ -129,9 +133,9 @@ * @param {Number} index 删除的收藏夹 */ function delectList(item, index) { - api.video.deleteCollect({ + api.video.deletefavorite({ query: { - jyCollectId: item.id, + folderId: item.id, } }).then(rs => { if (rs.code === 200) { @@ -155,6 +159,9 @@ // 点击的下标 const index = ev.index const item = listProperty.data[target] + // 关闭 + proxy.$refs.swipeActionRef.closeAll() + switch (index) { case 0: // 删除 @@ -165,13 +172,12 @@ }) break case 1: - // 编辑 - proxy.$refs.collectAddRef.open(item) + setTimeout(() => { + // 编辑 + proxy.$refs.collectAddRef.open(item) + }, 200) break } - - // 关闭 - proxy.$refs.swipeActionRef.closeAll() } /** @@ -202,12 +208,12 @@ @click="handleActionItem($event,index)"> - + - {{item.collectName}} + {{item.folderName}} - + diff --git a/jiuyi2/components/index/commentArea.vue b/jiuyi2/components/index/commentArea.vue index 440783d4..abe3f041 100644 --- a/jiuyi2/components/index/commentArea.vue +++ b/jiuyi2/components/index/commentArea.vue @@ -43,6 +43,8 @@ }) // 填充高度 const paddingHeight = ref(0) + // 用户信息 + const userinfo = computed(() => uni.$store.state.userinfo || {}) onMounted(() => { // @@ -52,7 +54,11 @@ }) onBeforeUnmount(() => { - uni.offKeyboardHeightChange() + try { + uni.offKeyboardHeightChange(() => {}); + } catch (error) { + console.error('Error onBeforeUnmount', error); + } }) // 刷新列表 @@ -67,8 +73,9 @@ function getList() { // api.video.getcomment({ - query: { + data: { videoId: detail.id, + parentId: 0, pageSize: listProperty.pageSize, pageNume: listProperty.pageNum, } @@ -111,13 +118,19 @@ } // - api.video.comment({ - query: { - partentId: reply.id ? reply.id : 0, - videoId: detail.videoId, - context: content.value, + api.video.savecomment({ + data: { + // 视频父id + parentId: reply.id ? reply.id : 0, + // 视频id + videoId: detail.id, + // 评论内容 + content: content.value, + // 用户id + userId: userinfo.value.id, } }).then(rs => { + console.log('saveComment', rs) if (rs.code == 200) { proxy.$refs.comment.close() detail.comment++ @@ -295,18 +308,20 @@ - + - {{item.userNickname}} - + {{item.nickName}} + {{item.content}} @@ -322,20 +337,26 @@ diff --git a/jiuyi2/pages/mine/collectsVideo.vue b/jiuyi2/pages/mine/collectsVideo.vue index 212e2417..86be46e6 100644 --- a/jiuyi2/pages/mine/collectsVideo.vue +++ b/jiuyi2/pages/mine/collectsVideo.vue @@ -74,12 +74,10 @@ // 获取列表 function getList() { // - api.video.getCollectVideoList({ + api.video.getFavoriteVideo({ query: { // 收藏夹id - collectId: collectId.value, - // 用户id - userId: userId.value || '', + folderId: collectId.value, pageSize: list.pageSize, pageNum: list.pageNum, }, diff --git a/jiuyi2/pages/mine/homepage.vue b/jiuyi2/pages/mine/homepage.vue index c18697ab..fdb1a6b4 100644 --- a/jiuyi2/pages/mine/homepage.vue +++ b/jiuyi2/pages/mine/homepage.vue @@ -66,7 +66,7 @@ } ]) // 分类列表下标 - const tabIndex = ref(0) + const tabIndex = ref(2) // tab当前项 const tabCurrent = computed(() => { let result = tabList[tabIndex.value] @@ -137,7 +137,7 @@ uni.navigateTo({ url: util.setUrl('/pages/mine/collectsVideo', { collectId: item.id, - collectName: item.collectName, + collectName: item.folderName, }) }) } @@ -307,23 +307,6 @@ - - - - - - - - - - - - 6541 - - - - diff --git a/jiuyi2/pages/news/chat/chat.vue b/jiuyi2/pages/news/chat/chat.vue index 60ec845e..b53b2452 100644 --- a/jiuyi2/pages/news/chat/chat.vue +++ b/jiuyi2/pages/news/chat/chat.vue @@ -140,6 +140,7 @@ // 开启监听消息 function addListener() { let onMessageReceived = function(event) { + console.log('TencentCloudChat.EVENT.MESSAGE_RECEIVED', event) setTimeout(() => { // 获取历史记录 getHistory({ @@ -359,6 +360,11 @@ redPacketId: redPacket.id, // 领取人id userId: userinfo.value.id, + // 群聊类型 + sendType: { + 'C2C': '1', + 'GROUP': '2', + } [msg.type], } }).then(rs => { if (rs.code == 200) { @@ -522,7 +528,7 @@ {{redPacket.fromName}}的红包 - {{ redPacket.blessing }} + {{ redPacket.blessing }} 红包已过期 来晚啦,红包已被抢完 diff --git a/jiuyi2/pages/news/chat/components/news-temp/index.vue b/jiuyi2/pages/news/chat/components/news-temp/index.vue index 2143df0e..1fa85aab 100644 --- a/jiuyi2/pages/news/chat/components/news-temp/index.vue +++ b/jiuyi2/pages/news/chat/components/news-temp/index.vue @@ -13,7 +13,6 @@ } from 'vue' import NewsAudio from '@/static/audio.png' import JyCommodityInformation from '@/components/public/jy-commodity-information' - import resEnvlope from '../red-envelope' const props = defineProps({ item: { type: Object, @@ -142,7 +141,7 @@ - + {{ formatData.data.blessing }} diff --git a/jiuyi2/pages/news/chat/components/red-envelope/index.vue b/jiuyi2/pages/news/chat/components/red-envelope/index.vue deleted file mode 100644 index 85e00fc5..00000000 --- a/jiuyi2/pages/news/chat/components/red-envelope/index.vue +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/jiuyi2/pages/news/redPacket.vue b/jiuyi2/pages/news/redPacket.vue index 0f4d7e22..c9050801 100644 --- a/jiuyi2/pages/news/redPacket.vue +++ b/jiuyi2/pages/news/redPacket.vue @@ -44,7 +44,7 @@ // 红包类型 const typeList = reactive([{ - id: 2, + id: 0, name: '普通红包', }, { id: 1, @@ -159,7 +159,7 @@ console.log('data', data) - // + // 发送红包 api.news.sendRedPacket({ query: { // 二级密码 @@ -182,12 +182,6 @@ // 发送红包 function handleSend() { - // - const data = { - ...form - } - - // 支付二级密码 proxy.$refs.payPwdRef.open() } @@ -234,9 +228,9 @@ - 祝福语: + 祝福语: - +