新增获取用户当前位置,app无网络新增快捷权限入口
parent
fd42096e66
commit
db1eb0d1ff
92
App.vue
92
App.vue
|
|
@ -85,6 +85,10 @@
|
|||
// 是否开启微信隐私弹窗授权提示、仅首页展示(0否, 1是)
|
||||
is_weixin_privacy_setting: 1,
|
||||
weixin_privacy_setting_timer: null,
|
||||
|
||||
// 弹出获取用户当前位置(0否, 1是)
|
||||
get_user_location_status: 1,
|
||||
get_user_location_timer: null,
|
||||
|
||||
// 微信小程序打开地图使用(0否, 1是)【腾讯位置服务路线规划】插件、(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a)
|
||||
is_weixin_open_location_use_plugins: 0,
|
||||
|
|
@ -2483,6 +2487,16 @@
|
|||
return { status: status, value: value };
|
||||
},
|
||||
|
||||
// 打开权限管理中心
|
||||
open_setting_event() {
|
||||
// #ifdef MP
|
||||
uni.openSetting();
|
||||
// #endif
|
||||
// #ifdef APP
|
||||
uni.openAppAuthorizeSetting();
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 扫码解析处理
|
||||
scan_handle() {
|
||||
var self = this;
|
||||
|
|
@ -2590,10 +2604,81 @@
|
|||
},
|
||||
};
|
||||
}
|
||||
user_location['text'] = user_location.status == 0 ? i18n.t('shopxo-uniapp.app.4v6q86') : user_location.name || user_location.address || '';
|
||||
user_location['text'] = user_location.status == 0 ? i18n.t('shopxo-uniapp.app.4v6q86') : (user_location.name || user_location.address || '');
|
||||
return user_location;
|
||||
},
|
||||
|
||||
// 获取用户当前位置
|
||||
get_user_location() {
|
||||
if(this.data.get_user_location_status == 1) {
|
||||
var cache_key = this.data.cache_userlocation_key;
|
||||
var result = uni.getStorageSync(cache_key) || null;
|
||||
if(result == null) {
|
||||
// 当前对象
|
||||
var self = this;
|
||||
// 当前平台
|
||||
var client_value = self.application_client_type();
|
||||
// 微信隐私状态
|
||||
var is_weixin_privacy = false;
|
||||
// 是否有网络
|
||||
var is_network = false;
|
||||
// 定时验证并获取位置权限
|
||||
self.data.get_user_location_timer = setInterval(function () {
|
||||
// 微信环境、协议验证处理
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.getPrivacySetting({
|
||||
success: (res) => {
|
||||
if (!res.needAuthorization) {
|
||||
is_weixin_privacy = true;
|
||||
}
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
|
||||
// app下先要网络
|
||||
// #ifdef APP
|
||||
uni.getNetworkType({
|
||||
success: function (res) {
|
||||
if (res.networkType != 'none') {
|
||||
is_network = true;
|
||||
}
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
|
||||
// 是否可以读取位置权限
|
||||
var status = true;
|
||||
// 微信环境、必须先同意隐私权限后再弹出获取用户位置权限
|
||||
if(client_value == 'weixin' && !is_weixin_privacy) {
|
||||
status = false;
|
||||
}
|
||||
// app环境、必须先初始化完成有网络后再弹出获取用户位置权限
|
||||
if((client_value == 'ios' || client_value == 'android') && !is_network) {
|
||||
status = false;
|
||||
}
|
||||
if(status) {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
uni.setStorageSync(cache_key, {
|
||||
name: i18n.t('shopxo-uniapp.app.tghyu3'),
|
||||
address: '',
|
||||
latitude: res.latitude || null,
|
||||
longitude: res.longitude || null,
|
||||
status: 1,
|
||||
});
|
||||
clearInterval(self.data.get_user_location_timer);
|
||||
},
|
||||
fail: function(res) {
|
||||
clearInterval(self.data.get_user_location_timer);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 清除定时任务
|
||||
clear_interval_handle() {
|
||||
// 清除初始化公共数据方法定时任务
|
||||
|
|
@ -2610,6 +2695,8 @@
|
|||
this.data.network_type_page_record_timer = null;
|
||||
// 清除微信隐私方法定时任务
|
||||
clearInterval(this.data.weixin_privacy_setting_timer);
|
||||
// 清除弹出位置权限提示定时任务
|
||||
clearInterval(this.data.get_user_location_timer);
|
||||
},
|
||||
|
||||
// 商品访问数据存储缓存
|
||||
|
|
@ -2671,6 +2758,9 @@
|
|||
page_event_onload_handle(params) {
|
||||
// 设置底部菜单
|
||||
this.set_tabbar();
|
||||
|
||||
// 获取用户当前位置
|
||||
this.get_user_location();
|
||||
},
|
||||
|
||||
// 页面展示事件处理
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
<!-- 是否有网络 -->
|
||||
<view v-if="network_type_value == 'none' && not_network_await_status == 0" class="network-type-tips wh-auto tc bs-bb padding-horizontal-main">
|
||||
<view class="cr-base text-size">{{$t('no-data.no-data.1u202v')}}</view>
|
||||
<view class="cr-grey margin-top-sm">{{$t('no-data.no-data.imw8f1')}}{{title}}{{$t('no-data.no-data.q87572')}}</view>
|
||||
<view class="cr-grey margin-top-sm">{{$t('no-data.no-data.imw8f1')}}{{title}}{{$t('no-data.no-data.q87572')}}</view>
|
||||
<view class="margin-top-lg tc">
|
||||
<button type="default" class="br-main bg-main cr-white round padding-horizontal-xxl" size="mini" @tap="open_setting_event">{{ $t('setup.setup.377uwg') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 1 加载中(0loog, 1名称) -->
|
||||
|
|
@ -137,7 +140,12 @@
|
|||
// 返回事件
|
||||
back_event(e) {
|
||||
app.globalData.page_back_prev_event();
|
||||
}
|
||||
},
|
||||
|
||||
// 打开权限管理中心
|
||||
open_setting_event() {
|
||||
app.globalData.open_setting_event();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1737,7 +1737,8 @@
|
|||
"87yghj": "Logout successful",
|
||||
"di6v5t": "Please obtain authorization first",
|
||||
"nu5058": "Geographic location selection is not supported!",
|
||||
"4v6q86": "No location selected"
|
||||
"4v6q86": "No location selected",
|
||||
"tghyu3": "current location"
|
||||
}
|
||||
},
|
||||
"password": {
|
||||
|
|
|
|||
|
|
@ -1722,7 +1722,8 @@
|
|||
"87yghj": "退出成功",
|
||||
"di6v5t": "请先获取授权",
|
||||
"nu5058": "不支持地理位置选择!",
|
||||
"4v6q86": "未选择位置"
|
||||
"4v6q86": "未选择位置",
|
||||
"tghyu3": "当前位置"
|
||||
}
|
||||
},
|
||||
"password": {
|
||||
|
|
|
|||
|
|
@ -522,10 +522,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
// 加载loding
|
||||
if(this.is_first == 0) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
|
@ -539,8 +541,10 @@
|
|||
data: this.request_data_ext_params_merge(data),
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if(this.is_first == 0) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
|
|
@ -683,7 +687,9 @@
|
|||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.hideLoading();
|
||||
if(this.is_first == 0) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@
|
|||
.agreement-content {
|
||||
padding: 40rpx;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
top: 15%;
|
||||
width: calc(100% - 160rpx);
|
||||
}
|
||||
.agreement-content .logo {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view :class="theme_view">
|
||||
<view class="padding-main">
|
||||
<block v-if="data_list.length > 0">
|
||||
<block v-if="data_list.length > 0">
|
||||
<scroll-view :scroll-y="true" class="scroll-box padding-main bs-bb" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="bg-white border-radius-main padding-main oh" :class="data_list.length > index + 1 ? 'spacing-mb' : ''">
|
||||
<view class="title flex-row jc-sb align-c wh-auto">
|
||||
<view class="name flex-1 flex-width cr-base">{{ item.name }}{{$t('goods-list.goods-list.27nkjm')}}</view>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view class="more flex-row jc-e align-c br-t-f9 padding-top-main">
|
||||
<view v-if="item.comments_count > 0" class="more flex-row jc-e align-c br-t-f9 padding-top-main">
|
||||
<view v-if="(item.hide_more || false) === false && ((item.hide_comments_list_num === 0 && !item.bool_more) || (item.hide_comments_list_num == undefined || item.hide_comments_list_num > 0))" class="cr-red text-size-xs" @tap="open_more(item.id, index)">
|
||||
<text v-if="item.hide_comments_list_num === 0 && !item.bool_more">{{$t('goods-list.goods-list.h3t0f1')}}</text>
|
||||
<text v-if="item.hide_comments_list_num == undefined || item.hide_comments_list_num > 0">{{$t('goods-list.goods-list.278qr1')}}{{ item.hide_comments_list_num || item.comments_count }}{{$t('goods-list.goods-list.8y3cc7')}}</text>
|
||||
|
|
@ -50,12 +50,12 @@
|
|||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -142,9 +142,11 @@
|
|||
});
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
|
|
@ -157,7 +159,9 @@
|
|||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
|
|
@ -200,7 +204,9 @@
|
|||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
|
|
@ -271,9 +277,7 @@
|
|||
});
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
|
|
|
|||
|
|
@ -115,10 +115,6 @@ export default {
|
|||
|
||||
methods: {
|
||||
init() {
|
||||
var self = this;
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
|
@ -130,13 +126,12 @@ export default {
|
|||
},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var data_base = data.base || null;
|
||||
var level_list = (data.level_list || null) != null && data.level_list.length > 0 ? data.level_list : [];
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_base: data_base,
|
||||
level_list: level_list,
|
||||
data_list_loding_status: data_base == null || level_list.length <= 0 ? 0 : 3,
|
||||
|
|
@ -144,20 +139,19 @@ export default {
|
|||
data_list_loding_msg: "",
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, self, "init")) {
|
||||
if (app.globalData.is_login_check(res.data, this, "init")) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
|
|
|
|||
|
|
@ -149,9 +149,11 @@ export default {
|
|||
});
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
|
||||
// 参数
|
||||
var order_status = (this.nav_status_list[this.nav_status_index] || null) == null ? -1 : this.nav_status_list[this.nav_status_index]["value"];
|
||||
|
|
@ -167,7 +169,9 @@ export default {
|
|||
},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
|
|
@ -212,7 +216,9 @@ export default {
|
|||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
|
|
|
|||
|
|
@ -100,9 +100,6 @@ export default {
|
|||
|
||||
methods: {
|
||||
init() {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
|
@ -112,7 +109,6 @@ export default {
|
|||
data: {},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
|
@ -144,7 +140,6 @@ export default {
|
|||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
|
|
|
|||
|
|
@ -146,9 +146,11 @@ export default {
|
|||
});
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
var status = (this.nav_status_list[this.nav_status_index] || null) == null ? -1 : this.nav_status_list[this.nav_status_index]["value"];
|
||||
|
|
@ -162,7 +164,9 @@ export default {
|
|||
},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
|
|
@ -207,7 +211,9 @@ export default {
|
|||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
|
|
|
|||
|
|
@ -189,9 +189,11 @@ export default {
|
|||
});
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
|
||||
// 请求参数
|
||||
var data = {
|
||||
|
|
@ -234,7 +236,9 @@ export default {
|
|||
data: data,
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
|
|
@ -280,7 +284,9 @@ export default {
|
|||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
|
|
|
|||
|
|
@ -258,12 +258,7 @@
|
|||
|
||||
// 打开权限管理中心
|
||||
open_setting_event() {
|
||||
// #ifdef MP
|
||||
uni.openSetting();
|
||||
// #endif
|
||||
// #ifdef APP
|
||||
uni.openAppAuthorizeSetting();
|
||||
// #endif
|
||||
app.globalData.open_setting_event();
|
||||
},
|
||||
|
||||
// 客服电话
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<text class="cr-base">{{ item.add_time }}</text>
|
||||
<text class="fr cr-red">{{ item.status_text }}</text>
|
||||
</view>
|
||||
<view :url="'/pages/user-orderaftersale-detail/user-orderaftersale-detail?oid=' + item.order_id + '&did=' + item.order_detail_id" @tap="url_event" class="goods-item oh cp">
|
||||
<view :data-value="'/pages/user-orderaftersale-detail/user-orderaftersale-detail?oid=' + item.order_id + '&did=' + item.order_detail_id" @tap="url_event" class="goods-item oh cp">
|
||||
<image class="goods-image fl radius" :src="item.order_data.items.images" mode="aspectFill"></image>
|
||||
<view class="goods-base pr">
|
||||
<view class="multi-text">{{ item.order_data.items.title }}</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue