# Conflicts:
#	jiuyi2/common/js/config.js
#	jiuyi2/vite.config.js
This commit is contained in:
sx 2025-02-23 20:22:45 +08:00
commit 0a930aa170
10 changed files with 468 additions and 487 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/jiuyi/unpackage /jiuyi/unpackage
/jiuyi2/.hbuilderx /jiuyi2/.hbuilderx
/jiuyi/.hbuilderx /jiuyi/.hbuilderx
unpackage

View File

@ -301,9 +301,9 @@ const video = {
*/ */
hotVideos(param) { hotVideos(param) {
return util.request({ return util.request({
url: `/home/hotVideos`, url: `/video/search/getHot`,
// query: param.query, // query: param.query,
method: 'POST', method: 'GET',
}) })
}, },
@ -325,8 +325,8 @@ const video = {
*/ */
videoSearch(param) { videoSearch(param) {
return util.request({ return util.request({
url: `/home/videoSearch`, url: `/video/search/searchData`,
query: param.query, data: param.query,
method: 'POST', method: 'POST',
}) })
}, },

View File

@ -111,7 +111,6 @@ function getList() {
uni.$chat.getConversationList().then(rs => { uni.$chat.getConversationList().then(rs => {
let res = rs.data.conversationList let res = rs.data.conversationList
console.log(res);
let arr = [] let arr = []
res.forEach(item => { res.forEach(item => {
let obj = {} let obj = {}

View File

@ -21,6 +21,7 @@
import api from '@/api/index.js' import api from '@/api/index.js'
// //
import statusBar from '@/components/header/statusBar.vue' import statusBar from '@/components/header/statusBar.vue'
import { set } from 'lodash';
const { const {
proxy proxy
@ -64,6 +65,12 @@
total: 0, total: 0,
}) })
//
const userinfo = computed(() => {
let resuilt = uni.$store.state.userinfo
return resuilt
})
onLoad(() => { onLoad(() => {
// //
getSearchLog() getSearchLog()
@ -87,17 +94,11 @@
// //
function getSearchLog() { function getSearchLog() {
// let searchList = uni.getStorageSync('searchLog');
api.video.videoSearchLog().then(rs => { if (searchList) {
if (rs.code == 200) { searchList = Array.from(new Set(searchList))
searchLog.push(...rs.data) searchLog.push(...searchList)
return
} }
util.alert({
content: rs.msg,
showCancel: false,
})
})
} }
// //
@ -144,6 +145,16 @@
// //
tabList[tabIndex.value].getList() tabList[tabIndex.value].getList()
//
let searchList = uni.getStorageSync('searchLog');
searchList = searchList == '' ? [] : searchList;
searchList.push(keyword.value)
searchList = Array.from(new Set(searchList))
searchList = searchList.reverse()
uni.setStorageSync("searchLog", searchList)
} }
// //
@ -162,27 +173,26 @@
// //
function getVideoList() { function getVideoList() {
api.video.videoSearch({ let obj = {
query: { content: keyword.value,
// type: +tabIndex.value + 1,
search: keyword.value, userId: userinfo.value.id,
pageNum: videoList.pageNum,
pageSize: videoList.pageSize,
} }
}).then(rs => {
console.log('videoSearch', rs) api.video.videoSearch({ query: obj }).then(rs => {
// console.log('videoSearch', rs)
if (rs.code == 200) { if (rs.code == 200) {
if (videoList.pageNum) videoList.data.length = 0 if (videoList.pageNum) videoList.data.length = 0
// //
videoList.data.push(...rs.rows.map(item => { videoList.data.push(...rs.rows.map(item => {
item.format_videoUrl = util.format_url(item.videoUrl, 'video') item.format_videoUrl = util.format_url(item.videoUrl, 'video')
item.format_header = util.format_url(item.header, 'img') item.format_header = util.format_url(item.avatar, 'img')
item.format_imageUrl = util.format_url(item.imageUrl, 'img') item.format_imageUrl = util.format_url(item.coverUrl, 'img')
return item return item
})) }))
// //
videoList.total = rs.total videoList.total = rs.total
console.log('videoList', videoList.data) // console.log('videoList', videoList.data)
return return
} }
util.alert({ util.alert({
@ -210,19 +220,18 @@
// //
function getFriendList() { function getFriendList() {
api.video.searchFriendByName({ let obj = {
path: [keyword.value], content: keyword.value,
query: { type: +tabIndex.value + 1,
pageNum: userList.pageNum, userId: userinfo.value.id,
pageSize: userList.pageSize,
} }
}).then(rs => { api.video.videoSearch({ query: obj }).then(rs => {
console.log(rs)
if (rs.code == 200) { if (rs.code == 200) {
if (userList.pageNum) userList.data.length = 0 if (userList.pageNum) userList.data.length = 0
// //
userList.data.push(...rs.rows.map(item => { userList.data.push(...rs.rows.map(item => {
item.format_userPortrait = util.format_url(item.userPortrait, 'img') item.userId = item.id
item.format_userPortrait = util.format_url(item.avatar, 'img')
return item return item
})) }))
// //
@ -244,7 +253,11 @@
* @param {String} key * @param {String} key
*/ */
function handleItemSearch(item, key) { function handleItemSearch(item, key) {
keyword.value = item[key] if (key == 'search') {
keyword.value = item
} else if (key == 'title') {
keyword.value = item.topic
}
// //
handleSearch() handleSearch()
@ -252,14 +265,22 @@
// //
function handleVideo(item) { function handleVideo(item) {
console.log('handleVideo', item)
//
uni.navigateTo({ uni.navigateTo({
url: util.setUrl('/pages/index/videoDetail', { url: util.setUrl('/pages/index/videoDetail', {
videoId: item.videoId videoId: item.id
}) })
}) })
} }
//
function deleteSearch() {
util.alert({
content: '确认删除历史记录吗?',
}).then(rs => {
uni.removeStorageSync('searchLog')
searchLog = searchLog.splice(0, searchLog.length)
})
}
</script> </script>
<template> <template>
@ -292,10 +313,12 @@
<view class="searchList mtb30 mlr30"> <view class="searchList mtb30 mlr30">
<view class="rows"> <view class="rows">
<view class="title c333 f28 b">历史记录</view> <view class="title c333 f28 b">历史记录</view>
<uni-icons type="trash" size="24rpx" color="#999" @click="deleteSearch" />
</view> </view>
<view class="list mt20 c333 f24"> <view class="list mt20 c333 f24">
<view class="item dib mtb10 mlr10 ptb10 plr20 bar" v-for="(item,index) in searchLog" :key="index" @click="handleItemSearch(item,'search')">{{item.search}}</view> <view class="item dib mtb10 mlr10 ptb10 plr20 bar" v-for="(item, index) in searchLog" :key="index"
@click="handleItemSearch(item, 'search')">{{ item }}</view>
<view class="nomore mtb20" v-if="!searchLog[0]">暂无搜索记录</view> <view class="nomore mtb20" v-if="!searchLog[0]">暂无搜索记录</view>
</view> </view>
@ -308,7 +331,8 @@
</view> </view>
<view class="list mt20 c333 f24"> <view class="list mt20 c333 f24">
<view class="item dib mtb10 mlr10 ptb10 plr20 bar" v-for="(item,index) in 15" :key="index">电商</view> <view class="item dib mtb10 mlr10 ptb10 plr20 bar" v-for="(item, index) in 15" :key="index">电商
</view>
</view> </view>
</view> </view>
@ -316,19 +340,20 @@
<view class="hotList mtb30 mlr30 c333"> <view class="hotList mtb30 mlr30 c333">
<view class="title f28 b">热门搜索</view> <view class="title f28 b">热门搜索</view>
<view class="list"> <view class="list">
<view class="item df aic jcsb ptb20" v-for="(item,index) in hotVideoList" :key="index" @click="handleItemSearch(item,'title')"> <view class="item df aic jcsb ptb20" v-for="(item, index) in hotVideoList" :key="index"
@click="handleItemSearch(item, 'title')">
<view class="rank c666 f32 b">{{ index + 1 }}</view> <view class="rank c666 f32 b">{{ index + 1 }}</view>
<view class="content df aic f1 mlr15 f24"> <view class="content df aic f1 mlr15 f24">
<text>{{item.title}}</text> <text>{{ item.topic }}</text>
<template v-if="0"> <template v-if="index < 3">
<view class="label hot" v-if="index % 2 == 0"></view> <view class="label hot" v-if="index < 3"></view>
<view class="label new" v-if="index % 2 == 1"></view> <view class="label new" v-if="0"></view>
</template> </template>
<view class="f1"></view> <view class="f1"></view>
</view> </view>
<view class="number f22">热度{{item.play}}</view> <view v-if="0" class="number f22">热度{{ item.play }}</view>
<view class="change wh40" v-if="0"> <view class="change wh40" v-if="0">
<image src="/static/hotSearchUp.png" mode="aspectFit" v-if="1" /> <image src="/static/hotSearchUp.png" mode="aspectFit" v-if="1" />
<image src="/static/hotSearchDefault.png" mode="aspectFit" v-else-if="1" /> <image src="/static/hotSearchDefault.png" mode="aspectFit" v-else-if="1" />
@ -343,7 +368,8 @@
<template v-else> <template v-else>
<!-- tab --> <!-- tab -->
<view class="tabList df plr15"> <view class="tabList df plr15">
<view class="item df fdc aic plr20" v-for="(item,index) in tabList" :key="index" :class="{'active': index === tabIndex}" @click="handleTabIndex(index)"> <view class="item df fdc aic plr20" v-for="(item, index) in tabList" :key="index"
:class="{ 'active': index === tabIndex }" @click="handleTabIndex(index)">
<view class="txt">{{ item.name }}</view> <view class="txt">{{ item.name }}</view>
<view class="line"></view> <view class="line"></view>
</view> </view>
@ -353,7 +379,8 @@
<view class="listBox ptb15 plr15"> <view class="listBox ptb15 plr15">
<!-- 视频列表 --> <!-- 视频列表 -->
<view class="videoList" v-if="tabIndex === 0"> <view class="videoList" v-if="tabIndex === 0">
<view class="item oh mb25 plr30 c333 bfff br20" v-for="(item,index) in videoList.data" :key="index" @click="handleVideo(item)"> <view class="item oh mb25 plr30 c333 bfff br20" v-for="(item, index) in videoList.data" :key="index"
@click="handleVideo(item)">
<!-- 用户 --> <!-- 用户 -->
<view class="userinfo df aic mtb25"> <view class="userinfo df aic mtb25">
<view class="avatar" @click.stop="handleUser(item)"> <view class="avatar" @click.stop="handleUser(item)">
@ -361,7 +388,7 @@
</view> </view>
<view class="user ml15 f1"> <view class="user ml15 f1">
<view class="nickname f32">{{item.userName}}</view> <view class="nickname f32">{{ item.userNickname }}</view>
<view class="date mt10 c999 f24">{{ item.createTime }}</view> <view class="date mt10 c999 f24">{{ item.createTime }}</view>
</view> </view>
</view> </view>
@ -378,21 +405,22 @@
<view class="menu df mtb20 c333 f28"> <view class="menu df mtb20 c333 f28">
<!-- 点赞数量 --> <!-- 点赞数量 -->
<view class="option f1 fmid"> <view class="option f1 fmid">
<image class="wh30" src="/static/indexLike.png" mode="aspectFit" v-if="item.isLike == 0" /> <image class="wh30" src="/static/indexLike.png" mode="aspectFit"
v-if="item.isLike == 1" />
<image class="wh30" src="/static/indexLike1.png" mode="aspectFit" v-else /> <image class="wh30" src="/static/indexLike1.png" mode="aspectFit" v-else />
<view class="number ml10">{{item.likes}}</view> <view class="number ml10">{{ item.likeCount }}</view>
</view> </view>
<!-- 评论数量 --> <!-- 评论数量 -->
<view class="option f1 fmid"> <view class="option f1 fmid">
<image class="wh30" src="/static/indexMsg.png" mode="aspectFit" /> <image class="wh30" src="/static/indexMsg.png" mode="aspectFit" />
<view class="number ml10">{{item.comment}}</view> <view class="number ml10">{{ item.reviewCount }}</view>
</view> </view>
<!-- 收藏数量 --> <!-- 收藏数量 -->
<view class="option f1 fmid"> <view class="option f1 fmid">
<image class="wh30" src="/static/indexCollect.png" mode="aspectFit" /> <image class="wh30" src="/static/indexCollect.png" mode="aspectFit" />
<view class="number ml10">{{item.collect}}</view> <view class="number ml10">{{ item.collectCount }}</view>
</view> </view>
<!-- 转发数量 --> <!-- 转发数量 -->
@ -419,11 +447,13 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="videoList.data.length == 0" class="mtb20 nomore">暂无更多</view>
</view> </view>
<!-- 用户列表 --> <!-- 用户列表 -->
<view class="userList" v-if="tabIndex === 1"> <view class="userList" v-if="tabIndex === 1">
<view class="item df aic mtb40 plr10" v-for="(item,index) in userList.data" :key="index" @click="handleUser(item)"> <view class="item df aic mtb40 plr10" v-for="(item, index) in userList.data" :key="index"
@click="handleUser(item)">
<view class="avatar fs0"> <view class="avatar fs0">
<image class="wh110 cir" :src="item.format_userPortrait" mode="aspectFill" /> <image class="wh110 cir" :src="item.format_userPortrait" mode="aspectFill" />
</view> </view>
@ -434,10 +464,11 @@
</view> </view>
<view class="button fs0"> <view class="button fs0">
<view class="btn cancel w150" v-if="item.isAttention">取消关注</view> <view class="btn cancel w150" v-if="item.isAttention == 0">取消关注</view>
<view class="btn focus w150" v-else>关注</view> <view class="btn focus w150" v-else>关注</view>
</view> </view>
</view> </view>
<view v-if="userList.data.length == 0" class="mtb20 nomore">暂无更多</view>
</view> </view>
</view> </view>
</template> </template>

View File

@ -0,0 +1,9 @@
{
"version" : "1.0",
"configurations" : [
{
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
}

View File

@ -6,7 +6,7 @@ const config = {
// #endif // #endif
// #ifndef H5 // #ifndef H5
// host: 'http://91f.xyz:8080', // host: 'http://91f.xyz:8080',
host: 'https://b433d23.r24.cpolar.top/', host: 'https://1a880cd5.r24.cpolar.top/',
// #endif // #endif
// 支付方式配置 // 支付方式配置
payType: { payType: {

View File

@ -1425,16 +1425,17 @@ const util = {
value: userinfo value: userinfo
}) })
setTimeout(() => {
util.loginTencent(userinfo)
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index' url: '/pages/index/index'
}) })
}, 500)
}, },
// 登录腾讯聊天 // 登录腾讯聊天
loginTencent(userinfo) { loginTencent(userinfo) {
api.login.getIMToken({}).then(rs => { api.login.getIMToken({}).then(rs => {
console.log(rs);
const imSig = rs.msg const imSig = rs.msg
uni.$chat.login({ uni.$chat.login({
@ -1444,22 +1445,6 @@ const util = {
console.log('im login success', rs) 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
}) })
}, },

View File

@ -142,6 +142,10 @@ onUnload(() => {
videoContext.value.stop() videoContext.value.stop()
}) })
onUnmounted(() => {
removeListener()
})
// //
function addListener() { function addListener() {
let onMessageReceived = function (event) { let onMessageReceived = function (event) {
@ -160,7 +164,7 @@ function addListener() {
// //
function removeListener() { function removeListener() {
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED); uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, () => { });
} }
// //

View File

@ -60,65 +60,59 @@ function addListener() {
// //
function removeListener() { function removeListener() {
uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED); uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, () => { });
} }
// //
function getList() { function getList() {
api.news.getMessageList({ // sdk
query: { let isReady = uni.$chat.isReady();
userId: userinfo.serviceId, if (!isReady) {
} setTimeout(function () {
}).then(rs => { getList();
if (rs.code == 200) { }, 800);
chatList.push(...rs.data.map(item => {
item.callbackData = JSON.parse(item.callbackJson)
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 return
} }
util.alert({
content: rs.msg, uni.$chat.getConversationList().then(rs => {
showCancel: false, 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;
// *
// * @param {Number} item })
// */ // api.news.getMessageList({
// function handleChat(item) { // query: {
// // // userId: userinfo.serviceId,
// } // }
// }).then(rs => {
// /** // if (rs.code == 200) {
// * // chatList.push(...rs.data.map(item => {
// * @param {String} url // item.callbackData = JSON.parse(item.callbackJson)
// */ // return item
// function link(url) { // }))
// uni.navigateTo({ // return
// url, // }
// util.alert({
// content: rs.msg,
// showCancel: false,
// }) // })
// } // })
}
// 退 // 退
function handleLogout() { function handleLogout() {
@ -126,7 +120,6 @@ function handleLogout() {
content: '确认退出登录吗?', content: '确认退出登录吗?',
}).then(rs => { }).then(rs => {
if (!rs.confirm) return if (!rs.confirm) return
util.logout(() => { util.logout(() => {
// #ifdef APP // #ifdef APP
plus.runtime.restart() plus.runtime.restart()
@ -135,22 +128,16 @@ function handleLogout() {
}) })
} }
/** /**
* 去聊天 * 去聊天
* @param {Object} item * @param {Object} item
*/ */
function handleChat(item) { function handleChat(item) {
console.log(111111111, item);
let param = { let param = {
type: 'C2C', type: 'C2C',
name: `${item.callbackData.from_name}`, name: `${item.callbackData.from_name}`,
msgId: `${item.callbackData.from_id}` msgId: `${item.callbackData.from_id}`
}; };
console.log(22222222, param);
util.toChat(param) util.toChat(param)
} }
@ -176,7 +163,7 @@ function delMsg(item) {
return 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 => { uni.$chat.deleteConversation(conversationId).then(rs => {
getList() getList()
@ -194,7 +181,7 @@ function setRead(item) {
return 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({ uni.$chat.setMessageRead({
conversationID: conversationId, conversationID: conversationId,
}).then(rs => { }).then(rs => {
@ -229,59 +216,24 @@ function setRead(item) {
<uni-icons type="right" /> <uni-icons type="right" />
</view> </view>
<!-- <view class="list">
<view class="item rows ptb20 plr20" v-for="(item, index) in chatList" :key="index"
@click="handleChat(item)">
<view class="avatar">
<image :src="item.avatar" class="wh80 cir" />
</view>
<view class="info f1 ml20">
<view class="rows">
<view class="name c333 f28">{{ item.name }}</view>
<view class="time c999 f22">2024.05.06 13:00</view>
</view>
<view class="rows">
<view class="content mt10 c666 f24">{{ item.lastMessage }}</view>
<view class="dot cfff f22">
<view class="content" v-if="item.dot">{{ item.dot }}</view>
</view>
</view>
</view>
</view>
</view> -->
<view class="firendBox pr"> <view class="firendBox pr">
<scroll-view scroll-y="true" class="scroll"> <scroll-view scroll-y="true" class="scroll">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view class="list pb30"> <view class="list pb30">
<uni-swipe-action-item :right-options="rightOption" v-for="(item, index) in chatList" <uni-swipe-action-item :right-options="rightOption" v-for="(item, index) in chatList.data"
:key="index" @click="handleMenu($event, item)"> :key="index" @click="handleMenu($event, item)">
<view class="item rows ptb20 plr30" @click="handleChat(item)"> <view class="item rows ptb20 plr30" @click="handleChat(item)">
<view class="image wh90 pr"> <view class="image wh90 pr">
<template v-if="item.groupId == null"> <image class="cir wh90" :src="item.avatar" mode="aspectFill" />
<image class="cir wh90" :src="item.callbackJson.from_url" mode="aspectFill" />
</template>
<template v-else>
<image class="cir wh90" :src="item.groupChatDTO.groupFaceUrl"
mode="aspectFill" />
</template>
<view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount <view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount
}} }}
</view> </view>
</view> </view>
<view class="col f1 ml20"> <view class="col f1 ml20">
<view class="rows"> <view class="rows">
<template v-if="item.groupId == null"> <view class="name f1 thd c333 f32">{{ item.name }}</view>
<view class="name f1 thd c333 f32">{{ item.callbackJson.from_name }}</view>
</template>
<template v-else>
<view class="name f1 thd c333 f32">{{ item.groupChatDTO.name }}</view>
</template>
<view class="datetime c999 f22"> <view class="datetime c999 f22">
{{ util.formatTime('MM-dd HH:mm', item.createTime) }}</view> {{ util.formatTime('MM-dd HH:mm', item.lastTime) }}</view>
</view> </view>
<view class="desc thd mt10 c666 f24">{{ item.chatText }}</view> <view class="desc thd mt10 c666 f24">{{ item.chatText }}</view>
</view> </view>

View File

@ -4,7 +4,7 @@ import {
import uni from '@dcloudio/vite-plugin-uni'; import uni from '@dcloudio/vite-plugin-uni';
// let target = 'http://91f.xyz:8080' // let target = 'http://91f.xyz:8080'
let target = 'https://b433d23.r24.cpolar.top/' let target = 'https://1a880cd5.r24.cpolar.top/'
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],