This commit is contained in:
haomingming
2023-03-06 17:57:39 +08:00
parent 3794faceae
commit 1066e37c96
4230 changed files with 193453 additions and 0 deletions
@@ -0,0 +1,89 @@
// eslint-disable-next-line no-undef
// Component Object
Component({
properties: {
myProperty: {
type: String,
value: '',
observer() {},
},
},
data: {
userID: '',
searchUser: {},
myID: '',
},
methods: {
goBack() {
this.triggerEvent('showConversation');
},
// 获取输入的 UserID
userIDInput(e) {
this.setData({
userID: e.detail.value,
searchUser: {},
});
},
// 获取该 UserID 对应的个人资料
getuserProfile() {
wx.$TUIKit.getUserProfile({
userIDList: [this.data.userID],
}).then((imRes) => {
if (imRes.data.length > 0) {
this.setData({
searchUser: imRes.data[0],
});
} else {
wx.showToast({
title: '用户不存在',
icon: 'error',
});
this.setData({
userID: '',
});
}
});
},
// 选择发起会话
handleChoose() {
this.data.searchUser.isChoose = !this.data.searchUser.isChoose;
this.setData({
searchUser: this.data.searchUser,
});
},
// 确认邀请
bindConfirmInvite() {
if (this.data.searchUser.isChoose) {
wx.aegis.reportEvent({
name: 'conversationType',
ext1: 'conversationType-c2c',
ext2: wx.$chat_reportType,
ext3: wx.$chat_SDKAppID,
});
this.triggerEvent('searchUserID', { searchUserID: `C2C${this.data.searchUser.userID}` });
} else {
wx.showToast({
title: '请选择相关用户',
icon: 'none',
});
}
},
},
created() {
},
attached() {
this.setData({
myID: wx.$chat_userID,
});
},
ready() {
},
moved() {
},
detached() {
},
});
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}
@@ -0,0 +1,25 @@
<view class="TUI-Create-conversation-container">
<view class="tui-navigatorbar">
<image class="tui-navigatorbar-back" bindtap="goBack" src="../../../../static/assets/ic_back_white.svg" />
<view class="conversation-title">发起会话</view>
</view>
<view class="tui-search-area">
<view class="tui-search-bar">
<image class="tui-searchcion" src="../../../../static/assets/serach-icon.svg" />
<input class="tui-search-bar-input" value="{{userID}}" placeholder="请输入用户ID" bindinput='userIDInput' bindconfirm="getuserProfile" bindblur="getuserProfile"/>
</view>
<view class="tui-showID">您的用户ID {{myID}}</view>
</view>
<view class="tui-person-to-invite" wx:if="{{searchUser.userID}}" bindtap="handleChoose" >
<image class="tui-normal-choose" src="{{searchUser.isChoose ? '../../../../static/assets/single-choice-hover.svg' : '../../../../static/assets/single-choice-normal.svg'}}" />
<view class="tui-person-profile">
<image class="tui-person-profile-avatar" src="{{searchUser.avatar || 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/avatar_21.png' }}" />
<view>
<view class="tui-person-profile-nick">{{searchUser.nick}}</view>
<view class="tui-person-profile-userID">用户ID{{searchUser.userID}}</view>
</view>
</view>
</view>
<view class="tui-confirm-btn" bindtap="bindConfirmInvite">确认邀请</view>
</view>
@@ -0,0 +1,138 @@
.TUI-Create-conversation-container {
width: 100vw;
height: 100vh;
background-color: #F4F5F9;
}
.tui-navigatorbar{
position: absolute;
top: 0;
width: 750rpx;
height: 170rpx;
background-color: #006EFF;
}
.tui-navigatorbar-back{
position: absolute;
width: 60rpx;
height: 60rpx;
left: 24rpx;
bottom: 15rpx;
}
.conversation-title {
position:absolute;
width: 350rpx;
height: 88rpx;
line-height: 56rpx;
font-size: 36rpx;
color: #FFFFFF;
bottom: 0;
left: 200rpx;
display: flex;
justify-content: center;
align-items: center;
}
.tui-search-area {
position: absolute;
top: 170rpx;
width: 750rpx;
background-color: #006EFF;
}
.tui-showID {
padding-left: 80rpx;
ine-height: 40rpx;
font-size: 28rpx;
color: white;
height: 50rpx;
padding-top: 18rpx;
}
.tui-search-bar {
display: flex;
flex-wrap: nowrap;
align-items: center;
margin-left: 40rpx;
margin-top: 32rpx;
width: 670rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 40rpx;
border-radius: 40rpx;
}
.tui-searchcion {
display: inline-block;
margin-left: 24rpx;
width: 48rpx;
height: 48rpx;
}
.tui-search-bar-input {
margin-left: 16rpx;
line-height: 40rpx;
font-size: 28rpx;
width: 100%;
display: inline-block;
}
.tui-person-to-invite {
position: absolute;
top: 352rpx;
display: flex;
flex-wrap: nowrap;
width: 750rpx;
height: 150rpx;
background-color: #FFFFFF;
}
.tui-normal-choose {
margin-left: 40rpx;
margin-right: 40rpx;
margin-top: 52rpx;
margin-bottom: 50rpx;
width: 48rpx;
height: 48rpx;
}
.tui-person-profile {
width: 622rpx;
display: flex;
align-items: center;
}
.tui-person-profile-avatar {
width: 96rpx;
height: 96rpx;
margin-right: 24rpx;
}
.tui-person-profile-nick {
color: #333333;
line-height: 50rpx;
font-size: 36rpx;
margin-bottom: 4rpx;
}
.tui-person-profile-userID {
color: #999999;
line-height: 40rpx;
font-size: 28rpx;
}
.tui-confirm-btn {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
bottom: 100rpx;
width: 670rpx;
height: 96rpx;
background: #006EFF;
color: #FFFFFF;
border-radius: 48rpx;
border-radius: 48rpx;
margin-left: 40rpx;
line-height: 44rpx;
font-size: 32rpx;
}