master
sws 2023-09-04 16:07:56 +08:00
parent 7000a248ba
commit 20b24ab4ee
1 changed files with 165 additions and 164 deletions

329
App.vue
View File

@ -1431,54 +1431,54 @@
return false;
},
// webopenid
is_user_weixin_web_openid(order_ids, payment_id = 0) {
// web_openid
if(this.is_weixin_env()) {
var web_openid = this.get_user_cache_info('weixin_web_openid') || null;
if(web_openid == null) {
//
var params = this.get_launch_cache_info();
if(params != null && (params.is_weixin_auth_web_openid || 0) == 1) {
uni.showLoading({
title: "处理中..."
});
uni.request({
url: this.get_request_url("tokenuserinfo", "user"),
method: "POST",
data: {},
dataType: "json",
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
uni.setStorageSync(this.data.cache_user_info_key, res.data.data);
} else {
this.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
this.showToast("服务器请求出错");
}
});
return true;
} else {
uni.setStorageSync(this.data.cache_page_pay_key, {
order_ids: (typeof order_ids == 'array') ? order_ids.join(',') : order_ids,
payment_id: payment_id
});
var page_url = this.get_page_url();
page_url += (page_url.indexOf('?') == -1) ? '?' : '&';
page_url += 'is_weixin_auth_web_openid=1';
var request_url = encodeURIComponent(base64.encode(page_url));
var url = this.get_request_url("index", "pay", "weixinwebauthorization", "request_url="+request_url, "index").replace('&ajax=ajax', '');
window.location.href = url;
}
return false;
}
}
return true;
},
// webopenid
is_user_weixin_web_openid(order_ids, payment_id = 0) {
// web_openid
if (this.is_weixin_env()) {
var web_openid = this.get_user_cache_info('weixin_web_openid') || null;
if (web_openid == null) {
//
var params = this.get_launch_cache_info();
if (params != null && (params.is_weixin_auth_web_openid || 0) == 1) {
uni.showLoading({
title: "处理中..."
});
uni.request({
url: this.get_request_url("tokenuserinfo", "user"),
method: "POST",
data: {},
dataType: "json",
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
uni.setStorageSync(this.data.cache_user_info_key, res.data.data);
} else {
this.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
this.showToast("服务器请求出错");
}
});
return true;
} else {
uni.setStorageSync(this.data.cache_page_pay_key, {
order_ids: (typeof order_ids == 'array') ? order_ids.join(',') : order_ids,
payment_id: payment_id
});
var page_url = this.get_page_url();
page_url += (page_url.indexOf('?') == -1) ? '?' : '&';
page_url += 'is_weixin_auth_web_openid=1';
var request_url = encodeURIComponent(base64.encode(page_url));
var url = this.get_request_url("index", "pay", "weixinwebauthorization", "request_url=" + request_url, "index").replace('&ajax=ajax', '');
window.location.href = url;
}
return false;
}
}
return true;
},
// app
get_application_title() {
@ -1685,136 +1685,136 @@
});
}, 1500);
},
//
is_app_mourning() {
var is_app = parseInt(this.get_config('plugins_base.mourning.data.is_app', 0));
if(is_app == 1) {
//
var time_current = Date.parse(new Date());
//
var time_start = this.get_config('plugins_base.mourning.data.time_start') || null;
if(time_start != null)
{
if(Date.parse(new Date(time_start)) > time_current)
{
return false;
}
}
//
var time_end = this.get_config('plugins_base.mourning.data.time_end') || null;
if(time_end != null)
{
if(Date.parse(new Date(time_end)) < time_current)
{
return false;
}
}
return true;
}
return false;
},
//
is_app_mourning() {
var is_app = parseInt(this.get_config('plugins_base.mourning.data.is_app', 0));
if (is_app == 1) {
//
var time_current = Date.parse(new Date());
//
var time_start = this.get_config('plugins_base.mourning.data.time_start') || null;
if (time_start != null) {
if (Date.parse(new Date(time_start)) > time_current) {
return false;
}
}
//
var time_end = this.get_config('plugins_base.mourning.data.time_end') || null;
if (time_end != null) {
if (Date.parse(new Date(time_end)) < time_current) {
return false;
}
}
return true;
}
return false;
},
//
currency_symbol() {
return this.get_config('currency_symbol') || this.data.currency_symbol;
},
//
currency_symbol() {
return this.get_config('currency_symbol') || this.data.currency_symbol;
},
//
get_location_check(type, object, method) {
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
var self = this;
uni.getSetting({
success(res) {
if (!res.authSetting[type]) {
uni.authorize({
scope: type,
success(res) {
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
}
});
} else {
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
}
},
fail: res => {
app.globalData.showToast("请先获取授权");
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
}
});
// #endif
// #ifdef MP-ALIPAY || H5 || APP
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
// #endif
// #ifdef MP-KUAISHOU
app.globalData.showToast('不支持地理位置选择!');
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
// #endif
},
//
get_location_check(type, object, method) {
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
var self = this;
uni.getSetting({
success(res) {
if (!res.authSetting[type]) {
uni.authorize({
scope: type,
success(res) {
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
}
});
} else {
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
}
},
fail: res => {
app.globalData.showToast("请先获取授权");
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
}
});
// #endif
// #ifdef MP-ALIPAY || H5 || APP
if (typeof object === 'object' && (method || null) != null) {
object[method](1);
}
// #endif
// #ifdef MP-KUAISHOU
app.globalData.showToast('不支持地理位置选择!');
if (typeof object === 'object' && (method || null) != null) {
object[method](0);
}
// #endif
},
// 0 1
start_location_update(type = 0, object, method) {
//
uni.stopLocationUpdate();
//
uni.offLocationChange();
// api
if(type == 0) {
//
uni.startLocationUpdate({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({status: 0, msg: res.errMsg});
}
}
});
} else {
//
uni.startLocationUpdateBackground({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({status: 0, msg: res.errMsg});
}
}
});
}
},
// 0 1
start_location_update(type = 0, object, method) {
//
uni.stopLocationUpdate();
//
uni.offLocationChange();
// api
if (type == 0) {
//
uni.startLocationUpdate({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({
status: 0,
msg: res.errMsg
});
}
}
});
} else {
//
uni.startLocationUpdateBackground({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({
status: 0,
msg: res.errMsg
});
}
}
});
}
},
//
start_location_update_change(object, method) {
uni.onLocationChange((res) => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({
status: 1,
lat: res.longitude,
lng: res.latitude,
lng: res.longitude,
lat: res.latitude,
data: res
});
}
});
},
//
get_theme_value() {
return uni.getStorageSync('theme') || 'yellow'
@ -1826,6 +1826,7 @@
// import `@/common/theme/theme-${mode}.scss`; //import
require(`./common/css/theme/${theme}.css`);
},
//
get_theme_color() {
let color_obj = {
yellow: '#f6c133', //
@ -1841,7 +1842,7 @@
return color_obj[theme];
},
//
groupArry(array, subGroupLength) {
group_arry(array, subGroupLength) {
let index = 0;
let newArray = [];
if (array.length > subGroupLength) {