优化体验

This commit is contained in:
TOP糯米 2023-03-12 17:05:35 +08:00
parent 9a191fc8da
commit 17c16ec9c8
4 changed files with 35 additions and 5 deletions

View File

@ -28,11 +28,23 @@ export default {
mounted() {}, mounted() {},
destroyed() {}, destroyed() {},
methods: { methods: {
/**
* 关闭弹窗
* 如果在tabBar页面则relaunch否则返回
*/
closeModal() { closeModal() {
this.$store.commit("user/showLoginModal", false); this.$store.commit("user/showLoginModal", false);
if (getCurrentPages().length <= 1) {
this.$utils.toPage("/pages/index/index", {}, "relaunch");
} else {
this.$utils.toPage("", {}, "back");
}
}, },
/**
* 登录页面
*/
toLogin() { toLogin() {
this.closeModal(); this.$store.commit("user/showLoginModal", false);
this.$utils.toPage("/pages/auth/auth"); this.$utils.toPage("/pages/auth/auth");
}, },
}, },

View File

@ -169,7 +169,7 @@ function toPage(url, options, type) {
currentPage.onShow(currentPage.options); currentPage.onShow(currentPage.options);
break; break;
case "back": case "back":
uni.navigateBack({ delta: 1 }); uni.navigateBack({ ...{ delta: 1 }, ...options });
break; break;
case "relaunch": case "relaunch":
uni.reLaunch(params); uni.reLaunch(params);

View File

@ -185,7 +185,21 @@ export default {
}) })
.then((response) => { .then((response) => {
this.$store.dispatch("user/info"); this.$store.dispatch("user/info");
this.$utils.toPage("", {}, "back"); this.$utils.toPage(
"",
{
complete() {
let pages = getCurrentPages();
let refer = pages[pages.length - 2];
if (typeof refer !== "undefined") {
if (typeof refer.initPage !== "undefined") {
refer.initPage(refer.options);
}
}
},
},
"back"
);
}) })
.catch((e) => { .catch((e) => {
this.$utils.toast(e); this.$utils.toast(e);

View File

@ -8,7 +8,7 @@
<text class="content version">v1.02</text> <text class="content version">v1.02</text>
</view> </view>
</view> </view>
<view class="widget-item"> <view class="widget-item" @click="toPage('/pages/member/password')">
<text class="title">密码管理</text> <text class="title">密码管理</text>
<view class="item-content"> <view class="item-content">
<text class="iconfont icon-jinru"></text> <text class="iconfont icon-jinru"></text>
@ -68,7 +68,11 @@ export default {
onReady() {}, onReady() {},
onReachBottom() {}, onReachBottom() {},
onPullDownRefresh() {}, onPullDownRefresh() {},
methods: {}, methods: {
toPage(url) {
this.$utils.toPage(url);
},
},
}; };
</script> </script>