添加配置项
This commit is contained in:
parent
62b4622fcd
commit
bdf07979fd
283
App.vue
283
App.vue
|
|
@ -1,156 +1,187 @@
|
|||
<script>
|
||||
import Vue from 'vue'
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch')
|
||||
export default {
|
||||
onLaunch: function () {
|
||||
console.log("App Launch");
|
||||
const updateManager = uni.getUpdateManager();
|
||||
|
||||
const openBgm = uni.createInnerAudioContext()
|
||||
Vue.prototype.bgmCtx = {}
|
||||
Vue.prototype.bgmCtx.openBgm = openBgm
|
||||
openBgm.src = this.$img('/static/mp3/open.mp3')
|
||||
/* 重置首页公告弹窗状态 */
|
||||
uni.setStorageSync('_is_this_show', false)
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
// 请求完新版本信息的回调
|
||||
console.log(res.hasUpdate);
|
||||
});
|
||||
|
||||
/* 清除缓存中的广告id */
|
||||
uni.removeStorageSync('_ad_id')
|
||||
/* 清除缓存中的click_id */
|
||||
uni.removeStorageSync('_click_id')
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
updateManager.onUpdateReady(function (res) {
|
||||
uni.showModal({
|
||||
title: "更新提示",
|
||||
content: "新版本已经准备好,是否重启应用?",
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
updateManager.onUpdateFailed(function (res) {
|
||||
// 新的版本下载失败
|
||||
});
|
||||
var that = this;
|
||||
|
||||
}
|
||||
}
|
||||
this.$config.init().then(async (data) => {
|
||||
//加载配置
|
||||
let src = await that.$config.getAppSettingAsync("win_audio");
|
||||
if (src == null || src == "") {
|
||||
src = that.$img("/static/mp3/open.mp3");
|
||||
}
|
||||
//创建中奖音乐
|
||||
const openBgm = uni.createInnerAudioContext();
|
||||
Vue.prototype.bgmCtx = {};
|
||||
Vue.prototype.bgmCtx.openBgm = openBgm;
|
||||
openBgm.src = src;
|
||||
});
|
||||
|
||||
/* 重置首页公告弹窗状态 */
|
||||
uni.setStorageSync("_is_this_show", false);
|
||||
|
||||
/* 清除缓存中的广告id */
|
||||
uni.removeStorageSync("_ad_id");
|
||||
/* 清除缓存中的click_id */
|
||||
uni.removeStorageSync("_click_id");
|
||||
},
|
||||
onShow: function () {
|
||||
console.log("App Show");
|
||||
},
|
||||
onHide: function () {
|
||||
console.log("App Hide");
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
@import './common/animate.css';
|
||||
@import url('./common/common.css');
|
||||
@import url('/components/gaoyia-parse/parse.css');
|
||||
/*每个页面公共css */
|
||||
@import "./common/animate.css";
|
||||
@import url("./common/common.css");
|
||||
@import url("/components/gaoyia-parse/parse.css");
|
||||
|
||||
/* 引入字体 */
|
||||
@font-face {
|
||||
font-family: 'YouSheBiaoTiHei';
|
||||
src: url($imgurl +'font/YouSheBiaoTiHei.ttf') format('truetype');
|
||||
}
|
||||
/* 引入字体 */
|
||||
@font-face {
|
||||
font-family: "YouSheBiaoTiHei";
|
||||
src: url($imgurl + "font/YouSheBiaoTiHei.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'zihun152hao-jijiachaojihei';
|
||||
src: url($imgurl+'font/zihun152hao-jijiachaojihei.TTF') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: "zihun152hao-jijiachaojihei";
|
||||
src: url($imgurl + "font/zihun152hao-jijiachaojihei.TTF") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'zihun147hao-xingyuanhei';
|
||||
src: url($imgurl+'font/zihun147hao-xingyuanhei.TTF') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: "zihun147hao-xingyuanhei";
|
||||
src: url($imgurl + "font/zihun147hao-xingyuanhei.TTF") format("truetype");
|
||||
}
|
||||
|
||||
page {
|
||||
overflow-x: hidden;
|
||||
page {
|
||||
overflow-x: hidden;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #1C1B20;
|
||||
}
|
||||
}
|
||||
&:before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #1c1b20;
|
||||
}
|
||||
}
|
||||
|
||||
.ziti {
|
||||
font-family: YouSheBiaoTiHei;
|
||||
}
|
||||
.ziti {
|
||||
font-family: YouSheBiaoTiHei;
|
||||
}
|
||||
|
||||
.flex_center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.flex_center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hang2 {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
.hang2 {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.hang1 {
|
||||
overflow: hidden;
|
||||
/*超出部分隐藏*/
|
||||
white-space: nowrap;
|
||||
/*不换行*/
|
||||
text-overflow: ellipsis;
|
||||
/*超出部分文字以...显示*/
|
||||
}
|
||||
.hang1 {
|
||||
overflow: hidden;
|
||||
/*超出部分隐藏*/
|
||||
white-space: nowrap;
|
||||
/*不换行*/
|
||||
text-overflow: ellipsis;
|
||||
/*超出部分文字以...显示*/
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.common_bg {
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.common_bg {
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
button.hide {
|
||||
position: absolute;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
button.hide {
|
||||
position: absolute;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* 重写组件样式 */
|
||||
/deep/.uni-noticebar {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
/* 重写组件样式 */
|
||||
/deep/.uni-noticebar {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/deep/.mescroll-upwarp {
|
||||
box-sizing: border-box;
|
||||
min-height: 55px;
|
||||
padding: 15px 0;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
}
|
||||
/deep/.mescroll-upwarp {
|
||||
box-sizing: border-box;
|
||||
min-height: 55px;
|
||||
padding: 15px 0;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/deep/.cmd-progress-outer {
|
||||
line-height: 0;
|
||||
/deep/.cmd-progress-outer {
|
||||
line-height: 0;
|
||||
|
||||
.cmd-progress-bg {
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
.cmd-progress-bg {
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-tabbar__bd {
|
||||
height: 50px !important;
|
||||
}
|
||||
.uni-tabbar__bd {
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
.uni-tabbar__icon {
|
||||
height: 50px !important;
|
||||
}
|
||||
.uni-tabbar__icon {
|
||||
height: 50px !important;
|
||||
}
|
||||
</style>
|
||||
177
common/config.js
Normal file
177
common/config.js
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
import RequestManager from '@/common/request.js'
|
||||
/**
|
||||
* 全局配置工具类
|
||||
* 用于项目启动时加载全局配置数据并缓存
|
||||
*/
|
||||
|
||||
// 数据缓存对象
|
||||
let configData = null;
|
||||
let isLoading = false;
|
||||
let loadPromise = null;
|
||||
|
||||
// 配置类
|
||||
class ConfigManager {
|
||||
/**
|
||||
* 初始化并加载配置
|
||||
* 在应用启动时调用
|
||||
*/
|
||||
static init() {
|
||||
return this.loadConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载配置数据
|
||||
* @returns {Promise} 返回加载完成的Promise
|
||||
*/
|
||||
static loadConfig() {
|
||||
// 避免重复加载
|
||||
if (isLoading) {
|
||||
return loadPromise;
|
||||
}
|
||||
|
||||
isLoading = true;
|
||||
loadPromise = new Promise(async (resolve, reject) => {
|
||||
const res = await RequestManager.request({
|
||||
url: 'config',
|
||||
method: "GET",
|
||||
data: {},
|
||||
Loading: isLoading
|
||||
});
|
||||
console.log(res);
|
||||
|
||||
if (res.status === 1 && res.data) {
|
||||
configData = res.data;
|
||||
uni.setStorageSync("configData", configData);
|
||||
console.log('全局配置数据加载成功');
|
||||
resolve(configData);
|
||||
} else {
|
||||
console.error('加载配置数据失败:', res.msg || '未知错误');
|
||||
reject(new Error(res.msg || '加载配置失败'));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return loadPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有配置数据
|
||||
* @returns {Object} 配置数据对象
|
||||
*/
|
||||
static getAll() {
|
||||
if (configData) {
|
||||
return configData;
|
||||
} else {
|
||||
console.warn('配置数据尚未加载,获取本地缓存中。。。');
|
||||
configData = uni.getStorageSync("configData");
|
||||
if (configData != null) {
|
||||
return configData;
|
||||
}
|
||||
this.loadConfig();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定键的配置值
|
||||
* @param {String} key 配置键
|
||||
* @param {any} defaultValue 默认值,当键不存在时返回
|
||||
* @returns {any} 配置值
|
||||
*/
|
||||
static get(key, defaultValue = null) {
|
||||
if (!configData) {
|
||||
console.warn('配置数据尚未加载,获取本地缓存中。。。');
|
||||
configData = uni.getStorageSync("configData");
|
||||
if (configData != null) {
|
||||
return configData;
|
||||
}
|
||||
this.loadConfig();
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return key in configData ? configData[key] : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新配置数据
|
||||
* @returns {Promise} 返回刷新完成的Promise
|
||||
*/
|
||||
static refresh() {
|
||||
isLoading = false;
|
||||
return this.loadConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查配置是否已加载
|
||||
* @returns {Boolean} 是否已加载
|
||||
*/
|
||||
static isLoaded() {
|
||||
return configData !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用设置
|
||||
* @param {String} key 设置键
|
||||
* @returns {Object|String|null} 设置值
|
||||
*/
|
||||
static getAppSetting(key = null) {
|
||||
let appSetting = this.get('app_setting');
|
||||
if (key == null) {
|
||||
return appSetting;
|
||||
}
|
||||
return key in appSetting ? appSetting[key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 盒子类型
|
||||
* @returns {Object} 商品类型对象
|
||||
*/
|
||||
static getGoodType() {
|
||||
let goodType = this.get('good_type');
|
||||
if (goodType != null) {
|
||||
return goodType.map(item => {
|
||||
return {
|
||||
id: item.value,
|
||||
title: item.name
|
||||
}
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定键的配置值
|
||||
* @param {String} key 配置键
|
||||
* @param {any} defaultValue 默认值,当键不存在时返回
|
||||
* @returns {any} 配置值
|
||||
*/
|
||||
static async getAsync(key, defaultValue = null) {
|
||||
if (!configData) {
|
||||
// console.warn('配置数据尚未加载,正在加载中...');
|
||||
await this.loadConfig();
|
||||
if (configData) {
|
||||
return key in configData ? configData[key] : defaultValue;;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return key in configData ? configData[key] : defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用设置
|
||||
* @param {String} key 设置键
|
||||
* @returns {Object|String|null} 设置值
|
||||
*/
|
||||
static async getAppSettingAsync(key = null) {
|
||||
let appSetting = await this.getAsync('app_setting');
|
||||
if (key == null) {
|
||||
return appSetting;
|
||||
}
|
||||
return key in appSetting ? appSetting[key] : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ConfigManager;
|
||||
234
common/request.js
Normal file
234
common/request.js
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/**
|
||||
* 网络请求工具类
|
||||
* 封装统一的网络请求方法
|
||||
*/
|
||||
|
||||
class RequestManager {
|
||||
/**
|
||||
* 发送网络请求
|
||||
* @param {Object} param 请求参数
|
||||
* @param {String} param.url 请求地址
|
||||
* @param {Object} param.data 请求数据
|
||||
* @param {Function} param.success 成功回调
|
||||
* @param {Function} param.fail 失败回调
|
||||
* @param {Function} param.complete 完成回调
|
||||
* @param {Boolean} param.Loading 是否显示加载提示
|
||||
* @param {String} backpage 返回页面
|
||||
* @param {String} backtype 返回类型
|
||||
* @returns {Promise} 返回请求Promise
|
||||
*/
|
||||
static request(param, backpage, backtype) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 参数检查
|
||||
if (!param || typeof param !== 'object') {
|
||||
reject(new Error('请求参数错误'))
|
||||
return
|
||||
}
|
||||
|
||||
uni.getNetworkType({
|
||||
success: function(res) {
|
||||
if (res.networkType == 'none') {
|
||||
uni.showToast({
|
||||
title: '网络连接异常,请检查网络',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(new Error('网络连接异常'))
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const url = param.url || ''
|
||||
const method = param.method || 'POST'
|
||||
const data = param.data || {}
|
||||
const Loading = param.Loading || false
|
||||
const token = uni.getStorageSync('token')
|
||||
let client = ""
|
||||
|
||||
// #ifdef H5
|
||||
client = "h5"
|
||||
// #endif
|
||||
|
||||
// 获取应用实例和基础URL
|
||||
const app = getApp()
|
||||
let siteBaseUrl = ''
|
||||
|
||||
if (app && app.globalData && app.globalData.siteBaseUrl) {
|
||||
siteBaseUrl = app.globalData.siteBaseUrl
|
||||
} else {
|
||||
// 尝试从Vue原型获取
|
||||
try {
|
||||
const Vue = require('vue').default
|
||||
if (Vue.prototype && Vue.prototype.siteBaseUrl) {
|
||||
siteBaseUrl = Vue.prototype.siteBaseUrl
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取siteBaseUrl失败', e)
|
||||
}
|
||||
|
||||
if (!siteBaseUrl) {
|
||||
// 兜底处理
|
||||
siteBaseUrl = 'https://manghe.zpc-xy.com/api/'
|
||||
}
|
||||
}
|
||||
|
||||
// 拼接完整请求地址,确保URL格式正确
|
||||
let requestUrl = ''
|
||||
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
// 如果是完整的URL,直接使用
|
||||
requestUrl = url
|
||||
} else {
|
||||
// 否则拼接基础URL和相对路径
|
||||
// 确保基础URL以/结尾,而请求路径不以/开头
|
||||
const baseUrlWithSlash = siteBaseUrl.endsWith('/') ? siteBaseUrl : siteBaseUrl + '/'
|
||||
const path = url.startsWith('/') ? url.substring(1) : url
|
||||
requestUrl = baseUrlWithSlash + path
|
||||
}
|
||||
|
||||
console.log('请求URL:', requestUrl)
|
||||
|
||||
let header = {}
|
||||
|
||||
if (method.toUpperCase() == 'POST') {
|
||||
header = {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
client: client,
|
||||
token: token,
|
||||
adid: uni.getStorageSync('_ad_id'),
|
||||
clickid: uni.getStorageSync('_click_id')
|
||||
}
|
||||
} else {
|
||||
header = {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
// 显示加载提示
|
||||
if (!Loading) {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
}
|
||||
|
||||
// 发起网络请求
|
||||
uni.request({
|
||||
url: requestUrl,
|
||||
method: method.toUpperCase(),
|
||||
header: header,
|
||||
data: data,
|
||||
success: res => {
|
||||
console.log("res.data.status", res.data.status)
|
||||
if (res.data.status == 1) {
|
||||
// 请求成功
|
||||
resolve(res.data)
|
||||
} else if (res.data.status == 2222) {
|
||||
// 特殊状态码处理
|
||||
resolve(res.data)
|
||||
} else if (res.data.status == -9) {
|
||||
let pages = getCurrentPages()
|
||||
console.log(pages[pages.length - 1].route)
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none',
|
||||
success() {
|
||||
setTimeout(() => {
|
||||
// #ifdef H5
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bangdingweb'
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bangding'
|
||||
})
|
||||
// #endif
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
}, 100)
|
||||
reject(res.data)
|
||||
} else if (res.data.status == 0) {
|
||||
setTimeout(function() {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}, 100)
|
||||
reject(res.data)
|
||||
} else if (res.data.status < 0) {
|
||||
var pages = getCurrentPages()
|
||||
for (var a = 0; a < pages.length; a++) {
|
||||
console.log(pages[a].route)
|
||||
if (pages[a].route == 'pages/user/index') {
|
||||
uni.setStorageSync('lgurl', pages[a].route)
|
||||
uni.setStorageSync('lgurldata', JSON.stringify(pages[a].options))
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
})
|
||||
}, 100)
|
||||
uni.redirectTo({
|
||||
url: '/pages/user/login'
|
||||
})
|
||||
reject(res.data)
|
||||
} else {
|
||||
reject(res.data)
|
||||
}
|
||||
typeof param.success == 'function' && param.success(res.data)
|
||||
},
|
||||
fail: e => {
|
||||
console.error('网络请求失败:', e)
|
||||
uni.showToast({
|
||||
title: e.errMsg || '请求失败',
|
||||
icon: 'none'
|
||||
})
|
||||
typeof param.fail == 'function' && param.fail(e)
|
||||
reject(e)
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
typeof param.complete == 'function' && param.complete()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送GET请求
|
||||
* @param {String} url 请求地址
|
||||
* @param {Object} data 请求参数
|
||||
* @param {Boolean} showLoading 是否显示加载提示
|
||||
* @returns {Promise} 返回请求Promise
|
||||
*/
|
||||
static get(url, data = {}, showLoading = true) {
|
||||
return this.request({
|
||||
url,
|
||||
data,
|
||||
method: 'GET',
|
||||
Loading: !showLoading
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送POST请求
|
||||
* @param {String} url 请求地址
|
||||
* @param {Object} data 请求参数
|
||||
* @param {Boolean} showLoading 是否显示加载提示
|
||||
* @returns {Promise} 返回请求Promise
|
||||
*/
|
||||
static post(url, data = {}, showLoading = true) {
|
||||
return this.request({
|
||||
url,
|
||||
data,
|
||||
method: 'POST',
|
||||
Loading: !showLoading
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default RequestManager;
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<view class="_priv_pop_bd_content">
|
||||
感谢选择我们的产品,我们非常重视您的个人信息安全和隐私保护.根据最新法律要求,使用我们的产品前,请仔细阅读
|
||||
<text @click="$c.to({ url: '/pages/guize/guize?type=5' })">
|
||||
《吧唧一番赏隐私保护指引》
|
||||
《{{ $config.getAppSetting("app_name") }}隐私保护指引》
|
||||
</text>
|
||||
,以便我们向您提供更优质的服务!
|
||||
</view>
|
||||
|
|
|
|||
245
main.js
245
main.js
|
|
@ -1,201 +1,53 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import Mixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'
|
||||
// import uView from "uview-ui"
|
||||
|
||||
import {
|
||||
gotopage
|
||||
} from '@/common/gotopage.js'
|
||||
// 配置公共方法
|
||||
Vue.prototype.gotoPage = gotopage
|
||||
|
||||
// Vue.use(uView);
|
||||
// 配置公共方法
|
||||
import common from '@/common/common.js'
|
||||
import { gotopage } from '@/common/gotopage.js'
|
||||
import RequestManager from '@/common/request.js'
|
||||
import ConfigManager from '@/common/config.js'
|
||||
|
||||
|
||||
// 基础配置
|
||||
const baseUrl = 'https://manghe.zpc-xy.com'
|
||||
const imageUrl = 'https://mh.shhuanmeng.com'
|
||||
const loginPage = "https://xinglanmh.shequtuangou.vip/login.html"
|
||||
|
||||
// 全局变量配置
|
||||
Vue.prototype.siteBaseUrl = baseUrl + '/api/'
|
||||
Vue.prototype.$baseUrl = baseUrl
|
||||
Vue.prototype.$z_img2 = imageUrl + '/zcq/'
|
||||
Vue.prototype.$img = url => imageUrl + '/static/web' + url
|
||||
Vue.prototype.$img1 = url => imageUrl + '/static/web/static/' + url
|
||||
Vue.prototype.$sys = () => uni.getSystemInfoSync()
|
||||
Vue.prototype.$loginPage = loginPage
|
||||
Vue.prototype.$wxloginPage = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0e33d80d35e4a3b1&redirect_uri=${escape(loginPage)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
||||
|
||||
// 公共方法
|
||||
Vue.prototype.gotoPage = gotopage
|
||||
Vue.prototype.$noMultipleClicks = common.noMultipleClicks
|
||||
Vue.prototype.$c = common;
|
||||
//var loginPage = "http://api.zpc-xy.com/login.html";
|
||||
// var loginPage="http://api.zpc-xy.com/login.html";
|
||||
var loginPage = "https://xinglanmh.shequtuangou.vip/login.html";
|
||||
Vue.prototype.$loginPage = loginPage;
|
||||
Vue.prototype.$wxloginPage =
|
||||
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0e33d80d35e4a3b1&redirect_uri=${escape(loginPage)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
|
||||
//ttps://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
|
||||
// https://open.weixin.qq.com/connect/oauth2/authorize? =wx520c15f417810387&redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&response_type=code&scope=snsapi_base&state=123#wechat_redirect
|
||||
Vue.prototype.req = function(param, backpage, backtype) {
|
||||
uni.getNetworkType({
|
||||
success: function(res) {
|
||||
if (res.networkType == 'none') {
|
||||
uni.showToast({
|
||||
title: '网络连接异常,请检查网络',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
var _self = this,
|
||||
url = param.url,
|
||||
method = 'POST',
|
||||
header = {},
|
||||
data = param.data || {},
|
||||
Loading = param.Loading || false
|
||||
Vue.prototype.$c = common
|
||||
|
||||
var token = uni.getStorageSync('token')
|
||||
// 我
|
||||
// var token = 'bf3dd927642ea5a7a9ad90f1e1d1faab4d61cd33';
|
||||
// 客户
|
||||
// var token = '801abe6ec37a36b3ff37ded44be13c7bf06b629e';
|
||||
var client = "";
|
||||
// #ifdef H5
|
||||
client = "h5";
|
||||
// #endif
|
||||
//拼接完整请求地址
|
||||
var requestUrl = this.siteBaseUrl + url
|
||||
if (method) {
|
||||
method = method.toUpperCase() //小写改为大写
|
||||
// console.log(token,11)
|
||||
if (method == 'POST') {
|
||||
header = {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
client: client,
|
||||
token: token,
|
||||
adid: uni.getStorageSync('_ad_id'),
|
||||
clickid: uni.getStorageSync('_click_id'),
|
||||
// 全局请求方法
|
||||
Vue.prototype.req = RequestManager.request
|
||||
Vue.prototype.$request = RequestManager
|
||||
|
||||
}
|
||||
|
||||
// if (uni.getStorageSync('_ad_id')) {
|
||||
// header.adid = uni.getStorageSync('_ad_id')
|
||||
// }
|
||||
// if (uni.getStorageSync('_click_id')) {
|
||||
// header.clickid = uni.getStorageSync('_click_id')
|
||||
// }
|
||||
} else {
|
||||
header = {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
method = 'GET'
|
||||
header = {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
//用户交互:加载圈
|
||||
// console.log(!Loading)
|
||||
if (!Loading) {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
}
|
||||
//网络请求
|
||||
|
||||
uni.request({
|
||||
url: requestUrl,
|
||||
method: method,
|
||||
header: header,
|
||||
data: data,
|
||||
success: res => {
|
||||
// if (requestUrl.indexOf('coupon_ling') != -1) {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: JSON.stringify(res),
|
||||
// showCancel: true,
|
||||
// success: ({ confirm, cancel }) => {}
|
||||
// })
|
||||
// }
|
||||
|
||||
console.log("res.data.status", res.data.status)
|
||||
if (res.data.status == 1) {
|
||||
//返回结果码code判断:1成功,-1错误
|
||||
// uni.showToast({
|
||||
// title: res.data.msg,
|
||||
// icon: 'none',
|
||||
// })
|
||||
} else if (res.data.status == 2222) {} else if (res.data.status == -9) {
|
||||
let pages = getCurrentPages()
|
||||
console.log(pages[pages.length - 1].route)
|
||||
// uni.setStorageSync('page', pages[pages.length - 1].route)
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none',
|
||||
success() {
|
||||
setTimeout(() => {
|
||||
// #ifdef H5
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bangdingweb'
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/bangding'
|
||||
})
|
||||
// #endif
|
||||
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
}, 100)
|
||||
} else if (res.data.status == 0) {
|
||||
setTimeout(function() {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}, 100)
|
||||
} else if (res.data.status < 0) {
|
||||
var pages = getCurrentPages()
|
||||
for (var a = 0; a < pages.length; a++) {
|
||||
console.log(pages[a].route)
|
||||
if (pages[a].route == 'pages/user/index') {
|
||||
uni.setStorageSync('lgurl', pages[a].route)
|
||||
uni.setStorageSync('lgurldata', JSON.stringify(pages[a].options))
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
})
|
||||
}, 100)
|
||||
uni.redirectTo({
|
||||
url: '/pages/user/login'
|
||||
})
|
||||
} else {
|
||||
return
|
||||
}
|
||||
typeof param.success == 'function' && param.success(res.data)
|
||||
},
|
||||
fail: e => {
|
||||
console.log('网络请求fail:' + JSON.stringify(e))
|
||||
typeof param.fail == 'function' && param.fail(e.data)
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
typeof param.complete == 'function' && param.complete()
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
// 全局配置管理器
|
||||
Vue.prototype.$config = ConfigManager
|
||||
|
||||
// #ifdef H5
|
||||
function loadScript(url) {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = url;
|
||||
document.head.appendChild(script);
|
||||
var script = document.createElement('script')
|
||||
script.type = 'text/javascript'
|
||||
script.src = url
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
loadScript('https://res.wx.qq.com/open/js/jweixin-1.6.0.js');
|
||||
loadScript('https://res.wx.qq.com/open/js/jweixin-1.6.0.js')
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
const updateManager = wx.getUpdateManager()
|
||||
console.log(updateManager);
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
// 请求完新版本信息的回调
|
||||
console.log(res.hasUpdate)
|
||||
})
|
||||
|
||||
|
|
@ -205,7 +57,6 @@ updateManager.onUpdateReady(function() {
|
|||
content: '新版本已经准备好,是否重启应用?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
|
|
@ -217,23 +68,6 @@ updateManager.onUpdateFailed(function() {
|
|||
})
|
||||
// #endif
|
||||
|
||||
// 测试
|
||||
|
||||
const baseUrl = 'https://manghe.zpc-xy.com'
|
||||
const imageUrl = 'https://mh.shhuanmeng.com';
|
||||
// 正式
|
||||
// const baseUrl = 'https://bajiapi.onelight.vip'
|
||||
Vue.prototype.siteBaseUrl = baseUrl + '/api/'
|
||||
|
||||
Vue.prototype.$z_img2 = imageUrl + '/zcq/'
|
||||
Vue.prototype.$baseUrl = baseUrl
|
||||
// Vue.prototype.$img = url => baseUrl + '/static/web' + url
|
||||
Vue.prototype.$img = url => imageUrl + '/static/web' + url
|
||||
// Vue.prototype.$img1 = url => baseUrl + '/static/web' + url
|
||||
Vue.prototype.$img1 = url => imageUrl + '/static/web/static/' + url
|
||||
|
||||
Vue.prototype.$sys = () => uni.getSystemInfoSync()
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.mixin(Mixin)
|
||||
App.mpType = 'app'
|
||||
|
|
@ -241,4 +75,17 @@ App.mpType = 'app'
|
|||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
|
||||
// 创建全局数据对象
|
||||
app.globalData = {
|
||||
siteBaseUrl: baseUrl + '/api/'
|
||||
}
|
||||
|
||||
// 应用启动时加载全局配置
|
||||
ConfigManager.init().then(config => {
|
||||
console.log('全局配置加载完成')
|
||||
}).catch(err => {
|
||||
console.error('全局配置加载失败', err)
|
||||
})
|
||||
|
||||
app.$mount()
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -523,8 +523,9 @@
|
|||
return co;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title: `吧唧一番赏${this.pageData.goods.title}系列`,
|
||||
title: this.$config.getAppSetting("app_name")+`${this.pageData.goods.title}系列`,
|
||||
imageUrl: this.pageData.goods.imgurl_detail,
|
||||
path: '/package/index/lian-ji' +
|
||||
this.$c.qs({
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
{
|
||||
"path": "pages/user/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "吧唧一番赏",
|
||||
"navigationBarTitleText": "友达赏",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
{
|
||||
"path": "pages/user/bangding",
|
||||
"style": {
|
||||
"navigationBarTitleText": "吧唧一番赏",
|
||||
"navigationBarTitleText": "友达赏",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
|
|
@ -499,7 +499,7 @@
|
|||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarTitleText": "吧唧一番赏",
|
||||
"navigationBarTitleText": "友达赏",
|
||||
"navigationBarBackgroundColor": "#222222",
|
||||
"backgroundColor": "#000000"
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,7 +3,7 @@
|
|||
<!-- 顶部搜索 -->
|
||||
<view class="content_top">
|
||||
<view class="content_top_bar"></view>
|
||||
<view class="content_top_title">吧唧一番赏</view>
|
||||
<view class="content_top_title">友达赏</view>
|
||||
<view class="flex_center">
|
||||
<view class="title_ipt">
|
||||
<image :src="z_imgPath+'search.png'"></image>
|
||||
|
|
|
|||
|
|
@ -286,8 +286,9 @@
|
|||
},
|
||||
onShareAppMessage() {
|
||||
let that = this;
|
||||
|
||||
return {
|
||||
title: "吧唧一番赏" + that.goods.title + '系列',
|
||||
title: that.$config.getAppSetting("app_name")+ that.goods.title + '系列',
|
||||
imageUrl: that.goods.card_banner,
|
||||
path: "/pages/chouka/ka?goods_id=" + that.goods_id + '&pid=' + uni.getStorageSync('userinfo').ID
|
||||
};
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@
|
|||
onShareAppMessage(e) {
|
||||
let that = this
|
||||
return {
|
||||
title: '吧唧一番赏' + that.goods.title + '系列',
|
||||
title: this.$config.getAppSetting("app_name")+ that.goods.title + '系列',
|
||||
imageUrl: that.goods.imgurl_detail,
|
||||
path: '/pages/shouye/detail_wuxian?goods_id=' +
|
||||
that.goods_id +
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@
|
|||
|
||||
<view class="detail-type">
|
||||
产品类型:
|
||||
<text>一番赏</text>
|
||||
<text>{{ $config.getAppSetting("app_name")}}</text>
|
||||
</view>
|
||||
|
||||
<view class="detail-price">
|
||||
|
|
@ -1190,9 +1190,10 @@ export default {
|
|||
|
||||
onShareAppMessage() {
|
||||
let that = this
|
||||
|
||||
return {
|
||||
title:
|
||||
'吧唧一番赏' +
|
||||
this.$config.getAppSetting("app_name") +
|
||||
that.goods.title +
|
||||
'系列' +
|
||||
' 第' +
|
||||
|
|
|
|||
|
|
@ -594,7 +594,7 @@
|
|||
}
|
||||
}
|
||||
return {
|
||||
title: `吧唧一番赏${this.pageData.goods.title}系列 第${this.pageData.goods.num}套`,
|
||||
title: this.$config.getAppSetting("app_name")+`${this.pageData.goods.title}系列 第${this.pageData.goods.num}套`,
|
||||
imageUrl: this.pageData.goods.imgurl_detail,
|
||||
path: '/pages/shouye/detail' +
|
||||
this.$c.qs({
|
||||
|
|
|
|||
|
|
@ -649,7 +649,7 @@
|
|||
}
|
||||
|
||||
return {
|
||||
title: `吧唧一番赏${this.pageData.goods.title}系列`,
|
||||
title: this.$config.getAppSetting("app_name")+`${this.pageData.goods.title}系列`,
|
||||
imageUrl: this.pageData.goods.imgurl_detail,
|
||||
path: '/pages/shouye/detail_wuxian' +
|
||||
this.$c.qs({
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user