111
This commit is contained in:
parent
1785e9309e
commit
f4c8df1950
58
App.vue
58
App.vue
@ -22,32 +22,32 @@ export default {
|
||||
uni.setStorageSync("userInfo", options.referrerInfo.extraData.userInfo);
|
||||
//getApp({allowDefault: true}).globalData.apiHost = options.referrerInfo.extraData.apiHost;
|
||||
}
|
||||
// if (
|
||||
// options &&
|
||||
// options.referrerInfo.extraData &&
|
||||
// options.referrerInfo.extraData.targetPath
|
||||
// ) {
|
||||
// uni.navigateTo({
|
||||
// url: options.referrerInfo.extraData.targetPath,
|
||||
// });
|
||||
// }
|
||||
if (
|
||||
options &&
|
||||
options.referrerInfo.extraData &&
|
||||
options.referrerInfo.extraData.targetPath
|
||||
) {
|
||||
uni.navigateTo({
|
||||
url: options.referrerInfo.extraData.targetPath,
|
||||
});
|
||||
}
|
||||
|
||||
console.log("app传递登录信息onLaunch-------------------");
|
||||
try {
|
||||
// #ifdef APP
|
||||
// uni.onNativeEventReceive((event, data) => {
|
||||
// console.log("app传递登录信息-------------------");
|
||||
// console.log("event数据");
|
||||
// console.log(event);
|
||||
// console.log("data数据");
|
||||
// console.log(data);
|
||||
// if (event.indexOf("loginInfo") > -1) {
|
||||
// uni.setStorageSync("DEV_AUTH_TOKEN_App", data.token);
|
||||
// uni.setStorageSync("userInfo", data.userInfo);
|
||||
// console.log("获取token数据");
|
||||
// console.log(uni.getStorageSync("DEV_AUTH_TOKEN_App"));
|
||||
// }
|
||||
// });
|
||||
uni.onNativeEventReceive((event, data) => {
|
||||
console.log("event", event);
|
||||
console.log("data", data);
|
||||
if (event.indexOf("clearToken") > -1) {
|
||||
uni.setStorageSync("AUTH_TOKEN_App", "");
|
||||
plus.runtime.quit();
|
||||
}
|
||||
if(event.indexOf("goPage") > -1){
|
||||
uni.navigateTo({
|
||||
url: data,
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
} catch (error) {
|
||||
console.log("app传递登录信息error-------------------");
|
||||
@ -117,19 +117,7 @@ export default {
|
||||
// }
|
||||
// }, 1000)
|
||||
|
||||
uni.onNativeEventReceive((event, data) => {
|
||||
console.log("event", event);
|
||||
console.log("data", data);
|
||||
if (event.indexOf("clearToken") > -1) {
|
||||
uni.setStorageSync("AUTH_TOKEN_App", "");
|
||||
plus.runtime.quit();
|
||||
}
|
||||
if(event.indexOf("goPage") > -1){
|
||||
uni.navigateTo({
|
||||
url: data,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let main = plus.android.runtimeMainActivity();
|
||||
//为了防止快速点按返回键导致程序退出重写quit方法改为隐藏至后台
|
||||
plus.runtime.quit = function () {
|
||||
|
||||
@ -398,17 +398,27 @@ const viewGuideline = (cell) => {
|
||||
console.log(downloadTasks.value);
|
||||
downloadTasks.value.forEach(item => {
|
||||
if(item.id == cell.uuid) {
|
||||
uni.openDocument({
|
||||
filePath: item.localPath,
|
||||
fileType: 'pdf',
|
||||
success: () => console.log('打开成功'),
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
plus.runtime.openFile(item.localPath, function(e) {
|
||||
console.log('打开成功');
|
||||
}, function(e) {
|
||||
uni.showToast({
|
||||
title: '打开失败:' + e.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
console.log('打开失败:' + e.message);
|
||||
});
|
||||
// uni.openDocument({
|
||||
// filePath: item.localPath,
|
||||
// fileType: 'pdf',
|
||||
// success: () => console.log('打开成功'),
|
||||
// fail: (err) => {
|
||||
// uni.showToast({
|
||||
// title: err,
|
||||
// icon: "none",
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -458,16 +458,11 @@ const viewGuideline = (cell) => {
|
||||
plus.runtime.openFile(item.localPath, function(e) {
|
||||
console.log('打开成功');
|
||||
}, function(e) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: JSON.stringify(e),
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
success: (res) => {
|
||||
if(res.confirm){
|
||||
}
|
||||
}
|
||||
});
|
||||
uni.showToast({
|
||||
title: '打开失败:' + e.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
console.log('打开失败:' + e.message);
|
||||
});
|
||||
// uni.openDocument({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user