Files
lucky_shop/pages_tool/seal/medium/detail.vue
ZF sun 4ae21c5d7a refactor: 完成多语言国际化全量替换与补充
1. 新增大量中英文语言包文件,覆盖自定义组件、页面、工具类的文案
2. 替换硬编码文本为多语言调用,统一全局文案管理
3. 优化语言包结构,拆分公共模块与业务模块
4. 修复部分语言加载与国际化适配问题
2026-06-26 17:32:35 +08:00

201 lines
4.8 KiB
Vue

<template>
<view>
<view class="content">
<view class="goods-attr">
<view class="title">{{title}}</view>
<view class="attr-wrap">
<block v-for="(item, index) in list" :key="index">
<view class="item">
<text class="attr-name" :style="{background: item.background}">{{item.text}}</text>
<text class="value-name" :style="{color: item.color}">{{item.value}}</text>
</view>
</block>
</view>
</view>
<block v-if="g0>0">
<view class="foot">
<view @tap="generateImage" class="item" style="margin-right:30rpx;">{{ $lang('seal.medium.detail.exportImage') }}</view>
<view @tap="generatePdf" class="item">{{ $lang('seal.medium.detail.exportPdf') }}</view>
</view>
</block>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: "",
info: {},
list: [],
keyword: "",
g0: 1 // 默认显示导出按钮
};
},
computed: {
themeColor() {
return '#ffffff';
}
},
onLoad(options) {
this.title = this.$lang('seal.medium.detail.title');
if (options.keyword) {
this.keyword = options.keyword;
}
this.getdata();
},
onShow() {
// 页面显示时执行
},
methods: {
generatePdf() {
const url = this.$util.img(this.info.files_url);
uni.showLoading({ title: this.$lang('seal.medium.detail.loading') });
try {
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
uni.hideLoading();
const filePath = res.tempFilePath;
uni.shareFileMessage({
filePath: filePath,
success: () => {},
fail: console.error
});
}
},
fail: () => {
uni.hideLoading();
},
complete: (res) => {
if (res.statusCode === 404) {
uni.showToast({ title: this.$lang('seal.medium.detail.fileNotExist'), icon: 'none' });
}
}
});
} catch (error) {
uni.hideLoading();
}
},
generateImage() {
const url = this.$util.img(this.info.img_url);
uni.showLoading({ title: this.$lang('seal.medium.detail.loading') });
uni.downloadFile({
url: url,
success: (res) => {
uni.hideLoading();
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
this.$util.showToast({ title: this.$lang('seal.medium.detail.saveSuccess') });
},
fail: (err) => {
if (err.errMsg !== 'saveImageToPhotosAlbum:fail auth deny' && err.errMsg !== 'saveImageToPhotosAlbum:fail:auth denied') {
this.$util.showToast({ title: this.$lang('seal.medium.detail.saveFailed') });
}
}
});
} else {
this.$util.showToast({ title: this.$lang('seal.medium.detail.downloadFailed') });
}
},
fail: (err) => {
uni.hideLoading();
this.$util.showToast({ title: this.$lang('seal.medium.detail.downloadFailed') });
}
});
},
getdata() {
this.$api.sendRequest({
url: '/api/seal/info',
data: { keyword: this.keyword },
success: (res) => {
this.list = res.value;
this.info = res;
this.title = res.name;
}
});
}
}
};
</script>
<style scoped>
.content {
padding: 20rpx;
}
.goods-attr {
margin: 24rpx 20rpx;
background-color: #fff;
border-radius: 16rpx;
overflow: hidden;
}
.goods-attr .title {
height: 70rpx;
line-height: 70rpx;
box-sizing: border-box;
font-size: 32rpx;
margin: 0 20rpx;
text-align: center;
font-weight: 600;
color: #000;
}
.goods-attr .attr-wrap {
margin: 20rpx;
border: 2rpx solid #f1f1f1;
overflow: hidden;
}
.goods-attr .attr-wrap .item {
display: flex;
border-bottom: 2rpx solid #f1f1f1;
}
.goods-attr .attr-wrap .item:last-child {
border-bottom: 0;
}
.goods-attr .attr-wrap .item .attr-name {
width: 200rpx;
padding-right: 30rpx;
background-color: #fbfafa;
white-space: pre-wrap;
border-right: 2rpx solid #f1f1f1;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
text-align: right;
font-weight: 600;
}
.goods-attr .attr-wrap .item .value-name {
padding-left: 30rpx;
white-space: pre-wrap;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
flex: 1;
width: 0;
}
.foot {
display: flex;
margin: 40rpx 20rpx;
}
.foot .item {
width: 50%;
text-align: center;
background: #ff4646;
padding: 10rpx 0;
color: #fff;
border-radius: 10rpx;
}
</style>