refactor(member): 优化多语言调用和可选链使用
1. 移除语言包默认参数,统一使用翻译文本作为默认值 2. 为嵌套属性访问添加可选链操作符,避免空指针报错 3. 新增会员相关的多语言词条
This commit is contained in:
@@ -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="isShowCancelButton"
|
||||
@click="cancellation">{{ $lang('cancellation', '账号注销') }}</view>
|
||||
@click="cancellation">{{ $lang('cancellation') }}</view>
|
||||
<view class="action-btn logout-btn" v-if="isShowLogoutButton"
|
||||
@click="logout">{{ $lang('logout', '退出登录') }}</view>
|
||||
@click="logout">{{ $lang('logout') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -97,10 +97,10 @@ export default {
|
||||
};
|
||||
},
|
||||
isShowCancelButton() {
|
||||
return this.diyData?.global?.isShowCancelButton[`${this.getAppType()}`] !== 0
|
||||
return this.diyData?.global?.isShowCancelButton?.[`${this.getAppType()}`] !== 0
|
||||
},
|
||||
isShowLogoutButton() {
|
||||
return this.diyData?.global?.isShowLogoutButton[`${this.getAppType()}`] !== 0
|
||||
return this.diyData?.global?.isShowLogoutButton?.[`${this.getAppType()}`] !== 0
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
@@ -12,8 +12,8 @@ export default {
|
||||
// 退出登录
|
||||
logout() {
|
||||
uni.showModal({
|
||||
title: this.$lang('logoutTitle', '提示'),
|
||||
content: this.$lang('logoutContent', '确定要退出登录吗'),
|
||||
title: this.$lang('logoutTitle'),
|
||||
content: this.$lang('logoutContent'),
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.clearLoginState();
|
||||
|
||||
Reference in New Issue
Block a user