新增获取用户当前位置,app无网络新增快捷权限入口

master
gongfuxiang 2024-05-06 20:31:22 +08:00
parent fd42096e66
commit db1eb0d1ff
14 changed files with 179 additions and 68 deletions

92
App.vue
View File

@ -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();
},
//

View File

@ -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>

View File

@ -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": {

View File

@ -1722,7 +1722,8 @@
"87yghj": "退出成功",
"di6v5t": "请先获取授权",
"nu5058": "不支持地理位置选择!",
"4v6q86": "未选择位置"
"4v6q86": "未选择位置",
"tghyu3": "当前位置"
}
},
"password": {

View File

@ -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'),

View File

@ -109,8 +109,7 @@
.agreement-content {
padding: 40rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
top: 15%;
width: calc(100% - 160rpx);
}
.agreement-content .logo {

View File

@ -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: () => {

View File

@ -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'),

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -258,12 +258,7 @@
//
open_setting_event() {
// #ifdef MP
uni.openSetting();
// #endif
// #ifdef APP
uni.openAppAuthorizeSetting();
// #endif
app.globalData.open_setting_event();
},
//

View File

@ -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>