feat: updateversion (#1199)

fix: 小程序 TUIKit 相关问题,@20220711

Co-authored-by: mileszzhang <mileszzhang@tencent.com>
This commit is contained in:
zhangChenXi
2022-07-11 19:48:16 +08:00
committed by GitHub
parent e63593f840
commit 6fde620ee8
43 changed files with 5345 additions and 372 deletions
+13 -2
View File
@@ -57,16 +57,26 @@ cd TIMSDK/MiniProgram/TUIKit
将以下域名添加到 **request 合法域名**:
从v2.11.2起,SDK 支持了 WebSocket,WebSocket 版本须添加以下域名:
**1. 小程序如果需要上线或者部署正式环境怎么办?**
请在**微信公众平台**>**开发**>**开发管理**>**开发设置**>**服务器域名**中进行域名配置:
从v2.11.2起 SDK 支持了 WebSocket,WebSocket 版本须添加以下域名到 **socket 合法域名**:
| 域名 | 说明 | 是否必须 |
|:-------:|---------|----|
|`wss://wss.im.qcloud.com`| Web IM 业务域名 | 必须|
|`wss://wss.tim.qq.com`| Web IM 业务域名 | 必须|
将以下域名添加到 **request 合法域名**:
| 域名 | 说明 | 是否必须 |
|:-------:|---------|----|
|`https://web.sdk.qcloud.com`| Web IM 业务域名 | 必须|
|`https://webim.tim.qq.com` | Web IM 业务域名 | 必须|
|`https://api.im.qcloud.com` | Web IM 业务域名 | 必须|
|`https://aegis.qq.com`| Web IM 统计域名 | 必须 |
v2.10.2及以下版本,使用 HTTP,HTTP 版本须添加以下域名:
v2.10.2及以下版本使用 HTTP,HTTP 版本须添加以下域名到 **request 合法域名**:
| 域名 | 说明 | 是否必须 |
|:-------:|---------|----|
@@ -88,6 +98,7 @@ v2.10.2及以下版本,使用 HTTP,HTTP 版本须添加以下域名:
|:-------:|---------|----|
|`https://cos.ap-shanghai.myqcloud.com` | 文件下载域名 | 必须|
### 文档:
- SDK API 手册:https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html
- SDK 更新日志:https://cloud.tencent.com/document/product/269/38492
+12
View File
@@ -3,6 +3,18 @@
基于 TIM 实现场景化接入方案
## Change Log
#### 2022/07/12
**新增**
- 消息发送失败提示原因
**修复**
- 消息撤回逻辑。
- 消息ID拼接规则改变,导致消息无法跳转到底部。
**变更**
- 修改自定义消息字段。
#### 2022/03/18
**新增**
@@ -10,7 +10,7 @@ if (typeof console !== 'undefined') {
}
const noop = function () {}
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
let { length } = methods
while (length--) {
@@ -1,7 +1,7 @@
import { parseAudio } from '../../../base/message-facade';
//创建audio控件
const myaudio = wx.createInnerAudioContext();
// 创建audio控件
const myaudio = wx.createInnerAudioContext();
// eslint-disable-next-line no-undef
Component({
/**
@@ -22,11 +22,11 @@ Component({
type: Object,
value: {},
observer(newVal) {
this.filtterAudioMessage(newVal)
this.filtterAudioMessage(newVal);
this.setData({
audioMessageList: newVal
})
}
audioMessageList: newVal,
});
},
},
isMine: {
type: Boolean,
@@ -44,12 +44,12 @@ Component({
* 组件的初始数据
*/
data: {
message:'',
message: '',
renderDom: [],
Audio: [],
audioMessageList: [],
audioSave: [],
audKey:'', //当前选中的音频key
audKey: '', // 当前选中的音频key
indexAudio: Number,
isPlay: false,
},
@@ -59,95 +59,93 @@ Component({
*/
methods: {
// 过滤语音消息,从消息列表里面筛选出语音消息
filtterAudioMessage(messageList){
const list = []
for(let index = 0; index< messageList.length; index++) {
if(messageList[index].type === "TIMSoundElem") {
list.push(messageList[index])
Object.assign(messageList[index], {
isPlaying: false,
}),
this.data.audioSave = list
this.setData({
audioSave: this.data.audioSave
})
}
filtterAudioMessage(messageList) {
const list = [];
for (let index = 0; index < messageList.length; index++) {
if (messageList[index].type === 'TIMSoundElem') {
list.push(messageList[index]);
Object.assign(messageList[index], {
isPlaying: false,
}),
this.data.audioSave = list;
this.setData({
audioSave: this.data.audioSave,
});
}
}
},
//音频播放
audioPlay(e) {
const id = e.currentTarget.dataset.id,
audioSave = this.data.audioSave;
//设置状态
audioSave.forEach((message, index,) => {
message.isPlaying = false;
if (audioSave[index].ID == id) {
message.isPlaying = true;
const indexAudio = audioSave.findIndex((value)=> value.ID == audioSave[index].ID)
// 音频播放
audioPlay(e) {
const { id } = e.currentTarget.dataset;
const { audioSave } = this.data;
// 设置状态
audioSave.forEach((message, index) => {
message.isPlaying = false;
if (audioSave[index].ID == id) {
message.isPlaying = true;
const indexAudio = audioSave.findIndex(value => value.ID == audioSave[index].ID);
this.setData({
indexAudio,
isPlay: false,
});
}
});
this.setData({
indexAudio,
isPlay: false,
})
}
})
this.setData({
audioSave: audioSave,
audKey: this.data.indexAudio,
isPlay: true,
})
myaudio.autoplay = true;
const audKey = this.data.audKey,
playSrc = audioSave[audKey].payload.url;
myaudio.src = playSrc;
audioSave,
audKey: this.data.indexAudio,
isPlay: true,
});
myaudio.autoplay = true;
const { audKey } = this.data;
const playSrc = audioSave[audKey].payload.url;
myaudio.src = playSrc;
myaudio.play();
//开始监听
myaudio.onPlay(() => {
console.log('开始播放');
})
// 开始监听
myaudio.onPlay(() => {
console.log('开始播放');
});
//结束监听
myaudio.onEnded(() => {
console.log('自动播放完毕');
audioSave[this.data.indexAudio].isPlaying = false;
// 结束监听
myaudio.onEnded(() => {
console.log('自动播放完毕');
audioSave[this.data.indexAudio].isPlaying = false;
this.setData({
audioSave,
isPlay: false,
});
});
// 错误回调
myaudio.onError((err) => {
console.log(err);
audioSave[this.data.indexAudio].isPlaying = false;
this.setData({
audioSave,
});
return;
});
},
// 音频停止
audioStop(e) {
const { key } = e.currentTarget.dataset;
const { audioSave } = this.data;
// 设置状态
audioSave.forEach((message, index) => {
message.isPlaying = false;
});
this.setData({
audioSave: audioSave,
audioSave,
isPlay: false,
})
})
//错误回调
myaudio.onError((err) => {
console.log(err);
audioSave[this.data.indexAudio].isPlaying = false;
this.setData({
audioSave:audioSave,
})
return
})
});
myaudio.stop();
// 停止监听
myaudio.onStop(() => {
console.log('停止播放');
});
},
},
// 音频停止
audioStop(e){
const key = e.currentTarget.dataset.key,
audioSave = this.data.audioSave;
//设置状态
audioSave.forEach((message, index,) => {
message.isPlaying = false;
})
this.setData({
audioSave: audioSave,
isPlay: false
})
myaudio.stop();
//停止监听
myaudio.onStop(() => {
console.log('停止播放');
})
},
}
});
@@ -25,8 +25,6 @@ Component({
* 组件的初始数据
*/
data: {
},
/**
@@ -81,79 +79,105 @@ Component({
}
},
parseCustom(message) {
// 约定自定义消息的 data 字段作为区分,不解析的不进行展示
if (message.payload.data === 'order') {
const extension = JSON.parse(message.payload.extension);
const renderDom = [{
type: 'order',
name: 'custom',
title: extension.title || '',
imageUrl: extension.imageUrl || '',
price: extension.price || 0,
description: message.payload.description,
}];
return renderDom;
try {
const customMessage = JSON.parse(message.payload.data);
// 约定自定义消息的 data 字段作为区分,不解析的不进行展示
if (customMessage.businessID === 'order') {
const renderDom = [{
type: 'order',
name: 'custom',
title: customMessage.title || '',
imageUrl: customMessage.imageUrl || '',
price: customMessage.price || 0,
description: customMessage.description,
}];
return renderDom;
}
// 服务评价
if (customMessage.businessID === 'evaluation') {
const renderDom = [{
type: 'evaluation',
title: message.payload.description,
score: customMessage.score,
description: customMessage.comment,
}];
return renderDom;
}
// native 自定义消息解析
if (customMessage.businessID === 'text_link') {
const renderDom = [{
type: 'text_link',
text: customMessage.text,
}];
return renderDom;
}
// 群消息解析
if (message.payload.data === 'group_create') {
const renderDom = [{
type: 'group_create',
text: message.payload.extension,
}];
return renderDom;
}
} catch (error) {
}
// 客服咨询
if (message.payload.data === 'consultion') {
try {
const extension = JSON.parse(message.payload.extension);
const renderDom = [{
type: 'consultion',
title: extension.title || '',
item: extension.item || 0,
description: extension.description,
}];
return renderDom;
}
// 服务评价
if (message.payload.data === 'evaluation') {
const extension = JSON.parse(message.payload.extension);
const renderDom = [{
type: 'evaluation',
title: message.payload.description,
score: extension.score,
description: extension.comment,
}];
return renderDom;
}
// 群消息解析
if (message.payload.data === 'group_create') {
const renderDom = [{
type: 'group_create',
text: message.payload.extension,
}];
return renderDom;
if (message.payload.data === 'consultion') {
const renderDom = [{
type: 'consultion',
title: extension.title || '',
item: extension.item || 0,
description: extension.description,
}];
return renderDom;
}
} catch (error) {
}
// 音视频通话消息解析
const callingmessage = JSON.parse(message.payload.data);
if (callingmessage.businessID === 1) {
if (message.conversationType === 'GROUP') {
if (message.payload.data.actionType === 5) {
message.nick = message.payload.data.inviteeList ? message.payload.data.inviteeList.join(',') : message.from;
try {
const callingmessage = JSON.parse(message.payload.data);
if (callingmessage.businessID === 1) {
if (message.conversationType === 'GROUP') {
if (message.payload.data.actionType === 5) {
message.nick = message.payload.data.inviteeList ? message.payload.data.inviteeList.join(',') : message.from;
}
const _text = this.extractCallingInfoFromMessage(message);
const groupText = `${_text}`;
const renderDom = [{
type: 'groupCalling',
text: groupText,
userIDList: [],
}];
return renderDom;
}
if (message.conversationType === 'C2C') {
const c2cText = this.extractCallingInfoFromMessage(message);
const renderDom = [{
type: 'c2cCalling',
text: c2cText,
}];
return renderDom;
}
const _text = this.extractCallingInfoFromMessage(message);
const groupText = `${_text}`;
const renderDom = [{
type: 'groupCalling',
text: groupText,
userIDList: [],
}];
return renderDom;
}
if (message.conversationType === 'C2C') {
const c2cText = this.extractCallingInfoFromMessage(message);
const renderDom = [{
type: 'c2cCalling',
text: c2cText,
}];
return renderDom;
}
return [{
type: 'notSupport',
text: '[自定义消息]',
}];
} catch (error) {
}
},
openLink(e) {
if (e.currentTarget.dataset.value.key === '立即前往') {
wx.navigateTo({
url: '/pages/TUI-User-Center/webview/webview?url=https://cloud.tencent.com/act/pro/imnew?from=16975&wechatMobile',
});
} else if (e.currentTarget.dataset.value.key === '立即体验') {
wx.navigateTo({
url: '/pages/TUI-User-Center/webview/webview?url=https://cloud.tencent.com/document/product/269/68091',
});
}
return [{
type: 'notSupport',
text: '[自定义消息]',
}];
},
},
});
@@ -9,8 +9,12 @@
</view>
<view wx:if="{{renderDom[0].type ==='consultion'}}" class="custom-message {{isMine?'my-custom':''}}">
<view class="custom-content">
<view class="custom-content-title">{{renderDom[0].title}}</view>
<view class="custom-content-description" wx:for="{{renderDom[0].item}}" wx:key="index" id="{{item.key}}">{{item.key}}</view>
<view>
<text class="custom-content-title">{{renderDom[0].title}}</text>
<text class="custom-content-hyperlinks" bindtap="openLink" data-value="{{renderDom[0].hyperlinks_text}}">{{renderDom[0].hyperlinks_text.key}}</text>
<view class="custom-content-description" wx:for="{{renderDom[0].item}}" wx:key="index" id="{{item.key}}">{{item.key}}
</view>
</view>
<text class="custom-content-description">{{renderDom[0].description}}</text>
</view>
</view>
@@ -23,6 +27,10 @@
<view class="custom-content-description">{{renderDom[0].description}}</view>
</view>
</view>
<view wx:if="{{renderDom[0].type === 'text_link'}}" class="message-body-span text-message">
<view class="message-body-span-text">{{renderDom[0].text}}</view>
<text class="message-body-span-link">查看详情>></text>
</view>
<view wx:if="{{renderDom[0].type ==='group_create'}}" class="custom-message {{isMine?'my-custom':''}}" >
<view class="custom-content-text">{{renderDom[0].text}}</view>
</view>
@@ -1,8 +1,10 @@
.custom-message {
max-width: 60vw;
background: #FBFBFB;
border-radius: 4rpx 20rpx 20rpx 20rpx;
display: flex;
padding: 10rpx 24rpx;
background-color: #fff;
border-radius: 2px 10px 10px 10px;
border: 1px solid #D9D9D9;
}
.my-custom {
@@ -11,12 +13,15 @@
}
.custom-content-title {
font-family: PingFangSC-Medium;
width: 278rpx;
line-height: 34rpx;
font-size: 24rpx;
max-width: 268rpx;
height: 34rpx;
font-size: 28rpx;
color: #000000;
letter-spacing: 0;
margin-bottom: 12rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.custom-content-description {
@@ -24,8 +29,10 @@
width: 278rpx;
line-height: 34rpx;
font-size: 28rpx;
color: #006EFF;
color: #999999;
letter-spacing: 0;
line-height: 40rpx;
font-size: 24rpx;
margin-bottom: 12rpx;
word-break: break-word;
}
@@ -71,7 +78,6 @@
}
.message-body-span {
display: flex;
justify-content: center;
align-items: center;
/*justify-content: flex-start;*/
flex-wrap: wrap;
@@ -82,10 +88,22 @@
max-width: 60vw;
}
.message-body-span-text {
width: 100%;
display: inline;
word-wrap: break-word;
word-break: break-all;
/* width: 434rpx; */
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 32rpx;
color: #000000;
letter-spacing: 0;
line-height: 42rpx;
}
.message-body-span-link {
color: blue;
}
.message-body-span-link {
color: blue;
}
.message-body-span-link {
color: blue;
}
.custom-content-text{
font-family: PingFangSC-Regular;
@@ -94,3 +112,12 @@
font-size: 28rpx;
letter-spacing: 0;
}
.custom-content-hyperlinks{
font-family: PingFangSC-Regular;
font-weight: 400;
line-height: 40rpx;
font-size: 28rpx;
color: #006EFF;
letter-spacing: 0;
margin-bottom: 12rpx;
}
@@ -34,8 +34,12 @@ Component({
methods: {
// 解析face 消息
parseFace(message) {
// 兼容android的大表情格式
if (message.payload.data.indexOf('@2x') < 0) {
message.payload.data = `${message.payload.data}@2x`;
}
const renderDom = {
src: `${this.data.faceUrl + message.payload.data}@2x.png`,
src: `${this.data.faceUrl + message.payload.data}.png`,
};
return renderDom;
},
@@ -0,0 +1,33 @@
// eslint-disable-next-line no-undef
Component({
/**
* 组件的属性列表
*/
properties: {
message: {
type: Object,
value: {},
observer(newVal) {
this.setData({
message: newVal,
});
},
},
isMine: {
type: Boolean,
value: true,
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
},
});
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,2 @@
<!--TUI-CustomerService/components/tui-chat/message-elements/relay-message/index.wxml-->
<text class="message-body-span text-message">[聊天记录]</text>
@@ -0,0 +1,21 @@
/* TUI-CustomerService/components/tui-chat/message-elements/relay-message/index.wxss */
.message-body-span {
display: flex;
align-items: center;
/*justify-content: flex-start;*/
flex-wrap: wrap;
outline: none;
font-size: 28rpx;
color: #333333;
position: relative;
max-width: 60vw;
}
.text-message {
display: inline-flex;
max-width: 60vw;
line-height: 52rpx;
padding: 12rpx 24rpx;
background: #F8F8F8;
border: 1px solid #D9D9D9;
border-radius: 2px 10px 10px 10px;
}
@@ -0,0 +1,39 @@
// eslint-disable-next-line no-undef
Component({
/**
* 组件的属性列表
*/
properties: {
message: {
type: Object,
value: {},
observer(newVal) {
this.setData({
message: newVal,
});
},
},
isMine: {
type: Boolean,
value: true,
},
},
/**
* 组件的初始数据
*/
data: {
message: '',
},
/**
* 组件的方法列表
*/
methods: {
resendMessage(e) {
this.triggerEvent('resendMessage', {
message: e.currentTarget.dataset.value.payload.text,
});
},
},
});
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,6 @@
<view class="revoke" data-value="{{message}}">
<label class="name" wx:if="{{message.flow === 'in'}}">{{message.nick || message.from}}</label>
<label class="name" wx:else>你</label>
<span class="name">撤回了一条消息</span>
<span class="edit" wx:if="{{message.flow === 'out' && message.type === 'TIMTextElem'}}" bindtap="resendMessage" data-value="{{message}}">重新编辑</span>
</view>
@@ -0,0 +1,19 @@
.revoke{
display: flex;
justify-content: center;
align-items: center
}
.name {
background-color:white;
border-radius: 8px;
font-size: 14px;
padding: 6px 0px;
}
.edit{
font-family: PingFangSC-Regular;
font-size: 14px;
color: #006eff;
letter-spacing: 0;
padding-left: 8px
}
@@ -28,10 +28,12 @@
max-width: 60vw;
}
.message-body-span-text {
width: 100%;
display: inline;
word-wrap: break-word;
word-break: break-all;
font-family: PingFangSC-Regular;
font-weight: 400;
color: #000000;
letter-spacing: 0;
line-height: 40rpx;
font-size: 28rpx;
}
.message-body-span-image {
display: inline-block;
@@ -1,5 +1,5 @@
import logger from '../../../utils/logger';
const app = getApp()
const app = getApp();
// eslint-disable-next-line no-undef
Component({
/**
@@ -319,7 +319,7 @@ Component({
onInputValueChange(event) {
if (event.detail.message) {
this.setData({
message: event.detail.message.payload.text,
message: event.detail.message,
sendMessageBtn: true,
});
} else if (event.detail.value) {
@@ -350,6 +350,7 @@ Component({
this.$sendTIMMessage(message);
this.setData({
displayOrderList: false,
displayCommonWords: false,
});
},
@@ -383,28 +384,29 @@ Component({
offlinePushInfo: {
disablePush: true,
},
}).then((res)=>{
if(this.data.firstSendMessage) {
wx.aegis.reportEvent({
}).then((res) => {
if (this.data.firstSendMessage) {
wx.aegis.reportEvent({
name: 'sendMessage',
ext1: 'sendMessage-success',
ext2: 'imTuikitExternal',
ext3: app.globalData.SDKAppID
})
}
}).catch((error) => {
logger.log(`| TUI-chat | message-input | sendMessageError: ${error.code} `);
wx.aegis.reportEvent({
name: 'sendMessage',
ext1: `sendMessage-failed#error: ${error}`,
ext2: 'imTuikitExternal',
ext3: app.globalData.SDKAppID
})
this.triggerEvent('showMessageErrorImage', {
showErrorImageFlag: error.code,
message,
ext3: app.globalData.SDKAppID,
});
}
})
.catch((error) => {
logger.log(`| TUI-chat | message-input | sendMessageError: ${error.code} `);
wx.aegis.reportEvent({
name: 'sendMessage',
ext1: `sendMessage-failed#error: ${error}`,
ext2: 'imTuikitExternal',
ext3: app.globalData.SDKAppID,
});
this.triggerEvent('showMessageErrorImage', {
showErrorImageFlag: error.code,
message,
});
});
});
this.setData({
displayFlag: '',
});
@@ -0,0 +1,13 @@
var concat = function() {
if (arguments[0] === 'GROUP' && arguments[2].indexOf('@TGS#') !== -1) {
arguments[2] = arguments[2].replace('@TGS#', '')
}
return arguments[1] + arguments[2]
}
var connect = function() {
return arguments[0] + arguments[1]
}
module.exports = {
concat: concat
connect: connect
};
@@ -51,7 +51,6 @@ Component({
checkID: '',
selectedMessage: {},
deleteMessage: '',
isRevoke: false,
RevokeID: '', // 撤回消息的ID用于处理对方消息展示界面
showName: '',
showDownJump: false,
@@ -80,7 +79,7 @@ Component({
firstTime: Number,
newArr: {},
errorMessage: {},
errorMessageID: ''
errorMessageID: '',
},
lifetimes: {
@@ -167,7 +166,8 @@ Component({
} else {
this.setData({
messageList,
jumpAim: this.filterSystemMessageID(currentMessageList[currentMessageList.length - 1].ID),
// 消息ID前拼接字符串为了解决scroll-into-view,无法跳转以数字开头的ID。
jumpAim: `ID-${this.filterSystemMessageID(currentMessageList[currentMessageList.length - 1].ID)}`,
}, () => {
});
}
@@ -233,33 +233,42 @@ Component({
},
// 自己的消息上屏
updateMessageList(message) {
this.$onMessageReadByPeer();
this.messageTimeForShow(message);
message.isSelf = true;
this.data.messageList.push(message);
this.setData({
lastMessageSequence: this.data.messageList.slice(-1)[0].sequence,
messageList: this.data.messageList,
jumpAim: this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID),
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID)}`,
});
},
// 兼容 scrollView
filterSystemMessageID(messageID) {
const index = messageID.indexOf('@TIM#');
if (index > -1) {
return messageID.replace('@TIM#', '');
const groupIndex = messageID.indexOf('@TGS#');
if (index === 0) {
messageID = messageID.replace('@TIM#', '');
}
if (groupIndex === 0) {
messageID = messageID.replace('@TGS#', '');
}
return messageID;
},
// 获取消息ID
handleLongPress(e) {
const { index } = e.currentTarget.dataset;
this.setData({
messageID: e.currentTarget.id,
selectedMessage: this.data.messageList[index],
Show: true,
});
for (let index = 0; index < this.data.messageList.length; index++) {
if (this.data.messageList[index].status === 'success') {
const { index } = e.currentTarget.dataset;
this.setData({
messageID: e.currentTarget.id,
selectedMessage: this.data.messageList[index],
Show: true,
});
}
}
},
// 更新messagelist
// 更新 messagelist
updateMessageByID(deleteMessageID) {
const { messageList } = this.data;
const deleteMessageArr = messageList.filter(item => item.ID === deleteMessageID);
@@ -295,13 +304,6 @@ Component({
resendMessage: imResponse.data.message,
});
this.updateMessageByID(imResponse.data.message.ID);
if (imResponse.data.message.from === app.globalData.userInfo.userID) {
this.setData({
showName: '你',
isRevoke: true,
isRewrite: true,
});
}
// 消息撤回成功
})
.catch((imError) => {
@@ -318,24 +320,10 @@ Component({
});
},
// 撤回消息重新发送
resendMessage() {
wx.$TUIKit.resendMessage(this.data.resendMessage)
.then((imResponse) => {
this.triggerEvent('resendMessage', {
message: imResponse.data.message,
});
this.setData({
isRevoke: true,
isRewrite: false,
});
})
.catch((imError) => {
wx.showToast({
title: '重发失败',
icon: 'none',
});
logger.warn('resendMessage error', imError);
});
resendMessage(e) {
this.triggerEvent('resendMessage', {
message: e.detail.message,
});
},
// 关闭弹窗
handleEditToggleAvatar() {
@@ -345,13 +333,6 @@ Component({
},
// 向对方通知消息撤回事件
$onMessageRevoked(event) {
if (event.data[0].from !== app.globalData.userInfo.userID) {
this.setData({
showName: event.data[0].nick,
RevokeID: event.data[0].ID,
isRevoke: true,
});
}
this.updateMessageByID(event.data[0].ID);
},
// 复制消息
@@ -373,7 +354,7 @@ Component({
// 消息跳转到最新
handleJumpNewMessage() {
this.setData({
jumpAim: this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID),
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID)}`,
showDownJump: false,
showNewMessageCount: [],
});
@@ -383,13 +364,13 @@ Component({
if (this.data.unreadCount > 15) {
this.getMessageList(this.data.conversation);
this.setData({
jumpAim: this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - this.data.unreadCount].ID),
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - this.data.unreadCount].ID)}`,
showUpJump: false,
});
} else {
this.getMessageList(this.data.conversation);
this.setData({
jumpAim: this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - this.data.unreadCount].ID),
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - this.data.unreadCount].ID)}`,
showUpJump: false,
});
}
@@ -397,7 +378,7 @@ Component({
// 滑动到最底部置跳转事件为false
scrollHandler() {
this.setData({
jumpAim: this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID),
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID)}`,
showDownJump: false,
});
},
@@ -409,16 +390,18 @@ Component({
messageTimeForShow(messageTime) {
const interval = 5 * 60 * 1000;
const nowTime = Math.floor(messageTime.time / 10) * 10 * 1000;
const lastTime = this.data.messageList.slice(-1)[0].time * 1000;
if (nowTime - lastTime > interval) {
Object.assign(messageTime, {
isShowTime: true,
}),
this.data.messageTime = dayjs(nowTime);
this.setData({
messageTime: dayjs(nowTime).format('YYYY-MM-DD HH:mm:ss'),
showMessageTime: true,
});
if (this.data.messageList.length > 0) {
const lastTime = this.data.messageList.slice(-1)[0].time * 1000;
if (nowTime - lastTime > interval) {
Object.assign(messageTime, {
isShowTime: true,
}),
this.data.messageTime = dayjs(nowTime);
this.setData({
messageTime: dayjs(nowTime).format('YYYY-MM-DD HH:mm:ss'),
showMessageTime: true,
});
}
}
},
// 渲染历史消息时间
@@ -445,21 +428,23 @@ Component({
},
// 拉取更多历史消息渲染时间
showMoreHistoryMessageTime(messageList) {
const showHistoryTime = messageList[0].time * 1000;
Object.assign(messageList[0], {
isShowMoreHistoryTime: true,
});
this.data.newArr[messageList[0].ID] = dayjs(showHistoryTime).format('YYYY-MM-DD HH:mm:ss');
this.setData({
newArr: this.data.newArr,
});
if (messageList.length > 0) {
const showHistoryTime = messageList[0].time * 1000;
Object.assign(messageList[0], {
isShowMoreHistoryTime: true,
});
this.data.newArr[messageList[0].ID] = dayjs(showHistoryTime).format('YYYY-MM-DD HH:mm:ss');
this.setData({
newArr: this.data.newArr,
});
}
},
// 消息发送失败
sendMessageError(event) {
this.setData({
errorMessage : event.detail.message,
errorMessageID: event.detail.message.ID
})
errorMessage: event.detail.message,
errorMessageID: event.detail.message.ID,
});
const DIRTYWORDS_CODE = 80001;
const UPLOADFAIL_CODE = 6008;
const REQUESTOVERTIME_CODE = 2081;
@@ -515,22 +500,21 @@ Component({
});
})
.catch((imError) => {
if(imError.code === DIRTYWORDS_CODE) {
if (imError.code === DIRTYWORDS_CODE) {
wx.showToast({
title: '您发送的消息包含违禁词汇!',
title: '您发送的消息包含违禁词汇!',
duration: 800,
icon: 'none',
});
} else if (imError.code === UPLOADFAIL_CODE ) {
} else if (imError.code === UPLOADFAIL_CODE) {
wx.showToast({
title: '文件上传失败!',
title: '文件上传失败!',
duration: 800,
icon: 'none',
});
} else if (imError.code === (REQUESTOVERTIME_CODE || DISCONNECTNETWORK_CODE))
{
} else if (imError.code === (REQUESTOVERTIME_CODE || DISCONNECTNETWORK_CODE)) {
wx.showToast({
title: '网络已断开!',
title: '网络已断开!',
duration: 800,
icon: 'none',
});
@@ -569,6 +553,16 @@ Component({
});
}
},
// 点击购买链接跳转
handleJumpLink(e) {
const dataLink = JSON.parse(e.currentTarget.dataset.value.payload.data);
if (dataLink.businessID === 'order' || dataLink.businessID === 'text_link') {
const url = `/pages/TUI-User-Center/webview/webview?url=${dataLink.link}&wechatMobile`;
wx.navigateTo({
url: encodeURI(url),
});
}
},
},
});
@@ -10,6 +10,8 @@
"TUI-TipMessage": "../message-elements/tip-message/index",
"TUI-SystemMessage": "../message-elements/system-message/index",
"TUI-FaceMessage": "../message-elements/face-message/index",
"TUI-FileMessage": "../message-elements/file-message/index"
"TUI-FileMessage": "../message-elements/file-message/index",
"TUI-MergerMessage": "../message-elements/merger-message/index",
"TUI-RevokeMessage": "../message-elements/revoke-message/index"
}
}
@@ -1,7 +1,7 @@
<view class="container">
<scroll-view class="message-list-container" scroll-y="true" scroll-top='{{topNum}}' scroll-into-view="{{jumpAim}}" refresher-enabled="{{true}}" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}" lower-threshold="200" bindscroll="handleScroll" bindscrolltolower="scrollHandler">
<scroll-view class="message-list-container" scroll-y="true" scroll-into-view="{{jumpAim}}" refresher-enabled="{{true}}" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}" lower-threshold="200" bindscroll="handleScroll" bindscrolltolower="scrollHandler">
<view class="no-message" wx:if="{{isCompleted}}">没有更多啦</view>
<view class="t-message" wx:if="{{conversation.type !== '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index" id="{{item.ID}}" data-index ='{{index}}' >
<view class="t-message" wx:if="{{conversation.type !== '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index" data-index ='{{index}}' >
<view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{showMessageTime}}">
<view class="showmessagetime" wx:if="{{item.isShowTime}}">
<text class="time" wx:if="{{!item.isDeleted && !item.isRevoked}}">{{messageTime}} </text>
@@ -17,9 +17,10 @@
<text class="time">{{newArr[item.ID]}} </text>
</view>
</view>
<view class="t-message-item" wx:if="{{!item.isDeleted && !item.isRevoked}}" bindtap="handleEditToggleAvatar" >
<TUI-RevokeMessage wx:if="{{item.isRevoked}}" message="{{item}}" isMine="{{item.isSelf}}" bind:resendMessage="resendMessage"/>
<view class="t-message-item" wx:if="{{!item.isDeleted && !item.isRevoked }}" bindtap="handleEditToggleAvatar" >
<view wx:if="{{Show}}" catchtap="handleEditToggleAvatar">
<view class="label-pop" wx:if="{{messageID === item.ID}}" class="{{item.isSelf ? 'label-self-body' : 'label-recieve-body'}}" >
<view class="label-pop" wx:if="{{messageID === concat.connect('ID-',item.ID)}}" class="{{item.isSelf ? 'label-self-body' : 'label-recieve-body'}}" >
<view class="label-pop-mask" >
<view class="copymessage" wx:if="{{item.type === 'TIMTextElem'|| item.type === 'TIMFaceElem'}}" catchtap="copyMessage" > <text>复制|</text>
</view>
@@ -40,14 +41,15 @@
<view wx:if="{{item.isSelf && item.ID === errorMessageID || item.status === 'fail'}}" class="t-message-error-box">
<image class="t-message-error" wx:if="{{showMessageError}}" src='../../../static/images/tuikit-msg-error.png' bindtap="ResndMessage" />
</view>
<view class="{{item.isSelf ? 't-self-message-body':'t-recieve-message-body'}}" catch:longpress="handleLongPress" data-index ='{{index}}' id="{{item.ID}}" message-value="{{item}}" >
<view class="{{item.isSelf ? 't-self-message-body':'t-recieve-message-body'}}" catch:longpress="handleLongPress" data-index='{{index}}' data-value='{{item}}' id="{{concat.concat(conversation.type,'ID-',item.ID)}}" message-value="{{item}}" >
<TUI-TextMessage wx:if="{{item.type === 'TIMTextElem'}}" message="{{item}}" isMine="{{item.isSelf}}" />
<TUI-ImageMessage wx:if="{{item.type === 'TIMImageElem'}}" message="{{item}}" isMine="{{item.isSelf}}" />
<TUI-VideoMessage wx:if="{{item.type === 'TIMVideoFileElem'}}" message="{{item}}" isMine="{{item.isSelf}}"/>
<TUI-AudioMessage wx:if="{{item.type === 'TIMSoundElem'}}" message="{{item}}" data-index ='{{index}}' messageList="{{messageList}}" isMine="{{item.isSelf}}"/>
<TUI-CustomMessage wx:if="{{item.type === 'TIMCustomElem'}}" message="{{item}}" isMine="{{item.isSelf}}"/>
<TUI-CustomMessage wx:if="{{item.type === 'TIMCustomElem'}}" message="{{item}}" isMine="{{item.isSelf}}" bindtap="handleJumpLink" data-value = "{{item}}"/>
<TUI-FaceMessage wx:if="{{item.type === 'TIMFaceElem'}}" message="{{item}}" isMine="{{item.isSelf}}"/>
<TUI-FileMessage wx:if="{{item.type === 'TIMFileElem'}}" message="{{item}}" isMine="{{item.isSelf}}"/>
<TUI-MergerMessage wx:if="{{item.type === 'TIMRelayElem'}}" message="{{item}}" isMine="{{item.isSelf}}"/>
</view>
<image class="t-message-avatar" wx:if="{{item.isSelf}}" src="{{item.avatar || 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/avatar_21.png'}}" data-value="{{item}}" bindtap="getMemberProfile"/>
</view>
@@ -56,14 +58,6 @@
<view class="t-message" wx:if="{{conversation.type === '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index" id="{{filterSystemMessageID}}" data-value="{{item.ID}}">
<TUI-SystemMessage message="{{item}}" bind:changeSystemMessageList="changeSystemMessageList"></TUI-SystemMessage>
</view>
<view wx:if="{{isRevoke}}">
<view class="notice" bindtap="resendMessage">
<view class="content">
<text class="revoke">{{showName}}:撤回了一条消息</text>
<text class="rewrite" wx:if="{{isRewrite}}">重新编辑</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view wx:if="{{showDownJump}}" bindtap="handleJumpNewMessage">
@@ -82,4 +76,5 @@
<text wx:else> {{unreadCount}}条未读</text>
</view>
</view>
</view>
</view>
<wxs src = './concat.wxs' module = 'concat'/>
@@ -166,16 +166,7 @@
font-size: 14px;
color: white;
}
.notice{
display: flex;
justify-content: center;
}
.content{
background-color:white;
border-radius: 8px;
font-size: 14px;
padding: 6px 8px;
}
.new-message-item{
position: absolute;
right: 30px;
@@ -63,6 +63,5 @@ Component({
message: e.currentTarget.dataset.words,
});
},
},
});
@@ -2,18 +2,24 @@ const orderList = [
{
orderNum: 1,
time: '2021-7-20 20:45',
title: '[天博检验]新冠核酸检测/预约',
description: '专业医学检测,电子报告',
imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/miles.jpeg',
price: '80元',
title: '即时通信 IM 首购活动',
description: '单用户限购1件',
imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/im.jpg',
link: 'https://cloud.tencent.com/act/pro/imnew?from=16262',
imageWidth: 135,
imageHeight: 135,
price: '0.9折起',
},
{
orderNum: 2,
time: '2021-7-20 22:45',
title: '[路边]新冠核酸检测/预约',
description: '专业医学检测,电子报告',
imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/miles.jpeg',
price: '7000元',
title: '即时通信 IM 老客户热销专区',
description: '购买时长越长越优惠',
imageUrl: 'https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/im.jpg',
link: 'https://cloud.tencent.com/act/pro/imnew?from=16262',
imageWidth: 135,
imageHeight: 135,
price: '7.2折起',
},
];
@@ -77,12 +83,19 @@ Component({
const { order } = e.currentTarget.dataset;
this.triggerEvent('sendCustomMessage', { // 传递给父组件,在父组件处调用SDK的接口,来进行自定消息的发送
payload: {
data: 'order', // data字段用于标识该消息类型
description: order.description, // 获取自定义消息的具体描述
extension: JSON.stringify({
data: JSON.stringify({
businessID: 'order',
version: 1,
title: order.title,
imageUrl: order.imageUrl,
price: order.price }), // 自定义消息的具体内容
imageWidth: order.imageWidth,
imageHeight: order.imageHeight,
link: order.link,
price: order.price,
description: order.description,
}), // data字段用于标识该消息类型
description: order.title, // 获取自定义消息的具体描述
extension: order.title, // 自定义消息的具体内容
},
});
},
@@ -52,12 +52,14 @@ Component({
this.triggerEvent('sendCustomMessage', {
payload: {
// data 字段作为表示,可以自定义
data: 'evaluation',
description: '对本次服务的评价', // 获取骰子点数
extension: JSON.stringify({
data: JSON.stringify({
businessID: 'evaluation',
version: 1,
score: this.data.score,
comment: this.data.comment,
}),
description: '对本次服务的评价', // 获取骰子点数
extension: '对本次服务的评价',
},
});
@@ -96,7 +96,7 @@ Page({
this.TRTCCalling.call(event.detail);
}
},
goBack() {
// eslint-disable-next-line no-undef
const pages = getCurrentPages(); // 当前页面栈
@@ -1,5 +1,6 @@
import logger from '../../../utils/logger';
// eslint-disable-next-line no-undef
const app = getApp();
// eslint-disable-next-line no-undef
Page({
@@ -73,7 +74,7 @@ Page({
// 了解更多链接
learnMore() {
wx.navigateTo({
url: '../../TUI-User-Center/webview/webview?url=https://cloud.tencent.com/product/im',
url: '/pages/TUI-User-Center/webview/webview?url=https://cloud.tencent.com/product/im',
});
},
// 点击事件跳转
@@ -1,6 +1,6 @@
// miniprogram/pages/TUI-Group/create-group/create.js
import logger from '../../../utils/logger';
const app = getApp();
// eslint-disable-next-line no-undef
Page({
@@ -54,12 +54,11 @@ Page({
// 确认创建群聊
bindConfirmCreate() {
logger.log(`| TUI-Group | create-group | bindConfirmCreate | groupID: ${this.data.groupID}`);
const promise = wx.$TUIKit.createGroup({
wx.$TUIKit.createGroup({
type: this.data.Type,
name: this.data.name,
groupID: this.data.groupID,
});
promise.then((imResponse) => { // 创建成功
}).then((imResponse) => { // 创建成功
// 创建的群的资料
const payloadData = {
conversationID: `GROUP${imResponse.data.group.groupID}`,
@@ -67,12 +66,13 @@ Page({
wx.navigateTo({
url: `../../TUI-Chat/chat?conversationInfomation=${JSON.stringify(payloadData)}`,
});
}).catch(() => {
wx.showToast({
title: '该群组ID被使用,请更换群ID',
icon: 'none',
})
.catch(() => {
wx.showToast({
title: '该群组ID被使用,请更换群ID',
icon: 'none',
});
});
});
},
// 点击空白区域关闭弹窗
handleChooseToggle() {
@@ -1,5 +1,5 @@
import logger from '../../../utils/logger';
const app = getApp();
// eslint-disable-next-line no-undef
Page({
@@ -0,0 +1,6 @@
var concat = function(str1, str2) {
return 2
}
module.exports = {
concat: concat
};
@@ -10,7 +10,7 @@ if (typeof console !== 'undefined') {
}
const noop = function () {}
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
let { length } = methods
while (length--) {
@@ -20,6 +20,5 @@ while (length--) {
_console[method] = noop
}
}
_console.methods = methods
export default _console
+12 -4
View File
@@ -45,6 +45,14 @@ App({
pagePerformance: true, // 开启页面测速
});
},
aegisInit() {
wx.aegis = new Aegis({
id: 'iHWefAYquFxvklBblC', // 项目key
reportApiSpeed: true, // 接口测速
reportAssetSpeed: true, // 静态资源测速
pagePerformance: true, // 开启页面测速
});
},
// TODO:
resetLoginData() {
this.globalData.expiresIn = ''
@@ -54,9 +62,9 @@ App({
userSig: '',
token: '',
phone: '',
}
this.globalData.userProfile = null
logger.log(`| app | resetLoginData | globalData: ${this.globalData}`)
};
this.globalData.userProfile = null;
logger.log(`| app | resetLoginData | globalData: ${this.globalData}`);
},
globalData: {
// userInfo: userID userSig token phone
@@ -95,4 +103,4 @@ App({
onSDKReload() {
},
})
});
+1 -1
View File
@@ -10,7 +10,7 @@
],
"plugins": {
"myPlugin": {
"version": "1.0.0",
"version": "1.0.3",
"provider": "wxb302e0fc8ab232b4"
}
},
File diff suppressed because one or more lines are too long
@@ -37,10 +37,16 @@ Page({
wx.navigateToMiniProgram({
appId: 'wx3b91b7aaa809ecf9',
});
} else {
} else if (tab.name === '在线客服') {
wx.navigateTo({
url: tab.url,
});
} else if (tab.name === '实时通话') {
{
wx.navigateTo({
url: tab.url,
});
}
}
},
learnMore() {
@@ -1,8 +1,8 @@
import { setTokenStorage } from '../../utils/token'
import logger from '../../utils/logger'
import { genTestUserSig } from '../../debug/GenerateTestUserSig'
import { setTokenStorage } from '../../utils/token';
import logger from '../../utils/logger';
import { genTestUserSig } from '../../debug/GenerateTestUserSig';
const app = getApp()
const app = getApp();
Page({
data: {
userID: '',
@@ -18,7 +18,7 @@ Page({
onLoad(option) {
this.setData({
path: option.path,
})
});
wx.setStorage({
key: 'path',
data: option.path,
@@ -41,46 +41,47 @@ Page({
},
// 输入userID
bindUserIDInput(e) {
const val = e.detail.value
const val = e.detail.value;
this.setData({
userID: val,
})
});
},
login() {
const userID = this.data.userID
const userSig = genTestUserSig(userID).userSig
logger.log(`TUI-login | login | userSig:${userSig} userID:${userID}`)
const { userID } = this.data;
const { userSig } = genTestUserSig(userID);
logger.log(`TUI-login | login | userSig:${userSig} userID:${userID}`);
app.globalData.userInfo = {
userSig,
userID,
}
};
setTokenStorage({
userInfo: app.globalData.userInfo,
})
wx.$TUIKit.login({userID: userID, userSig: userSig})
.then(()=> {
wx.aegis.reportEvent({
name: 'login',
ext1: 'login-success',
ext2: 'imTuikitExternal',
ext3: app.globalData.SDKAppID,
});
wx.$TUIKit.login({ userID, userSig })
.then(() => {
wx.aegis.reportEvent({
name: 'login',
ext1: 'login-success',
ext2: 'imTuikitExternal',
ext3: app.globalData.SDKAppID,
});
})
}).catch((error)=> {
wx.aegis.reportEvent({
name: 'login',
ext1: `login-failed#error:${error}`,
ext2: 'imTuikitxEternal',
ext3: app.globalData.SDKAppID,
})
})
.catch((error) => {
wx.aegis.reportEvent({
name: 'login',
ext1: `login-failed#error:${error}`,
ext2: 'imTuikitxEternal',
ext3: app.globalData.SDKAppID,
});
});
if (this.data.path && this.data.path !== 'undefined') {
wx.redirectTo({
url: this.data.path,
})
});
} else {
wx.switchTab({
url: '../TUI-Index/index',
})
});
}
},
onAgreePrivateProtocol() {
@@ -100,6 +101,6 @@ Page({
const url = 'https://web.sdk.qcloud.com/document/Tencent-IM-User-Agreement.html'
wx.navigateTo({
url: `../TUI-User-Center/webview/webview?url=${url}&nav=User-Agreement`,
})
});
},
})
});
@@ -1,4 +1,4 @@
<!--miniprogram/webview/webview.wxml-->
<view class="page">
<web-view class="web-view"src="{{url}}"/>
<web-view class="web-view" src="{{url}}"/>
</view>
@@ -0,0 +1,43 @@
{
"appid": "wx649acbec87e200b4",
"compileType": "miniprogram",
"libVersion": "2.25.0",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"urlCheck": true,
"coverView": true,
"es6": true,
"postcss": true,
"lazyloadPlaceholderEnable": false,
"preloadBackgroundData": false,
"minified": true,
"autoAudits": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"useStaticServer": true,
"showES6CompileOption": false,
"checkInvalidKey": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"disableUseStrict": false,
"useCompilerPlugins": false,
"minifyWXML": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
}
@@ -0,0 +1,7 @@
{
"projectname": "miniprogram",
"setting": {
"compileHotReLoad": true
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
}
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ if (typeof console !== 'undefined') {
}
const noop = function () {}
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
const methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']
let { length } = methods
while (length--) {
@@ -20,6 +20,5 @@ while (length--) {
_console[method] = noop
}
}
_console.methods = methods
export default _console
@@ -28,6 +28,7 @@ export function setTokenStorage(options) {
userID: options.userInfo.userID,
userSig: options.userInfo.userSig,
},
isFirstSendMessage: options.isFirstSendMessage,
}
if (!app) {
app = getApp()