Compare commits
5 Commits
zhu-kaijii
...
custom/uni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe3d00c653 | ||
|
|
5c7daab504 | ||
|
|
e77bdc0359 | ||
|
|
5b37e00b98 | ||
|
|
123daa600c |
29
App.vue
29
App.vue
@@ -4,6 +4,8 @@
|
||||
import {
|
||||
Weixin
|
||||
} from 'common/js/wx-jssdk.js';
|
||||
// 新增:引入多语言核心工具类
|
||||
import langConfig from '@/common/js/lang.js';
|
||||
|
||||
export default {
|
||||
mixins: [auth],
|
||||
@@ -15,6 +17,9 @@
|
||||
}
|
||||
uni.hideTabBar();
|
||||
|
||||
// 新增:应用启动时初始化多语言(核心修改)
|
||||
this.initLang();
|
||||
|
||||
// #ifdef MP
|
||||
const updateManager = uni.getUpdateManager();
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
@@ -23,8 +28,8 @@
|
||||
|
||||
updateManager.onUpdateReady(function(res) {
|
||||
uni.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已经准备好,是否重启应用?',
|
||||
title: langConfig.lang('common.updateTip'), // 新增:多语言标题
|
||||
content: langConfig.lang('common.updateContent'), // 新增:多语言内容
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
@@ -48,8 +53,8 @@
|
||||
uni.onNetworkStatusChange(function(res) {
|
||||
if (!res.isConnected) {
|
||||
uni.showModal({
|
||||
title: '网络失去链接',
|
||||
content: '请检查网络链接',
|
||||
title: langConfig.lang('common.networkTip'), // 新增:多语言标题
|
||||
content: langConfig.lang('common.networkContent'), // 新增:多语言内容
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
@@ -144,6 +149,9 @@
|
||||
// #endif
|
||||
},
|
||||
onShow: function(options) {
|
||||
// 新增:应用前台显示时刷新多语言(确保切后台后语言仍生效)
|
||||
langConfig.refresh();
|
||||
|
||||
// #ifdef MP
|
||||
// 自动授权登录
|
||||
this.getAuthInfo();
|
||||
@@ -165,6 +173,19 @@
|
||||
},
|
||||
onHide: function() {},
|
||||
methods: {
|
||||
// 新增:多语言初始化方法
|
||||
initLang() {
|
||||
// 1. 读取本地存储的语言,无则默认中文
|
||||
const currentLang = uni.getStorageSync('lang') || 'zh-cn';
|
||||
// 2. 初始化lang.js的locale变量(确保全局语言一致)
|
||||
langConfig.locale = currentLang;
|
||||
// 3. 刷新多语言配置(标题、tabBar等)
|
||||
langConfig.refresh();
|
||||
// 4. 挂载全局多语言方法(方便所有页面直接调用)
|
||||
uni.$lang = langConfig.lang;
|
||||
// 5. 挂载全局语言切换方法(可选,方便全局调用)
|
||||
uni.$switchLang = langConfig.change;
|
||||
},
|
||||
/**
|
||||
* 获取授权信息
|
||||
*/
|
||||
|
||||
@@ -14,16 +14,16 @@ try {
|
||||
// 调试版本,配置说明
|
||||
const devCfg = {
|
||||
// 商户ID
|
||||
uniacid: 460, //825
|
||||
uniacid: 2285, //825
|
||||
|
||||
//api请求地址
|
||||
baseUrl: 'https://xcx30.5g-quickapp.com/',
|
||||
baseUrl: 'https://xcx.aigc-quickapp.com/',
|
||||
|
||||
// 图片域名
|
||||
imgDomain: 'https://xcx30.5g-quickapp.com/',
|
||||
imgDomain: 'https://xcx.aigc-quickapp.com/',
|
||||
|
||||
// H5端域名
|
||||
h5Domain: 'https://xcx30.5g-quickapp.com/',
|
||||
h5Domain: 'https://xcx.aigc-quickapp.com/',
|
||||
|
||||
// // api请求地址
|
||||
// baseUrl: 'https://tsaas.liveplatform.cn/',
|
||||
|
||||
@@ -1,129 +1,136 @@
|
||||
const langList = ['zh-cn', 'en-us'];
|
||||
|
||||
var locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言
|
||||
var locale = uni.getStorageSync('lang') || "zh-cn"; // 设置默认语言
|
||||
|
||||
export default {
|
||||
langList: ['zh-cn', 'en-us'],
|
||||
/**
|
||||
* * 解析多语言
|
||||
* @param {Object} field
|
||||
* 解析多语言
|
||||
* @param {String} field 语言包字段(如 'common.title')
|
||||
* @returns {String} 对应语言的文字
|
||||
*/
|
||||
lang(field) {
|
||||
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||
if (!_this) return;
|
||||
if (!_this) return field; // 无页面时返回原字段,避免undefined
|
||||
|
||||
var value = '';
|
||||
var value = field; // 默认返回原字段,防止空白
|
||||
let newRoute;
|
||||
try {
|
||||
//公共语言包
|
||||
var lang = require('../../lang/' + locale + '/common.js').lang;
|
||||
|
||||
//当前页面语言包
|
||||
// 1. 加载公共语言包(核心,兜底)
|
||||
var commonLang = require('../../lang/' + locale + '/common.js').lang;
|
||||
// 2. 加载当前页面语言包(可选,失败不影响)
|
||||
let route = _this.route.split("/");
|
||||
newRoute = route.slice(1, route.length);
|
||||
let currentPageLang = require('../../lang/' + locale + '/' + newRoute.join("/") + '.js').lang;
|
||||
|
||||
for (let f in currentPageLang) {
|
||||
lang[f] = currentPageLang[f];
|
||||
let currentPageLang = {};
|
||||
// 容错:页面语言包不存在时不报错
|
||||
try {
|
||||
currentPageLang = require('../../lang/' + locale + '/' + newRoute.join("/") + '.js').lang;
|
||||
} catch (e) {
|
||||
console.warn(`当前页面(${newRoute.join("/")})无${locale}语言包`);
|
||||
}
|
||||
// 合并:页面语言包覆盖公共语言包
|
||||
var lang = { ...commonLang, ...currentPageLang };
|
||||
|
||||
// 解析字段(支持多级,如 'common.langSwitchBtn')
|
||||
var arr = field.split(".");
|
||||
if (arr.length > 1) {
|
||||
for (let i in arr) {
|
||||
var next = parseInt(i) + 1;
|
||||
if (next < arr.length) {
|
||||
value = lang[arr[i]][arr[next]];
|
||||
}
|
||||
value = lang; // 初始化为完整语言包
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (!value[arr[i]]) break; // 字段不存在时终止,避免报错
|
||||
value = value[arr[i]];
|
||||
}
|
||||
|
||||
} else {
|
||||
value = lang[field];
|
||||
value = lang[field] || field; // 字段不存在返回原字段
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
if (field.indexOf("common.") != -1 || field.indexOf("tabBar.") != -1) {
|
||||
value = lang[field];
|
||||
} else {
|
||||
value = field;
|
||||
}
|
||||
|
||||
console.error("语言包解析失败:", e);
|
||||
value = field; // 兜底:返回原字段,避免空白
|
||||
}
|
||||
|
||||
// 替换参数(如 'hello {0}' → 'hello 世界')
|
||||
if (arguments.length > 1) {
|
||||
//有参数,需要替换
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
value = value.replace("{" + (i - 1) + "}", arguments[i]);
|
||||
value = value.replace("{" + (i - 1) + "}", arguments[i] || "");
|
||||
}
|
||||
}
|
||||
if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field
|
||||
return value;
|
||||
// 最终兜底:避免返回undefined/空字符串
|
||||
return value || field;
|
||||
},
|
||||
//切换语言
|
||||
// 切换语言(核心修复:防白屏+全局事件)
|
||||
change(value) {
|
||||
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||
if (!_this) return;
|
||||
|
||||
// 1. 校验语言值合法性
|
||||
if (!langList.includes(value)) {
|
||||
console.error("语言值不合法:", value);
|
||||
return;
|
||||
}
|
||||
// 2. 保存语言到本地存储
|
||||
uni.setStorageSync("lang", value);
|
||||
locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言
|
||||
|
||||
locale = value; // 更新全局locale,立即生效
|
||||
// 3. 刷新标题/tabBar(保留原有逻辑)
|
||||
this.refresh();
|
||||
|
||||
uni.reLaunch({
|
||||
url: '/pages/member/index'
|
||||
});
|
||||
// 4. 触发全局语言切换事件(通知所有页面/组件更新)
|
||||
uni.$emit('lang-changed', value);
|
||||
// 5. 修复白屏:延迟重启当前页面(而非固定会员页)
|
||||
setTimeout(() => {
|
||||
let currentPage = getCurrentPages()[getCurrentPages().length - 1];
|
||||
if (currentPage) {
|
||||
uni.reLaunch({
|
||||
url: '/' + currentPage.route // 重启当前页面,而非固定会员页
|
||||
});
|
||||
} else {
|
||||
uni.reLaunch({ url: '/pages/index/index' }); // 兜底:重启首页
|
||||
}
|
||||
}, 300); // 300ms延迟:确保语言配置加载完成,避免白屏
|
||||
},
|
||||
//刷新标题、tabbar
|
||||
// 刷新标题、tabbar(优化:容错+强制生效)
|
||||
refresh() {
|
||||
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||
if (!_this) return;
|
||||
locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言
|
||||
|
||||
this.title(this.lang("title"));
|
||||
locale = uni.getStorageSync('lang') || "zh-cn"; // 重新读取,确保最新
|
||||
|
||||
//设置tabbar的文字语言
|
||||
// uni.setTabBarItem({
|
||||
// index: 0,
|
||||
// text: this.lang("tabBar.home")
|
||||
// });
|
||||
// uni.setTabBarItem({
|
||||
// index: 1,
|
||||
// text: this.lang("tabBar.category")
|
||||
// });
|
||||
// uni.setTabBarItem({
|
||||
// index: 2,
|
||||
// text: this.lang("tabBar.cart")
|
||||
// });
|
||||
// uni.setTabBarItem({
|
||||
// index: 3,
|
||||
// text: this.lang("tabBar.member")
|
||||
// });
|
||||
// 刷新导航栏标题(容错:标题字段不存在时不报错)
|
||||
let titleText = this.lang("title") || "";
|
||||
this.title(titleText);
|
||||
|
||||
// 修复:启用tabBar文字更新(原代码被注释,导致tabBar语言不切换)
|
||||
try {
|
||||
uni.setTabBarItem({ index: 0, text: this.lang("tabBar.home") || "首页" });
|
||||
uni.setTabBarItem({ index: 1, text: this.lang("tabBar.category") || "分类" });
|
||||
uni.setTabBarItem({ index: 2, text: this.lang("tabBar.cart") || "购物车" });
|
||||
uni.setTabBarItem({ index: 3, text: this.lang("tabBar.member") || "我的" });
|
||||
} catch (e) {
|
||||
console.warn("tabBar文字更新失败:", e);
|
||||
}
|
||||
},
|
||||
// 设置导航栏标题(优化:容错)
|
||||
title(str) {
|
||||
if (str) {
|
||||
if (str && typeof str === 'string') {
|
||||
uni.setNavigationBarTitle({
|
||||
title: str,
|
||||
success: function (res) {
|
||||
},
|
||||
fail: function (err) {
|
||||
console.warn("导航栏标题设置失败:", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取语言包列表
|
||||
// 获取语言包列表(优化:容错)
|
||||
list() {
|
||||
var list = [];
|
||||
try {
|
||||
//公共语言包
|
||||
for (var i = 0; i < langList.length; i++) {
|
||||
let item = require('../../lang/' + langList[i] + '/common.js').lang;
|
||||
let langPath = '../../lang/' + langList[i] + '/common.js';
|
||||
let item = require(langPath).lang;
|
||||
list.push({
|
||||
name: item.common.name,
|
||||
name: item.common.name || langList[i], // 兜底:显示语言值
|
||||
value: langList[i]
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// "没有找到语言包:", '../../lang/' + locale + '/common.js'
|
||||
console.error("获取语言包列表失败:", e);
|
||||
// 兜底:返回基础列表
|
||||
list = langList.map(item => ({ name: item, value: item }));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,20 @@
|
||||
<template>
|
||||
<!-- 悬浮按钮 -->
|
||||
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
|
||||
<!-- <view class="btn-item" v-if="fixBtnShow" @click="$util.redirectTo('/pages/index/index')"> -->
|
||||
<!-- 客服按钮 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true" :style="{backgroundImage:'url('+(kefuimg?kefuimg:'')+')',backgroundSize:'100% 100%'}">
|
||||
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
||||
<!-- <view>首页</view> -->
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- 电话按钮 -->
|
||||
<view class="btn-item" v-if="fixBtnShow" @click="call()" :style="{backgroundImage:'url('+(phoneimg?phoneimg:'')+')',backgroundSize:'100% 100%'}">
|
||||
<text class="iconfont icon-dianhua" v-if="!phoneimg"></text>
|
||||
<!-- <view>我的</view> -->
|
||||
</view>
|
||||
|
||||
<!-- <view class="btn-item icon-xiala" v-if="fixBtnShow" @click="fixBtnShow ? (fixBtnShow = false) : (fixBtnShow = true)">
|
||||
<text class="iconfont icon-unfold"></text>
|
||||
<!-- 新增:语言切换按钮 -->
|
||||
<view class="btn-item" v-if="fixBtnShow" @click="switchLang" :style="{backgroundSize:'100% 100%'}">
|
||||
<text class="lang-text">{{ currentLang === 'zh-cn' ? 'EN' : '中文' }}</text>
|
||||
</view>
|
||||
<view class="btn-item switch" v-else :class="{ show: fixBtnShow }"
|
||||
@click="fixBtnShow ? (fixBtnShow = false) : (fixBtnShow = true)">
|
||||
<view class="">快捷</view>
|
||||
<view>导航</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -39,7 +33,9 @@
|
||||
fixBtnShow: true,
|
||||
tel:'',
|
||||
kefuimg:'',
|
||||
phoneimg:''
|
||||
phoneimg:'',
|
||||
// 新增:当前语言(默认中文)
|
||||
currentLang: uni.getStorageSync('lang') || 'zh-cn'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -53,7 +49,10 @@
|
||||
that.tel = e.data.mobile
|
||||
}
|
||||
})
|
||||
|
||||
// 新增:监听全局语言切换事件,实时更新按钮文字
|
||||
uni.$on('lang-changed', (lang) => {
|
||||
this.currentLang = lang;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
//拨打电话
|
||||
@@ -61,7 +60,26 @@
|
||||
uni.makePhoneCall({
|
||||
phoneNumber:this.tel+''
|
||||
})
|
||||
},
|
||||
// 新增:语言切换核心方法
|
||||
switchLang() {
|
||||
// 1. 切换目标语言(中文↔英文)
|
||||
const targetLang = this.currentLang === 'zh-cn' ? 'en-us' : 'zh-cn';
|
||||
// 2. 保存到本地存储(全局生效)
|
||||
uni.setStorageSync('lang', targetLang);
|
||||
// 3. 触发全局语言事件(通知其他页面更新)
|
||||
uni.$emit('lang-changed', targetLang);
|
||||
// 4. 延迟重启当前页面(避免白屏,保证语言生效)
|
||||
setTimeout(() => {
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
uni.reLaunch({ url: '/' + currentPage.route });
|
||||
}, 300);
|
||||
}
|
||||
},
|
||||
// 新增:页面销毁时移除监听,避免内存泄漏
|
||||
beforeDestroy() {
|
||||
uni.$off('lang-changed');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -86,14 +104,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
//悬浮按钮
|
||||
//悬浮按钮(容器样式保持原始不变,确保按钮不消失)
|
||||
.fixed-box {
|
||||
position: fixed;
|
||||
right: 0rpx;
|
||||
bottom: 200rpx;
|
||||
z-index: 10;
|
||||
// background: #fff;
|
||||
// box-shadow: 2rpx 2rpx 22rpx rgba(0, 0, 0, 0.3);
|
||||
border-radius: 120rpx;
|
||||
padding: 20rpx 0;
|
||||
display: flex;
|
||||
@@ -107,12 +123,14 @@
|
||||
.btn-item {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center; // 新增:垂直居中,和其他按钮对齐
|
||||
text-align: center;
|
||||
flex-direction: column;
|
||||
line-height: 1;
|
||||
margin: 14rpx 0;
|
||||
transition: 0.1s;
|
||||
background: #fff;
|
||||
// ========== 修改1:按钮背景改为纯红色(红底) ==========
|
||||
background: #E60012;
|
||||
border-radius: 50rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
@@ -120,11 +138,22 @@
|
||||
text {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
// ========== 修改2:图标文字改为白色(白字) ==========
|
||||
color: #FFFFFF;
|
||||
}
|
||||
// 新增:语言按钮文字样式
|
||||
.lang-text {
|
||||
font-size: 24rpx; // 适配圆形按钮大小
|
||||
font-weight: 600;
|
||||
// ========== 修改3:语言按钮文字改为白色 ==========
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
view {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
// ========== 兜底:确保所有文字都是白色 ==========
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
&.show {
|
||||
@@ -137,6 +166,12 @@
|
||||
margin: 0;
|
||||
margin-top: 0.1rpx;
|
||||
}
|
||||
|
||||
// ========== 新增:按钮点击交互效果 ==========
|
||||
&:active {
|
||||
background: #C4000F; // 红色轻微加深
|
||||
transform: scale(0.95); // 按钮小幅度缩小
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +1,12 @@
|
||||
<template>
|
||||
<view>
|
||||
<block v-if="text == '客服'">
|
||||
<!-- <ns-contact :niushop="chatParam" :send-message-title="sendData.title" :send-message-path="sendData.path" :send-message-img="sendData.img"> -->
|
||||
<button hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true" class="action-icon-wrap" style="background: transparent;padding: 0;margin: 0;">
|
||||
<!-- 修改后(兼容英文) -->
|
||||
<block v-if="text == '客服' || text == 'Contact'">
|
||||
<button hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true" class="action-icon-wrap" style="background: transparent;padding: 0;margin: 0;" @click="contactClick">
|
||||
<view class="iconfont color-title" :class="icon"></view>
|
||||
<text>{{ text }}</text>
|
||||
<view class="corner-mark color-base-bg" v-if="cornerMark.length" :style="{ background: cornerMarkBg+'!important', color: cornerMarkColor }">{{ cornerMark }}</view>
|
||||
</button>
|
||||
<!-- </ns-contact> -->
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="action-icon-wrap" @click="clickEvent">
|
||||
@@ -24,37 +23,30 @@ import nsContact from '@/components/ns-contact/ns-contact.vue';
|
||||
export default {
|
||||
name: 'ns-goods-action-icon',
|
||||
props: {
|
||||
// 商品底部icon导航icon图标
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 商品底部icon导航文字
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 角标文字
|
||||
cornerMark: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 角标背景色
|
||||
cornerMarkBg: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 角标文字颜色
|
||||
cornerMarkColor: {
|
||||
type: String,
|
||||
default: '#fff'
|
||||
},
|
||||
// 开放能力
|
||||
openType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 发送内容 openType="contact"时有效
|
||||
sendData: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
@@ -77,7 +69,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
clickEvent() {
|
||||
console.log('【组件内部】非客服按钮被点击,触发clickEvent');
|
||||
this.$emit('click');
|
||||
},
|
||||
contactClick() {
|
||||
console.log('【组件内部】客服按钮(Contact)被点击,触发contactClick');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -143,4 +139,4 @@ export default {
|
||||
font-size: $font-size-tag;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,21 +1,40 @@
|
||||
export const lang = {
|
||||
|
||||
// 底部选项卡
|
||||
// 底部选项卡(英文)
|
||||
tabBar: {
|
||||
home: 'index',
|
||||
category: 'category',
|
||||
cart: 'cart',
|
||||
member: 'member',
|
||||
home: 'Home',
|
||||
category: 'Category',
|
||||
cart: 'Cart',
|
||||
member: 'Member Center'
|
||||
},
|
||||
|
||||
//公共
|
||||
// 公共文字
|
||||
common: {
|
||||
//语言包名称
|
||||
name: '英文',
|
||||
mescrollTextInOffset: 'pull to refresh',
|
||||
mescrollTextOutOffset: 'Loading...',
|
||||
name: 'English',
|
||||
mescrollTextInOffset: 'Pull down to refresh',
|
||||
mescrollTextOutOffset: 'Release to update',
|
||||
mescrollEmpty: "No data available",
|
||||
goodsRecommendTitle: 'Guess you like',
|
||||
currencySymbol: '¥'
|
||||
goodsRecommendTitle: 'You May Also Like',
|
||||
currencySymbol: '¥',
|
||||
submit: 'Submit',
|
||||
langSwitchBtn: '中文',
|
||||
// ========== 新增:kefu 对应的英文文案 ==========
|
||||
kefu: 'Contact',
|
||||
// =============================================
|
||||
// App.vue弹窗翻译
|
||||
updateTip: 'Update Tip',
|
||||
updateContent: 'The new version is ready, do you want to restart the app?',
|
||||
networkTip: 'Network Disconnected',
|
||||
networkContent: 'Please check your network connection', // 关键:这里加逗号!
|
||||
// 首页多语言字段
|
||||
siteName: 'Site Name',
|
||||
welcomeMsg: 'Welcome to follow',
|
||||
followOfficialAccount: 'Follow Official Account',
|
||||
followMoreInfo: 'Follow for more information',
|
||||
iKnow: 'I know',
|
||||
confirmStore: 'Please confirm the store',
|
||||
reposition: 'Reposition',
|
||||
currentStore: 'Current Store',
|
||||
confirmEnter: 'Confirm to enter',
|
||||
chooseOtherStore: 'Choose other stores'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
export const lang = {
|
||||
|
||||
// 底部选项卡
|
||||
// 底部选项卡(中文)
|
||||
tabBar: {
|
||||
home: '首页',
|
||||
category: '分类',
|
||||
@@ -8,15 +7,31 @@ export const lang = {
|
||||
member: '个人中心'
|
||||
},
|
||||
|
||||
//公共
|
||||
// 公共文字
|
||||
common: {
|
||||
//语言包名称
|
||||
name: '中文',
|
||||
mescrollTextInOffset: '下拉刷新',
|
||||
mescrollTextOutOffset: '释放更新',
|
||||
mescrollEmpty: "暂无相关数据",
|
||||
goodsRecommendTitle: '猜你喜欢',
|
||||
currencySymbol: '¥',
|
||||
submit: '提交'
|
||||
submit: '提交',
|
||||
langSwitchBtn: 'EN',
|
||||
// App.vue弹窗翻译
|
||||
updateTip: '更新提示',
|
||||
updateContent: '新版本已经准备好,是否重启应用?',
|
||||
networkTip: '网络失去连接',
|
||||
networkContent: '请检查网络连接', // 关键:这里加逗号!
|
||||
// 首页多语言字段
|
||||
siteName: '站点名称',
|
||||
welcomeMsg: '欢迎关注',
|
||||
followOfficialAccount: '关注公众号',
|
||||
followMoreInfo: '关注了解更多',
|
||||
iKnow: '我知道了',
|
||||
confirmStore: '请确认门店',
|
||||
reposition: '重新定位',
|
||||
currentStore: '当前门店',
|
||||
confirmEnter: '确认进入',
|
||||
chooseOtherStore: '选择其他门店'
|
||||
}
|
||||
}
|
||||
}
|
||||
4
node_modules/jweixin-module/README.md
generated
vendored
4
node_modules/jweixin-module/README.md
generated
vendored
@@ -19,8 +19,8 @@ https://unpkg.com/jweixin-module/out/index.js
|
||||
## 使用
|
||||
|
||||
```js
|
||||
var wx = require('jweixin-module')
|
||||
wx.ready(function(){
|
||||
var jweixin = require('jweixin-module')
|
||||
jweixin.ready(function(){
|
||||
// TODO
|
||||
});
|
||||
```
|
||||
|
||||
@@ -131,12 +131,16 @@
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<hover-nav></hover-nav>
|
||||
<diy-bottom-nav></diy-bottom-nav>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 👇 引入语言工具文件
|
||||
import langUtil from '@/common/js/lang.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -194,6 +198,13 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 👇 新增:语言切换方法
|
||||
toggleLang() {
|
||||
const currentLang = this.$lang?.locale || 'zh-cn';
|
||||
const targetLang = currentLang === 'zh-cn' ? 'en-us' : 'zh-cn';
|
||||
langUtil.change(targetLang);
|
||||
},
|
||||
|
||||
test(){
|
||||
// channelReady(function(bAvailable) {
|
||||
// alert('是否存在框架服务:' + bAvailable)
|
||||
@@ -508,4 +519,30 @@ image {
|
||||
width: 90rpx;
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
|
||||
/* 👇 新增:语言切换按钮样式 */
|
||||
.lang-switch-wrap {
|
||||
position: fixed !important;
|
||||
bottom: 120rpx !important; /* 避开底部tabBar */
|
||||
right: 30rpx !important;
|
||||
z-index: 99999 !important; /* 层级拉满 */
|
||||
width: 120rpx;
|
||||
height: 60rpx;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid #e5e5e5 !important;
|
||||
border-radius: 30rpx !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1) !important;
|
||||
}
|
||||
.lang-text {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
.lang-switch-wrap:active {
|
||||
transform: scale(0.95) !important;
|
||||
transition: transform 0.1s ease !important;
|
||||
}
|
||||
</style>
|
||||
@@ -30,7 +30,9 @@
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
diyData: null
|
||||
diyData: null,
|
||||
// 新增:标记是否已监听语言事件,避免重复监听
|
||||
langListenerAdded: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
@@ -38,20 +40,51 @@
|
||||
this.$langConfig.refresh();
|
||||
uni.hideTabBar();
|
||||
this.getDiyInfo();
|
||||
// 新增:监听全局语言切换事件
|
||||
this.addLangListener();
|
||||
},
|
||||
onShow() {
|
||||
if (this.$refs.category) this.$refs.category[0].pageShow();
|
||||
},
|
||||
onUnload() {
|
||||
if (!this.storeToken && this.$refs.login) this.$refs.login.cancelCompleteInfo();
|
||||
// 新增:页面销毁时移除语言监听,避免内存泄漏
|
||||
this.removeLangListener();
|
||||
},
|
||||
methods: {
|
||||
// 新增:添加语言切换监听(封装为方法,避免重复监听)
|
||||
addLangListener() {
|
||||
if (!this.langListenerAdded) {
|
||||
uni.$on('lang-changed', this.handleLangChange);
|
||||
this.langListenerAdded = true;
|
||||
}
|
||||
},
|
||||
// 新增:移除语言切换监听
|
||||
removeLangListener() {
|
||||
if (this.langListenerAdded) {
|
||||
uni.$off('lang-changed', this.handleLangChange);
|
||||
this.langListenerAdded = false;
|
||||
}
|
||||
},
|
||||
// 新增:语言切换后的处理逻辑
|
||||
handleLangChange() {
|
||||
// 1. 刷新多语言配置(确保语言包生效)
|
||||
this.$langConfig.refresh();
|
||||
// 2. 显示加载遮罩,提升用户体验
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.show();
|
||||
// 3. 重新请求分类数据(核心:获取对应语言的分类内容)
|
||||
this.getDiyInfo();
|
||||
},
|
||||
getDiyInfo() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/diyview/info',
|
||||
data: {
|
||||
name: 'DIY_VIEW_GOODS_CATEGORY'
|
||||
},
|
||||
// 新增:请求头携带当前语言,让后端返回对应语言的分类数据
|
||||
header: {
|
||||
'lang': uni.getStorageSync('lang') || 'zh-cn'
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
this.diyData = res.data;
|
||||
@@ -61,6 +94,11 @@
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
},
|
||||
// 新增:请求失败时隐藏加载遮罩,避免遮罩卡死
|
||||
fail: () => {
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -71,6 +109,14 @@
|
||||
onPullDownRefresh() {
|
||||
uni.hideTabBar();
|
||||
this.getDiyInfo();
|
||||
},
|
||||
// 新增:页面隐藏时移除监听(可选,增强容错)
|
||||
onHide() {
|
||||
this.removeLangListener();
|
||||
},
|
||||
// 新增:页面重新显示时重新添加监听
|
||||
onReShow() {
|
||||
this.addLangListener();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -6,6 +6,9 @@ export default {
|
||||
couponBtnSwitch: false, //获取优惠券防止重复提交
|
||||
|
||||
posterApi: '/api/goods/poster',
|
||||
// 👇 新增初始定义
|
||||
contactData: {}, // 客服基础参数初始值
|
||||
chatRoomParams: {}, // 客服会话参数初始值
|
||||
|
||||
//满减活动
|
||||
manjian: {
|
||||
@@ -91,6 +94,14 @@ export default {
|
||||
//同步获取商品详情
|
||||
await this.getGoodsSkuDetail();
|
||||
},
|
||||
// 在detail.js的created/mounted中添加
|
||||
created() {
|
||||
// 监听语言切换事件(需项目有全局事件总线,或直接在切换方法中调用)
|
||||
uni.$on('lang-switch', () => {
|
||||
this.getGoodsSkuDetail(); // 切换语言后重新获取商品数据,赋值两个变量
|
||||
});
|
||||
},
|
||||
|
||||
onHide() {
|
||||
this.couponBtnSwitch = false;
|
||||
},
|
||||
@@ -103,6 +114,14 @@ export default {
|
||||
fail(){}
|
||||
})
|
||||
},
|
||||
// 新增:跳转到客服会话页面
|
||||
goToContact() {
|
||||
// 新增这行日志:打印“父页面触发跳转”
|
||||
console.log('【父页面】点击Contact,触发goToContact方法');
|
||||
uni.navigateTo({
|
||||
url: '/pages/contact/contact'
|
||||
});
|
||||
},
|
||||
setSkuId(val) {
|
||||
if (val) {
|
||||
this.skuId = val;
|
||||
@@ -141,6 +160,12 @@ export default {
|
||||
this.chatRoomParams = {
|
||||
sku_id: this.goodsSkuDetail.sku_id
|
||||
};
|
||||
// 👇 新增contactData赋值(至少空对象,也可补充业务参数)
|
||||
this.contactData = {
|
||||
goodsId: this.goodsId,
|
||||
shopId: this.goodsSkuDetail.shop_id || '', // 若有店铺ID则补充
|
||||
lang: uni.getStorageSync('lang') // 传递当前语言标识,方便客服组件兼容
|
||||
};
|
||||
let typeId = this.goodsSkuDetail.goods_promotion[0];
|
||||
if (typeId) {
|
||||
// 限时折扣
|
||||
|
||||
@@ -7,17 +7,16 @@
|
||||
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="info-box" :style="{ color: '#ffffff' }">
|
||||
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
||||
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
||||
<!-- 新增:多语言 - 站点名称 -->
|
||||
<text class="font-size-base">{{ $lang('common.siteName') || siteInfo.site_name }}</text>
|
||||
<!-- 新增:多语言 - 公众号欢迎语 -->
|
||||
<text>{{ $lang('common.welcomeMsg') || followOfficialAccount.welcomeMsg }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="dite-button" @click="officialAccountsOpen">关注公众号</view>
|
||||
<!-- 新增:多语言 - 关注公众号按钮 -->
|
||||
<view class="dite-button" @click="officialAccountsOpen">{{ $lang('common.followOfficialAccount') }}</view>
|
||||
</view>
|
||||
|
||||
<!-- <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"/>
|
||||
</view> -->
|
||||
|
||||
<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>
|
||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" :haveTopCategory="true" :followOfficialAccount="followOfficialAccount"/>
|
||||
@@ -36,33 +35,15 @@
|
||||
<view @touchmove.prevent.stop>
|
||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||
<view class="small-bot">
|
||||
<!-- <view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==1}}">
|
||||
<view bindtap="adverclose">跳过</view>
|
||||
<view class="time">{{clock}}s</view>
|
||||
</view>
|
||||
<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> -->
|
||||
<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">
|
||||
<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> -->
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view bindtap="adverclose" class="small-bot-close" @click="closePopupWindow">
|
||||
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="image-wrap">
|
||||
<swiper class="swiper" style="width:100%;height: 1200rpx;" :autoplay="true" interval="3000" circular="true" :indicator-dots="true" indicator-color="#000" indicator-active-color="red">
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in adv.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)">
|
||||
<view class="item">
|
||||
<image :src="$util.img(item.imageUrl)" mode="aspectFit" :show-menu-by-longpress="true"/>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<text class="iconfont icon-round-close" @click="closePopupWindow"></text> -->
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
@@ -77,7 +58,8 @@
|
||||
<uni-popup ref="officialAccountsPopup" type="center">
|
||||
<view class="official-accounts-wrap">
|
||||
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
||||
<text class="desc">关注了解更多</text>
|
||||
<!-- 新增:多语言 - 关注公众号提示 -->
|
||||
<text class="desc">{{ $lang('common.followMoreInfo') }}</text>
|
||||
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
||||
</view>
|
||||
</uni-popup>
|
||||
@@ -87,25 +69,29 @@
|
||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||
<view v-if="showTip" class="collectPopupWindow" :style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit"/>
|
||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||
<!-- 新增:多语言 - 我知道了 -->
|
||||
<text @click="closeCollectPopupWindow">{{ $lang('common.iKnow') }}</text>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<!-- 选择门店弹出框,定位当前位置,展示最近的一个门店 -->
|
||||
<!-- 选择门店弹出框 -->
|
||||
<view @touchmove.prevent.stop class="choose-store">
|
||||
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
||||
<view class="choose-store-popup">
|
||||
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
||||
<!-- 新增:多语言 - 请确认门店 -->
|
||||
<view class="head-wrap" @click="closeChooseStorePopup">{{ $lang('common.confirmStore') }}</view>
|
||||
<view class="position-wrap">
|
||||
<text class="iconfont icon-dizhi"></text>
|
||||
<text class="address">{{ currentPosition }}</text>
|
||||
<view class="reposition" @click="reposition" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||
<text class="iconfont icon-dingwei"></text>
|
||||
<text>重新定位</text>
|
||||
<!-- 新增:多语言 - 重新定位 -->
|
||||
<text>{{ $lang('common.reposition') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="store-wrap" v-if="nearestStore">
|
||||
<text class="tag">当前门店</text>
|
||||
<!-- 新增:多语言 - 当前门店 -->
|
||||
<text class="tag">{{ $lang('common.currentStore') }}</text>
|
||||
<view class="store-name">{{ nearestStore.store_name }}</view>
|
||||
<view class="address">{{ nearestStore.show_address }}</view>
|
||||
<view class="distance" v-if="nearestStore.distance">
|
||||
@@ -113,21 +99,25 @@
|
||||
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' : nearestStore.distance * 1000 + 'm' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<button type="primary" @click="enterStore">确认进入</button>
|
||||
<!-- 新增:多语言 - 确认进入 -->
|
||||
<button type="primary" @click="enterStore">{{ $lang('common.confirmEnter') }}</button>
|
||||
<view class="other-store" @click="chooseOtherStore" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||
<text>选择其他门店</text>
|
||||
<!-- 新增:多语言 - 选择其他门店 -->
|
||||
<text>{{ $lang('common.chooseOtherStore') }}</text>
|
||||
<text class="iconfont icon-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<!-- 悬浮按钮组件(已包含语言切换按钮) -->
|
||||
<hover-nav></hover-nav>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 小程序隐私协议 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
<!-- #endif -->
|
||||
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
||||
<ns-login ref="login"></ns-login>
|
||||
|
||||
<!-- 👇 删除:重复的语言切换按钮(hover-nav里已有) -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -138,7 +128,8 @@
|
||||
import indexJs from './public/js/index.js';
|
||||
import toTop from '@/components/toTop/toTop.vue';
|
||||
import scroll from '@/common/js/scroll-view.js';
|
||||
|
||||
// 👇 保留引入,但无需重复定义切换方法(hover-nav已处理)
|
||||
import langUtil from '@/common/js/lang.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -146,7 +137,47 @@
|
||||
nsNavbar,
|
||||
toTop
|
||||
},
|
||||
mixins: [diyJs, scroll, indexJs]
|
||||
mixins: [diyJs, scroll, indexJs],
|
||||
data() {
|
||||
return {
|
||||
// 新增:标记是否已监听语言事件
|
||||
langListenerAdded: false
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 新增:监听语言切换事件,刷新首页DIY数据
|
||||
this.addLangListener();
|
||||
},
|
||||
onUnload() {
|
||||
// 新增:页面销毁时移除监听
|
||||
this.removeLangListener();
|
||||
},
|
||||
methods: {
|
||||
// 新增:添加语言监听
|
||||
addLangListener() {
|
||||
if (!this.langListenerAdded) {
|
||||
uni.$on('lang-changed', this.handleLangChange);
|
||||
this.langListenerAdded = true;
|
||||
}
|
||||
},
|
||||
// 新增:移除语言监听
|
||||
removeLangListener() {
|
||||
if (this.langListenerAdded) {
|
||||
uni.$off('lang-changed', this.handleLangChange);
|
||||
this.langListenerAdded = false;
|
||||
}
|
||||
},
|
||||
// 新增:语言切换后刷新首页数据
|
||||
handleLangChange() {
|
||||
// 重新请求首页DIY数据,确保内容同步为新语言
|
||||
if (this.getDiyInfo) {
|
||||
this.getDiyInfo(); // 调用首页获取DIY数据的方法
|
||||
}
|
||||
// 刷新多语言配置
|
||||
this.$langConfig?.refresh();
|
||||
},
|
||||
// 👇 删除:重复的toggleLang方法(hover-nav里已有)
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -154,8 +185,6 @@
|
||||
@import '@/common/css/diy.scss';
|
||||
@import './public/css/index.scss';
|
||||
|
||||
|
||||
|
||||
.small-bot {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -194,7 +223,6 @@
|
||||
.small-bot-close i {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
<style scoped>
|
||||
.swiper /deep/ .uni-swiper-dots-horizontal {
|
||||
@@ -229,8 +257,9 @@
|
||||
}
|
||||
|
||||
/deep/ .mescroll-totop {
|
||||
right: 24rpx!important;
|
||||
bottom: 182rpx!important;
|
||||
right: 24rpx !important;
|
||||
bottom: 182rpx !important;
|
||||
}
|
||||
|
||||
/* 👇 删除:重复的语言按钮样式(hover-nav里已有) */
|
||||
</style>
|
||||
@@ -1,127 +1,151 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<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 }">
|
||||
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="true"/>
|
||||
</view>
|
||||
|
||||
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl" :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"/>
|
||||
</diy-index-page>
|
||||
|
||||
<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"/>
|
||||
<ns-copyright v-show="isShowCopyRight"/>
|
||||
|
||||
<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=1')">注册协议</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="diyData.global && diyData.global.popWindow && diyData.global.popWindow.count != -1 && diyData.global.popWindow.imageUrl">
|
||||
<view @touchmove.prevent.stop>
|
||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||
<view class="image-wrap">
|
||||
<image :src="$util.img(diyData.global.popWindow.imageUrl)" :style="popWindowStyle" @click="uniPopupWindowFn()" mode="aspectFit"/>
|
||||
</view>
|
||||
<text class="iconfont icon-round-close" @click="closePopupWindow"></text>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 底部tabBar -->
|
||||
<view id="tab-bar" :class="{ hide: bottomNavHidden }" v-if="openBottomNav">
|
||||
<diy-bottom-nav @callback="callback"/>
|
||||
</view>
|
||||
|
||||
<!-- 收藏 -->
|
||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||
<view v-if="showTip" class="collectPopupWindow" :style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit"/>
|
||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<ns-birthday-gift ref="birthdayGift"></ns-birthday-gift>
|
||||
<ns-new-gift ref="nsNewGift"></ns-new-gift>
|
||||
|
||||
|
||||
<hover-nav></hover-nav>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 小程序隐私协议 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<!-- 补充页面根模板结构(适配uni-app规范) -->
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view class="member-page">
|
||||
<!-- 原有页面内容(因你未提供完整模板,此处保留核心结构,按钮添加在最后) -->
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue';
|
||||
import nsNavbar from '@/components/ns-navbar/ns-navbar.vue';
|
||||
import diyJs from '@/common/js/diy.js';
|
||||
import indexJs from './public/js/index.js';
|
||||
// 👇 引入语言工具文件
|
||||
import langUtil from '@/common/js/lang.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uniPopup,
|
||||
nsNavbar
|
||||
},
|
||||
mixins: [diyJs, indexJs],
|
||||
methods:{
|
||||
|
||||
tourl(url){
|
||||
this.$util.redirectTo(url);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
diyRoute: '/pages/member/index'
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
storeToken: function(nVal, oVal) {
|
||||
if (nVal) {
|
||||
this.initData();
|
||||
if (uni.getStorageSync('source_member')) this.$util.onSourceMember(uni.getStorageSync(
|
||||
'source_member'));
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(data) {
|
||||
//刷新多语言
|
||||
this.$langConfig.refresh();
|
||||
|
||||
uni.hideTabBar();
|
||||
this.name = 'DIY_VIEW_MEMBER_INDEX';
|
||||
if (data.code) {
|
||||
this.$api.sendRequest({
|
||||
url: '/wechat/api/wechat/authcodetoopenid',
|
||||
data: {
|
||||
code: data.code
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0) {
|
||||
if (res.data.userinfo.nickName) this.modifyNickname(res.data.userinfo.nickName);
|
||||
if (res.data.userinfo.avatarUrl) this.modifyHeadimg(res.data.userinfo
|
||||
.avatarUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
||||
// 刷新会员数据
|
||||
if (this.$refs.diyGroup) {
|
||||
if (this.$refs.diyGroup.$refs.diyMemberIndex) this.$refs.diyGroup.$refs.diyMemberIndex[0].init();
|
||||
if (this.$refs.diyGroup.$refs.diyMemberMyOrder) this.$refs.diyGroup.$refs.diyMemberMyOrder[0].getOrderNum();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 👇 新增:语言切换方法
|
||||
toggleLang() {
|
||||
const currentLang = this.$lang?.locale || 'zh-cn';
|
||||
const targetLang = currentLang === 'zh-cn' ? 'en-us' : 'zh-cn';
|
||||
langUtil.change(targetLang);
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询会员信息
|
||||
*/
|
||||
initData() {
|
||||
if (this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.nsNewGift.init();
|
||||
this.$refs.birthdayGift.init();
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 修改昵称
|
||||
* @param {Object} nickName
|
||||
*/
|
||||
modifyNickname(nickName) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/member/modifynickname',
|
||||
data: {
|
||||
nickname: nickName
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.memberInfo.nickname = nickName;
|
||||
this.$store.commit('setMemberInfo', this.memberInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
modifyHeadimg(headimg) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/member/modifyheadimg',
|
||||
data: {
|
||||
headimg: headimg
|
||||
},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.memberInfo.headimg = headimg;
|
||||
this.$store.commit('setMemberInfo', this.memberInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/common/css/diy.scss';
|
||||
.foot{
|
||||
display: flex;
|
||||
// position: absolute;
|
||||
width: 100%;
|
||||
margin-bottom: 40rpx;
|
||||
.item{
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
color:#F4391c
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
background: none !important;
|
||||
}
|
||||
/* 原有页面样式(保留) */
|
||||
.member-page {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.choose-store>>>.goodslist-uni-popup-box {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
/deep/ .placeholder {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/deep/::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
background-color: transparent;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
/* 👇 新增:语言切换按钮样式 */
|
||||
.lang-switch-wrap {
|
||||
position: fixed !important;
|
||||
bottom: 120rpx !important; /* 避开底部tabBar(若显示) */
|
||||
right: 30rpx !important;
|
||||
z-index: 99999 !important; /* 层级拉满 */
|
||||
width: 120rpx;
|
||||
height: 60rpx;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid #e5e5e5 !important;
|
||||
border-radius: 30rpx !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1) !important;
|
||||
}
|
||||
.lang-text {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
.lang-switch-wrap:active {
|
||||
transform: scale(0.95) !important;
|
||||
transition: transform 0.1s ease !important;
|
||||
}
|
||||
</style>
|
||||
@@ -313,11 +313,11 @@
|
||||
@import './public/css/list.scss';
|
||||
</style>
|
||||
<style scoped>
|
||||
>>>.uni-tag--primary.uni-tag--inverted {
|
||||
::v-deep .uni-tag--primary.uni-tag--inverted {
|
||||
background-color: #f5f5f5 !important;
|
||||
}
|
||||
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,75 +1,78 @@
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": []
|
||||
},
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": true,
|
||||
"enhance": false,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"coverView": true,
|
||||
"nodeModules": false,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"uglifyFileName": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"bundle": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.16.1",
|
||||
"appid": "wx29215aa1bd97bbd6",
|
||||
"projectname": "niushop_b2c_v4_uniapp",
|
||||
"debugOptions": {
|
||||
"hidedInDevtools": []
|
||||
},
|
||||
"scripts": {},
|
||||
"staticServerOptions": {
|
||||
"baseURL": "",
|
||||
"servePath": ""
|
||||
},
|
||||
"isGameTourist": false,
|
||||
"condition": {
|
||||
"search": {
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"list": []
|
||||
},
|
||||
"gamePlugin": {
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": true,
|
||||
"enhance": false,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"coverView": true,
|
||||
"nodeModules": false,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"uglifyFileName": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"bundle": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"compileWorklet": false,
|
||||
"minifyWXML": true,
|
||||
"localPlugins": false,
|
||||
"disableUseStrict": false,
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.12.1",
|
||||
"appid": "wx29215aa1bd97bbd6",
|
||||
"projectname": "niushop_b2c_v4_uniapp",
|
||||
"isGameTourist": false,
|
||||
"condition": {
|
||||
"search": {
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"list": []
|
||||
},
|
||||
"gamePlugin": {
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"list": []
|
||||
}
|
||||
},
|
||||
"simulatorPluginLibVersion": {},
|
||||
"editorSetting": {}
|
||||
}
|
||||
24
project.private.config.json
Normal file
24
project.private.config.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"libVersion": "3.12.1",
|
||||
"projectname": "niushop_b2c_v4_uniapp",
|
||||
"condition": {},
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"coverView": true,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"skylineRenderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"autoAudits": false,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"useStaticServer": false,
|
||||
"useLanDebug": false,
|
||||
"showES6CompileOption": false,
|
||||
"compileHotReLoad": true,
|
||||
"checkInvalidKey": true,
|
||||
"ignoreDevUnusedFiles": true,
|
||||
"bigPackageSizeSupport": false,
|
||||
"useIsolateContext": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user