Browse Source

删除webim 答题页优化 切换到正式环境

master
kola-web 2 months ago
parent
commit
03dc76339b
  1. 2
      project.config.json
  2. 14
      src/app.ts
  3. BIN
      src/images/topic-end-bg.png
  4. BIN
      src/images/topic-start-badge.png
  5. BIN
      src/images/topic-start-code1.png
  6. BIN
      src/images/topic-start-code2.png
  7. BIN
      src/images/topic-start.png
  8. 3
      src/pages/topic/index.json
  9. 72
      src/pages/topic/index.scss
  10. 101
      src/pages/topic/index.ts
  11. 43
      src/pages/topic/index.wxml
  12. 1
      src/sdk/Easemob-chat-4.1.4.js
  13. 1
      src/sdk/Easemob-chat-4.1.5.js
  14. 1
      src/sdk/Easemob-chat-4.1.7.js
  15. 1
      src/sdk/Easemob-chat-4.2.0.js
  16. 1
      src/sdk/Easemob-chat-4.2.1.js
  17. 1
      src/sdk/Easemob-chat-4.3.0.js
  18. 1
      src/sdk/Easemob-chat-4.3.1.js
  19. 7367
      src/sdk/Easemob-chat.d.ts
  20. 37
      src/utils/webIM/Dispatcher.js
  21. 48
      src/utils/webIM/Observe.js
  22. 266
      src/utils/webIM/WebIM.js
  23. 88
      src/utils/webIM/WebIMConfig.js
  24. 2
      src/utils/webIM/broadcast.js

2
project.config.json

@ -61,5 +61,5 @@ @@ -61,5 +61,5 @@
}
]
},
"appid": "wxbdf6f933281b1eb4"
"appid": "wxa4a28b299df7d921"
}

14
src/app.ts

@ -19,14 +19,14 @@ App<IAppOption>({ @@ -19,14 +19,14 @@ App<IAppOption>({
// 测试号 wx2b0bb13edf717c1d
// dev
// appid:wxbdf6f933281b1eb4
url: 'https://m.shizhong.hbraas.com',
upFileUrl: 'https://m.shizhong.hbraas.com/',
imageUrl: 'https://m.shizhong.hbraas.com/api/shizhong/',
// url: 'https://m.shizhong.hbraas.com',
// upFileUrl: 'https://m.shizhong.hbraas.com/',
// imageUrl: 'https://m.shizhong.hbraas.com/api/shizhong/',
// pro
// appid:wx1e025040096c7e1d
// url: 'https://m.shizhong.hbsaas.com',
// upFileUrl: 'https://m.shizhong.hbsaas.com/',
// imageUrl: 'https://m.shizhong.hbsaas.com/wt/',
// appid:wxa4a28b299df7d921
url: 'https://m.shizhong.hbsaas.com',
upFileUrl: 'https://m.shizhong.hbsaas.com/',
imageUrl: 'https://m.shizhong.hbsaas.com/api/shizhong/',
loginState: '',
isLogin: 0,

BIN
src/images/topic-end-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
src/images/topic-start-badge.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
src/images/topic-start-code1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
src/images/topic-start-code2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
src/images/topic-start.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

3
src/pages/topic/index.json

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
"usingComponents": {
"van-progress": "@vant/weapp/progress/index",
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-icon": "@vant/weapp/icon/index"
"van-icon": "@vant/weapp/icon/index",
"van-popup": "@vant/weapp/popup/index"
}
}

72
src/pages/topic/index.scss

@ -118,6 +118,60 @@ page { @@ -118,6 +118,60 @@ page {
}
}
}
.end {
position: relative;
margin: 272rpx 48rpx 16rpx;
padding: 70rpx 52rpx 84rpx;
box-sizing: border-box;
background: #ffffff;
box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(188, 188, 188, 0.18);
border-radius: 24rpx 24rpx 24rpx 24rpx;
.badge {
display: block;
margin: 0 auto;
width: 217rpx;
height: 182rpx;
}
.title {
font-size: 40rpx;
color: #222222;
font-weight: bold;
text-align: center;
}
.content {
margin-top: 30rpx;
font-size: 32rpx;
color: #222222;
}
.codes {
margin-top: 30rpx;
display: flex;
justify-content: space-between;
.c-item {
.code {
width: 246rpx;
height: 246rpx;
}
.name {
margin-top: 4rpx;
text-align: center;
font-size: 28rpx;
color: #222222;
}
}
}
.btn {
margin-top: 54rpx;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 36rpx;
color: #fff;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
}
}
.relove {
@ -145,3 +199,21 @@ page { @@ -145,3 +199,21 @@ page {
color: #ffffff;
}
}
.start {
padding: 710rpx 32rpx 0;
width: 654rpx;
height: 860rpx;
box-sizing: border-box;
.btn {
width: 596rpx;
height: 88rpx;
font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
background: #3795f7;
border-radius: 96rpx 96rpx 96rpx 96rpx;
}
}

101
src/pages/topic/index.ts

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
const app = getApp<IAppOption>();
const licia = require('miniprogram-licia');
// const licia = require('miniprogram-licia');
Page({
data: {
@ -7,9 +7,33 @@ Page({ @@ -7,9 +7,33 @@ Page({
percentage: 0,
question: [] as { questionId: string; title: string; answer?: '1' | '2' }[],
relove: false,
back: false,
start: true,
end: false,
answerList: [
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['非常了解', '一般了解', '完全不了解'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['非常了解', '一般了解', '完全不了解'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
['很感兴趣', '一般兴趣', '不感兴趣'],
],
},
onLoad(options) {
this.setData({
@ -30,16 +54,35 @@ Page({ @@ -30,16 +54,35 @@ Page({
});
});
},
handleBtn: licia.debounce(function (e) {
handleEnd() {
app.waitLogin().then(() => {
wx.reLaunch({
url: '/pages/home/index',
});
});
},
// handleBtn: licia.debounce(function (e) {
// const { index, id } = e.currentTarget.dataset;
// const { question, nav } = this.data;
// question[index].answer = id;
// this.setData({
// question,
// nav: nav === question.length - 1 ? nav : nav + 1,
// percentage: ((nav + 1) / question.length) * 100,
// });
// }, 200),
handleBtn(e) {
const { index, id } = e.currentTarget.dataset;
const { question, nav } = this.data;
// 防止重复点击
if (question[index].answer && nav > index) return;
question[index].answer = id;
this.setData({
question,
nav: nav === question.length - 1 ? nav : nav + 1,
percentage: ((nav + 1) / question.length) * 100,
});
}, 200),
},
handlePrev() {
this.setData({
nav: this.data.nav - 1,
@ -60,14 +103,7 @@ Page({ @@ -60,14 +103,7 @@ Page({
},
}).then(() => {
this.setData({
relove: true,
});
app.waitLogin().then(() => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/home/index',
});
}, 1500);
end: true,
});
});
},
@ -79,24 +115,31 @@ Page({ @@ -79,24 +115,31 @@ Page({
catchTouchMove() {
return false;
},
handleStart() {
this.setData({ start: false });
},
handleBack() {
wx.showModal({
title: '确认退出?',
content: '还差一点就完成了,退出会清空所有答题,确认现在要退出吗?',
cancelText: '退出',
confirmText: '继续答题',
success: (res) => {
if (res.cancel) {
if (this.data.back) {
wx.navigateBack();
} else {
wx.reLaunch({
url: '/pages/home/index',
});
if (this.data.end) {
wx.navigateBack();
} else {
wx.showModal({
title: '确认退出?',
content: '还差一点就完成了,退出会清空所有答题,确认现在要退出吗?',
cancelText: '退出',
confirmText: '继续答题',
success: (res) => {
if (res.cancel) {
if (this.data.back) {
wx.navigateBack();
} else {
wx.reLaunch({
url: '/pages/home/index',
});
}
}
}
},
});
},
});
}
},
});

43
src/pages/topic/index.wxml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<view
class="page"
style="background: url('{{imageUrl}}topic-bg.png?t={{Timestamp}}') no-repeat left {{menuButtonInfo.bottom+102}}rpx /100% 1284rpx;"
style="background: url('{{imageUrl}}topic{{end?'-end':''}}-bg.png?t={{Timestamp}}') no-repeat left {{menuButtonInfo.bottom+102}}rpx /100% 1284rpx;"
>
<van-nav-bar title="" border="{{false}}" custom-style="background:transparent" bind:click-left="handleBack" fixed>
<van-icon name="arrow-left" slot="left" color="#000" size="46rpx" />
@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
current="{{nav}}"
bindtransition="bindtransition"
style="margin-top:{{menuButtonInfo.bottom+73}}px;"
wx:if="{{!end}}"
>
<swiper-item wx:for="{{question}}" wx:key="index" wx:for-item="questionItem" catch:touchmove="catchTouchMove">
<view class="topic">
@ -33,7 +34,7 @@ @@ -33,7 +34,7 @@
data-id="1"
data-index="{{index}}"
>
非常了解
{{answerList[index][0]}}
</view>
<view
class="btn {{questionItem.answer==='2' && 'active'}}"
@ -41,7 +42,7 @@ @@ -41,7 +42,7 @@
data-id="2"
data-index="{{index}}"
>
一般了解
{{answerList[index][1]}}
</view>
<view
class="btn {{questionItem.answer==='3' && 'active'}}"
@ -49,7 +50,7 @@ @@ -49,7 +50,7 @@
data-id="3"
data-index="{{index}}"
>
完全不了解
{{answerList[index][2]}}
</view>
<view class="footer">
<view class="prev" bind:tap="handlePrev" wx:if="{{index>0}}">
@ -66,14 +67,34 @@ @@ -66,14 +67,34 @@
</view>
</view>
</swiper-item>
<swiper-item></swiper-item>
</swiper>
<view class="end" wx:if="{{end}}">
<image class="badge" src="{{imageUrl}}topic-start-badge.png?t={{Timestamp}}"></image>
<view class="title">
提交成功
<view></view>
感谢您的参与!
</view>
<view class="content">
欢迎打开适中健康信息小程序,您将看到一个查有可依、科学性、体系化的健康信息世界,化零为整,随时查阅。
</view>
<view class="codes">
<view class="c-item">
<image class="code" src="{{imageUrl}}topic-start-code1.png?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="name">关注公众号</view>
</view>
<view class="c-item">
<image class="code" src="{{imageUrl}}topic-start-code2.png?t={{Timestamp}}" show-menu-by-longpress></image>
<view class="name">关注企微号</view>
</view>
</view>
<view class="btn" bind:tap="handleEnd">现在体验</view>
</view>
</view>
<view class="relove" wx:if="{{relove}}">
<image class="icon" src="{{imageUrl}}relove.png?t={{Timestamp}}"></image>
<view class="content">
提交成功
<view></view>
感谢您的参与
<van-popup show="{{ start }}" custom-style="background:transparent" round>
<view class="start" style="background: url('{{imageUrl}}topic-start.png?t={{Timestamp}}') no-repeat center /100%;">
<view class="btn" bind:tap="handleStart">开始答题</view>
</view>
</view>
</van-popup>

1
src/sdk/Easemob-chat-4.1.4.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.1.5.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.1.7.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.2.0.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.2.1.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.3.0.js

File diff suppressed because one or more lines are too long

1
src/sdk/Easemob-chat-4.3.1.js

File diff suppressed because one or more lines are too long

7367
src/sdk/Easemob-chat.d.ts vendored

File diff suppressed because it is too large Load Diff

37
src/utils/webIM/Dispatcher.js

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
var dispCbs = [];
var dispIns = [];
function Dispatcher() {
dispIns.push(this);
dispCbs.push({});
}
Dispatcher.prototype = {
on(type, cb) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
if (!~cbs.indexOf(cb)) {
cbs.push(cb);
}
},
off(type, cb) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
let curTypeCbIdx = cbs.indexOf(cb);
if (~curTypeCbIdx) {
cbs.splice(curTypeCbIdx, 1);
}
},
fire(type, ...args) {
let cbtypes = dispCbs[dispIns.indexOf(this)];
let cbs = cbtypes[type] = cbtypes[type] || [];
for (let i = 0; i < cbs.length; i++) {
cbs[i].apply(null, args);
}
}
};
module.exports = Dispatcher;

48
src/utils/webIM/Observe.js

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
var obsCbs = obsCbs || [];
var obsObjs = obsObjs || [];
var cloneObjs = cloneObjs || [];
function newOne(obj){
obsObjs.push(obj);
obsCbs.push([]);
cloneObjs.push(Object.assign({}, obj));
}
module.exports = {
del(obj, cb){
let curObjIdx = obsObjs.indexOf(obj);
if(~curObjIdx){
let cbs = obsCbs[curObjIdx];
let curCbIdx = cbs.indexOf(cb);
if(~curCbIdx){
cbs.splice(curCbIdx, 1);
if(!cbs.length){
obsObjs.splice(curObjIdx, 1);
}
}
}
},
add(obj, cb){
let curIdx = obsObjs.indexOf(obj);
if(!~curIdx){
curIdx = obsObjs.length;
newOne(obj);
}
let cbs = obsCbs[curIdx];
cbs.push(cb);
for(let key in obj){
Object.defineProperty(obj, key, {
set: function(val){
cloneObjs[curIdx][key] = val;
for(let i = 0; i < cbs.length; i++){
cbs[i].apply(obj, [val, key]);
}
},
get: function(){
return cloneObjs[curIdx][key];
}
});
}
return obj;
},
};

266
src/utils/webIM/WebIM.js

@ -1,266 +0,0 @@ @@ -1,266 +0,0 @@
import websdk from "@/sdk/Easemob-chat-4.3.1";
import config from "./WebIMConfig";
console.group = console.group || {};
console.groupEnd = console.groupEnd || {};
const window = {};
const WebIM = window.WebIM = websdk;
WebIM.message = websdk.message
window.WebIM.config = config;
//var DOMParser = window.DOMParser = xmldom.DOMParser;
//let document = window.document = new DOMParser().parseFromString("<?xml version='1.0'?>\n", "text/xml");
WebIM.isDebug = function (option) {
if (option) {
WebIM.config.isDebug = option.isDebug
openDebug(WebIM.config.isDebug)
}
function openDebug(value) {
function ts() {
const d = new Date();
const Hours = d.getHours(); // 获取当前小时数(0-23)
const Minutes = d.getMinutes(); // 获取当前分钟数(0-59)
const Seconds = d.getSeconds(); // 获取当前秒数(0-59)
return `${Hours < 10 ? `0${ Hours}` : Hours }:${ Minutes < 10 ? `0${ Minutes}` : Minutes }:${ Seconds < 10 ? `0${ Seconds}` : Seconds } `;
}
// if (value) {
// Strophe.Strophe.Connection.prototype.rawOutput = function(data){
// try{
// console.group("%csend # " + ts(), "color: blue; font-size: large");
// console.log("%c" + data, "color: blue");
// console.groupEnd();
// }
// catch(e){
// console.log(e);
// }
// };
// }else{
// Strophe.Strophe.Connection.prototype.rawOutput = function(){};
// }
}
}
/**
* Set autoSignIn as true (autoSignInName and autoSignInPwd are configured below),
* You can auto signed in each time when you refresh the page in dev model.
*/
WebIM.config.autoSignIn = false;
if (WebIM.config.autoSignIn) {
WebIM.config.autoSignInName = "lwz2";
WebIM.config.autoSignInPwd = "1";
}
// var stropheConn = new window.Strophe.Connection("ws://im-api.easemob.com/ws/", {
// inactivity: 30,
// maxRetries: 5,
// pollingTime: 4500
// });
//
// stropheConn.connect(
// '$t$' + 'YWMtmbQEBKKIEeaGmMtXyg5n1wAAAVlkQvGO2WOJGlMCEJKM4VV9GCMnb_XLCXU',
// function() {
// console.log(arguments, 'ggogogo');
// }, stropheConn.wait, stropheConn.hold);
WebIM.parseEmoji = function (msg) {
if (typeof WebIM.Emoji === "undefined" || typeof WebIM.Emoji.map === "undefined") {
return msg;
}
const emoji = WebIM.Emoji;
var reg = null;
const msgList = [];
const objList = [];
for (const face in emoji.map) {
if (emoji.map.hasOwnProperty(face)) {
while (msg.includes(face)) {
msg = msg.replace(face, `^${ emoji.map[face] }^`);
}
}
}
const ary = msg.split("^");
var reg = /^e.*g$/;
for (var i = 0; i < ary.length; i++) {
if (ary[i] != "") {
msgList.push(ary[i]);
}
}
for (var i = 0; i < msgList.length; i++) {
if (reg.test(msgList[i])) {
var obj = {};
obj.data = msgList[i];
obj.type = "emoji";
objList.push(obj);
}
else {
var obj = {};
obj.data = msgList[i];
obj.type = "txt";
objList.push(obj);
}
}
return objList;
};
WebIM.time = function () {
const date = new Date();
const Hours = date.getHours();
const Minutes = date.getMinutes();
const Seconds = date.getSeconds();
const time = `${date.getFullYear() }-${ date.getMonth() + 1 }-${ date.getDate() } ${
Hours < 10 ? `0${ Hours}` : Hours }:${ Minutes < 10 ? `0${ Minutes}` : Minutes }:${ Seconds < 10 ? `0${ Seconds}` : Seconds}`;
return time;
};
WebIM.Emoji = {
path: "../../../../../images/faces/",
map: {
"[):]": "ee_1.png",
"[:D]": "ee_2.png",
"[;)]": "ee_3.png",
"[:-o]": "ee_4.png",
"[:p]": "ee_5.png",
"[(H)]": "ee_6.png",
"[:@]": "ee_7.png",
"[:s]": "ee_8.png",
"[:$]": "ee_9.png",
"[:(]": "ee_10.png",
"[:'(]": "ee_11.png",
"[<o)]": "ee_12.png",
"[(a)]": "ee_13.png",
"[8o|]": "ee_14.png",
"[8-|]": "ee_15.png",
"[+o(]": "ee_16.png",
"[|-)]": "ee_17.png",
"[:|]": "ee_18.png",
"[*-)]": "ee_19.png",
"[:-#]": "ee_20.png",
"[^o)]": "ee_21.png",
"[:-*]": "ee_22.png",
"[8-)]": "ee_23.png",
"[del]": "btn_del.png",
"[(|)]": "ee_24.png",
"[(u)]": "ee_25.png",
"[(S)]": "ee_26.png",
"[(*)]": "ee_27.png",
"[(#)]": "ee_28.png",
"[(R)]": "ee_29.png",
"[({)]": "ee_30.png",
"[(})]": "ee_31.png",
"[(k)]": "ee_32.png",
"[(F)]": "ee_33.png",
"[(W)]": "ee_34.png",
"[(D)]": "ee_35.png"
}
};
WebIM.EmojiObj = {
// 相对 emoji.js 路径
path: "../../../../../images/faces/",
map1: {
"[):]": "ee_1.png",
"[:D]": "ee_2.png",
"[;)]": "ee_3.png",
"[:-o]": "ee_4.png",
"[:p]": "ee_5.png",
"[(H)]": "ee_6.png",
"[:@]": "ee_7.png"
},
map2: {
"[:s]": "ee_8.png",
"[:$]": "ee_9.png",
"[:(]": "ee_10.png",
"[:'(]": "ee_11.png",
"[<o)]": "ee_12.png",
"[(a)]": "ee_13.png",
"[8o|]": "ee_14.png"
},
map3: {
"[8-|]": "ee_15.png",
"[+o(]": "ee_16.png",
"[|-)]": "ee_17.png",
"[:|]": "ee_18.png",
"[*-)]": "ee_19.png",
"[:-#]": "ee_20.png",
"[del]": "del.png"
},
map4: {
"[^o)]": "ee_21.png",
"[:-*]": "ee_22.png",
"[8-)]": "ee_23.png",
"[(|)]": "ee_24.png",
"[(u)]": "ee_25.png",
"[(S)]": "ee_26.png",
"[(*)]": "ee_27.png"
},
map5: {
"[(#)]": "ee_28.png",
"[(R)]": "ee_29.png",
"[({)]": "ee_30.png",
"[(})]": "ee_31.png",
"[(k)]": "ee_32.png",
"[(F)]": "ee_33.png",
"[(W)]": "ee_34.png",
"[(D)]": "ee_35.png"
},
map6: {
"[del]": "del.png"
}
};
WebIM.conn = new WebIM.connection({
appKey: WebIM.config.appkey,
isMultiLoginSessions: WebIM.config.isMultiLoginSessions,
https: true, //typeof WebIM.config.https === "boolean" ? WebIM.config.https : location.protocol === "https:",
url: WebIM.config.socketServer,
apiUrl: WebIM.config.apiURL,
isAutoLogin: false,
heartBeatWait: 30000, //WebIM.config.heartBeatWait,
autoReconnectNumMax: WebIM.config.autoReconnectNumMax,
autoReconnectInterval: WebIM.config.autoReconnectInterval,
isDebug: WebIM.config.isDebug,
deviceId: WebIM.config.deviceId
});
// async response
// WebIM.conn.listen({
// onOpened: () => dispatch({type: Types.ON_OPEND})
// })
Math.uuid = function (len, radix) {
const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
const chars = CHARS; const uuid = []; let i;
radix = radix || chars.length;
if (len) {
// Compact form
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
// rfc4122, version 4 form
let r;
// rfc4122 requires these characters
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
// Fill in random data. At i==19 set the high bits of clock sequence
// as
// per rfc4122, sec. 4.1.5
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
};
// export default WebIM;
module.exports = {
"default": WebIM
};

88
src/utils/webIM/WebIMConfig.js

@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
/**
* git do not control webim.config.js
* everyone should copy webim.config.js to webim.config.js
* and have their own configs.
* In this way , others won't be influenced by this config while git pull.
*
*/
// for react native
const location = {
protocol: "https",
};
const config = {
/*
* socket server
*/
// socketServer: "wss://im-api.easemob.com/ws/", //小程序2.0sdk线上环境 请使用2.0版本sdk
// socketServer: "wss://im-api-hsb.easemob.com/ws/", //小程序2.0sdk沙箱环境 请使用2.0版本sdk
// socketServer: 'wss://im-api-new-hsb.easemob.com/websocket', //小程序沙箱环境
socketServer: "wss://im-api-wechat.easemob.com/websocket", //小程序线上环境
// socketServer: 'wss://hk-wx.easemob.com/websocket',
/*
* Backend REST API URL
*/
// apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com',
apiURL: "https://a1.easemob.com", // 线上环境
// apiURL: "https://a1-hsb.easemob.com", // 沙箱环境
// apiURL: 'https://hk-test.easemob.com',
/*
* Application AppKey
*/
appkey: "1110180510146396#dream",
/*
* Whether to use HTTPS '1177161227178308#xcx'
* @parameter {Boolean} true or false
*/
https: false,
/*
* isMultiLoginSessions
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
* false: A visitor can sign in to only one webpage and receive messages at the webpage.
*/
isMultiLoginSessions: false,
/**
* Whether to use window.doQuery()
* @parameter {boolean} true or false
*/
isWindowSDK: false,
/**
* isSandBox=true: xmppURL: 'im-api.sandbox.easemob.com', apiURL: '//a1.sdb.easemob.com',
* isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com',
* @parameter {boolean} true or false
*/
isSandBox: false,
/**
* Whether to console.log in strophe.log()
* @parameter {boolean} true or false
*/
isDebug: true,
/**
* will auto connect the xmpp server autoReconnectNumMax times in background when client is offline.
* won't auto connect if autoReconnectNumMax=0.
*/
autoReconnectNumMax: 5,
/**
* the interval secons between each atuo reconnectting.
* works only if autoReconnectMaxNum >= 2.
*/
autoReconnectInterval: 2,
/**
* webrtc supports WebKit and https only
*/
isWebRTC: false,
/*
* Set to auto sign-in
*/
isAutoLogin: true,
heartBeatWait: 30000,
/*
* 需要替换成自己的声网 appId appId 有限量仅供参考使用同时获取声网 token 的接口仅能供此 appId 使用换成自己的 appId 后需要自己去实现 app server 获取声网token
*/
AgoraAppId: "15cb0d28b87b425ea613fc46f7c9f974",
};
export default config;

2
src/utils/webIM/broadcast.js

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
var Dispatcher = require("./Dispatcher");
module.exports = new Dispatcher();
Loading…
Cancel
Save