合并代码
This commit is contained in:
parent
3c27a4a274
commit
b07032764e
|
@ -44,9 +44,9 @@ export const news = {
|
|||
*/
|
||||
deleteFriend(param) {
|
||||
return util.request({
|
||||
url: `/user/friend/deleteFriend`,
|
||||
url: `/user/chat/relation/deleteFriend`,
|
||||
method: 'POST',
|
||||
path: param.path,
|
||||
data: param.data,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -9,19 +9,21 @@ const video = {
|
|||
*/
|
||||
homeVideo(param) {
|
||||
return util.request({
|
||||
url: `/video/api/queryVideoByPage`,
|
||||
url: `/video/video/list`,
|
||||
// url: `/video/api/queryVideoByPage`,
|
||||
query: param.query,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 发布作品
|
||||
* 发布视频
|
||||
* @param {Object} param
|
||||
*/
|
||||
saveVideo(param) {
|
||||
return util.request({
|
||||
url: `/video/api/saveVideo`,
|
||||
url: `/video/video/add`,
|
||||
// url: `/video/api/saveVideo`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
})
|
||||
|
@ -57,7 +59,8 @@ const video = {
|
|||
*/
|
||||
getLabel(param) {
|
||||
return util.request({
|
||||
url: `/video/api/getTagsByPage`,
|
||||
url: `/video/tag/list`,
|
||||
// url: `/video/api/getTagsByPage`,
|
||||
data: param.data,
|
||||
method: 'GET',
|
||||
load: true,
|
||||
|
@ -90,6 +93,7 @@ const video = {
|
|||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 展播量推送
|
||||
* @param {Object} param
|
||||
|
@ -102,6 +106,7 @@ const video = {
|
|||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 他人用户主页
|
||||
* @param {Object} param
|
||||
|
|
|
@ -18,10 +18,8 @@
|
|||
import util from '@/common/js/util.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
//
|
||||
import api from '@/api/index.js'
|
||||
// api
|
||||
import newsApi from '@/api/news.js'
|
||||
import api from '@/api/index.js'
|
||||
import pinyin from 'js-pinyin'
|
||||
const {
|
||||
proxy
|
||||
|
@ -214,48 +212,33 @@
|
|||
function getFriendList() {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
console.log('isReady', isReady)
|
||||
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
getFriendList()
|
||||
}, 1000);
|
||||
}, 500);
|
||||
return
|
||||
}
|
||||
|
||||
newsApi.getFriendList().then(rs => {
|
||||
api.news.getFriendList().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
viewData.value = rs.data;
|
||||
// 这里可以将好友列表传递给book组件进行展示
|
||||
console.log('好友列表:', viewData.value);
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
|
||||
return
|
||||
|
||||
uni.$chat.getFriendList().then(rs => {
|
||||
console.log('friend', rs)
|
||||
if (rs.code == 0) {
|
||||
const result = rs.data
|
||||
|
||||
//
|
||||
userList.data.push(...result.map(item => {
|
||||
userList.data.push(...result.rows.map(item => {
|
||||
// 取拼音
|
||||
let char = pinyin.getCamelChars(item.remark || item.profile.nick);
|
||||
let char = pinyin.getCamelChars(item.remark || item.userNickname);
|
||||
return {
|
||||
key: char.charAt(0),
|
||||
letter: char.charAt(0),
|
||||
child: [item]
|
||||
}
|
||||
}))
|
||||
console.log('userList.data', userList.data)
|
||||
// console.log('friend list', list)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -311,9 +294,7 @@
|
|||
* @param {Object} user 用户信息
|
||||
*/
|
||||
function handleSwipeAction(ev, user) {
|
||||
//
|
||||
ev.content.fn(user)
|
||||
//
|
||||
proxy.$refs.swipeAction.closeAll()
|
||||
}
|
||||
|
||||
|
@ -324,18 +305,26 @@
|
|||
function delFriend(user) {
|
||||
new Promise((resolve, reject) => {
|
||||
util.alert({
|
||||
content: `确认删除好友${user.profile.nick}?`
|
||||
content: `确认删除好友${user.remark || user.userNickname}?`
|
||||
}).then(res => {
|
||||
if (!res.confirm) return
|
||||
return resolve()
|
||||
})
|
||||
}).then(rs => {
|
||||
uni.$chat.deleteFriend({
|
||||
userIDList: [user.userID],
|
||||
type: TencentCloudChat.TYPES.SNS_DELETE_TYPE_BOTH
|
||||
api.news.deleteFriend({
|
||||
data: {
|
||||
toUserId: user.userId,
|
||||
},
|
||||
}).then(rs => {
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
if (rs.code === 200) {
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -380,18 +369,40 @@
|
|||
* @param {Object} user 当前用户信息
|
||||
*/
|
||||
function handleUser(user) {
|
||||
console.log('handleUser', user)
|
||||
util.toChat({
|
||||
name: user.remark || user.profile.nick,
|
||||
msgId: user.userID,
|
||||
type: 'C2C',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
* @param {Object} url
|
||||
*/
|
||||
function link(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="firendBox pr">
|
||||
<scroll-view scroll-y="true" class="scroll" :scroll-into-view="listKey">
|
||||
<!-- 菜单 -->
|
||||
<view class="menu oh c333 f34">
|
||||
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/newFriend')">
|
||||
<view class="">好友申请</view>
|
||||
<uni-icons type="right" color="#999" size="30rpx" />
|
||||
</view>
|
||||
|
||||
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/chatGroup')">
|
||||
<view class="">群聊列表</view>
|
||||
<uni-icons type="right" color="#999" size="30rpx" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<view class="list pb30">
|
||||
<view class="li" v-for="(item, index) in userList.data" :key="item.key" :id="item.key">
|
||||
|
@ -400,8 +411,8 @@
|
|||
<uni-swipe-action-item :right-options="rightOption" v-for="(user, secIndex) in item.child"
|
||||
:key="secIndex" @click="handleSwipeAction($event,user)">
|
||||
<view class="item rows ptb20" @click="handleUser(user)">
|
||||
<image class="wh80 avatar cir" :src="user.profile.avatar" mode="aspectFill" />
|
||||
<view class="name thd f1 ml20 c333 f32">{{user.remark || user.profile.nick}}</view>
|
||||
<image class="wh80 avatar cir" :src="user.avatar" mode="aspectFill" />
|
||||
<view class="name thd f1 ml20 c333 f32">{{user.remark || user.userNickname}}</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</view>
|
||||
|
|
|
@ -625,12 +625,6 @@
|
|||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/feedback",
|
||||
"style": {
|
||||
"navigationBarTitleText": "意见反馈"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/setting/safeCenter",
|
||||
"style": {
|
||||
|
@ -712,10 +706,16 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/mine/setting/secondPwd",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "二级密码",
|
||||
"path": "pages/mine/setting/secondPwd",
|
||||
"style": {
|
||||
"navigationBarTitleText": "二级密码",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/news/chatGroup",
|
||||
"style": {
|
||||
"navigationBarTitleText": "群聊列表",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<script setup>
|
||||
// 意见反馈
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="app">
|
||||
<!-- -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -226,7 +226,7 @@
|
|||
|
||||
<navigator url="/pages/mine/userinfo" class="user f1 ml20">
|
||||
<view class="f36 b">{{userinfo.userNickname}}</view>
|
||||
<view class="f24">账号:{{userinfo.userAccount}}</view>
|
||||
<view class="f24">账号:{{userinfo.account}}</view>
|
||||
</navigator>
|
||||
|
||||
<view class="tac" v-if="userinfo.isShop == 1">
|
||||
|
|
|
@ -72,6 +72,19 @@
|
|||
count: 6,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片
|
||||
* @param {Object} index
|
||||
*/
|
||||
function removeImage(index) {
|
||||
util.alert({
|
||||
content: '删除后不可恢复,确认删除吗?',
|
||||
}).then(rs => {
|
||||
if (!rs.confirm) return
|
||||
form.url.splice(index, 1)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -95,7 +108,8 @@
|
|||
<view class="key f36">请输入您遇到的问题</view>
|
||||
<view class="imgList mt30">
|
||||
<view class="imgs wh180 br20" v-for="(item,index) in form.url" :key="index">
|
||||
<image :src="item" mode="aspectFill" />
|
||||
<image class="wh180 br20" :src="item" mode="aspectFill" />
|
||||
<uni-icons type="clear" class="close" color="red" @click="removeImage(index)" />
|
||||
</view>
|
||||
<view class="imgs upload fmid wh180 br20" @click="uploadImg">
|
||||
<uni-icons type="plusempty" size="80rpx" color="#aaa" />
|
||||
|
|
|
@ -77,9 +77,10 @@
|
|||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
const result = rs.data
|
||||
if (userList.pageNum) userList.data.length = 0
|
||||
// 追加朋友列表
|
||||
userList.data.push(...rs.rows.map(item => {
|
||||
userList.data.push(...result.rows.map(item => {
|
||||
item.format_userPortrait = util.format_url(item.userPortrait, 'img')
|
||||
return item
|
||||
}))
|
||||
|
@ -139,10 +140,10 @@
|
|||
function addFriendConfirm() {
|
||||
api.news.addFriend({
|
||||
data: [{
|
||||
toAccount: friend.value.userId,
|
||||
addWording: friend.value.AddWording,
|
||||
remark: friend.value.Remark,
|
||||
}],
|
||||
toAccount: friend.value.userId,
|
||||
addWording: friend.value.AddWording,
|
||||
remark: friend.value.Remark,
|
||||
}],
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('已发送好友申请,请等待对方同意')
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
<script setup>
|
||||
// 群组列表
|
||||
|
||||
import {
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
} from 'vue';
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
import {
|
||||
onLoad,
|
||||
onUnload,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
//
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
// 数据列表
|
||||
const list = reactive([])
|
||||
|
||||
// 右滑菜单
|
||||
const rightOption = [{
|
||||
text: '退出群聊',
|
||||
style: {
|
||||
backgroundColor: '#F85050'
|
||||
},
|
||||
fn: (item) => quitGroup(item)
|
||||
}]
|
||||
|
||||
onLoad(() => {
|
||||
//
|
||||
getGroupList()
|
||||
// 开启监听
|
||||
addListener()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
// 移除监听
|
||||
removeListener()
|
||||
})
|
||||
|
||||
// 开启监听
|
||||
function addListener() {
|
||||
let onFriendListUpdated = function(event) {
|
||||
getGroupList()
|
||||
}
|
||||
|
||||
uni.$chat.on(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, onFriendListUpdated);
|
||||
}
|
||||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED);
|
||||
}
|
||||
|
||||
// 获取群组列表
|
||||
function getGroupList() {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
getGroupList()
|
||||
}, 200);
|
||||
return
|
||||
}
|
||||
|
||||
uni.$chat.getGroupList().then(rs => {
|
||||
if (rs.code == 0) {
|
||||
list.length = 0
|
||||
list.push(...rs.data.groupList)
|
||||
console.log('group list', list)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群组列表
|
||||
* @param {Object} item
|
||||
*/
|
||||
function handleGroupItem(item) {
|
||||
console.log('group item', item)
|
||||
util.toChat({
|
||||
name: `${item.name}(${item.memberCount})`,
|
||||
msgId: item.groupID,
|
||||
type: 'GROUP',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
* @param {Object} ev 默认事件
|
||||
* @param {Object} item 单项
|
||||
*/
|
||||
function handleMenu(ev, item) {
|
||||
ev.content.fn(item)
|
||||
proxy.$refs.swipeAction.closeAll()
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出群组
|
||||
* @param {Object} item 详情
|
||||
*/
|
||||
function quitGroup(item) {
|
||||
util.alert({
|
||||
content: '确认退出群聊?'
|
||||
}).then(rs => {
|
||||
if (!rs.confirm) return
|
||||
uni.$chat.quitGroup({
|
||||
groupID: item.groupID,
|
||||
}).then(rs => {
|
||||
getGroupList()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="group app">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<view class="list plr20 pb30">
|
||||
<view class="li" v-for="(item, index) in list" :key="index">
|
||||
<uni-swipe-action-item :right-options="rightOption" @click="handleMenu($event,item)">
|
||||
<view class="item rows ptb20" @click="handleGroupItem(item)">
|
||||
<image class="wh80 avatar br10" :src="item.avatar" mode="aspectFill" />
|
||||
|
||||
<view class="f1 mlr20">
|
||||
<view class="name thd f1 c333 f32">{{item.name}}</view>
|
||||
<!-- <view class="content thd mt10 c666 f24">{{item.lastMessage.messageForShow || ''}}</view> -->
|
||||
</view>
|
||||
<!-- <view class="time c999 f22" v-if="item.lastMessage.messageForShow || ''">{{util.formatTime('yyyy-MM-dd HH:mm:ss',item.lastMessage.lastTime)}}</view> -->
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</view>
|
||||
|
||||
<view class="mtb20 nomore">到底啦~</view>
|
||||
</view>
|
||||
</uni-swipe-action>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.group {
|
||||
height: 100%;
|
||||
|
||||
.scroll {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -163,10 +163,6 @@
|
|||
<noLogin class="f1" />
|
||||
</view>
|
||||
|
||||
<view class="" v-else-if="!imLoad">
|
||||
加载中
|
||||
</view>
|
||||
|
||||
<view class="page" v-else>
|
||||
<apex>
|
||||
<template #left>
|
||||
|
|
|
@ -334,6 +334,7 @@
|
|||
return
|
||||
}
|
||||
|
||||
// 如果不是草稿箱
|
||||
if (data.status == 1) {
|
||||
if (!data.title) {
|
||||
util.alert('标题不能为空')
|
||||
|
@ -384,7 +385,7 @@
|
|||
<view class="imgs wh200 br10" v-if="form.coverUrl">
|
||||
<image :src="form.coverUrl" class="br10" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="imgs wh200 upload fmid bfff br10" v-else @click="uploadImg">
|
||||
<view class="imgs wh200 upload fmid bfff br10" @click="uploadImg">
|
||||
<uni-icons type="plusempty" color="#E8E8E8" size="50rpx" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -396,7 +397,7 @@
|
|||
<view class="imgs wh200 br10" v-if="form.videoUrl">
|
||||
<video :src="form.videoUrl" class="br10" />
|
||||
</view>
|
||||
<view class="imgs wh200 upload fmid bfff br10" v-else @click="uploadVideo">
|
||||
<view class="imgs wh200 upload fmid bfff br10" @click="uploadVideo">
|
||||
<uni-icons type="plusempty" color="#E8E8E8" size="50rpx" />
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -14,18 +14,22 @@ export default defineConfig({
|
|||
changeOrigin: true,
|
||||
},
|
||||
"/user": {
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/coreplay": {
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/file": {
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/video": {
|
||||
// target: "http://192.168.0.129:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue