|
@@ -39,7 +39,11 @@
|
|
|
fontWeight: "bold",
|
|
|
color: '#111111'
|
|
|
}
|
|
|
- },
|
|
|
+ },
|
|
|
+ backAlert:{
|
|
|
+ typeof:Boolean,
|
|
|
+ default:false
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -53,25 +57,38 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- toBack(url) {
|
|
|
- if (!url) {
|
|
|
- if (uni.getStorageSync('options')) {
|
|
|
- uni.redirectTo(JSON.parse(decodeURIComponent(uni.getStorageSync('options'))));
|
|
|
- return uni.removeStorageSync('options');
|
|
|
- }
|
|
|
- let canNavBack = getCurrentPages();
|
|
|
- if (canNavBack && canNavBack.length > 1) uni.navigateBack();
|
|
|
- else uni.reLaunch({
|
|
|
- url: '/pages/index/index'
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (this.tabUrls.find(u => u == url)) uni.reLaunch({
|
|
|
- url
|
|
|
- });
|
|
|
- else uni.redirectTo({
|
|
|
- url
|
|
|
- });
|
|
|
- }
|
|
|
+ toBack(url) {
|
|
|
+ if(this.backAlert){
|
|
|
+ uni.showModal({
|
|
|
+ title:'温馨提示',
|
|
|
+ content:'您当前正在填写问卷,返回会清空作答进度,是否确认返回?',
|
|
|
+ success: (res) => {
|
|
|
+ if(res.confirm){
|
|
|
+ this.dealBack(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else this.dealBack(url)
|
|
|
+ },
|
|
|
+ dealBack(url){
|
|
|
+ if (!url) {
|
|
|
+ if (uni.getStorageSync('options')) {
|
|
|
+ uni.redirectTo(JSON.parse(decodeURIComponent(uni.getStorageSync('options'))));
|
|
|
+ return uni.removeStorageSync('options');
|
|
|
+ }
|
|
|
+ let canNavBack = getCurrentPages();
|
|
|
+ if (canNavBack && canNavBack.length > 1) uni.navigateBack();
|
|
|
+ else uni.reLaunch({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (this.tabUrls.find(u => u == url)) uni.reLaunch({
|
|
|
+ url
|
|
|
+ });
|
|
|
+ else uni.redirectTo({
|
|
|
+ url
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
toHome() {
|
|
|
uni.reLaunch({
|