refactor: 替换硬编码文本为多语言配置

替换了项目中所有硬编码的提示文案,将其统一迁移到多语言语言包中,包括授权、自定义页面、HTTP请求、分享、客服等模块的提示文本,提升项目的国际化可维护性
This commit is contained in:
2026-06-23 08:36:55 +08:00
parent 6c7f7d4837
commit 750ed2dac7
7 changed files with 123 additions and 53 deletions

View File

@@ -1,4 +1,6 @@
// 文件分享工具函数
import lang from './lang.js';
export default {
/**
* 生成文件预览链接
@@ -30,7 +32,7 @@ export default {
* @param {string} title - 分享标题,默认使用文件名
* @param {string} desc - 分享描述,默认使用固定文案
*/
shareFile(file, title = file.name, desc = '查看企业文件:' + file.name) {
shareFile(file, title = file.name, desc = lang('share.filePreview') + file.name) {
// 生成文件预览链接
const filePreviewUrl = this.generateFilePreviewUrl(file);
@@ -44,17 +46,17 @@ export default {
url: filePreviewUrl
}).catch(err => {
console.error('分享失败:', err);
uni.showToast({ title: '分享失败', icon: 'none' });
uni.showToast({ title: lang('share.failed'), icon: 'none' });
});
} else {
// 不支持 Web Share API 的浏览器
uni.setClipboardData({
data: filePreviewUrl,
success: () => {
uni.showToast({ title: '链接已复制,请粘贴分享', icon: 'success' });
uni.showToast({ title: lang('share.linkCopied'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '复制失败', icon: 'none' });
uni.showToast({ title: lang('common.copyFailed'), icon: 'none' });
}
});
}
@@ -63,7 +65,7 @@ export default {
// #ifdef MP-WEIXIN
// 微信小程序分享
uni.showActionSheet({
itemList: ['发送给朋友', '分享到朋友圈'],
itemList: [lang('share.sendToFriend'), lang('share.sendToMoments')],
success: (res) => {
if (res.tapIndex === 0) {
// 发送给朋友
@@ -71,10 +73,10 @@ export default {
title: title,
path: filePreviewUrl,
success: () => {
uni.showToast({ title: '分享成功', icon: 'success' });
uni.showToast({ title: lang('share.success'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '分享失败', icon: 'none' });
uni.showToast({ title: lang('share.failed'), icon: 'none' });
}
});
} else if (res.tapIndex === 1) {
@@ -83,10 +85,10 @@ export default {
title: desc,
path: filePreviewUrl,
success: () => {
uni.showToast({ title: '分享成功', icon: 'success' });
uni.showToast({ title: lang('share.success'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '分享失败', icon: 'none' });
uni.showToast({ title: lang('share.failed'), icon: 'none' });
}
});
}