fix: 统一登录态失效后的跳转逻辑并补充多语言默认值

1.  统一所有接口登录态异常(-1)时的处理,跳转至登录页而非原页面或首页
2.  补充$lang多语言调用的默认参数,防止翻译缺失
3.  修正公共js中的跳转路径和异常处理逻辑
This commit is contained in:
2026-06-17 10:10:17 +08:00
parent 851b5fe722
commit 17864427c1
7 changed files with 23 additions and 9 deletions

View File

@@ -111,6 +111,9 @@ export default {
if (res.data.member_info.is_fenxiao == 1) {
this.fenxiao_info = res.data.fenxiao_info;
}
} else if (res.code == -1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});

View File

@@ -44,6 +44,10 @@ export default {
if (res.code >= 0) {
this.agreement = res.data;
if (this.agreement.content) this.agreement.content = htmlParser(this.agreement.content);
} else if (res.code == -1) {
this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', '');
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});

View File

@@ -38,6 +38,10 @@ export default {
success: res => {
if (res.code >= 0) {
this.reason = res.data.reason;
} else if (res.code == -1) {
this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', '');
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});

View File

@@ -71,7 +71,7 @@
if (res.code == -1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});

View File

@@ -41,7 +41,7 @@
if (res.code >= 0) {
if (res.data && res.data.status == 1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
}
@@ -49,7 +49,7 @@
},
success() {
this.clearLoginState();
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
};

View File

@@ -21,17 +21,17 @@
<view class="foot">
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=0')">{{
$lang('privacyPolicy') }}</view>
$lang('privacyPolicy', '隐私协议') }}</view>
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=1')">{{
$lang('registrationAgreement') }}</view>
$lang('registrationAgreement', '注册协议') }}</view>
</view>
<!-- 退出登录和账号注销按钮 -->
<view class="action-buttons" v-if="storeToken">
<view class="action-btn cancel-btn" v-if="!diyData.global || diyData.global.isShowCancelButton !== 0"
@click="cancellation">{{ $lang('cancellation') }}</view>
@click="cancellation">{{ $lang('cancellation', '账号注销') }}</view>
<view class="action-btn logout-btn" v-if="!diyData.global || diyData.global.isShowLogoutButton !== 0"
@click="logout">{{ $lang('logout') }}</view>
@click="logout">{{ $lang('logout', '退出登录') }}</view>
</view>
</view>

View File

@@ -17,7 +17,7 @@ export default {
success: (res) => {
if (res.confirm) {
this.clearLoginState();
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});
@@ -49,6 +49,9 @@ export default {
} else {
this.$util.redirectTo('/pages_tool/member/cancellation');
}
} else if (res.code == -1) {
this.clearLoginState();
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
}
}
});
@@ -68,7 +71,7 @@ export default {
if (rres.code >= 0) {
if (options.clearStateAndRedirect) {
this.clearLoginState();
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
} else {
this.$util.redirectTo('/pages_tool/member/cancelstatus');
}