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:
2026-06-25 10:48:15 +08:00
parent a74263016b
commit 5f41febd70
516 changed files with 79257 additions and 50306 deletions

View File

@@ -1,255 +1,255 @@
<template>
<view class="container" :style="themeColor">
<view class="head-wrap" v-if="storeToken">
<text @click="manageFootprint">{{ manage ? '完成' : '管理' }}</text>
</view>
<mescroll-uni ref="mescroll" @getData="getListData" top="110rpx">
<block slot="list">
<view class="goods-list single-column" v-if="goodsList.length > 0">
<view v-for="(item, index) in goodsList" :key="index">
<view class="datetime">{{ datetime(item) }}</view>
<view class="goods-item" :class="{ manage: manage }">
<view class="checkbox-wrap" v-if="manage" @click="singleElection(item)">
<text class="iconfont" :class="$util.inArray(item.id, idArr) != -1 ? 'icon-yuan_checked color-base-text' : 'icon-yuan_checkbox'"></text>
</view>
<view class="goods-img" @click="toDetail(item)">
<image :src="goodsImg(item.goods_image)" mode="widthFix" @error="imgError(index)" show-menu-by-longpress ></image>
<view class="color-base-bg goods-tag" v-if="goodsTag(item) != ''">{{ goodsTag(item) }}</view>
</view>
<view class="info-wrap" @click="toDetail(item)">
<view class="name-wrap">
<view class="goods-name">{{ isEnEnv ? item.en_goods_name : item.goods_name }}</view>
</view>
<view class="lineheight-clear">
<view class="discount-price">
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
<text class="price price-style large">{{ parseFloat(showPrice(item)).toFixed(2).split('.')[0] }}</text>
<text class="unit price-style small">.{{ parseFloat(showPrice(item)).toFixed(2).split('.')[1] }}</text>
</view>
<view class="member-price-tag" v-if="item.member_price && item.member_price == showPrice(item)">
<image :src="$util.img('public/uniapp/index/VIP.png')" mode="widthFix" show-menu-by-longpress ></image>
</view>
<view class="member-price-tag" v-else-if="item.promotion_type == 1">
<image :src="$util.img('public/uniapp/index/discount.png')" mode="widthFix" show-menu-by-longpress ></image>
</view>
</view>
<view class="pro-info">
<view class="delete-price font-size-activity-tag color-tip price-font" v-if="showMarketPrice(item)">
<text class="unit">{{ $lang('common.currencySymbol') }}</text>
<text>{{ showMarketPrice(item) }}</text>
</view>
<view class="sale font-size-activity-tag color-tip" v-if="item.sale_show">已售{{ item.sale_num }}{{ item.unit ? item.unit : '件' }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="footprint-empty" v-else>
<ns-empty text="暂无浏览过的商品" subText="赶紧去逛逛, 发现更多商品吧" :isIndex="Boolean(storeToken)" :emptyBtn="{ text: $lang('toGoodsCategoryPage'), url: '/pages_goods/category' }"></ns-empty>
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
@click="toLogin">{{ $lang('toLogin') }}</button>
</view>
<view class="bottom-wrap" v-if="goodsList.length && manage">
<view class="all-election" @click="allElection">
<view class="iconfont" :class="isAll ? 'icon-yuan_checked color-base-text' : 'icon-yuan_checkbox'"></view>
<text>全选</text>
</view>
<view class="action-btn"><button type="primary" @click="deleteFootprint()" class="delete" :class="{ disabled: selected }">删除</button></view>
</view>
</block>
</mescroll-uni>
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
var dateList = [];
import common from './public/js/common.js';
export default {
mixins: [common],
data() {
return {
goodsList: [],
current: -1,
manage: false,
idArr: [],
mescroll: null,
isSub: false,
};
},
onShow() {
if (this.storeToken) {
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
} else {
this.$nextTick(() => {
this.$refs.loadingCover.hide();
});
}
},
computed: {
selected() {
return this.idArr.length == 0;
},
isAll() {
return this.idArr.length == this.goodsList.length;
}
},
methods: {
getListData(mescroll) {
this.mescroll = mescroll;
this.$api.sendRequest({
url: '/api/goodsbrowse/page',
data: {
page: mescroll.num,
page_size: mescroll.size
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) this.goodsList = []; //如果是第一页需手动制空列表
this.goodsList = this.goodsList.concat(newArr); //追加新数据
dateList = [];
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
longpress(index) {
this.current = index;
},
deleteFootprint() {
if (this.idArr.length == 0) {
this.$util.showToast({
title: '请选择要删除的数据!'
});
return;
}
if (this.isSub) return;
this.isSub = true;
this.$api.sendRequest({
url: '/api/goodsbrowse/delete',
data: {
id: this.idArr.toString()
},
success: res => {
this.isSub = false;
if (res.code >= 0) {
this.idArr = [];
this.mescroll.resetUpScroll();
} else {
this.$util.showToast({
title: res.message
});
}
}
});
},
manageFootprint() {
this.manage = !this.manage;
dateList = [];
},
goodsImg(imgStr) {
let imgs = imgStr.split(',');
return imgs[0]
? this.$util.img(imgs[0], {
size: 'mid'
})
: this.$util.getDefaultImage().goods;
},
imgError(index) {
dateList = [];
this.goodsList[index].goods_image = this.$util.getDefaultImage().goods;
},
showPrice(data) {
let price = data.discount_price;
if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price;
return price;
},
showMarketPrice(item) {
if (item.market_price_show) {
let price = this.showPrice(item);
if (item.market_price > 0) {
return item.market_price;
} else if (parseFloat(item.price) > parseFloat(price)) {
return item.price;
}
}
return '';
},
goodsTag(data) {
return data.label_name || '';
},
datetime(item) {
let date = new Date();
date.setTime(item.browse_time * 1000);
let y = date.getFullYear();
let m = date.getMonth() + 1;
m = m < 10 ? '0' + m : m;
let d = date.getDate();
d = d < 10 ? '0' + d : d;
var dateTime = y + '/' + m + '/' + d;
if (this.$util.inArray(dateTime, dateList) == -1) {
dateList.push(dateTime);
return dateTime;
}
},
singleElection(item) {
if (this.$util.inArray(item.id, this.idArr) == -1) {
this.idArr.push(item.id);
} else {
this.idArr.splice(this.$util.inArray(item.id, this.idArr), 1);
}
dateList = [];
},
allElection() {
if (this.idArr.length != this.goodsList.length) {
this.idArr = [];
let ids = [];
this.goodsList.forEach(item => {
ids.push(item.id);
});
this.idArr = ids;
} else {
this.idArr = [];
}
dateList = [];
},
toDetail(e) {
this.$util.redirectTo('/pages_goods/detail', {
goods_id: e.goods_id
});
}
},
watch: {
storeToken: function(nVal, oVal) {
if (nVal) {
this.$refs.mescroll.refresh();
}
}
}
};
</script>
<style lang="scss">
::v-deep .empty {
margin-top: 0 !important;
}
@import './public/css/footprint.scss';
</style>
<template>
<view class="container" :style="themeColor">
<view class="head-wrap" v-if="storeToken">
<text @click="manageFootprint">{{ manage ? '完成' : $lang('member.footprint.l4') }}</text>
</view>
<mescroll-uni ref="mescroll" @getData="getListData" top="110rpx">
<block slot="list">
<view class="goods-list single-column" v-if="goodsList.length > 0">
<view v-for="(item, index) in goodsList" :key="index">
<view class="datetime">{{ datetime(item) }}</view>
<view class="goods-item" :class="{ manage: manage }">
<view class="checkbox-wrap" v-if="manage" @click="singleElection(item)">
<text class="iconfont" :class="$util.inArray(item.id, idArr) != -1 ? 'icon-yuan_checked color-base-text' : 'icon-yuan_checkbox'"></text>
</view>
<view class="goods-img" @click="toDetail(item)">
<image :src="goodsImg(item.goods_image)" mode="widthFix" @error="imgError(index)" show-menu-by-longpress ></image>
<view class="color-base-bg goods-tag" v-if="goodsTag(item) != ''">{{ goodsTag(item) }}</view>
</view>
<view class="info-wrap" @click="toDetail(item)">
<view class="name-wrap">
<view class="goods-name">{{ isEnEnv ? item.en_goods_name : item.goods_name }}</view>
</view>
<view class="lineheight-clear">
<view class="discount-price">
<text class="unit price-style small">{{ $lang('common.currency_symbol') }}</text>
<text class="price price-style large">{{ parseFloat(showPrice(item)).toFixed(2).split('.')[0] }}</text>
<text class="unit price-style small">.{{ parseFloat(showPrice(item)).toFixed(2).split('.')[1] }}</text>
</view>
<view class="member-price-tag" v-if="item.member_price && item.member_price == showPrice(item)">
<image :src="$util.img('public/uniapp/index/VIP.png')" mode="widthFix" show-menu-by-longpress ></image>
</view>
<view class="member-price-tag" v-else-if="item.promotion_type == 1">
<image :src="$util.img('public/uniapp/index/discount.png')" mode="widthFix" show-menu-by-longpress ></image>
</view>
</view>
<view class="pro-info">
<view class="delete-price font-size-activity-tag color-tip price-font" v-if="showMarketPrice(item)">
<text class="unit">{{ $lang('common.currency_symbol') }}</text>
<text>{{ showMarketPrice(item) }}</text>
</view>
<view class="sale font-size-activity-tag color-tip" v-if="item.sale_show">{ $lang("goods.detail.l18") } item.sale_num }}{{ item.unit ? item.unit : $lang('common.ns-goods-sku.ns-goods-sku-index.l150.t0') }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="footprint-empty" v-else>
<ns-empty text=$lang("member.footprint.l49") subText="赶紧去逛逛, 发现更多商品吧" :isIndex="Boolean(storeToken)" :emptyBtn="{ text: $lang('common.empty.goShopping'), url: '/pages_goods/category' }"></ns-empty>
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
@click="toLogin">{{ $lang('login.list.to_login') }}</button>
</view>
<view class="bottom-wrap" v-if="goodsList.length && manage">
<view class="all-election" @click="allElection">
<view class="iconfont" :class="isAll ? 'icon-yuan_checked color-base-text' : 'icon-yuan_checkbox'"></view>
<text>{{ $lang("member.footprint.l57") }}</text>
</view>
<view class="action-btn"><button type="primary" @click="deleteFootprint()" class="delete" :class="{ disabled: selected }">{{ $lang("member.footprint.l59") }}</button></view>
</view>
</block>
</mescroll-uni>
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
var dateList = [];
import common from './public/js/common.js';
export default {
mixins: [common],
data() {
return {
goodsList: [],
current: -1,
manage: false,
idArr: [],
mescroll: null,
isSub: false,
};
},
onShow() {
if (this.storeToken) {
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
} else {
this.$nextTick(() => {
this.$refs.loadingCover.hide();
});
}
},
computed: {
selected() {
return this.idArr.length == 0;
},
isAll() {
return this.idArr.length == this.goodsList.length;
}
},
methods: {
getListData(mescroll) {
this.mescroll = mescroll;
this.$api.sendRequest({
url: '/api/goodsbrowse/page',
data: {
page: mescroll.num,
page_size: mescroll.size
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) this.goodsList = []; //如果是第一页需手动制空列表
this.goodsList = this.goodsList.concat(newArr); //追加新数据
dateList = [];
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
longpress(index) {
this.current = index;
},
deleteFootprint() {
if (this.idArr.length == 0) {
this.$util.showToast({
title: $lang('member.footprint.l137')
});
return;
}
if (this.isSub) return;
this.isSub = true;
this.$api.sendRequest({
url: '/api/goodsbrowse/delete',
data: {
id: this.idArr.toString()
},
success: res => {
this.isSub = false;
if (res.code >= 0) {
this.idArr = [];
this.mescroll.resetUpScroll();
} else {
this.$util.showToast({
title: res.message
});
}
}
});
},
manageFootprint() {
this.manage = !this.manage;
dateList = [];
},
goodsImg(imgStr) {
let imgs = imgStr.split(',');
return imgs[0]
? this.$util.img(imgs[0], {
size: 'mid'
})
: this.$util.getDefaultImage().goods;
},
imgError(index) {
dateList = [];
this.goodsList[index].goods_image = this.$util.getDefaultImage().goods;
},
showPrice(data) {
let price = data.discount_price;
if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price;
return price;
},
showMarketPrice(item) {
if (item.market_price_show) {
let price = this.showPrice(item);
if (item.market_price > 0) {
return item.market_price;
} else if (parseFloat(item.price) > parseFloat(price)) {
return item.price;
}
}
return '';
},
goodsTag(data) {
return data.label_name || '';
},
datetime(item) {
let date = new Date();
date.setTime(item.browse_time * 1000);
let y = date.getFullYear();
let m = date.getMonth() + 1;
m = m < 10 ? '0' + m : m;
let d = date.getDate();
d = d < 10 ? '0' + d : d;
var dateTime = y + '/' + m + '/' + d;
if (this.$util.inArray(dateTime, dateList) == -1) {
dateList.push(dateTime);
return dateTime;
}
},
singleElection(item) {
if (this.$util.inArray(item.id, this.idArr) == -1) {
this.idArr.push(item.id);
} else {
this.idArr.splice(this.$util.inArray(item.id, this.idArr), 1);
}
dateList = [];
},
allElection() {
if (this.idArr.length != this.goodsList.length) {
this.idArr = [];
let ids = [];
this.goodsList.forEach(item => {
ids.push(item.id);
});
this.idArr = ids;
} else {
this.idArr = [];
}
dateList = [];
},
toDetail(e) {
this.$util.redirectTo('/pages_goods/detail', {
goods_id: e.goods_id
});
}
},
watch: {
storeToken: function(nVal, oVal) {
if (nVal) {
this.$refs.mescroll.refresh();
}
}
}
};
</script>
<style lang="scss">
::v-deep .empty {
margin-top: 0 !important;
}
@import './public/css/footprint.scss';
</style>