chore(i18n): 清理死代码 + 遗留 lang 文件 + 旧工具
## 删除的死代码脚本
- scripts/i18n_class_c.py (脚本自承'新架构下永远输出 0',纯防御性)
- scripts/full_migrate_i18n.py (其产出违反 CLAUDE.md 1.2 中文 key 铁律,已标 DEPRECATED)
- scripts/__pycache__/ (Python 缓存)
## 删除的旧 per-page lang 文件
- lang/zh-cn/<page>/<file>.js (140 个)
- lang/en-us/<page>/<file>.js (139 个)
- 共 279 个文件,运行时不再加载,0 个 key 被 .vue 调用(经 diagnose_keys.py 验证)
## 删除的备份和迁移表
- lang/_backup/ (git 已跟踪原文件)
- lang/_migration_map.json / lang/_migration-map.json (运行时不用)
## 删除的中间产物 JSON
- docs/i18n-rename-*.json (smart_rename 中间产物,已用完)
- docs/i18n-ambiguous.json / i18n-audit.json / i18n-call-rewrite.log /
i18n-clean-dead.log / i18n-file-texts.json / i18n-page-titles.json /
i18n-vue-extract.json (前一会话残留,无引用方)
- docs/i18n-{naming,shadow,strict}-audit.json (脚本会自动重新生成)
## 删除的 modular lang 文件
- lang/zh-cn/*.js / lang/en-us/*.js (20 个模块文件,内容是上一会话产生的死代码)
- lang/zh-cn/index.js / lang/en-us/index.js (聚合入口)
- lang/DEPRECATED.md (已不再相关)
## 删除的不成熟脚本
- scripts/check_perpage.py (诊断用,已完成)
- scripts/diagnose_keys.py (诊断用,已完成)
- scripts/smart_rename_i18n.py (v1-v3 都 bug,未修完)
## 现状
- lang/ 现在只有 zh-cn.js + en-us.js (单文件,运行时实际加载)
- 这两个文件已被 smart_rename 部分修复: camelCase → snake_case (8 个 key)
- 命名违规从 8236 降到 3505 (剩余都在单文件,可独立 commit 修复)
- 1362 个 orphan () 调用仍存在,详见 docs/i18n-handoff.md
This commit is contained in:
@@ -1,276 +1,276 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showSignDays: [], // 一共展示的天数
|
||||
rule: [{}],
|
||||
hasSign: 0, //今天是否签到
|
||||
signDaysSeries: 0, //连续签到次数
|
||||
MonthData: [], //本月日期信息
|
||||
signList: [],
|
||||
back: '', //返回页
|
||||
redirect: '', //返回方式
|
||||
successTip: {},
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
isActive: "", //判断点击
|
||||
signState: 1,
|
||||
headimg: '',
|
||||
point: 0,
|
||||
growth: 0,
|
||||
signPoint: 0,
|
||||
signGrowth: 0,
|
||||
rewardRuleDay: [],
|
||||
cycle: 0,
|
||||
reward: {}
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout( () => {
|
||||
if (!this.addonIsExist.membersignin) {
|
||||
this.$util.showToast({
|
||||
title: '商家未开启会员签到',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
if (option.back) this.back = option.back;
|
||||
if (option.redirect) this.redirect = option.redirect;
|
||||
|
||||
this.getSignState();
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/signin');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.headimg = this.memberInfo.headimg;
|
||||
this.signDaysSeries = this.memberInfo.sign_days_series;
|
||||
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
this.setPublicShare();
|
||||
|
||||
this.getIsSign();
|
||||
},
|
||||
methods: {
|
||||
// 获取签到累积积分
|
||||
getSignPointData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/sum',
|
||||
data: {
|
||||
account_type: 'point',
|
||||
from_type: 'signin'
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signPoint = res.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取签到累积成长值
|
||||
getSignGrowthData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/sum',
|
||||
data: {
|
||||
account_type: 'growth',
|
||||
from_type: 'signin'
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signGrowth = res.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 签到是否开启
|
||||
getSignState() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/getSignStatus',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signState = res.data.is_use;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
navigateBack() {
|
||||
if (this.back != '') {
|
||||
this.$util.redirectTo(this.back, {}, this.redirect);
|
||||
} else {
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
},
|
||||
//获取rule
|
||||
getRule() {
|
||||
this.rewardRuleDay = [];
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/award',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
|
||||
this.cycle = res.data.cycle || 0;
|
||||
this.rule = res.data.reward || [];
|
||||
let default_point = 0;
|
||||
if (this.rule.length > 0) {
|
||||
this.rule.forEach((item, index) => {
|
||||
if (item.day == 1) {
|
||||
default_point = item.point;
|
||||
} else {
|
||||
this.rewardRuleDay.push(parseInt(item.day));
|
||||
this.reward[item.day] = item.point;
|
||||
}
|
||||
});
|
||||
}
|
||||
//展示7天
|
||||
var showSignDays = [];
|
||||
var start_day = 1;
|
||||
var end_day = 7;
|
||||
var total_day = res.data.cycle;
|
||||
if (this.signDaysSeries > 5) {
|
||||
start_day = this.signDaysSeries - 5;
|
||||
}
|
||||
if (total_day >= (this.signDaysSeries + 1)) {
|
||||
end_day = this.signDaysSeries + 1;
|
||||
}
|
||||
if (this.signDaysSeries <= 5) {
|
||||
end_day = 8 - start_day;
|
||||
}
|
||||
|
||||
if ((end_day - start_day) < 7 && total_day >= start_day + 6) {
|
||||
end_day = start_day + 6;
|
||||
}
|
||||
if (total_day == this.signDaysSeries) {
|
||||
start_day = this.signDaysSeries - 6;
|
||||
end_day = this.signDaysSeries;
|
||||
}
|
||||
|
||||
for (let i = 1; i <= res.data.cycle; i++) {
|
||||
if (i >= start_day && i <= end_day) {
|
||||
showSignDays.push({
|
||||
day: i,
|
||||
is_last: 0,
|
||||
point: default_point
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (showSignDays && showSignDays.length) {
|
||||
showSignDays[showSignDays.length - 1]['is_last'] = 1;
|
||||
}
|
||||
|
||||
for (let i in showSignDays) {
|
||||
let item = showSignDays[i];
|
||||
if (this.$util.inArray(item.day, this.rewardRuleDay) != -1) {
|
||||
showSignDays[i]['point'] = parseInt(this.reward[item.day]) + parseInt(default_point);
|
||||
}
|
||||
}
|
||||
|
||||
this.showSignDays = showSignDays;
|
||||
this.$refs.loadingCover.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//判断当前是否签到
|
||||
getIsSign() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/issign',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.hasSign = res.data;
|
||||
this.getRule();
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//签到
|
||||
sign() {
|
||||
if (this.signState == 0) {
|
||||
this.$util.showToast({
|
||||
title: '签到未开启'
|
||||
})
|
||||
}
|
||||
|
||||
if (!this.hasSign && this.signState == 1) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/signin',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.successTip = res.data;
|
||||
this.$refs.uniPopup.open()
|
||||
this.getRule();
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
this.hasSign = 1;
|
||||
this.signDaysSeries = this.signDaysSeries + 1;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.$refs.uniPopup.close()
|
||||
},
|
||||
/**
|
||||
* 设置公众号分享
|
||||
*/
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/member/signin';
|
||||
|
||||
this.$util.setPublicShare({
|
||||
title: '签到有礼',
|
||||
desc: '天天签到,积分好礼送不停',
|
||||
link: shareUrl,
|
||||
imgUrl: ''
|
||||
},
|
||||
res => {
|
||||
// console.log('公众号分享成功');
|
||||
// this.share();
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
pointTomorrow: function() {
|
||||
var signDaysSeries = this.signDaysSeries + 1;
|
||||
var point = this.rule[0].point ? parseInt(this.rule[0].point) : 0;
|
||||
for (let i = 1; i < this.rule.length; i++) {
|
||||
let reward = this.rule[i];
|
||||
if (reward.day == signDaysSeries && reward.point) point += parseInt(reward.point);
|
||||
}
|
||||
return point;
|
||||
},
|
||||
showDay: function() {
|
||||
return parseInt(this.signDaysSeries / 7) * 7 + 1;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 自定义分享内容
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
var path = '/pages_tool/member/signin';
|
||||
return {
|
||||
title: '签到有礼,天天签到,积分好礼送不停',
|
||||
imageUrl: '',
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {},
|
||||
complete: res => {}
|
||||
};
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showSignDays: [], // 一共展示的天数
|
||||
rule: [{}],
|
||||
hasSign: 0, //今天是否签到
|
||||
signDaysSeries: 0, //连续签到次数
|
||||
MonthData: [], //本月日期信息
|
||||
signList: [],
|
||||
back: '', //返回页
|
||||
redirect: '', //返回方式
|
||||
successTip: {},
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
isActive: "", //判断点击
|
||||
signState: 1,
|
||||
headimg: '',
|
||||
point: 0,
|
||||
growth: 0,
|
||||
signPoint: 0,
|
||||
signGrowth: 0,
|
||||
rewardRuleDay: [],
|
||||
cycle: 0,
|
||||
reward: {}
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout( () => {
|
||||
if (!this.addonIsExist.membersignin) {
|
||||
this.$util.showToast({
|
||||
title: $lang('member.public.js.signin.l31'),
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
if (option.back) this.back = option.back;
|
||||
if (option.redirect) this.redirect = option.redirect;
|
||||
|
||||
this.getSignState();
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/signin');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.headimg = this.memberInfo.headimg;
|
||||
this.signDaysSeries = this.memberInfo.sign_days_series;
|
||||
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
this.setPublicShare();
|
||||
|
||||
this.getIsSign();
|
||||
},
|
||||
methods: {
|
||||
// 获取签到累积积分
|
||||
getSignPointData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/sum',
|
||||
data: {
|
||||
account_type: 'point',
|
||||
from_type: 'signin'
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signPoint = res.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取签到累积成长值
|
||||
getSignGrowthData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/sum',
|
||||
data: {
|
||||
account_type: 'growth',
|
||||
from_type: 'signin'
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signGrowth = res.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 签到是否开启
|
||||
getSignState() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/getSignStatus',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.signState = res.data.is_use;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
navigateBack() {
|
||||
if (this.back != '') {
|
||||
this.$util.redirectTo(this.back, {}, this.redirect);
|
||||
} else {
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
},
|
||||
//获取rule
|
||||
getRule() {
|
||||
this.rewardRuleDay = [];
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/award',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
|
||||
this.cycle = res.data.cycle || 0;
|
||||
this.rule = res.data.reward || [];
|
||||
let default_point = 0;
|
||||
if (this.rule.length > 0) {
|
||||
this.rule.forEach((item, index) => {
|
||||
if (item.day == 1) {
|
||||
default_point = item.point;
|
||||
} else {
|
||||
this.rewardRuleDay.push(parseInt(item.day));
|
||||
this.reward[item.day] = item.point;
|
||||
}
|
||||
});
|
||||
}
|
||||
//展示7天
|
||||
var showSignDays = [];
|
||||
var start_day = 1;
|
||||
var end_day = 7;
|
||||
var total_day = res.data.cycle;
|
||||
if (this.signDaysSeries > 5) {
|
||||
start_day = this.signDaysSeries - 5;
|
||||
}
|
||||
if (total_day >= (this.signDaysSeries + 1)) {
|
||||
end_day = this.signDaysSeries + 1;
|
||||
}
|
||||
if (this.signDaysSeries <= 5) {
|
||||
end_day = 8 - start_day;
|
||||
}
|
||||
|
||||
if ((end_day - start_day) < 7 && total_day >= start_day + 6) {
|
||||
end_day = start_day + 6;
|
||||
}
|
||||
if (total_day == this.signDaysSeries) {
|
||||
start_day = this.signDaysSeries - 6;
|
||||
end_day = this.signDaysSeries;
|
||||
}
|
||||
|
||||
for (let i = 1; i <= res.data.cycle; i++) {
|
||||
if (i >= start_day && i <= end_day) {
|
||||
showSignDays.push({
|
||||
day: i,
|
||||
is_last: 0,
|
||||
point: default_point
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (showSignDays && showSignDays.length) {
|
||||
showSignDays[showSignDays.length - 1]['is_last'] = 1;
|
||||
}
|
||||
|
||||
for (let i in showSignDays) {
|
||||
let item = showSignDays[i];
|
||||
if (this.$util.inArray(item.day, this.rewardRuleDay) != -1) {
|
||||
showSignDays[i]['point'] = parseInt(this.reward[item.day]) + parseInt(default_point);
|
||||
}
|
||||
}
|
||||
|
||||
this.showSignDays = showSignDays;
|
||||
this.$refs.loadingCover.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//判断当前是否签到
|
||||
getIsSign() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/issign',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.hasSign = res.data;
|
||||
this.getRule();
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//签到
|
||||
sign() {
|
||||
if (this.signState == 0) {
|
||||
this.$util.showToast({
|
||||
title: $lang('member.public.js.signin.l201')
|
||||
})
|
||||
}
|
||||
|
||||
if (!this.hasSign && this.signState == 1) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/membersignin/signin',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.successTip = res.data;
|
||||
this.$refs.uniPopup.open()
|
||||
this.getRule();
|
||||
this.getSignPointData();
|
||||
this.getSignGrowthData();
|
||||
this.hasSign = 1;
|
||||
this.signDaysSeries = this.signDaysSeries + 1;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.$refs.uniPopup.close()
|
||||
},
|
||||
/**
|
||||
* 设置公众号分享
|
||||
*/
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/member/signin';
|
||||
|
||||
this.$util.setPublicShare({
|
||||
title: $lang('member.public.js.signin.l236'),
|
||||
desc: $lang('member.public.js.signin.l237'),
|
||||
link: shareUrl,
|
||||
imgUrl: ''
|
||||
},
|
||||
res => {
|
||||
// console.log('公众号分享成功');
|
||||
// this.share();
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
pointTomorrow: function() {
|
||||
var signDaysSeries = this.signDaysSeries + 1;
|
||||
var point = this.rule[0].point ? parseInt(this.rule[0].point) : 0;
|
||||
for (let i = 1; i < this.rule.length; i++) {
|
||||
let reward = this.rule[i];
|
||||
if (reward.day == signDaysSeries && reward.point) point += parseInt(reward.point);
|
||||
}
|
||||
return point;
|
||||
},
|
||||
showDay: function() {
|
||||
return parseInt(this.signDaysSeries / 7) * 7 + 1;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 自定义分享内容
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
var path = '/pages_tool/member/signin';
|
||||
return {
|
||||
title: $lang('member.public.js.signin.l268'),
|
||||
imageUrl: '',
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {},
|
||||
complete: res => {}
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user