本地开发
This commit is contained in:
@@ -15,107 +15,29 @@
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
localStorage.setItem("appId",10000)
|
||||
|
||||
appInit(500).then((res)=>{
|
||||
console.log("获取到token,创建长链接")
|
||||
this.$store.dispatch('getAddressList');
|
||||
setTimeout(()=>{
|
||||
this.$socketTask.connectSocket()
|
||||
},2500)
|
||||
uni.setStorageSync("initReady",1)
|
||||
},1000)
|
||||
}).then((error)=>{
|
||||
console.log("未获取到IM的token")
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
// #ifdef H5
|
||||
console.log(
|
||||
`%c 考拉Team ${name} %c v${version} `,
|
||||
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
|
||||
'background:#007aff ;padding: 1px; border-radius: 0 3px 3px 0; color: #fff; font-weight: bold;'
|
||||
)
|
||||
|
||||
console.log(consoleImgs.fz)
|
||||
// todo 下列两行
|
||||
uni.setStorageSync('device', 'H5');
|
||||
uni.setStorageSync('version', versionName);
|
||||
|
||||
// #endif
|
||||
console.log('App Launch')
|
||||
let token= uni.getStorageSync('imUserSign');
|
||||
if (!token) {
|
||||
//不存在则跳转至登录页
|
||||
// #ifdef APP-PLUS
|
||||
plus.navigator.closeSplashscreen();
|
||||
// #endif
|
||||
} else {
|
||||
// #ifdef H5
|
||||
this.$socketTask.connectSocket()
|
||||
// #endif
|
||||
this.$store.dispatch('get_UserInfo').then(res=>{
|
||||
// #ifdef APP-PLUS
|
||||
var nickName=res.nickName
|
||||
var portrait=res.portrait
|
||||
this.$http.request({
|
||||
url: '/trtc/getSign',
|
||||
success: (res) => {
|
||||
var sdkAppID=res.data.data.appId
|
||||
var userID=res.data.data.userId
|
||||
var userSig=res.data.data.sign
|
||||
TUICalling.login({//登录音视频
|
||||
sdkAppID: sdkAppID,
|
||||
userID: userID,
|
||||
userSig: userSig
|
||||
},(res) => {
|
||||
console.log('音视频登录成功')
|
||||
TUICalling.setUserNickname({
|
||||
nickName: nickName
|
||||
})
|
||||
TUICalling.setUserAvatar({
|
||||
avatar: portrait
|
||||
})
|
||||
plus.io.requestFileSystem(plus.io.PRIVATE_WWW, function(fs) {
|
||||
fs.root.getFile('/static/longcall.mp3', {
|
||||
create: false
|
||||
}, function(fileEntry) {
|
||||
fileEntry.file(function(file) {
|
||||
TUICalling.setCallingBell({
|
||||
ringtone: file.fullPath
|
||||
},(res) => {
|
||||
console.log(JSON.stringify(res))
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
});
|
||||
var nowCid=plus.push.getClientInfo().clientid
|
||||
this.$http.request({
|
||||
url: '/my/bindCid/'+nowCid,
|
||||
success: (res) => {
|
||||
console.log('新cid'+nowCid)
|
||||
uni.setStorageSync('cid', nowCid);
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: "wx/tabbar1/index",
|
||||
}).then(res=>{
|
||||
// #ifdef APP-PLUS
|
||||
plus.navigator.closeSplashscreen();
|
||||
// #endif
|
||||
})
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
|
||||
uni.onNetworkStatusChange( (res)=> {
|
||||
if(res.isConnected){
|
||||
this.$store.dispatch('get_UserInfo')
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
|
||||
uni.getStorage({
|
||||
key: 'call',
|
||||
success: (res) => {
|
||||
|
||||
Reference in New Issue
Block a user