refactor: 替换多页面国际化文本为硬编码中文内容

移除项目内大部分$lang()国际化调用,替换为直接中文文本,统一前端展示文案
This commit is contained in:
2026-06-23 08:55:16 +08:00
parent 750ed2dac7
commit f258987e0e
180 changed files with 2207 additions and 4701 deletions

View File

@@ -23,7 +23,7 @@ export function currentTime() {
}
//时间戳转日期
export function timeStamp(time, dayNames) {
export function timeStamp(time) {
const dates = new Date(time)
const year = dates.getFullYear()
const month = dates.getMonth() + 1
@@ -31,33 +31,32 @@ export function timeStamp(time, dayNames) {
const day = dates.getDay()
const hour = dates.getHours()
const min = dates.getMinutes()
const days = dayNames || ['日', '一', '二', '三', '四', '五', '六']
const days = ['日', '一', '二', '三', '四', '五', '六']
return {
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
date: `${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01,${strFormat(year)}-${strFormat(month)}-${strFormat(date)}
day: `${days[day]}`, //返回的礼拜天数 星期一
day: `周${days[day]}`, //返回的礼拜天数 星期一
hour: strFormat(hour) + ':' + strFormat(min) // + ':00' //返回的时钟 08:00
}
}
//获取最近7天的日期和礼拜天数
export function initData(appointedDay = '', dayNames) {
export function initData(appointedDay = '') {
const time = []
const date = appointedDay ? new Date(appointedDay) : new Date()
const now = date.getTime() //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000 //一天的时间戳
const defaults = dayNames || { today: "今天", tomorrow: "明天", dayAfterTomorrow: "后天" }
let obj = {
0: defaults.today,
1: defaults.tomorrow,
2: defaults.dayAfterTomorrow
0: "今天",
1: "明天",
2: "后天"
}
for (let i = 0; i < 7; i++) {
const timeObj = {}
timeObj.date = timeStamp(now + timeStr * i, dayNames).date //保存日期
timeObj.date = timeStamp(now + timeStr * i).date //保存日期
timeObj.timeStamp = now + timeStr * i //保存时间戳
timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i, dayNames).day) : timeStamp(now + timeStr * i, dayNames)
timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i).day) : timeStamp(now + timeStr * i)
.day
time.push(timeObj)
}

View File

@@ -20,7 +20,7 @@
</scroll-view>
<div class="appointed-day">
<uni-datetime-picker type="date" :start="pickerStartDay" :end="pickerEndDay" @change="change">
<text class="day-box">{{ $lang('yuyueDate.appointedDate') }}</text>
<text class="day-box">指定日期</text>
<text class="iconfont iconyoujiantou"></text>
</uni-datetime-picker>
</div>
@@ -173,7 +173,7 @@
return {
pickerStartDay: '', // 指定开始日期
pickerEndDay: '', // 指定结束日期
orderDateTime: this.$lang('date.noSelection'), // 选中时间
orderDateTime: '暂无选择', // 选中时间
orderTimeArr: {}, //多选的时间
dateArr: [], //日期数据
timeArr: [], //时间数据
@@ -188,16 +188,14 @@
};
},
created(props) {
const dayNames = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
const dayLabels = { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') };
this.selectDate = this.nowDate = currentTime().date;
this.pickerStartDay = currentTime().year + '-' + currentTime().date;
const now = new Date(this.pickerStartDay).getTime(); //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000; //一天的时间戳
let day = 90; // 未来3个月
this.pickerEndDay = timeStamp(now + timeStr * day, dayNames).allDate;
this.pickerEndDay = timeStamp(now + timeStr * day).allDate;
this.initOnload();
this.dateArr = initData('', dayLabels); // 日期栏初始化
this.dateArr = initData(); // 日期栏初始化
},
methods: {
open() {
@@ -211,18 +209,18 @@
let date = e.split("-");
date = date[1] + "-" + date[2];
if (this.disableWeek.length && date >= weekDate()[0] && date <= weekDate()[1]) {
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let index = new Date(e).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({
title: weekBox[index] + this.$lang('date.cannotReserve'),
title: weekBox[index] + '不可以预约',
icon: 'none'
})
return false;
}
}
this.initOnload(e);
this.dateArr = initData(e, { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') }); // 日期栏初始化
this.dateArr = initData(e); // 日期栏初始化
this.selectDateEvent(0, this.dateArr[0]);
},
initOnload(appointedDay) {
@@ -233,7 +231,7 @@
// 判断默认是不能选择的周,则都禁止选中
if (this.disableWeek.length && this.selectDate >= weekDate()[0] && this.selectDate <=
weekDate()[1]) {
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let date = currentTime().year + '-' + this.selectDate;
let index = new Date(date).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
@@ -282,7 +280,7 @@
this.isSection && (item.isInclude = false);
});
this.orderDateTime = isFullTime ? this.$lang('date.noSelection') : this.selectDate;
this.orderDateTime = isFullTime ? '暂无选择' : this.selectDate;
this.timeActive = -1;
for (let i = 0, len = this.timeArr.length; i < len; i++) {
if (!this.timeArr[i].disable) {
@@ -299,11 +297,11 @@
// 日期选择事件
selectDateEvent(index, item) {
if (this.disableWeek.length && item.date >= weekDate()[0] && item.date <= weekDate()[1]) {
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let index = new Date(item.timeStamp).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({
title: weekBox[index] + this.$lang('date.cannotReserve'),
title: weekBox[index] + '不可以预约',
icon: 'none'
})
return false;