Merge branch 'lr' of http://1.94.221.165:3000/sx/jiuyiUniapp
# Conflicts: # jiuyi2/common/js/config.js # jiuyi2/vite.config.js
This commit is contained in:
commit
0a930aa170
|
@ -2,3 +2,4 @@
|
||||||
/jiuyi/unpackage
|
/jiuyi/unpackage
|
||||||
/jiuyi2/.hbuilderx
|
/jiuyi2/.hbuilderx
|
||||||
/jiuyi/.hbuilderx
|
/jiuyi/.hbuilderx
|
||||||
|
unpackage
|
||||||
|
|
|
@ -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',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -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 = {}
|
||||||
|
|
|
@ -1,107 +1,108 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 搜索
|
* 搜索
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
computed,
|
computed,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
onPullDownRefresh,
|
onPullDownRefresh,
|
||||||
onReachBottom
|
onReachBottom
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
|
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util';
|
import util from '@/common/js/util';
|
||||||
// api
|
// api
|
||||||
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
|
||||||
} = getCurrentInstance()
|
} = getCurrentInstance()
|
||||||
// 搜索状态
|
// 搜索状态
|
||||||
const searchState = ref(false)
|
const searchState = ref(false)
|
||||||
// 搜索记录
|
// 搜索记录
|
||||||
const searchLog = reactive([])
|
const searchLog = reactive([])
|
||||||
// 热点视频
|
// 热点视频
|
||||||
const hotVideoList = reactive([])
|
const hotVideoList = reactive([])
|
||||||
// 分类列表
|
// 分类列表
|
||||||
const tabList = reactive([{
|
const tabList = reactive([{
|
||||||
name: '视频',
|
name: '视频',
|
||||||
getList: () => getVideoList(),
|
getList: () => getVideoList(),
|
||||||
getMoreList: () => getMoreVideoList(),
|
getMoreList: () => getMoreVideoList(),
|
||||||
refreshList: () => refreshVideoList()
|
refreshList: () => refreshVideoList()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '用户',
|
name: '用户',
|
||||||
getList: () => getFriendList(),
|
getList: () => getFriendList(),
|
||||||
getMoreList: () => getMoreFriendList(),
|
getMoreList: () => getMoreFriendList(),
|
||||||
refreshList: () => refreshFriendList()
|
refreshList: () => refreshFriendList()
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
// 分类下标
|
// 分类下标
|
||||||
const tabIndex = ref(0)
|
const tabIndex = ref(0)
|
||||||
// 搜索关键字
|
// 搜索关键字
|
||||||
const keyword = ref('')
|
const keyword = ref('')
|
||||||
// 视频列表
|
// 视频列表
|
||||||
const videoList = reactive({
|
const videoList = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
})
|
})
|
||||||
// 用户列表
|
// 用户列表
|
||||||
const userList = reactive({
|
const userList = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
// 用户信息
|
||||||
|
const userinfo = computed(() => {
|
||||||
|
let resuilt = uni.$store.state.userinfo
|
||||||
|
return resuilt
|
||||||
|
})
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
// 获取用户搜索记录
|
// 获取用户搜索记录
|
||||||
getSearchLog()
|
getSearchLog()
|
||||||
// 获取热点视频
|
// 获取热点视频
|
||||||
getHotVideo()
|
getHotVideo()
|
||||||
})
|
})
|
||||||
|
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
// 获取更多列表
|
// 获取更多列表
|
||||||
if (searchState.value) tabList[tabIndex.value].getMoreList()
|
if (searchState.value) tabList[tabIndex.value].getMoreList()
|
||||||
})
|
})
|
||||||
|
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
if (!searchState.value) {
|
if (!searchState.value) {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 刷新
|
// 刷新
|
||||||
tabList[tabIndex.value].refreshList()
|
tabList[tabIndex.value].refreshList()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取用户搜索记录
|
// 获取用户搜索记录
|
||||||
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,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取热点视频
|
// 获取热点视频
|
||||||
function getHotVideo() {
|
function getHotVideo() {
|
||||||
// 热点视频
|
// 热点视频
|
||||||
api.video.hotVideos().then(rs => {
|
api.video.hotVideos().then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
|
@ -113,30 +114,30 @@
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// tab下标
|
// tab下标
|
||||||
function handleTabIndex(index) {
|
function handleTabIndex(index) {
|
||||||
if (tabIndex.value === index) return
|
if (tabIndex.value === index) return
|
||||||
tabIndex.value = index
|
tabIndex.value = index
|
||||||
// 重载
|
// 重载
|
||||||
tabList[tabIndex.value].refreshList()
|
tabList[tabIndex.value].refreshList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看用户主页
|
* 查看用户主页
|
||||||
* @param {Object} item
|
* @param {Object} item
|
||||||
*/
|
*/
|
||||||
function handleUser(item) {
|
function handleUser(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: util.setUrl('/pages/index/videoHome', {
|
url: util.setUrl('/pages/index/videoHome', {
|
||||||
userId: item.userId
|
userId: item.userId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索
|
// 搜索
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
if (!keyword.value) {
|
if (!keyword.value) {
|
||||||
searchState.value = false
|
searchState.value = false
|
||||||
return
|
return
|
||||||
|
@ -144,45 +145,54 @@
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
tabList[tabIndex.value].getList()
|
tabList[tabIndex.value].getList()
|
||||||
}
|
|
||||||
|
|
||||||
// 重载视频列表
|
|
||||||
function refreshVideoList() {
|
// 缓存搜索历史
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重载视频列表
|
||||||
|
function refreshVideoList() {
|
||||||
videoList.pageNum = 1
|
videoList.pageNum = 1
|
||||||
videoList.total = 0
|
videoList.total = 0
|
||||||
getVideoList()
|
getVideoList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取更多视频列表
|
// 获取更多视频列表
|
||||||
function getMoreVideoList() {
|
function getMoreVideoList() {
|
||||||
if (videoList.data.length >= videoList.total) return
|
if (videoList.data.length >= videoList.total) return
|
||||||
videoList.pageNum++
|
videoList.pageNum++
|
||||||
getVideoList()
|
getVideoList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取视频列表
|
||||||
|
function getVideoList() {
|
||||||
|
let obj = {
|
||||||
|
content: keyword.value,
|
||||||
|
type: +tabIndex.value + 1,
|
||||||
|
userId: userinfo.value.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取视频列表
|
api.video.videoSearch({ query: obj }).then(rs => {
|
||||||
function getVideoList() {
|
// console.log('videoSearch', rs)
|
||||||
api.video.videoSearch({
|
|
||||||
query: {
|
|
||||||
// 搜索
|
|
||||||
search: keyword.value,
|
|
||||||
pageNum: videoList.pageNum,
|
|
||||||
pageSize: videoList.pageSize,
|
|
||||||
}
|
|
||||||
}).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({
|
||||||
|
@ -192,37 +202,36 @@
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重载朋友列表
|
// 重载朋友列表
|
||||||
function refreshFriendList() {
|
function refreshFriendList() {
|
||||||
userList.pageNum = 1
|
userList.pageNum = 1
|
||||||
userList.total = 0
|
userList.total = 0
|
||||||
getFriendList()
|
getFriendList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取更多朋友列表
|
// 获取更多朋友列表
|
||||||
function getMoreFriendList() {
|
function getMoreFriendList() {
|
||||||
if (userList.data.length >= userList.total) return
|
if (userList.data.length >= userList.total) return
|
||||||
userList.pageNum++
|
userList.pageNum++
|
||||||
getFriendList()
|
getFriendList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取朋友列表
|
// 获取朋友列表
|
||||||
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
|
||||||
}))
|
}))
|
||||||
// 视频列表
|
// 视频列表
|
||||||
|
@ -236,30 +245,42 @@
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击当前元素搜索
|
* 点击当前元素搜索
|
||||||
* @param {Object} item 被点击的元素
|
* @param {Object} item 被点击的元素
|
||||||
* @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()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转视频
|
// 跳转视频
|
||||||
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"
|
||||||
<view class="rank c666 f32 b">{{index + 1}}</view>
|
@click="handleItemSearch(item, 'title')">
|
||||||
|
<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,8 +368,9 @@
|
||||||
<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"
|
||||||
<view class="txt">{{item.name}}</view>
|
:class="{ 'active': index === tabIndex }" @click="handleTabIndex(index)">
|
||||||
|
<view class="txt">{{ item.name }}</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
</view>
|
</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,13 +388,13 @@
|
||||||
</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>
|
||||||
|
|
||||||
<!-- 简介 -->
|
<!-- 简介 -->
|
||||||
<view class="desc mtb20 f28">{{item.title}}</view>
|
<view class="desc mtb20 f28">{{ item.title }}</view>
|
||||||
|
|
||||||
<!-- 封面图 -->
|
<!-- 封面图 -->
|
||||||
<view class="coverImg mtb20">
|
<view class="coverImg mtb20">
|
||||||
|
@ -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,25 +447,28 @@
|
||||||
</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>
|
||||||
|
|
||||||
<view class="user oh f1 mlr25">
|
<view class="user oh f1 mlr25">
|
||||||
<view class="nickname c333 f32">{{item.userNickname}}</view>
|
<view class="nickname c333 f32">{{ item.userNickname }}</view>
|
||||||
<view class="fans c999 f24">粉丝:{{item.userFans}}</view>
|
<view class="fans c999 f24">粉丝:{{ item.userFans }}</view>
|
||||||
</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>
|
||||||
|
@ -446,38 +477,38 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 顶部
|
// 顶部
|
||||||
.apex {
|
.apex {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
.search {
|
.search {
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
background-color: #f1f1f1;
|
background-color: #f1f1f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索列表
|
// 搜索列表
|
||||||
.searchList {
|
.searchList {
|
||||||
|
|
||||||
// 单项
|
// 单项
|
||||||
.item {
|
.item {
|
||||||
background-color: #f1f1f1;
|
background-color: #f1f1f1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 热搜列表
|
// 热搜列表
|
||||||
.hotList {
|
.hotList {
|
||||||
|
|
||||||
.item+.item {
|
.item+.item {
|
||||||
border-top: 1rpx solid #F6F6F6;
|
border-top: 1rpx solid #F6F6F6;
|
||||||
|
@ -518,10 +549,10 @@
|
||||||
background-image: linear-gradient(123deg, #27EFE2 0%, #A45EFF 43%, #FF004F 99%);
|
background-image: linear-gradient(123deg, #27EFE2 0%, #A45EFF 43%, #FF004F 99%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分栏列表
|
// 分栏列表
|
||||||
.tabList {
|
.tabList {
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
.line {
|
.line {
|
||||||
|
@ -543,10 +574,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 列表容器
|
// 列表容器
|
||||||
.listBox {
|
.listBox {
|
||||||
min-height: 95vh;
|
min-height: 95vh;
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
|
|
||||||
|
@ -555,5 +586,5 @@
|
||||||
height: 376rpx;
|
height: 376rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"version" : "1.0",
|
||||||
|
"configurations" : [
|
||||||
|
{
|
||||||
|
"playground" : "standard",
|
||||||
|
"type" : "uni-app:app-android"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -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: {
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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, () => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取更多消息记录
|
// 获取更多消息记录
|
||||||
|
|
|
@ -60,73 +60,66 @@ 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;
|
||||||
|
|
||||||
})
|
})
|
||||||
|
// 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() {
|
function handleLogout() {
|
||||||
util.alert({
|
util.alert({
|
||||||
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>
|
||||||
|
|
|
@ -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()],
|
||||||
|
|
Loading…
Reference in New Issue