源文件

This commit is contained in:
gyq
2025-04-25 09:49:53 +08:00
commit 791d82b9e3
640 changed files with 130029 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
page {
background: #fbfbfb;
}
.open-setting-view {
background: hsla(0, 0%, 0%, 0.1);
position: fixed;
top: 0;
/* #ifdef H5 */
top: calc(88rpx + env(safe-area-inset-top));
/* #endif */
left: 0;
width: 100%;
height: 100%;
text-align: center;
z-index: 1000000;
}
.open-setting-view .content {
margin: 0 auto;
width: 360rpx;
height: 200rpx;
padding: 50rpx;
border-radius: 12rpx;
margin-top: 70%;
position: relative;
}
.open-setting-view .content button {
margin-top: 15rpx;
}
.open-setting-view .content .value {
margin-top: 5rpx;
}
.open-setting-view .content .value text {
font-weight: 500;
color: #333;
}
.open-setting-loding {
padding-top: 35%;
}
.open-setting-loding image {
margin: 0 auto;
}

View File

@@ -0,0 +1,149 @@
<template>
<view :class="theme_view">
<view v-if="is_show_open_setting" class="open-setting-view">
<view class="content bg-white">
<view class="msg cr-grey">{{$t('open-setting-location.open-setting-location.61wezw')}}</view>
<view class="value cr-base">{{$t('open-setting-location.open-setting-location.6vev38')}}<text>{{$t('open-setting-location.open-setting-location.lult41')}}</text>{{$t('open-setting-location.open-setting-location.407106')}}</view>
<button type="primary" open-type="openSetting" size="mini" @opensetting="setting_event">{{$t('open-setting-location.open-setting-location.65q4b3')}}</button>
<view class="tc margin-top-sm">
<navigator open-type="navigateBack" class="cp cr-grey dis-inline-block" hover-class="none">{{$t('common.return')}}</navigator>
</view>
</view>
</view>
<view v-else class="open-setting-loding">
<image :src="common_static_url + 'bg-loding.gif'" class="avatar dis-block" mode="widthFix"></image>
<view class="tc margin-top-sm">
<navigator open-type="navigateBack" class="cp cr-grey dis-inline-block" hover-class="none">{{$t('common.return')}}</navigator>
</view>
</view>
<view v-if="(error_msg || null) != null" class="cr-red margin-top-lg padding-horizontal-main">{{ error_msg }}</view>
</view>
</template>
<script>
const app = getApp();
var common_static_url = app.globalData.get_static_url("common");
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
common_static_url: common_static_url,
params: null,
is_show_open_setting: false,
auth: "scope.userLocation",
cache_key: app.globalData.data.cache_userlocation_key,
error_msg: null,
};
},
components: {},
onLoad(params) {
// 调用公共事件方法
app.globalData.page_event_onload_handle(params);
// 设置参数
this.setData({
params: params,
});
this.init();
},
onShow() {
// 调用公共事件方法
app.globalData.page_event_onshow_handle();
},
methods: {
// 获取权限
init() {
app.globalData.get_location_check(this.auth, this, "location_back_handle");
},
// 位置权限校验回调
location_back_handle(status = 0) {
if (status == 1) {
// 是否校验成功直接返回
if (parseInt(this.params.is_check_success_back || 0) == 1) {
uni.navigateBack();
} else {
this.choose_location();
}
} else {
this.setData({
is_show_open_setting: true,
});
}
},
// 配置打开事件
setting_event(e) {
if (e.detail.authSetting[this.auth]) {
// 不展示打开设置的按钮容器
this.setData({
is_show_open_setting: false,
});
// 是否校验成功直接返回
if (parseInt(this.params.is_check_success_back || 0) == 1) {
uni.navigateBack();
} else {
this.choose_location();
}
}
},
// 打开位置服务
choose_location() {
// app先返回当前页面再调用位置选择组件
// #ifdef APP
uni.navigateBack();
// #endif
// 调用位置选择组件
uni.chooseLocation({
success: (res) => {
// 位置数据存储缓存中,改变状态值(成功)
res['status'] = 1;
res['lat'] = res.latitude;
res['lng'] = res.longitude;
delete res['latitude'];
delete res['longitude'];
uni.setStorageSync(this.cache_key, res);
// 触发自定义事件并传递参数给上一页
uni.$emit('refresh', { location_success: true });
// app则不执行返回操作、上面已经返回过了
// #ifndef APP
setTimeout(function () {
uni.navigateBack();
}, 500);
// #endif
},
fail: (res) => {
// 存在数据则改变状态值(失败)
var result = {...(uni.getStorageSync(this.cache_key) || {}), ...{status: 3}};
uni.setStorageSync(this.cache_key, result);
// 取消则自动返回、则显示错误
// error=11 支付宝取消、msg包含cancel则其他平台
var msg = res.errorMessage || res.chooseLocation || res.errMsg || this.$t('open-setting-location.open-setting-location.hwn386');
if(res.error == 11 || msg.indexOf('cancel') != -1) {
// app则不执行返回操作、上面已经返回过了
// #ifndef APP
uni.navigateBack();
// #endif
} else {
this.setData({ error_msg: res.errMsg });
app.globalData.showToast(res.errMsg);
}
}
});
}
},
};
</script>
<style>
@import "./open-setting-location.css";
</style>