feat: add and optimize multilingual text resources

- add new language packs for multiple pages and components including category, cart, order, member center, distribution, etc.
- add Chinese and English translations for new features and UI text
- fix navigation service error message to use multilingual text
- update component templates to use dynamic language translation instead of hardcoded text
- adjust code indentation and formatting for consistency
This commit is contained in:
2026-06-26 13:49:26 +08:00
parent 66a579d48c
commit f7fb9f34f9
116 changed files with 1640 additions and 525 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.lang('share.defaultDesc', { name: 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.lang('share.shareFailed'), icon: 'none' });
});
} else {
// 不支持 Web Share API 的浏览器
uni.setClipboardData({
data: filePreviewUrl,
success: () => {
uni.showToast({ title: '链接已复制,请粘贴分享', icon: 'success' });
uni.showToast({ title: Lang.lang('share.linkCopied'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '复制失败', icon: 'none' });
uni.showToast({ title: Lang.lang('share.copyFailed'), icon: 'none' });
}
});
}
@@ -63,7 +65,7 @@ export default {
// #ifdef MP-WEIXIN
// 微信小程序分享
uni.showActionSheet({
itemList: ['发送给朋友', '分享到朋友圈'],
itemList: [Lang.lang('share.sendToFriend'), Lang.lang('share.shareToTimeline')],
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.lang('share.shareSuccess'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '分享失败', icon: 'none' });
uni.showToast({ title: Lang.lang('share.shareFailed'), 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.lang('share.shareSuccess'), icon: 'success' });
},
fail: () => {
uni.showToast({ title: '分享失败', icon: 'none' });
uni.showToast({ title: Lang.lang('share.shareFailed'), icon: 'none' });
}
});
}
@@ -97,4 +99,4 @@ export default {
});
// #endif
}
};
};