NurseStationApp/pages/site/site.vue

155 lines
4.0 KiB
Vue
Raw Normal View History

2022-10-13 11:30:22 +08:00
<template>
2022-10-21 11:01:04 +08:00
<view class="app">
2022-10-24 16:40:37 +08:00
<view class="nursetation" @tap='detailed()'>
<text class="what">什么是护理站</text>
<u-icon class="icon" name="arrow-right"></u-icon>
</view>
2022-10-31 09:04:45 +08:00
<view class="map" style="height:35vh;">
<map style="width:100%; height:100%" scale="17" :latitude="latitude" :longitude="longitude"
2022-10-24 16:40:37 +08:00
:markers="markers"></map>
2022-10-13 11:30:22 +08:00
</view>
2022-10-14 19:48:48 +08:00
<view class="conNew">
2022-10-24 16:40:37 +08:00
<view class="addressContent" v-for="(item,index) in nursestationlist" :key="index">
<view class="lists">
2022-10-21 11:01:04 +08:00
<view class="nurse">{{item.nurseStationName}}</view>
2022-10-24 16:40:37 +08:00
<view class="distance">距离您{{item.distance}}</view>
2022-10-31 09:04:45 +08:00
<image class="background" :src="item.stationPictureUrl" mode=""></image>
2022-10-24 16:40:37 +08:00
<view class="understand" @tap='godetails(item)'>
2022-10-14 19:48:48 +08:00
点击了解
</view>
</view>
2022-10-13 11:30:22 +08:00
</view>
2022-10-13 16:31:59 +08:00
</view>
2022-10-24 16:40:37 +08:00
<view class="masks" style="" v-if="mask">
2022-10-13 16:31:59 +08:00
<view class="mask">
2022-10-24 16:40:37 +08:00
<view class="picture">
2022-10-13 16:31:59 +08:00
<image src="../../static/locatinsmall.png"></image>
</view>
2022-10-24 16:40:37 +08:00
<view class="text">
2022-10-13 16:31:59 +08:00
请打开系统定位
</view>
<view class="btns">
2022-10-24 16:40:37 +08:00
<view class="bt" @tap='cancel()'>取消</view>
2022-10-31 09:04:45 +08:00
<view class="btn" @tap='getlocation()'>确定</view>
2022-10-13 11:30:22 +08:00
</view>
</view>
</view>
2022-10-13 16:31:59 +08:00
</view>
2022-10-13 11:30:22 +08:00
</template>
<script>
2022-10-14 19:48:48 +08:00
import {
nearbyList
2022-10-20 09:15:48 +08:00
} from '@/api/site/site.js';
2022-10-14 19:48:48 +08:00
import baseurl from '@/api/baseurl.js'
2022-10-13 11:30:22 +08:00
export default {
data() {
return {
2022-10-24 16:40:37 +08:00
nursestationlist: [],
2022-10-31 09:04:45 +08:00
mask: false,
2022-10-14 19:48:48 +08:00
pageNum: 1,
pageSize: 10,
2022-10-31 09:04:45 +08:00
total: 0,
2022-10-21 11:01:04 +08:00
//map地图所需
id: 0, // 使用 marker点击事件 需要填写id
2022-10-31 09:04:45 +08:00
// latitude: 39.909,
// longitude: 116.39742,
latitude: 36.649372,
longitude: 116.977102,
2022-10-21 11:01:04 +08:00
markers: [],
2022-10-31 09:04:45 +08:00
covers: [],
2022-10-13 11:30:22 +08:00
}
},
2022-10-31 09:04:45 +08:00
methods: {
getlocation() {
uni.getLocation({
type: 'gcj02',
success: res => {
console.log(res)
this.latitude = res.latitude
this.longitude = res.longitude
this.requestinfo();
},
fail: error => {
console.log("获取定位失败了", error)
uni.showModal({
title: '提示',
content: '获取定位失败,是否授权打开定位',
success: (res) => {
if (res.confirm) {
uni.getSystemInfo({
success: (sys) => {
if (sys.platform == 'ios') {
plus.runtime.openURL(
"app-settings://");
} else {
var main = plus.android
.runtimeMainActivity();
var Intent = plus.android.importClass(
"android.content.Intent");
//可能应该直接进入应用列表的权限设置?=> android.settings.APPLICATION_SETTINGS
var mIntent = new Intent(
'android.settings.LOCATION_SOURCE_SETTINGS'
);
main.startActivity(mIntent);
}
}
})
}
}
})
2022-10-20 09:15:48 +08:00
}
});
2022-10-14 19:48:48 +08:00
},
requestinfo() {
2022-10-24 16:40:37 +08:00
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseTypeCode, ).then(res => {
2022-10-31 09:04:45 +08:00
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
})
2022-10-24 16:40:37 +08:00
this.nursestationlist = res.rows
2022-10-31 09:04:45 +08:00
this.mask = false
this.total = res.total
2022-10-24 16:40:37 +08:00
// console.log(this.nursestationlist)
})
2022-10-14 19:48:48 +08:00
},
2022-10-24 16:40:37 +08:00
godetails(item) {
console.log(item)
2022-10-14 19:48:48 +08:00
uni.navigateTo({
2022-10-24 16:40:37 +08:00
url: `/pages/nursestation/nursestation?nurseStationId=${item.nurseStationId}`
2022-10-14 19:48:48 +08:00
})
},
detailed() {
uni.navigateTo({
url: `/pages/detail/detail`
})
},
cancel() {
this.mask = false
},
},
2022-10-31 09:04:45 +08:00
onReachBottom() {
if (this.nursestationlist.length >= this.total) {} else {
this.pageNum++;
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseTypeCode, this.iptVal)
.then(res => {
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
this.nursestationlist.push(e)
})
})
}
},
watch: {
iptVal() {
// this.requestinfo()
},
},
onShow() {},
onLoad() {
this.requestinfo()
},
2022-10-14 19:48:48 +08:00
}
2022-10-13 11:30:22 +08:00
</script>
<style lang="scss">
2022-10-31 09:04:45 +08:00
@import './site.scss'
2022-10-13 11:30:22 +08:00
</style>