|
|
|
|
@ -1,23 +1,16 @@
|
|
|
|
|
<script>
|
|
|
|
|
// 引入检查更新
|
|
|
|
|
//import checkupdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update.js"
|
|
|
|
|
//引进检查版本
|
|
|
|
|
// import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version';
|
|
|
|
|
//#ifdef APP-PLUS
|
|
|
|
|
// const jpushModule = uni.requireNativePlugin('JG-JPush');
|
|
|
|
|
//#endif
|
|
|
|
|
export default {
|
|
|
|
|
async onLaunch() {
|
|
|
|
|
|
|
|
|
|
//#ifdef H5
|
|
|
|
|
|
|
|
|
|
var token= uni.getStorageSync("token");
|
|
|
|
|
if(token){
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '/pages/index/index'
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
console.log("APPonLaunch");
|
|
|
|
|
// var token= uni.getStorageSync("token");
|
|
|
|
|
// if(token){
|
|
|
|
|
// uni.redirectTo({
|
|
|
|
|
// url: '/pages/index/index'
|
|
|
|
|
// });
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const queryString = window.location.search;
|
|
|
|
|
const searchParams = new URLSearchParams(queryString);
|
|
|
|
|
@ -37,42 +30,6 @@
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '登录跳转中...'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// const {data: res} = await uni.$http.post('/loginBySSO?ticket='+ticket);
|
|
|
|
|
// if(res.success){
|
|
|
|
|
// if(res.data){
|
|
|
|
|
// console.log(res.data)
|
|
|
|
|
// uni.setStorageSync('expires', res.data.expires);
|
|
|
|
|
// uni.setStorageSync('token', res.data.token);
|
|
|
|
|
// uni.setStorageSync('user', JSON.stringify(res.data.user));
|
|
|
|
|
// uni.setStorageSync('menu', JSON.stringify(res.data.btns));
|
|
|
|
|
// this.getdept();
|
|
|
|
|
// // 跳转 首页
|
|
|
|
|
// uni.switchTab({
|
|
|
|
|
// url: '/pages/index/index'
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// uni.showModal({
|
|
|
|
|
// title: '提示',
|
|
|
|
|
// content: '获取登录token失败,请重新登录后进入!',
|
|
|
|
|
// cancelText: '取消',
|
|
|
|
|
// confirmText: '确定',
|
|
|
|
|
// success: ress => {
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// uni.showModal({
|
|
|
|
|
// title: '提示',
|
|
|
|
|
// content: '获取登录token失败,请重新登录后进入!',
|
|
|
|
|
// cancelText: '取消',
|
|
|
|
|
// confirmText: '确定',
|
|
|
|
|
// success: ress => {
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
uni.request({
|
|
|
|
|
header: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
@ -137,60 +94,8 @@
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
// 判断版本更新 需要真机进行测试
|
|
|
|
|
//checkupdate();
|
|
|
|
|
|
|
|
|
|
//#ifdef APP-PLUS
|
|
|
|
|
|
|
|
|
|
// // 消息推送
|
|
|
|
|
// jpushModule.setLoggerEnable(true);
|
|
|
|
|
// jpushModule.initJPushService()
|
|
|
|
|
// jpushModule.addConnectEventListener(result=>{
|
|
|
|
|
// let connectEnable = result.connectEnable
|
|
|
|
|
// console.log("jpush连接", connectEnable)
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// jpushModule.addTagAliasListener(result => {
|
|
|
|
|
// let code = result.code
|
|
|
|
|
// let sequence = result.sequence
|
|
|
|
|
// let tags = result.tags
|
|
|
|
|
// let tag = result.tag
|
|
|
|
|
// let tagEnable = result.tagEnable
|
|
|
|
|
// let alias = result.alias
|
|
|
|
|
// console.log(alias, '别名')
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// // 通知事件回调
|
|
|
|
|
// jpushModule.addNotificationListener(result => {
|
|
|
|
|
// let notificationEventType = result.notificationEventType
|
|
|
|
|
// let messageID = result.messageID
|
|
|
|
|
// let title = result.title
|
|
|
|
|
// let content = result.content
|
|
|
|
|
// let extras = result.extras
|
|
|
|
|
// console.log("通知", result)
|
|
|
|
|
// // 点击事件
|
|
|
|
|
// if (notificationEventType == 'notificationOpened') {
|
|
|
|
|
// uni.reLaunch({
|
|
|
|
|
// url: `/pages/message/newMsg`
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// jpushModule.getRegistrationID(result => {
|
|
|
|
|
// console.log("注册ID", result.registerID)
|
|
|
|
|
// if (result.registerID) {
|
|
|
|
|
// uni.setStorageSync("register_id", result.registerID)
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// jpushModule.addCustomMessageListener(result => {
|
|
|
|
|
// let messageID = result.messageID
|
|
|
|
|
// let content = result.content
|
|
|
|
|
// let extras = result.extras
|
|
|
|
|
// console.log("自定义消息", result)
|
|
|
|
|
// })
|
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
//#endif
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getdept(){
|
|
|
|
|
|