master
xy 2 years ago
parent 3fb8128278
commit a66724edf9

@ -1,7 +1,11 @@
<script>
export default {
globalData: {
navbarHeight: 44,
},
onLaunch: function() {
console.log('App Launch')
this.globalData.navbarHeight = uni.getSystemInfoSync().safeArea.top
},
onShow: function() {
console.log('App Show')

@ -8,6 +8,15 @@
<view class="hot-title" v-if="activeCity && !serachCity">当前定位城市</view>
<view class="hot-city" v-if="activeCity && !serachCity">
<view class="hot-item" @click="cityTrigger(activeCity)">{{ activeCity[formatName] }}</view>
<u-button v-if="isRefresh"
size="medium"
ripple
:custom-style="{ 'background': '#ca2328','color': '#fff',width: '200rpx',height: '62rpx', 'line-height': '62rpx' }"
@click="$emit('refreshLocation')">
<u-icon name="map-fill"></u-icon>
<text style="padding-left: 10rpx;">更新定位</text>
</u-button>
</view>
<!-- 热门城市 -->
<view class="hot-title" v-if="hotCity.length > 0 && !serachCity">热门城市</view>
@ -20,13 +29,13 @@
<view class="citys" v-if="!serachCity">
<view v-for="(city, index) in sortItems" :key="index" v-show="city.isCity" class="citys-row">
<view class="citys-item-letter" :id="'city-letter-' + (city.name === '#' ? '0' : city.name)">{{ city.name }}</view>
<view class="citys-item" v-for="(item, inx) in city.citys" :key="inx" @click="cityTrigger(item)">{{ item.cityName }}</view>
<view class="citys-item" v-for="(item, inx) in city.citys" :key="inx" :class="{ 'is-active': activeCity[formatName] === item[formatName] }" @click="cityTrigger(item)">{{ item[formatName] }}</view>
</view>
</view>
<!-- 城市列表(搜索后) -->
<view class="citys" v-if="serachCity">
<view v-for="(item, index) in searchDatas" :key="index" class="citys-row">
<view class="citys-item" :key="inx" @click="cityTrigger(item)">{{ item.name }}</view>
<view class="citys-item" :key="index" @click="cityTrigger(item)">{{ item.name }}</view>
</view>
</view>
</scroll-view>
@ -62,6 +71,11 @@
import citySelect from './citySelect.js';
export default {
props: {
//是否需要更新定位
isRefresh: {
type: Boolean,
default: false
},
//查询提示文字
placeholder: {
type: String,
@ -313,6 +327,7 @@
</script>
<style lang="scss">
$theme-color: #ca2328;
//宽度转换vw
@function vww($number) {
@return ($number / 375) * 750+rpx;
@ -352,7 +367,7 @@
line-height: vww(40);
font-size: vww(14);
padding: 0 vww(5);
border: 1px solid #4d8cfd;
border: 1px solid $theme-color;
border-radius: 3px;
}
}
@ -447,6 +462,9 @@
border: none;
}
}
.is-active {
color: $theme-color
}
}
}
@ -471,7 +489,7 @@
width: vww(20);
padding: vww(5) 0;
font-size: 12px;
color: #4d8cfd;
color: $theme-color;
// &:last-child {
// margin-bottom: 0;

@ -0,0 +1,201 @@
p<template>
<view v-if="showPrivacy" :class="privacyClass">
<view :class="contentClass">
<view class="title">隐私保护指引</view>
<view class="des">
感谢选择我们的小程序,我们非常重视您的个人信息安全和隐私保护。根据最新法律要求,使用我们的产品前,请仔细阅读“<text class="link"
@tap="openPrivacyContract">{{privacyContractName}}
</text>”,以便我们向您提供更优质的服务!<br />我们将尽全力保护您的个人信息及合法权益,感谢您的信任!
<br />
</view>
<view class="btns">
<button class="item reject" @tap="exitMiniProgram">拒绝</button>
<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'PrivacyPopup',
data() {
return {
privacyContractName: '',
showPrivacy: false,
isRead: false,
resolvePrivacyAuthorization: null,
};
},
props: {
position: {
type: String,
default: 'center'
}
},
computed: {
privacyClass() {
return this.position === 'bottom' ? 'privacy privacy-bottom' : 'privacy';
},
contentClass() {
return this.position === 'bottom' ? 'content content-bottom' : 'content';
}
},
mounted() {
if (wx.onNeedPrivacyAuthorization) {
wx.onNeedPrivacyAuthorization((resolve) => {
this.resolvePrivacyAuthorization = resolve;
});
}
if (wx.getPrivacySetting) {
wx.getPrivacySetting({
success: (res) => {
console.log(res, 'getPrivacySetting');
if (res.needAuthorization) {
this.privacyContractName = res.privacyContractName;
this.showPrivacy = true;
}
},
});
}
},
methods: {
openPrivacyContract() {
wx.openPrivacyContract({
success: () => {
this.isRead = true;
},
fail: () => {
uni.showToast({
title: '遇到错误',
icon: 'error',
});
},
});
},
exitMiniProgram() {
this.$emit('reject-privacy'); // 当用户拒绝隐私政策时发出事件
wx.exitMiniProgram();
},
handleAgreePrivacyAuthorization() {
// if (this.isRead) {
this.showPrivacy = false;
this.$emit('agree-privacy'); // 当用户同意隐私政策时发出事件
if (typeof this.resolvePrivacyAuthorization === 'function') {
this.resolvePrivacyAuthorization({
buttonId: 'agree-btn',
event: 'agree',
});
}
// } else {
// uni.showToast({
// title: '请先阅读隐私授权协议',
// icon: 'error',
// });
// }
},
},
};
</script>
<style scoped>
.privacy {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
}
.privacy-bottom {
align-items: flex-end;
}
.content {
width: 632rpx;
padding: 48rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
}
.content-bottom {
position: absolute;
bottom: 0;
width: 96%;
padding: 36rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
border-radius: 16rpx 16rpx 0 0;
}
.content .title {
text-align: center;
color: #333;
font-weight: bold;
font-size: 32rpx;
}
.content .des {
font-size: 26rpx;
color: #666;
margin-top: 40rpx;
text-align: justify;
line-height: 1.6;
}
.content .des .link {
color: #07c160;
text-decoration: underline;
}
.btns {
margin-top: 48rpx;
margin-bottom: 12rpx;
display: flex;
}
.btns .item {
width: 200rpx;
height: 72rpx;
overflow: visible;
display: flex;
align-items: center;
justify-content: center;
/* border-radius: 16rpx; */
box-sizing: border-box;
border: none !important;
}
.btns .reject {
background: #f4f4f5;
color: #666;
font-size: 14px;
font-weight: 300;
margin-right: 16rpx;
}
.btns .agree {
width: 320rpx;
background: #07c160;
color: #fff;
font-size: 16px;
}
.privacy-bottom .btns .agree {
width: 440rpx;
}
</style>

@ -189,7 +189,7 @@ export default {
next () {
if (!this.isAuth && this.currentStep === 0) {
this.$refs.uTips.show({
title: '请认真阅读《服务条款同意书》!',
title: '请认真阅读《服务条款同意书》',
type: 'warning',
duration: '2000'
})

@ -1,9 +1,9 @@
<template>
<view class="page">
<view class="top">
<view class="position" @click="isShowCity = true">
<view class="position" @click="$u.route({ url: '/pages/CitySelect/CitySelect' })">
<u-icon name="map-fill"></u-icon>
<text>苏州</text>
<text>{{ vuex_location.city.replace(/(市|区|县)/,'') }}</text>
<u-icon name="arrow-down" size="22"></u-icon>
</view>
</view>
@ -31,13 +31,12 @@
</view>
</view>
<view class="right">
<u-button shape="circle" ripple :custom-style="orderBtnStyle">预约</u-button>
<u-button shape="circle" ripple :custom-style="orderBtnStyle" @click="toOrder(i)">预约</u-button>
</view>
</view>
</view>
</view>
<u-picker v-model="isShowCity" mode="region"></u-picker>
</view>
</template>
@ -54,8 +53,17 @@ export default {
'height': '60rpx',
'line-height': '60rpx'
},
isShowCity: false
};
},
mounted() {
this.$store.dispatch('getLocation')
},
methods: {
toOrder(item) {
this.$u.route({
url: '/package_sub/pages/AddOrder/AddOrder'
})
}
}
}
</script>

@ -12,8 +12,7 @@
{
"path": "pages/order/order",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true
"navigationBarTitleText": "订单列表"
}
},
{
@ -28,6 +27,12 @@
"style": {
"navigationBarTitleText": "城市选择"
}
},
{
"path": "pages/login/login",
"style": {
"navigationStyle": "custom"
}
}
],
"subPackages": [

@ -2,12 +2,14 @@
<view>
<city-select
@cityClick="cityClick"
:formatName="formatName"
formatName="cityName"
:activeCity="activeCity"
:hotCity="hotCity"
:obtainCitys="obtainCitys"
:isSearch="true"
:is-refresh="true"
ref="citys"
@refreshLocation="refreshLocation"
></city-select>
</view>
</template>
@ -22,12 +24,8 @@ export default {
data() {
return {
//需要构建索引参数的名称(注意:传递的对象里面必须要有这个名称的参数)
formatName: 'title',
//当前城市
activeCity: {
id: 1,
title: '南京市'
},
activeCity: {},
//热门城市
hotCity: [
{
@ -40,26 +38,24 @@ export default {
}
],
//显示的城市数据
obtainCitys: [
{
id: 0,
title: '南京'
},
{
id: 1,
title: '北京'
},
{
id: 2,
title: '天津'
},
{
id: 3,
title: '东京'
}
]
obtainCitys: []
};
},
watch: {
vuex_location: {
handler:function(newVal, oldVal) {
this.activeCity = {
cityName: newVal.city,
cityCode: newVal.cityCode
}
},
deep: true,
immediate: true
}
},
mounted() {
this.$store.dispatch('getLocation')
},
onLoad () {
//动态更新数据
setTimeout(() => {
@ -67,8 +63,8 @@ export default {
this.formatName = 'cityName'
//修改当前城市
this.activeCity = {
cityName: '南京',
cityCode: 110100
cityName: this.vuex_location.city,
cityCode: this.vuex_location.cityCode
}
//修改热门城市
this.hotCity = [
@ -83,25 +79,16 @@ export default {
]
//修改构建索引数据
this.obtainCitys = citys
uni.showToast({
icon: 'none',
title: '更新数据成功',
// #ifdef MP-WEIXIN
duration: 3000,
// #endif
mask: true
})
}, 500)
}, 0)
},
methods: {
refreshLocation() {
this.$store.dispatch('getLocation')
},
cityClick(item) {
uni.showToast({
icon: 'none',
title: 'item: ' + JSON.stringify(item),
// #ifdef MP-WEIXIN
duration: 3000,
// #endif
mask: true
this.$store.commit('SET_CITY',{
cityName: item.cityName,
cityCode: item.cityCode
})
}
}

@ -8,9 +8,9 @@
alt=""
></image>
<view class="top" :style="{ 'padding-right': menuButtonRight + 'px' }">
<view class="position" @click="isShowCity = true">
<view class="position" @click="toPage('/pages/CitySelect/CitySelect')">
<u-icon name="map-fill"></u-icon>
<text>{{ location.city.replace(/(市|区|县)/,'') }}</text>
<view>{{ vuex_location.city.replace(/(市|区|县)/,'') }}</view>
<u-icon name="arrow-down" size="22"></u-icon>
</view>
<view class="icon">
@ -37,7 +37,7 @@
<view v-if="isShowSticky" class="search-sticky" :style="{ 'padding-top': statusBarHeight + 'px','padding-right': menuButtonRight + 'px' }">
<view class="search-sticky__position" @click="isShowCity = true">
<u-icon name="map-fill"></u-icon>
<text>苏州</text>
<view>{{ vuex_location.city.replace(/(市|区|县)/,'') }}</view>
<u-icon name="arrow-down" size="22"></u-icon>
</view>
@ -144,22 +144,24 @@
<image class="bottom" src="~@/static/index/bottom.png" mode="aspectFit" alt=""></image>
</view>
<u-picker v-model="isShowCity" mode="region"></u-picker>
<u-top-tips :navbar-height="navbarHeight" ref="uTips"></u-top-tips>
<tabbar />
<PrivacyPopup />
</view>
</template>
<script>
import Tabbar from "@/component/Tabbar/Tabbar.vue";
import PrivacyPopup from "@/component/privacy-popup/privacy-popup.vue";
export default {
components: {
Tabbar,
PrivacyPopup
},
data() {
return {
navbarHeight: 44,
isShowSticky: false,
scrollTop: 308,
statusBarHeight: 40,
@ -210,20 +212,13 @@ export default {
},
],
isShowCity: false,
location: {
latitude: '',
longitude: '',
city: '',
cityCode: ''
}
};
},
mounted() {
this.getElScrollTop()
this.$store.dispatch('getLocation')
},
created() {
this.navbarHeight = uni.getSystemInfoSync().safeArea.top
this.menuButtonRight =
uni.getSystemInfoSync().screenWidth -
uni.getMenuButtonBoundingClientRect().left +
@ -234,7 +229,11 @@ export default {
this.isShowSticky = e.scrollTop > this.scrollTop
},
onLoad() {
this.getLocation()
},
computed: {
navbarHeight() {
return getApp().globalData.navbarHeight
}
},
methods: {
getElScrollTop () {
@ -264,42 +263,6 @@ export default {
break
}
},
async getLocation () {
try {
const [err, res] = await uni.getLocation({
type: 'gcj02'
})
if (err) {
await Promise.reject(err)
}
this.location.latitude = res.latitude;
this.location.longitude = res.longitude;
const address = await new Promise((resolve, reject) => {
this.$qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success: address => resolve(address),
fail: error => reject(error)
})
})
console.log('address', address)
if (!!address.status) {
await Promise.reject(address.message)
}
this.location.city = address?.result?.ad_info.city
this.location.cityCode = address?.result?.ad_info?.city_code
} catch (err) {
console.error(err)
this.$refs.uTips.show({
title: '获取定位失败',
type: 'warning',
duration: '2000'
})
}
}
},
};
</script>
@ -340,9 +303,15 @@ export default {
font-size: 30rpx;
letter-spacing: 3rpx;
font-weight: 500;
display: flex;
align-items: center;
& > text {
& > view {
padding: 0 13rpx;
max-width: 160rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.icon {
@ -400,9 +369,15 @@ export default {
font-weight: 500;
white-space: nowrap;
padding: 0 16rpx;
display: flex;
align-items: center;
& > text {
& > view {
padding: 0 10rpx;
max-width: 160rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
&__search {

@ -0,0 +1,169 @@
<template>
<view>
<image class="bkg" mode="aspectFill" src="~@/static/login/bkg.png"></image>
<view class="container">
<image class="logo" mode="aspectFit" src="~@/static/login/logo.png"></image>
<view class="login">
<view class="text">
<view>医康养 申请获取以下权限! </view>
<view>获取您绑定的手机号码</view>
</view>
<view class="btns">
<u-button ripple
:hair-line="false"
:custom-style="mobileBtnStyle"
open-type="getPhoneNumber"
@getphonenumber="mobileLogin">手机登录</u-button>
<u-button ripple :hair-line="false" :custom-style="authBtnStyle" @click="authLogin">一件授权登录</u-button>
</view>
<view class="auth">
<u-checkbox v-model="isAuth" shape="circle" active-color="#c20d12">
<text style="padding-left: 18rpx;">阅读并同意</text>
<text style="color: #c20d12;" @click.stop.prevent>《用户协议》</text>
<text>和</text>
<text style="color: #c20d12;" @click.stop.prevent>《隐私协议》</text>
</u-checkbox>
</view>
</view>
</view>
<image class="bottom" src="~@/static/login/bottom.png" mode="aspectFit"></image>
<u-top-tips :navbar-height="navbarHeight" ref="uTips"></u-top-tips>
</view>
</template>
<script>
export default {
data() {
return {
mobileBtnStyle: {
width: '185rpx',
height: '72rpx',
'border-radius': '5rpx',
'line-height': '72rpx',
'font-size': '28rpx',
'color': '#333',
background: '#e1e0e4'
},
authBtnStyle: {
width: '434rpx',
height: '72rpx',
'border-radius': '5rpx',
'line-height': '72rpx',
'font-size': '28rpx',
'color': '#fff',
background: 'linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%)'
},
isAuth: false
};
},
computed: {
navbarHeight() {
return getApp().globalData.navbarHeight
}
},
methods: {
authLogin() {
if (!this.isAuth) {
this.$refs.uTips.show({
title: '请阅读《用户协议》和《隐私协议》',
type: 'warning',
duration: '2000'
})
return
}
uni.login({
provider: 'weixin', //使用微信登录
success: (loginRes) => {
console.log(loginRes);
this.$u.route({
type: 'switchTab',
url: '/pages/index/index'
})
}
});
},
mobileLogin(e) {
if (!this.isAuth) {
this.$refs.uTips.show({
title: '请阅读《用户协议》和《隐私协议》',
type: 'warning',
duration: '2000'
})
return
}
console.log(e)
}
}
}
</script>
<style>
page {
min-height: 100vh;
background: #fff;
}
</style>
<style lang="scss" scoped>
.bkg {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 510rpx;
}
.container {
position: relative;
padding-top: 15.5vh;
z-index: 3;
.logo {
width: 399rpx;
height: 392rpx;
margin: 0 auto;
display: flex;
}
.login {
margin-top: 10.5vh;
.text {
padding-left: 50rpx;
& > view:nth-child(1) {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
& > view:nth-child(2) {
font-size: 24rpx;
color: #999;
padding-top: 10rpx;
}
}
.btns {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 50rpx;
margin-top: 2.1vh;
}
.auth {
font-size: 24rpx;
color: #999999;
font-weight: 500;
padding: 4.61vh 0 0 95rpx;
}
}
}
.bottom {
position: absolute;
width: 491rpx;
height: 192rpx;
left: 50%;
bottom: 7.82vh;
transform: translateX(-50%);
}
</style>

@ -1,24 +1,307 @@
<template>
<view>
order
<tabbar />
<view class="wrap safe-area-inset-bottom">
<view class="u-tabs-box">
<u-tabs-swiper :height="76"
:font-size="24"
active-color="#c20d12"
bg-color="transparent"
inactive-color="#999"
ref="tabs"
:list="tabs"
:current="current"
@change="change"
:is-scroll="false"
:offset="[5,5]"
swiperWidth="750"></u-tabs-swiper>
</view>
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
<view class="order" v-for="i in 10" :key="i">
<view class="title">
<view class="title__name">专享半天陪诊</view>
<view class="title__status">待支付</view>
</view>
<view class="price">
<view class="price-icon">
<u-icon name="integral" size="30"></u-icon>
</view>
<view class="price-text">
<view class="price-text__num">¥600</view>
<view class="price-text__no">订单号 PZ2024111855448048</view>
</view>
</view>
<view class="info">
<view class="info__item">
<text>就诊城市</text>
<text>苏州</text>
</view>
<view class="info__item">
<text>就诊医院</text>
<text>苏大附属</text>
</view>
<view class="info__item">
<text>就诊人</text>
<text>萍萍</text>
</view>
<view class="info__item">
<text>就诊时间</text>
<text>2024-12-18 17:00</text>
</view>
</view>
<view class="bottom">
<view class="time">
<text>下单时间: </text>
<text>2024-11-18 17:48:47</text>
</view>
<u-button ripple shape="circle" :custom-style="payBtnStyle">立即支付</u-button>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
</scroll-view>
</swiper-item>
</swiper>
</view>
<Tabbar />
</view>
</template>
<script>
import Tabbar from "@/component/Tabbar/Tabbar.vue";
import Tabbar from '@/component/Tabbar/Tabbar.vue'
export default {
components: {
Tabbar
},
data() {
return {};
return {
payBtnStyle: {
'background-image': 'linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%)',
'font-weight': '500',
'font-size': '28rpx',
'color': '#fff',
'width': '185rpx',
'height': '60rpx',
'line-height': '60rpx'
},
tabs: [
{
name: '全部'
},
{
name: '待支付'
},
{
name: '待评价'
},
{
name: '服务中',
count: 12
},
{
name: '已完成'
},
{
name: '已取消'
}
],
current: 0,
swiperCurrent: 0,
tabsHeight: 0,
dx: 0,
loadStatus: [],
};
},
onLoad() {
},
created() {
this.loadStatus = Array.from({ length: this.tabs.length },_ => 'loadmore')
},
computed: {
},
methods: {
reachBottom() {
// 此tab为空数据
},
// tab栏切换
change(index) {
this.swiperCurrent = index;
},
transition({ detail: { dx } }) {
this.$refs.tabs.setDx(dx);
},
animationfinish({ detail: { current } }) {
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
}
}
}
};
</script>
<style lang="scss">
<style>
page {
height: 100%;
background-color: #eee;
}
</style>
<style lang="scss" scoped>
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top) - calc(60px + 6px));
width: 100%;
}
.swiper-box {
flex: 1;
}
.swiper-item {
height: 100%;
}
.order {
margin: 0 25rpx;
border-radius: 10rpx;
filter: drop-shadow(0 0 10rpx rgba(211,211,214,0.3));
background-color: #ffffff;
margin-top: 24rpx;
.title {
display: flex;
align-items: center;
padding: 37rpx 39rpx 32rpx 45rpx;
position: relative;
&__name {
font-size: 24rpx;
color: #333333;
font-weight: bold;
}
&__status {
font-size: 24rpx;
color: #c20d12;
font-weight: 500;
margin-left: auto;
}
&::after {
content: '';
height: 2rpx;
background: #999999;
opacity: 0.302;
position: absolute;
bottom: 0;
left: 39rpx;
right: 39rpx;
}
}
.price {
display: flex;
align-items: center;
padding: 28rpx 0 0 44rpx;
&-icon {
display: flex;
justify-content: center;
align-items: center;
width: 90rpx;
height: 84rpx;
border-radius: 10rpx;
background-color: #f3e7d8;
}
&-text {
padding-left: 28rpx;
&__num {
font-size: 24rpx;
color: #000000;
font-weight: bold;
}
&__no {
font-size: 24rpx;
color: #999999;
font-weight: 500;
padding-top: 14rpx;
}
}
}
.info {
display: flex;
flex-wrap: wrap;
padding: 35rpx 45rpx 0;
&__item {
flex-basis: 50%;
color: #333;
font-size: 24rpx;
font-weight: 500;
display: flex;
margin-bottom: 32rpx;
& > text {
display: block;
}
& > text:nth-child(1) {
color: #999;
padding-right: 20rpx;
flex: 0;
word-break: keep-all;
}
& > text:nth-child(2) {
}
}
}
.bottom {
padding: 6rpx 28rpx 35rpx 43rpx;
display: flex;
align-items: center;
justify-content: space-between;
.time {
font-size: 24rpx;
color: #999999;
font-weight: 500;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

@ -7,7 +7,7 @@ let lifeData = {};
try{
// 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
lifeData = uni.getStorageSync('lifeData');
}catch(e){
} catch(e) {
}
@ -34,6 +34,13 @@ const store = new Vuex.Store({
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0',
vuex_location: {
latitude: '',
longitude: '',
city: '',
cityCode: ''
}
},
mutations: {
$uStore(state, payload) {
@ -55,6 +62,49 @@ const store = new Vuex.Store({
}
// 保存变量到本地,见顶部函数定义
saveLifeData(saveKey, state[saveKey])
},
SET_CITY(state, { cityName, cityCode }) {
state.vuex_location.city = cityName
state.vuex_location.cityCode = cityCode
}
},
actions: {
async getLocation({ state }) {
try {
const [err, res] = await uni.getLocation({
type: 'gcj02'
})
if (err) {
await Promise.reject(err)
}
console.log(state, res)
state.vuex_location.latitude = res.latitude;
state.vuex_location.longitude = res.longitude;
const address = await new Promise((resolve, reject) => {
Vue.prototype.$qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success: address => resolve(address),
fail: error => reject(error)
})
})
console.log('address', address)
if (!!address.status) {
await Promise.reject(address.message)
}
state.vuex_location.city = address?.result?.ad_info.city
state.vuex_location.cityCode = address?.result?.ad_info?.city_code
} catch (err) {
console.error(err)
uni.showToast({
title: '获取定位失败',
icon: 'none',
duration: 2000
})
}
}
}
})

Loading…
Cancel
Save