进入uniapp

This commit is contained in:
2023-12-01 23:57:44 +08:00
parent a78893ea1f
commit d61f5e6c92
524 changed files with 88081 additions and 12 deletions

View File

@@ -0,0 +1,411 @@
<template>
<view class="bgColor" v-if="userdetail">
<watermark></watermark>
<view class="person-wx">
<view class="person-wx-user">
<image class="person-wx-avatar" @click="$fc.previewImagesolo(userdetail.portrait)" :src="userdetail.portrait" mode="aspectFill"></image>
<view class="person-wx-user-detail">
<view class="person-wx-nikename">
<text class="text">{{userdetail.nickName}}</text>
<view class="wxfont person-wx-nikename-icon" :class="{'nv':userdetail.gender=='0'}" v-if="userdetail.gender=='0'"></view>
<view class="wxfont person-wx-nikename-icon" :class="{'nan':userdetail.gender=='1'}" v-if="userdetail.gender=='1'"></view>
</view>
<text class="person-wx-name">
微聊号{{userdetail.chatNo}}
</text>
<text class="person-wx-name" v-if="userdetail.provinces">地区{{userdetail.provinces}} {{userdetail.city}}</text>
</view>
</view>
</view>
<tool-list-wx :list="list2"></tool-list-wx>
<tool-list-wx :list="list3" v-if="detail.applyStatus!=='0'&&type=='2'"></tool-list-wx>
<tool-list-wx v-if="type=='2'&&detail.applyStatus=='0'&&userdetail.isFriend=='N'" :list="list4" type="btns" @itemClick="itemClicklist4"></tool-list-wx>
<tool-list-wx v-if="type=='1'&&userdetail.isFriend=='N'" :list="list1" type="btns" @itemClick="itemClick"></tool-list-wx>
<tool-list-wx v-if="userdetail.isFriend=='Y'" :list="list5" type="btns" @itemClick="itemClick5"></tool-list-wx>
</view>
</template>
<script>
// #ifdef APP-PLUS
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
// #endif
export default {
data() {
return {
userdetail:'',
type:'',
detail:'',
param:'',
list1: [{
title: '添加到通讯录',
path: '#',
icon: ''
}],
list3:[{
title: '状态',
path: '#',
else: [{
type: 'text',
content: ''
}],
hideRight:true
}],
list2: [{
title: '来源',
path: '#',
else: [{
type: 'text',
content: ''
}],
hideRight:true
}],
list4: [{
title: '添加到通讯录',
path: '#',
icon: ''
},{
title: '拒绝',
path: '#',
icon: ''
},{
title: '忽略',
path: '#',
icon: ''
}],
list5:[{
title: '发消息',
path: '#',
icon: 'faxiaoxi'
},{
title: '音视频通话',
path: '#',
icon: 'shipin'
}]
}
},
onLoad(e) {
this.param=e.param
this.type=e.type
if(this.type=='2'){
this.getApplyInfo(e.param)
}
if(this.type=='1'){
this.getUser(e.param)
}
},
methods: {
getApplyInfo(e){//申请记录好友详情
this.$http.request({
url: '/apply/info/'+e,
success: (res) => {
if (res.data.code == 200) {
this.detail=res.data.data
this.list3[0].else[0].content=this.detail.applyStatusLabel
this.list2[0].else[0].content=this.detail.applySourceLabel
this.getUser(this.detail.chatNo)
}
}
});
},
getUser(e){//搜索好友
this.$http.request({
url: '/friend/findFriend',
method: 'POST',
data:JSON.stringify({param:e}),
success: (res) => {
if (res.data.code == 200) {
this.userdetail=res.data.data
if(this.userdetail.sourceLabel){
this.list2[0].else[0].content=this.userdetail.sourceLabel
}
}else{
uni.navigateBack({
delta:1
})
}
}
});
},
itemClick(e,i){
switch (i){
case 0:
uni.navigateTo({
url:'../search-friends/add?userId='+this.userdetail.userId+'&source='+this.userdetail.source
})
break;
default:
break;
}
},
itemClick5(e,i){
switch (i){
case 0:
uni.navigateTo({
url:'../chatWindow/index?userId='+this.userdetail.userId+'&windowType=SINGLE'
})
break;
case 1:
uni.showActionSheet({
itemList: ['视频通话','语音通话'],
success: (res) => {
switch (res.tapIndex){
case 0:
this.sendVideoCall()
break;
case 1:
this.sendVoiceCall()
break;
default:
break;
}
}
});
break;
default:
break;
}
},
itemClicklist4(e,i){
switch (i){
case 0://同意
this.$http.request({
url: '/apply/agree',
method: 'POST',
data:JSON.stringify({applyId:this.param}),
success: (res) => {
if (res.data.code == 200) {
uni.navigateBack({
delta:1
}).then(res=>{
uni.showToast({
title:'已同意',
icon:'none'
})
})
}
}
});
break;
case 1:
this.$http.request({
url: '/apply/refused',
method: 'POST',
data:JSON.stringify({applyId:this.param}),
success: (res) => {
if (res.data.code == 200) {
uni.navigateBack({
delta:1
}).then(res=>{
uni.showToast({
title:'已拒绝',
icon:'none'
})
})
}
}
});
break;
case 2:
this.$http.request({
url: '/apply/ignore',
method: 'POST',
data:JSON.stringify({applyId:this.param}),
success: (res) => {
if (res.data.code == 200) {
uni.navigateBack({
delta:1
}).then(res=>{
uni.showToast({
title:'已忽略',
icon:'none'
})
})
}
}
});
break;
default:
break;
}
},
sendVoiceCall(){
//发起语音
uni.showLoading({
title:'发起语音通话'
})
var formdata={
userId: this.userdetail.userId,
msgType: "TRTC_VOICE_START",
content: "TRTC_VOICE_START"
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),
success: (res) => {
if(res.data.code=='200'){
if(res.data.data.status!=='0'){
uni.showToast({
title:res.data.data.statusLabel,
icon:'none'
})
return
}
var userInfo=res.data.data.userInfo
var data={
userId:userInfo.userId,
trtcId:userInfo.trtcId,
nickName:userInfo.nickName,
portrait:userInfo.portrait,
startTime:new Date().getTime(),
type:'audio'
}
uni.setStorage({
key: 'call',
data: JSON.stringify(data),
success: function () {
console.log('success');
TUICalling.call({
userID: userInfo.trtcId,
type: 1
})
}
});
}
}
});
},
sendVideoCall(){
//发起视频
uni.showLoading({
title:'发起视频通话'
})
var formdata={
userId: this.userdetail.userId,
msgType: "TRTC_VIDEO_START",
content: "TRTC_VIDEO_START"
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),
success: (res) => {
if(res.data.code=='200'){
if(res.data.data.status!=='0'){
uni.showToast({
title:res.data.data.statusLabel,
icon:'none'
})
return
}
var userInfo=res.data.data.userInfo
var data={
userId:userInfo.userId,
trtcId:userInfo.trtcId,
nickName:userInfo.nickName,
portrait:userInfo.portrait,
startTime:new Date().getTime(),
type:'video'
}
uni.setStorage({
key: 'call',
data: JSON.stringify(data),
success: function () {
console.log('success');
TUICalling.call({
userID: userInfo.trtcId,
type: 2
})
}
});
}
}
});
}
}
}
</script>
<style scoped>
/* #ifdef APP-PLUS */
.bgColor{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #EDEDED;
overflow: auto;
}
/* #endif */
/* #ifdef H5 */
page{
background: #EDEDED;
}
/* #endif */
.person-wx {
background-color: #fff;
padding:44rpx 24rpx;
padding-right: 24rpx;
border-bottom: 1px #eee solid;
}
.person-wx-user {
display: flex;
flex-direction: row;
align-items: center;
}
.person-wx-avatar {
width: 120rpx;
min-width: 120rpx;
height: 120rpx;
margin-right: 42rpx;
border-radius: 16rpx;
}
.person-wx-user-detail {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 540rpx;
}
.person-wx-nikename {
font-size: 36rpx;
font-weight: bold;
display: flex;flex-direction: row;align-items: center;
}
.person-wx-nikename .text{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 480rpx;
}
.person-wx-name {
color: #666;
font-size: 28rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.person-wx-fcode{
width: 46rpx;
height: 46rpx;
margin-left: auto;
margin-right: 40rpx;
}
.person-wx-right{
}
.person-wx-nikename-icon.nan{
color: #007AFF;
}
.person-wx-nikename-icon.nv{
color: #FF5A5F;
}
.person-wx-nikename-icon{
margin-right: auto;
}
</style>

View File

@@ -0,0 +1,121 @@
<template>
<view>
<watermark></watermark>
<form @submit="subform" class="remarkForm">
<view class="remarkForm-item">
<view class="remarkForm-label">备注</view>
<input class="remarkForm-input" placeholder="添加备注" type="text" v-model="form.remark" />
</view>
</form>
</view>
</template>
<script>
export default {
data() {
return {
form: {
remark: '',
userId: ''
}
};
},
computed: {
chatListInfo() {
return this.$store.state.chatlist[this.form.userId];
}
},
onLoad(e) {
this.form.userId = e.userId;
this.form.remark = e.remark;
},
methods: {
subform(e) {
var rules = {
remark: {
rules: [
{
checkType: 'required',
errorMsg: '请填写内容'
}
]
}
};
var formData = JSON.parse(JSON.stringify(this.form));
var checkRes = this.$zmmFormCheck.check(formData, rules);
if (checkRes) {
this.$http.request({
url: '/friend/remark',
method: 'POST',
data: JSON.stringify(formData),
success: res => {
if (res.data.code == 200) {
this.chatListInfo.nickName = this.form.remark;
var ChatData=JSON.parse(JSON.stringify(this.$store.state.chatDatalist[this.form.userId]))
ChatData.fromInfo.nickName=this.form.remark
this.$store.dispatch('updateChatObjById', {
userId: this.form.userId,
data: ChatData
})
this.$store.dispatch('updateChatListInfoById', { userId: this.form.userId, data: this.chatListInfo });
uni.navigateBack({
delta: 1
}).then(() => {
uni.showToast({
title: '备注成功',
icon: 'success'
});
});
}
}
});
} else {
uni.showToast({
title: this.$zmmFormCheck.error,
icon: 'none',
position: 'bottom'
});
}
}
},
onNavigationBarButtonTap(e) {
switch (e.index) {
case 0:
this.subform();
break;
default:
break;
}
}
};
</script>
<style scoped lang="scss">
.remarkForm {
padding: 24rpx 44rpx;
display: flex;
flex-direction: column;
}
.remarkForm-item {
display: flex;
flex-direction: column;
margin-bottom: 24rpx;
}
.remarkForm-textarea {
width: 100%;
line-height: 48rpx;
min-height: 240rpx;
}
.remarkForm-label {
font-size: 26rpx;
color: #5c5c5c;
margin-bottom: 15rpx;
}
.remarkForm-input {
border-radius: 12rpx;
background-color: #f7f7f7;
height: 110rpx;
line-height: 110rpx;
padding: 0 34rpx;
}
</style>

View File

@@ -0,0 +1,382 @@
<template>
<view class="bgColor">
<watermark></watermark>
<view class="person-wx" v-if="detail">
<view class="person-wx-user">
<image class="person-wx-avatar" @click="$fc.previewImagesolo(detail.portrait)" :src="detail.portrait" mode="aspectFill"></image>
<view class="person-wx-user-detail">
<view class="person-wx-nikename">
<text class="text">{{detail.nickName}}</text>
<view class="wxfont person-wx-nikename-icon" :class="{'nv':detail.gender=='0'}" v-if="detail.gender=='0'"></view>
<view class="wxfont person-wx-nikename-icon" :class="{'nan':detail.gender=='1'}" v-if="detail.gender=='1'"></view>
</view>
<text class="person-wx-name">
微聊号{{detail.chatNo}}
</text>
<text class="person-wx-name" v-if="detail.provinces">地区{{detail.provinces}} {{detail.city}}</text>
</view>
</view>
</view>
<tool-list-wx :list="list2" @itemClick="itemClick2"></tool-list-wx>
<tool-list-wx :list="list3" v-if="detail.isFriend=='Y'" type="btns" @itemClick="itemClick"></tool-list-wx>
<tool-list-wx :list="list4" v-if="detail.isFriend=='N'" type="btns" @itemClick="itemClick4"></tool-list-wx>
</view>
</template>
<script>
// #ifdef APP-PLUS
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
// #endif
export default {
data() {
return {
type:'',
detail:'',
param:'',
list2: [{
title: '来源',
path: '#',
else: [{
type: 'text',
content: ''
}],
hideRight:true
},{
title: '朋友圈',
path: '#'
}],
list3: [{
title: '发消息',
path: '#',
icon: 'faxiaoxi'
},{
title: '音视频通话',
path: '#',
icon: 'shipin'
}],
list4: [{
title: '添加到通讯录',
path: '#'
}],
source:'',
showtitleNViewBtns:false
}
},
onLoad(e) {
this.param=e.param
this.source=e.source
},
onShow(){
this.getUserInfo(this.param)
},
mounted() {
this.$fc.setTitleNViewBtns(0,'')
},
methods: {
getUserInfo(e){//好友详情
this.$http.request({
url: '/friend/info/'+e,
success: (res) => {
if (res.data.code == 200) {
this.detail=res.data.data
if(this.detail.userType!=='normal'||this.detail.isFriend=='N'){
this.showtitleNViewBtns=false
this.list3.splice(1,1)
this.list2.splice(1,1)
}else{
this.showtitleNViewBtns=true
this.$fc.setTitleNViewBtns(0,'\ue623')
}
if(this.detail.userType=='self'){
this.list2.push({
title: '朋友圈',
path: '#'
})
}
if(this.detail.sourceLabel){
if(!this.source){
this.source=this.detail.source
}
this.list2[0].else[0].content=this.detail.sourceLabel
} else if(this.source){
var text=''
switch (this.source){
case '1':
text='扫一扫'
break;
case '2':
text='名片'
break;
case '3':
text='微聊号'
break;
case '4':
text='手机号'
break;
case '5':
text='摇一摇'
break;
case '6':
text='系统'
break;
case '7':
text='群聊'
break;
case '8':
text='附近的人'
break;
default:
break;
}
this.list2[0].else[0].content=text
}else{
this.list2[0].else[0].content='无'
}
}
}
});
},
itemClick2(e,i){
switch (i){
case 1:
uni.navigateTo({
url:'../../wx/friendsCircle/person?userId='+this.detail.userId
})
break;
default:
break;
}
},
itemClick4(e,i){
switch (i){
case 0:
uni.navigateTo({
url:'../search-friends/add?userId='+this.detail.userId+'&source='+this.source
})
break;
default:
break;
}
},
itemClick(e,i){
switch (i){
case 0:
uni.navigateTo({
url:'../chatWindow/index?userId='+this.detail.userId+'&windowType=SINGLE'
})
break;
case 1:
uni.showActionSheet({
itemList: ['视频通话','语音通话'],
success: (res) => {
switch (res.tapIndex){
case 0:
this.sendVideoCall()
break;
case 1:
this.sendVoiceCall()
break;
default:
break;
}
}
});
break;
default:
break;
}
},
sendVoiceCall(){
//发起语音
uni.showLoading({
title:'发起语音通话'
})
var formdata={
userId: this.detail.userId,
msgType: "TRTC_VOICE_START",
content: "TRTC_VOICE_START"
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),
success: (res) => {
if(res.data.code=='200'){
if(res.data.data.status!=='0'){
uni.showToast({
title:res.data.data.statusLabel,
icon:'none'
})
return
}
var userInfo=res.data.data.userInfo
var data={
userId:userInfo.userId,
trtcId:userInfo.trtcId,
nickName:userInfo.nickName,
portrait:userInfo.portrait,
startTime:new Date().getTime(),
type:'audio'
}
uni.setStorage({
key: 'call',
data: JSON.stringify(data),
success: function () {
console.log('success');
TUICalling.call({
userID: userInfo.trtcId,
type: 1
})
}
});
}
}
});
},
sendVideoCall(){
//发起视频
uni.showLoading({
title:'发起视频通话'
})
var formdata={
userId: this.detail.userId,
msgType: "TRTC_VIDEO_START",
content: "TRTC_VIDEO_START"
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),
success: (res) => {
if(res.data.code=='200'){
if(res.data.data.status!=='0'){
uni.showToast({
title:res.data.data.statusLabel,
icon:'none'
})
return
}
var userInfo=res.data.data.userInfo
var data={
userId:userInfo.userId,
trtcId:userInfo.trtcId,
nickName:userInfo.nickName,
portrait:userInfo.portrait,
startTime:new Date().getTime(),
type:'video'
}
uni.setStorage({
key: 'call',
data: JSON.stringify(data),
success: function () {
console.log('success');
TUICalling.call({
userID: userInfo.trtcId,
type: 2
})
}
});
}
}
});
}
},
onNavigationBarButtonTap(e) {
if(!this.showtitleNViewBtns){
return
}
switch (e.index) {
case 0:
uni.navigateTo({
url:'edit?data='+ encodeURIComponent(JSON.stringify(this.detail))
})
break;
default:
break;
}
}
}
</script>
<style scoped>
/* #ifdef APP-PLUS */
.bgColor{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #EDEDED;
overflow: auto;
}
/* #endif */
/* #ifdef H5 */
page{
background: #EDEDED;
}
/* #endif */
.person-wx {
background-color: #fff;
padding:44rpx 24rpx;
padding-right: 24rpx;
border-bottom: 1px #eee solid;
}
.person-wx-user {
display: flex;
flex-direction: row;
align-items: center;
}
.person-wx-avatar {
width: 120rpx;
min-width: 120rpx;
height: 120rpx;
margin-right: 42rpx;
border-radius: 16rpx;
}
.person-wx-user-detail {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 540rpx;
}
.person-wx-nikename {
font-size: 36rpx;
font-weight: bold;
display: flex;flex-direction: row;align-items: center;
}
.person-wx-nikename .text{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 480rpx;
}
.person-wx-name {
color: #666;
font-size: 28rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.person-wx-fcode{
width: 46rpx;
height: 46rpx;
margin-left: auto;
margin-right: 40rpx;
}
.person-wx-right{
}
.person-wx-nikename-icon.nan{
color: #007AFF;
}
.person-wx-nikename-icon.nv{
color: #FF5A5F;
}
.person-wx-nikename-icon{
margin-right: auto;
}
</style>

View File

@@ -0,0 +1,194 @@
<template>
<view class="bgColor">
<watermark></watermark>
<!-- <tool-list-wx :list="list1" @itemClick="itemClick1"></tool-list-wx> -->
<tool-list-wx :list="list2" @itemClick="itemClick2"></tool-list-wx>
<view class="xw-tool-list">
<view class="xw-tool-list-content">
<view class="xw-tool-item">
<text class="xw-tool-text">加入黑名单</text>
<switch color="#05C160" :checked="Baned" @change="heifangfangChange" style="transform:scale(0.75);" />
</view>
</view>
</view>
<view class="xw-tool-list">
<view class="xw-tool-list-content">
<view class="xw-tool-btn-item" @click="deleteFriend">
<view class="xw-tool-btn-text" style="color: #FF5A5F;">删除</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
detail:'',
list1: [{
title: '把他推荐给朋友',
path: '#'
}],
list2: [{
title: '设置备注和标签',
path: '#'
}],
}
},
onLoad(e) {
var stringdata=decodeURIComponent(e.data)
// #ifndef MP-WEIXIN
e.data=e.data.replace(/%/g, '%25')
// #endif
var data = JSON.parse(stringdata)
this.detail=data
},
computed:{
Baned(){
return this.detail.black=='Y' ? true : false
},
chatList() {
return this.$store.state.chatlist
}
},
onShow(){},
methods: {
itemClick2(e,i){
switch (i){
case 0:
uni.navigateTo({
url:'beizhu?userId='+this.detail.userId+'&remark='+this.detail.nickName
})
break;
default:
break;
}
},
heifangfangChange(e){
var yn=e.detail.value ? 'Y' : 'N'
var ynText=e.detail.value ? '已加入黑名单' : '已移除黑名单'
this.$http.request({
url: '/friend/black',
method: 'POST',
data:JSON.stringify({
userId:this.detail.userId,
black:yn
}),
success: (res) => {
if (res.data.code == 200) {
uni.showToast({
title:ynText,
icon:'none'
})
}
}
});
},
deleteFriend(){
uni.showModal({
title: '提醒',
content: '是否确认删除好友',
success: (res)=> {
if (res.confirm) {
this.$http.request({
url: '/friend/delFriend',
method: 'POST',
data:JSON.stringify({
userId:this.detail.userId
}),
success: (res) => {
if (res.data.code == 200) {
delete this.chatList[this.detail.userId]
this.$store.dispatch('updateChatListInfoById',{
userId: this.detail.userId,
data: {}
});
this.$store.dispatch('updateChatById', {
userId: this.detail.userId,
data: []
});
uni.showToast({
title:'删除成功',
icon:'none'
}).then(()=>{
uni.navigateBack({
delta:3
})
})
}
}
});
} else if (res.cancel) {
}
}
});
},
itemClick1(e,i){
switch (i){
case 0:
uni.showToast({
title:'把他推荐给朋友',
icon:'none'
})
break;
default:
break;
}
},
},
}
</script>
<style scoped>
/* #ifdef APP-PLUS */
.bgColor{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #EDEDED;
overflow: auto;
}
/* #endif */
/* #ifdef H5 */
page{
background: #EDEDED;
}
/* #endif */
.xw-tool-list {
display: flex;
flex-direction: column;
background-color: #ffffff;
margin-bottom: 18rpx;
}
.xw-tool-item {
display: flex;
flex-direction: row;
align-items: center;
padding: 26rpx 24rpx;
border-bottom: 1px #eee solid;
}
.xw-tool-item:nth-last-child(1) {
border: none;
}
.xw-tool-text {
margin-right: auto;
}
.xw-tool-btn-item{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 34rpx 44rpx;
border-bottom: 1px #eee solid;
font-weight: bold;
color: #5F698C;
}
</style>