Files
lucky_shop/pages_tool/help/list.vue
ZF sun 94142268a0 refactor(i18n): 完成全量硬编码中文文案替换为多语言方案
1.  替换所有页面/组件中的硬编码中文提示文案为$lang调用,包括支付、帮助中心、公告等页面
2.  重构diy.js加载失败文案处理逻辑,支持参数化替换
3.  新增多语言混入逻辑,实现导航标题随语种动态切换
4.  重构支付组件初始化逻辑,优化平台适配代码
5.  添加多语言单元测试和硬编码扫描脚本
6.  更新语言包,新增缺失的翻译词条
2026-07-23 09:46:16 +08:00

142 lines
3.2 KiB
Vue

<template>
<view class="help" :style="themeColor">
<block v-if="dataList.length">
<view class="help-item" v-for="(item, index) in dataList" :key="index">
<view :class="['item-title', item.child_list.length == 0 ? 'empty' : '']">{{ item.class_name }}</view>
<view class="item-content" v-for="(s_item, s_index) in item.child_list" :key="s_index" @click="helpDetail(s_item)">{{ s_item.title }}</view>
</view>
</block>
<block v-else><ns-empty :text="$lang('help.list.noHelp')" :isIndex="false"></ns-empty></block>
<loading-cover ref="loadingCover"></loading-cover>
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
</view>
</template>
<script>
export default {
data() {
return {
dataList: []
};
},
onLoad() {},
onShow() {
this.setPublicShare();
this.getData();
},
methods: {
getData() {
this.$api.sendRequest({
url: '/api/helpclass/lists',
data: {},
success: res => {
if (res.code == 0 && res.data) {
this.dataList = res.data;
} else {
this.$util.showToast({
title: res.message
});
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
helpDetail(e) {
// #ifndef MP-WEIXIN
if (e.link_address) {
// H5:浏览器不自动编码,需要手动 encodeURIComponent
// 其他小程序平台(HarmonyOS 等):uni.redirectTo 内部会自动编码,不能再 encode,否则双重编码
// #ifdef H5
uni.redirectTo({
url: '/pages_tool/webview/webview?src=' + encodeURIComponent(e.link_address)
});
// #endif
// #ifndef H5
uni.redirectTo({
url: '/pages_tool/webview/webview?src=' + e.link_address
});
// #endif
} else {
this.$util.redirectTo('/pages_tool/help/detail', {
id: e.id
});
}
// #endif
// #ifdef MP-WEIXIN
this.$util.redirectTo('/pages_tool/help/detail', {
id: e.id
});
// #endif
},
// 设置公众号分享
setPublicShare() {
let shareUrl = this.$config.h5Domain + '/pages_tool/help/list';
this.$util.setPublicShare({
title: this.$lang('help.list.title'),
desc: '',
link: shareUrl,
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) : ''
});
}
},
onShareAppMessage(res) {
var title = '帮助中心使你更加方便';
var path = '/pages_tool/help/list';
return {
title: title,
path: path,
success: res => {},
fail: res => {}
};
}
};
</script>
<style lang="scss" scoped>
.help {
height: 100%;
box-sizing: border-box;
padding-top: 20rpx;
.help-item {
width: calc(100% - 60rpx);
margin: 0 auto;
padding: 32rpx 35rpx;
box-sizing: border-box;
background-color: #fff;
margin-bottom: 18rpx;
border-radius: 10rpx;
.item-title {
padding-bottom: 15rpx;
font-size: 30rpx;
color: #000;
border-bottom: 2rpx solid #f1f1f1;
&.empty {
padding-bottom: 0;
border-bottom: none;
}
}
.item-content {
padding: 24rpx 0;
border-bottom: 2rpx solid #f1f1f1;
font-size: $font-size-base;
color: $color-sub;
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
}
}
}
</style>