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,139 +1,139 @@
|
||||
<template>
|
||||
<view :style="themeColor" class="page">
|
||||
<view class="notice-title">{{ detail.title }}</view>
|
||||
<view class="notice-meta">
|
||||
<text class="notice-time">发表时间: {{ $util.timeStampTurnTime(detail.create_time) }}</text>
|
||||
</view>
|
||||
<view class="notice-content"><rich-text :nodes="content"></rich-text></view>
|
||||
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
|
||||
<!-- 隐私弹窗 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import htmlParser from '@/common/js/html-parser';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
noticeId: 0,
|
||||
content: '',
|
||||
detail: {}
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.noticeId = options.notice_id || 0;
|
||||
// 小程序扫码进入
|
||||
if (options.scene) {
|
||||
var sceneParams = decodeURIComponent(options.scene);
|
||||
this.noticeId = sceneParams.split('-')[1];
|
||||
}
|
||||
if (this.noticeId == 0) {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/notice/info',
|
||||
data: {
|
||||
id: this.noticeId
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data) {
|
||||
this.detail = res.data;
|
||||
this.content = htmlParser(res.data.content);
|
||||
this.$langConfig.title(this.detail.title);
|
||||
this.setPublicShare();
|
||||
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/notice/detail?notice_id=' + this.noticeId;
|
||||
this.$util.setPublicShare({
|
||||
title: this.detail.title,
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) :
|
||||
''
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '[公告]' + this.detail.title;
|
||||
var path = '/pages_tool/notice/detail?notice_id=' + this.noticeId;
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
};
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
var title = this.detail.title;
|
||||
var query = 'notice_id=' + this.noticeId;
|
||||
return {
|
||||
title: title,
|
||||
query: query,
|
||||
imageUrl: ''
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
font-size: $font-size-toolbar;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.notice-content {
|
||||
margin-top: $margin-updown;
|
||||
word-break: break-all;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
|
||||
.notice-meta {
|
||||
text-align: left;
|
||||
margin-top: $margin-updown;
|
||||
color: $color-tip;
|
||||
|
||||
.notice-time {
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
<template>
|
||||
<view :style="themeColor" class="page">
|
||||
<view class="notice-title">{{ detail.title }}</view>
|
||||
<view class="notice-meta">
|
||||
<text class="notice-time">发表时间: {{ $util.timeStampTurnTime(detail.create_time) }}</text>
|
||||
</view>
|
||||
<view class="notice-content"><rich-text :nodes="content"></rich-text></view>
|
||||
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
|
||||
<!-- 隐私弹窗 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import htmlParser from '@/common/js/html-parser';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
noticeId: 0,
|
||||
content: '',
|
||||
detail: {}
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.noticeId = options.notice_id || 0;
|
||||
// 小程序扫码进入
|
||||
if (options.scene) {
|
||||
var sceneParams = decodeURIComponent(options.scene);
|
||||
this.noticeId = sceneParams.split('-')[1];
|
||||
}
|
||||
if (this.noticeId == 0) {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/notice/info',
|
||||
data: {
|
||||
id: this.noticeId
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data) {
|
||||
this.detail = res.data;
|
||||
this.content = htmlParser(res.data.content);
|
||||
this.$langConfig.title(this.detail.title);
|
||||
this.setPublicShare();
|
||||
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
fail: res => {
|
||||
this.$util.redirectTo('/pages_tool/notice/list', {}, 'redirectTo');
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/notice/detail?notice_id=' + this.noticeId;
|
||||
this.$util.setPublicShare({
|
||||
title: this.detail.title,
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) :
|
||||
''
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = $lang('notice.detail.l87') + this.detail.title;
|
||||
var path = '/pages_tool/notice/detail?notice_id=' + this.noticeId;
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
};
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
var title = this.detail.title;
|
||||
var query = 'notice_id=' + this.noticeId;
|
||||
return {
|
||||
title: title,
|
||||
query: query,
|
||||
imageUrl: ''
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
font-size: $font-size-toolbar;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.notice-content {
|
||||
margin-top: $margin-updown;
|
||||
word-break: break-all;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
|
||||
.notice-meta {
|
||||
text-align: left;
|
||||
margin-top: $margin-updown;
|
||||
color: $color-tip;
|
||||
|
||||
.notice-time {
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,182 +1,182 @@
|
||||
<template>
|
||||
<view :style="themeColor">
|
||||
<mescroll-uni @getData="getData" ref="mescroll" :style="tabBarPagePaddingStyle">
|
||||
<block slot="list">
|
||||
<view class="notice-list" v-if="dataList.length">
|
||||
<view class="notice-item" @click="jumpDetail(item.id)" v-for="(item, index) in dataList"
|
||||
:key="index">
|
||||
<view class="title-info">
|
||||
<view class="title">
|
||||
<text v-if="item.is_top == 1" class="color-base-bg tag">置顶</text>
|
||||
<text class="txt using-hidden">{{ item.title }}</text>
|
||||
</view>
|
||||
<text class="release-time">{{ $util.timeStampTurnTime(item.create_time, 1) }}</text>
|
||||
<view class="iconfont icon-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="cart-empty"><ns-empty text="暂无公告" :isIndex="false"></ns-empty></view>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
|
||||
<!-- 隐私弹窗 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
|
||||
<!-- 底部tabBar -->
|
||||
<view id="tab-bar">
|
||||
<diy-bottom-nav></diy-bottom-nav>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.setPublicShare();
|
||||
},
|
||||
methods: {
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/notice/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
|
||||
this.dataList = this.dataList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
jumpDetail(e) {
|
||||
this.$util.redirectTo('/pages_tool/notice/detail?notice_id=' + e);
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/notice/list';
|
||||
this.$util.setPublicShare({
|
||||
title: '公告',
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) : ''
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '公告';
|
||||
var path = '/pages_tool/notice/list';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => { },
|
||||
fail: res => { }
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.cart-empty {
|
||||
padding-top: 308rpx;
|
||||
}
|
||||
|
||||
.notice-list {
|
||||
.notice-item {
|
||||
margin: $margin-updown $margin-both;
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
padding: 32rpx 34rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
|
||||
.title-info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
flex: 6;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.txt {
|
||||
color: #000;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
|
||||
.tag {
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
line-height: 28rpx;
|
||||
border-radius: 6rpx;
|
||||
padding: 2rpx 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.release-time {
|
||||
flex: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-left: 20rpx;
|
||||
color: $color-tip;
|
||||
text-align: right;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: $color-tip;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-top: 10rpx;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
color: $color-tip;
|
||||
font-size: $font-size-goods-tag;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
<template>
|
||||
<view :style="themeColor">
|
||||
<mescroll-uni @getData="getData" ref="mescroll" :style="tabBarPagePaddingStyle">
|
||||
<block slot="list">
|
||||
<view class="notice-list" v-if="dataList.length">
|
||||
<view class="notice-item" @click="jumpDetail(item.id)" v-for="(item, index) in dataList"
|
||||
:key="index">
|
||||
<view class="title-info">
|
||||
<view class="title">
|
||||
<text v-if="item.is_top == 1" class="color-base-bg tag">{{ $lang("notice.list.l10") }}</text>
|
||||
<text class="txt using-hidden">{{ item.title }}</text>
|
||||
</view>
|
||||
<text class="release-time">{{ $util.timeStampTurnTime(item.create_time, 1) }}</text>
|
||||
<view class="iconfont icon-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="cart-empty"><ns-empty text="暂无公告" :isIndex="false"></ns-empty></view>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
|
||||
<!-- 隐私弹窗 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
|
||||
<!-- 底部tabBar -->
|
||||
<view id="tab-bar">
|
||||
<diy-bottom-nav></diy-bottom-nav>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataList: []
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.setPublicShare();
|
||||
},
|
||||
methods: {
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/notice/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
|
||||
this.dataList = this.dataList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
jumpDetail(e) {
|
||||
this.$util.redirectTo('/pages_tool/notice/detail?notice_id=' + e);
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/notice/list';
|
||||
this.$util.setPublicShare({
|
||||
title: $lang('diy.diy-notice.l45.t0'),
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) : ''
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = $lang('diy.diy-notice.l45.t0');
|
||||
var path = '/pages_tool/notice/list';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => { },
|
||||
fail: res => { }
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.cart-empty {
|
||||
padding-top: 308rpx;
|
||||
}
|
||||
|
||||
.notice-list {
|
||||
.notice-item {
|
||||
margin: $margin-updown $margin-both;
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
padding: 32rpx 34rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
|
||||
.title-info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
flex: 6;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.txt {
|
||||
color: #000;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
|
||||
.tag {
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
line-height: 28rpx;
|
||||
border-radius: 6rpx;
|
||||
padding: 2rpx 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.release-time {
|
||||
flex: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-left: 20rpx;
|
||||
color: $color-tip;
|
||||
text-align: right;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: $color-tip;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-top: 10rpx;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
color: $color-tip;
|
||||
font-size: $font-size-goods-tag;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user