chore(多语言): 部分多语言采用 isEnEnv 变量了判断,后面移植到语言包中

This commit is contained in:
2025-12-29 10:56:04 +08:00
parent f9973d9546
commit 74c7eaf497
7 changed files with 303 additions and 278 deletions

View File

@@ -334,7 +334,11 @@ export default {
let diyDataValue = res.data; let diyDataValue = res.data;
if (diyDataValue.value) { if (diyDataValue.value) {
this.diyData = JSON.parse(diyDataValue.value); this.diyData = JSON.parse(diyDataValue.value);
this.$langConfig.title(this.diyData.global.title);
// 导航栏标题要根据语言环境切换
const title = this.isEnEnv ? this.diyData?.global?.en_title : this.diyData?.global?.title;
if (title) this.$langConfig.title(title);
this.mpCollect = this.diyData.global.mpCollect; this.mpCollect = this.diyData.global.mpCollect;
this.setPublicShare(); this.setPublicShare();
/* if (this.diyData.global.popWindow && this.diyData.global.popWindow.imageUrl) { /* if (this.diyData.global.popWindow && this.diyData.global.popWindow.imageUrl) {

View File

@@ -92,6 +92,8 @@ export default {
} }
} }
if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field
console.log(`字段: ${field}, 值: ${value}`)
return value; return value;
}, },
/** /**

View File

@@ -47,6 +47,7 @@
onLoad() { onLoad() {
//刷新多语言 //刷新多语言
this.$langConfig.refresh(); this.$langConfig.refresh();
uni.hideTabBar(); uni.hideTabBar();
this.getDiyInfo(); this.getDiyInfo();
}, },
@@ -70,6 +71,7 @@
this.diyData = JSON.parse(this.diyData.value); this.diyData = JSON.parse(this.diyData.value);
if (this.$refs.loadingCover) this.$refs.loadingCover.hide(); if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
} }
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
} }
} }

View File

@@ -1,7 +1,8 @@
<template> <template>
<page-meta :page-style="themeColor"></page-meta> <page-meta :page-style="themeColor"></page-meta>
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }" class="page-img"> <view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }" class="page-img">
<view class="site-info-box" v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode"> <view class="site-info-box"
v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
<view class="site-info"> <view class="site-info">
<view class="img-box" v-if="siteInfo.logo_square"> <view class="img-box" v-if="siteInfo.logo_square">
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image> <image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
@@ -11,24 +12,28 @@
<text>{{ followOfficialAccount.welcomeMsg }}</text> <text>{{ followOfficialAccount.welcomeMsg }}</text>
</view> </view>
</view> </view>
<view class="dite-button" @click="officialAccountsOpen">关注公众号</view> <view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号' }}</view>
</view> </view>
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }"> <!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="false"/> <ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="false"/>
</view> --> </view> -->
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl" :scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page"> <diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
<template v-slot:components> <template v-slot:components>
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" :haveTopCategory="true" :followOfficialAccount="followOfficialAccount"/> <diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
</template> </template>
<template v-slot:default> <template v-slot:default>
<ns-copyright v-show="isShowCopyRight" /> <ns-copyright v-show="isShowCopyRight" />
</template> </template>
</diy-index-page> </diy-index-page>
<view v-else class="bg-index" :style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }"> <view v-else class="bg-index"
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" :followOfficialAccount="followOfficialAccount"/> :style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
:followOfficialAccount="followOfficialAccount" />
<ns-copyright v-show="isShowCopyRight" /> <ns-copyright v-show="isShowCopyRight" />
</view> </view>
@@ -43,9 +48,11 @@
<view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==0}}"> <view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==0}}">
<view class="time" style="line-height: 64rpx;">{{clock}}s</view> <view class="time" style="line-height: 64rpx;">{{clock}}s</view>
</view> --> </view> -->
<swiper autoplay="true" :circular="true" indicator-active-color="#fff" indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000"> <swiper autoplay="true" :circular="true" indicator-active-color="#fff"
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
<swiper-item v-for="(item, index) in adv.list" :key="index"> <swiper-item v-for="(item, index) in adv.list" :key="index">
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%" :src="$util.img(item.imageUrl)" width="100%"></image> <image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
:src="$util.img(item.imageUrl)" width="100%"></image>
<!-- <image bindtap="adverclose" class="slide-image" height="100%" src="{{item.imgurl}}" width="100%" wx:if="{{item.click==1}}"></image> --> <!-- <image bindtap="adverclose" class="slide-image" height="100%" src="{{item.imgurl}}" width="100%" wx:if="{{item.click==1}}"></image> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
@@ -85,7 +92,8 @@
<!-- 收藏 --> <!-- 收藏 -->
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect"> <uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
<view v-if="showTip" class="collectPopupWindow" :style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }"> <view v-if="showTip" class="collectPopupWindow"
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" /> <image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
<text @click="closeCollectPopupWindow">我知道了</text> <text @click="closeCollectPopupWindow">我知道了</text>
</view> </view>
@@ -99,7 +107,8 @@
<view class="position-wrap"> <view class="position-wrap">
<text class="iconfont icon-dizhi"></text> <text class="iconfont icon-dizhi"></text>
<text class="address">{{ currentPosition }}</text> <text class="address">{{ currentPosition }}</text>
<view class="reposition" @click="reposition" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1"> <view class="reposition" @click="reposition"
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
<text class="iconfont icon-dingwei"></text> <text class="iconfont icon-dingwei"></text>
<text>重新定位</text> <text>重新定位</text>
</view> </view>
@@ -110,11 +119,14 @@
<view class="address">{{ nearestStore.show_address }}</view> <view class="address">{{ nearestStore.show_address }}</view>
<view class="distance" v-if="nearestStore.distance"> <view class="distance" v-if="nearestStore.distance">
<text class="iconfont icon-dizhi"></text> <text class="iconfont icon-dizhi"></text>
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' : nearestStore.distance * 1000 + 'm' }}</text> <text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' : nearestStore.distance *
1000 +
'm' }}</text>
</view> </view>
</view> </view>
<button type="primary" @click="enterStore">确认进入</button> <button type="primary" @click="enterStore">确认进入</button>
<view class="other-store" @click="chooseOtherStore" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1"> <view class="other-store" @click="chooseOtherStore"
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
<text>选择其他门店</text> <text>选择其他门店</text>
<text class="iconfont icon-right"></text> <text class="iconfont icon-right"></text>
</view> </view>
@@ -139,10 +151,10 @@
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue'; import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
// #endif // #endif
import diyJs from '@/common/js/diy.js'; import diyJs from '@/common/js/diy.js';
import indexJs from './public/js/index.js';
import toTop from '@/components/toTop/toTop.vue'; import toTop from '@/components/toTop/toTop.vue';
import scroll from '@/common/js/scroll-view.js'; import scroll from '@/common/js/scroll-view.js';
import indexJs from './public/js/index.js';
export default { export default {
components: { components: {
@@ -200,13 +212,13 @@
.small-bot-close i { .small-bot-close i {
font-size: 60rpx; font-size: 60rpx;
} }
</style> </style>
<style scoped> <style scoped>
.swiper /deep/ .uni-swiper-dots-horizontal { .swiper /deep/ .uni-swiper-dots-horizontal {
left: 40%; left: 40%;
bottom: 40px bottom: 40px
} }
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box { .wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none !important; background: none !important;
} }
@@ -244,5 +256,4 @@
bottom: 180rpx !important; bottom: 180rpx !important;
/* #endif */ /* #endif */
} }
</style> </style>

View File

@@ -1,30 +1,36 @@
<template> <template>
<page-meta :page-style="themeColor"></page-meta> <page-meta :page-style="themeColor"></page-meta>
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }" class="page-img"> <view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }" class="page-img">
<view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }"> <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch"
:style="{ backgroundImage: bgImg }">
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="true" /> <ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="true" />
</view> </view>
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl" :scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page"> <diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" :haveTopCategory="true"/> :scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
:haveTopCategory="true" />
<ns-copyright v-show="isShowCopyRight" /> <ns-copyright v-show="isShowCopyRight" />
</diy-index-page> </diy-index-page>
<view v-else class="bg-index" :style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }"> <view v-else class="bg-index"
:style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" /> <diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" />
<ns-copyright v-show="isShowCopyRight" /> <ns-copyright v-show="isShowCopyRight" />
<view class="foot"> <view class="foot">
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=0')">隐私协议</view> <view class="item" @click="tourl('/pages_tool/agreement/contenr?type=0')">{{ isEnEnv ? 'Privacy Policy' : '隐私协议'}}</view>
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=1')">注册协议</view> <view class="item" @click="tourl('/pages_tool/agreement/contenr?type=1')">{{ isEnEnv ? 'Registration Agreement' : '注册协议'}}</view>
</view> </view>
</view> </view>
<template v-if="diyData.global && diyData.global.popWindow && diyData.global.popWindow.count != -1 && diyData.global.popWindow.imageUrl"> <template
v-if="diyData.global && diyData.global.popWindow && diyData.global.popWindow.count != -1 && diyData.global.popWindow.imageUrl">
<view @touchmove.prevent.stop> <view @touchmove.prevent.stop>
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false"> <uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
<view class="image-wrap"> <view class="image-wrap">
<image :src="$util.img(diyData.global.popWindow.imageUrl)" :style="popWindowStyle" @click="uniPopupWindowFn()" mode="aspectFit"/> <image :src="$util.img(diyData.global.popWindow.imageUrl)" :style="popWindowStyle"
@click="uniPopupWindowFn()" mode="aspectFit" />
</view> </view>
<text class="iconfont icon-round-close" @click="closePopupWindow"></text> <text class="iconfont icon-round-close" @click="closePopupWindow"></text>
</uni-popup> </uni-popup>
@@ -38,7 +44,8 @@
<!-- 收藏 --> <!-- 收藏 -->
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect"> <uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
<view v-if="showTip" class="collectPopupWindow" :style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }"> <view v-if="showTip" class="collectPopupWindow"
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" /> <image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
<text @click="closeCollectPopupWindow">我知道了</text> <text @click="closeCollectPopupWindow">我知道了</text>
</view> </view>
@@ -80,11 +87,13 @@
<style lang="scss"> <style lang="scss">
@import '@/common/css/diy.scss'; @import '@/common/css/diy.scss';
.foot { .foot {
display: flex; display: flex;
// position: absolute; // position: absolute;
width: 100%; width: 100%;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.item { .item {
width: 50%; width: 50%;
text-align: center; text-align: center;

View File

@@ -15,9 +15,6 @@ export default {
} }
}, },
onLoad(data) { onLoad(data) {
//刷新多语言
this.$langConfig.refresh();
uni.hideTabBar(); uni.hideTabBar();
this.name = 'DIY_VIEW_MEMBER_INDEX'; this.name = 'DIY_VIEW_MEMBER_INDEX';
if (data.code) { if (data.code) {

View File

@@ -217,19 +217,19 @@
<uni-popup ref="pointPopup" type="bottom"> <uni-popup ref="pointPopup" type="bottom">
<view class="tips-layer"> <view class="tips-layer">
<view class="head" @click="closePointPopup()"> <view class="head" @click="closePointPopup()">
<view class="title">积分说明</view> <view class="title">{{ isEnEnv ? 'Integral Description' : '积分说明'}}</view>
<text class="iconfont icon-close"></text> <text class="iconfont icon-close"></text>
</view> </view>
<view class="body"> <view class="body">
<view class="detail margin-bottom"> <view class="detail margin-bottom">
<view class="tip">积分的获取</view> <view class="tip">{{ isEnEnv ? 'Integral Acquisition' : '积分的获取'}}</view>
<view class="font-size-base">1积分可在注册签到分享消费充值时获得</view> <view class="font-size-base">1积分可在注册签到分享消费充值时获得</view>
<view class="font-size-base">2在购买部分商品时可获得积分</view> <view class="font-size-base">2在购买部分商品时可获得积分</view>
<view class="tip">积分的使用</view> <view class="tip">{{ isEnEnv ? 'Integral Use' : '积分的使用'}}</view>
<view class="font-size-base">1积分可用于兑换积分中心的商品</view> <view class="font-size-base">1积分可用于兑换积分中心的商品</view>
<view class="font-size-base">2积分可在参与某些活动时使用</view> <view class="font-size-base">2积分可在参与某些活动时使用</view>
<view class="font-size-base">3积分不得转让出售不设有效期</view> <view class="font-size-base">3积分不得转让出售不设有效期</view>
<view class="tip">积分的查询</view> <view class="tip">{{ isEnEnv ? 'Integral Query' : '积分的查询'}}</view>
<view class="font-size-base">1积分可在会员中心中查询具体数额以及明细</view> <view class="font-size-base">1积分可在会员中心中查询具体数额以及明细</view>
</view> </view>
</view> </view>