Files
fangche/app.js
2021-04-07 15:18:17 +08:00

31 lines
754 B
JavaScript

// app.js
import GoEasyIM from './static/lib/goeasy-im-1.5.1.js';
App({
onLaunch: function () {
wx.im = GoEasyIM.getInstance({
host: 'hangzhou.goeasy.io',
appkey: 'BC-5d0a3ae138494c93869320535ee155fc'
});
wx.GoEasyIM = GoEasyIM;
},
formatDate: function (time) {
const date = new Date(time);
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
return [month, day].map(this.formatNumber).join('-') + ' ' + [hour, minute].map(this.formatNumber).join(':');
},
formatNumber: function (n) {
n = n.toString();
return n[1] ? n : '0' + n;
},
globalData: {
userInfo: null,
im: {},
imService: null,
}
})