初始化商家端

This commit is contained in:
wangxiaowei
2025-04-30 14:08:39 +08:00
commit 68b408b1e7
568 changed files with 118884 additions and 0 deletions

87
lang/index.js Normal file
View File

@ -0,0 +1,87 @@
import { LANGUAGES } from '../common/config.js'
const publicCogfig = {};
const errorList = {};
const emptyList = [];
LANGUAGES.forEach(val => {
if (!publicCogfig[val.type]) {
publicCogfig[val.type] = {};
errorList[val.type] = [];
}
})
// console.log(publicCogfig)
const pageLangs = require.context('../pages/', true, /\lang.js$/);
const componentsLangs = require.context('../components/', true, /\lang.js$/);
const commonLangs = require.context('../lang/', true, /\lang.js$/);
// pages下语言文件合并
const pagesModules = pageLangs.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
const value = pageLangs(modulePath);
// console.log(value)
LANGUAGES.forEach(val => {
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default && !value.default[val.type]) {
errorList[val.type].push(moduleName);
}
if ((typeof value == 'object') && !value.default) {
emptyList.push(moduleName);
}
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default) {
Object.assign(modules[val.type], value.default[val.type]);
}
})
return modules;
}, publicCogfig);
// console.log(Object.keys(pagesModules.zh).length)
// 公共组件下语言文件合并
const componentsModules = componentsLangs.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
const value = componentsLangs(modulePath);
LANGUAGES.forEach(val => {
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default && !value.default[val.type]) {
errorList[val.type].push(moduleName);
}
if ((typeof value == 'object') && !value.default) {
emptyList.push(moduleName);
}
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default) {
Object.assign(modules[val.type], value.default[val.type]);
}
})
return modules;
}, publicCogfig);
// console.log(errorList)
// 公共底包下语言文件合并
const commonModules = commonLangs.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
const value = commonLangs(modulePath);
LANGUAGES.forEach(val => {
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default && !value.default[val.type]) {
errorList[val.type].push(moduleName);
}
if ((typeof value == 'object') && !value.default) {
emptyList.push(moduleName);
}
// 排除建了lang.js没有内容时报错
if ((typeof value == 'object') && value.default) {
Object.assign(modules[val.type], value.default[val.type]);
}
})
return modules;
}, publicCogfig);
const totalLangs = {}
for (let attr in publicCogfig) {
if (!totalLangs[attr]) {
totalLangs[attr] = publicCogfig[attr];
}
}
// console.log('config配置后单页面lang.js缺少配置的页面',errorList)
// console.log('单页面lang.js无任何内容的页面',emptyList)
export default totalLangs;

3
lang/lang.js Normal file
View File

@ -0,0 +1,3 @@
export default {
zh:{"请求错误(400)":"请求错误(400)","未授权,请重新登录(401)":"未授权,请重新登录(401)","登录失效":"登录失效","拒绝访问(403)":"拒绝访问(403)","请求出错(404)":"请求出错(404)","请求超时(408)":"请求超时(408)","服务器错误(500)":"服务器错误(500)","服务未实现(501)":"服务未实现(501)","网络错误(502)":"网络错误(502)","服务不可用(503)":"服务不可用(503)","网络超时(504)":"网络超时(504)","HTTP版本不受支持(505)":"HTTP版本不受支持(505)","服务器错误!":"服务器错误!","服务器太拥挤了~请您稍后重试":"服务器太拥挤了~请您稍后重试","登录失效,请重新登录":"登录失效,请重新登录","刚刚":"刚刚","分钟前":"分钟前","小时前":"小时前","天前":"天前","个月前":"个月前","年前":"年前","请先设置你的密码":"请先设置你的密码","要携带的参数":"要携带的参数","请用指纹解锁":"请用指纹解锁","验证失败":"验证失败","请用FaceID解锁":"请用FaceID解锁","识别成功":"识别成功","首页":"首页","分类":"分类","购物车":"购物车","我的":"我的","操作成功~":"操作成功~","支付失败":"支付失败","上传中":"上传中","上传失败,请重试":"上传失败,请重试","视频上传失败,请重试":"视频上传失败,请重试","图片上传失败,请重试":"图片上传失败,请重试","通知权限开启提醒":"通知权限开启提醒","您还没有开启通知权限,无法接受到消息通知,是否前往设置?":"您还没有开启通知权限,无法接受到消息通知,是否前往设置?","直播":"直播","验证码发送成功":"验证码发送成功","请输入手机号":"请输入手机号","请正确输入手机号":"请正确输入手机号","请发送验证码":"请发送验证码","后重新获取":"后重新获取","提示":"提示","确定要清除本地缓存?":"确定要清除本地缓存?","缓存清理完成!":"缓存清理完成!","取消支付":"取消支付","支付失败,请稍后重试":"支付失败,请稍后重试","请输入账号":"请输入账号","请正确账号":"请正确账号","发送中...":"发送中..."},
}