49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
Page({
|
|
data: {
|
|
url:''
|
|
},
|
|
onLoad() {
|
|
let userType = dd.$toolAll.getCache('userData').userType;
|
|
let token = dd.$toolAll.getCache('token');
|
|
console.log(userType,123)
|
|
if(userType==1){
|
|
this.setData({
|
|
url: 'https://sy.h5.emingren.com/#/consultant?token='+token
|
|
})
|
|
}else if(userType==0){
|
|
this.setData({
|
|
url: 'https://sy.h5.emingren.com/#/index?token='+token
|
|
})
|
|
}
|
|
|
|
this.webViewContext = dd.createWebViewContext('web-view-1');
|
|
},
|
|
onmessage: function(e) {
|
|
console.log(e.detail,4545454545)
|
|
if(e.detail.name == 'clearAll'){
|
|
// 缓存删除
|
|
dd.$toolAll.removeCache('token');
|
|
dd.$toolAll.removeCache('userinfo');
|
|
dd.$toolAll.removeCache('centerUserData');
|
|
dd.$toolAll.removeCache('userData');
|
|
dd.$toolAll.removeCache('isInFirst');
|
|
// 钉钉跳转
|
|
dd.redirectTo({url: '/pages/login/login'});
|
|
}else if(e.detail.name == 'downImg'){
|
|
dd.downloadFile({
|
|
url: e.detail.url,
|
|
success({ filePath }) {
|
|
dd.previewImage({
|
|
urls: [filePath],
|
|
});
|
|
},
|
|
fail(res) {
|
|
dd.alert({
|
|
content: res.errorMessage || res.error,
|
|
});
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|