NurseStationApp/pages/site/site.vue

238 lines
4.8 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">
<view>
<view class="nursetation" @tap='detailed()'>
2022-10-14 19:48:48 +08:00
<text class="what">什么是护理站</text>
<u-icon class="icon" name="arrow-right"></u-icon>
</view>
2022-10-14 19:48:48 +08:00
<view class="map">
2022-10-21 11:01:04 +08:00
<map style="width:100%; height:40vh;" scale="17" :latitude="latitude" :longitude="longitude"
:markers="markers"></map>
2022-10-13 11:30:22 +08:00
</view>
</view>
2022-10-14 19:48:48 +08:00
<view class="conNew">
<view class="addressContent">
<view class="lists" v-for="(item,index) in nearbylist" :key="index">
2022-10-21 11:01:04 +08:00
<view class="nurse">{{item.nurseStationName}}</view>
<view class="distance">距离您800米</view>
2022-10-14 19:48:48 +08:00
<view class="background">
2022-10-21 11:01:04 +08:00
<image src="/static/logo.png" mode=""></image>
2022-10-14 19:48:48 +08:00
</view>
2022-10-21 11:01:04 +08:00
<view class="understand" @tap='godetails()'>
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-14 19:48:48 +08:00
2022-10-21 11:01:04 +08:00
<view class="masks" style="" v-if="locationmask">
2022-10-13 16:31:59 +08:00
<view class="mask">
<view class="picture2">
<image src="../../static/locatinsmall.png"></image>
</view>
<view class="title">
请打开系统定位
</view>
<view class="btns">
<view class="btn1" @tap='cancel()'>取消</view>
<view class="btn2" @tap='getsite()'>去打开</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-14 19:48:48 +08:00
nearbylist: [],
2022-10-21 11:01:04 +08:00
locationmask: false,
2022-10-14 19:48:48 +08:00
pageNum: 1,
pageSize: 10,
2022-10-21 11:01:04 +08:00
//map地图所需
id: 0, // 使用 marker点击事件 需要填写id
latitude: 39.909,
longitude: 116.39742,
markers: [],
covers: []
2022-10-13 11:30:22 +08:00
}
},
2022-10-20 09:15:48 +08:00
onReachBottom() {
this.pageNum++;
if (this.nurseTypeCode != undefined) {
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseTypeCode, this.iptVal)
.then(res => {
if (res.total == this.nearbylist.length) {
2022-10-20 09:15:48 +08:00
} else {
res.rows.forEach(e => {
this.nearbylist.push(e)
})
}
})
} else {
uni.request({
url: baseurl +
`/nurseApplet/nearbyNursingStation/nearbyList?pageSize=${this.pageSize}&pageNum=${this.pageNum}&homeLongitude=${this.longitude}&homeLatitude=${this.latitude}&nurseStationName=${this.iptVal}`, //仅为示例,并非真实接口地址。
success: (res) => {
if (res.data.total == this.nearbylist.length) {} else {
res.data.rows.forEach(e => {
this.nearbylist.push(e)
})
}
console.log(this.nearbylist)
}
});
}
},
2022-10-14 19:48:48 +08:00
watch: {
iptVal() {
// this.requestinfo()
},
},
2022-10-13 11:30:22 +08:00
onShow() {},
2022-10-14 19:48:48 +08:00
onLoad() {
var that = this
this.requestinfo()
},
2022-10-13 11:30:22 +08:00
methods: {
2022-10-14 19:48:48 +08:00
requestinfo() {
if (this.nurseTypeCode != undefined) {
nearbyList()
.then(res => {
this.nearbylist = res.rows
console.log(this.nearbylist)
})
} else {
uni.request({
url: baseurl +
2022-10-21 11:01:04 +08:00
`/nurseApplet/nearbyNursingStation/nearbyList`,
2022-10-14 19:48:48 +08:00
success: (res) => {
this.nearbylist = res.data.rows
console.log(this.nearbylist)
}
});
}
},
godetails() {
uni.navigateTo({
url: `/pages/nursestation/nursestation`
})
},
detailed() {
uni.navigateTo({
url: `/pages/detail/detail`
})
},
cancel() {
this.mask = false
},
},
}
2022-10-13 11:30:22 +08:00
</script>
<style lang="scss">
2022-10-21 11:01:04 +08:00
//护理站列表
2022-10-20 09:15:48 +08:00
.conNew {
2022-10-21 11:01:04 +08:00
width: 96%;
2022-10-14 19:48:48 +08:00
background-color: #F4F5F7;
2022-10-13 11:30:22 +08:00
z-index: 999;
position: absolute;
2022-10-21 11:01:04 +08:00
top: 400rpx;
left: 2%;
.addressContent {
width: 100%;
}
.lists {
background-color: #ffffff;
width: 100%;
height: 240rpx;
margin-bottom: 14rpx;
border-radius: 20rpx;
position: relative;
.nurse {
font-size: 30rpx;
position: absolute;
top: 15%;
left: 35%;
}
2022-10-13 16:31:59 +08:00
2022-10-21 11:01:04 +08:00
.distance {
position: absolute;
top: 40%;
font-size: 14rpx;
margin-left: 35%;
color: #666666;
}
2022-10-13 16:31:59 +08:00
2022-10-21 11:01:04 +08:00
.background {
width: 180rpx;
height: 180rpx;
background-color: #4C7BC9;
position: absolute;
top: 12%;
left: 7%;
border-radius: 30rpx;
}
2022-10-13 16:31:59 +08:00
2022-10-21 11:01:04 +08:00
.background image {
width: 99rpx;
height: 99rpx;
// margin: 0 auto;
text-align: center;
margin-top: 5%;
margin-left: 20%;
}
2022-10-14 19:48:48 +08:00
2022-10-21 11:01:04 +08:00
.understand {
color: #ffffff;
width: 170rpx;
height: 70rpx;
line-height: 70rpx;
text-align: center;
background-color: #4C7BC9;
position: absolute;
bottom: 10%;
right: 5%;
border-radius: 35rpx;
}
}
2022-10-13 11:30:22 +08:00
}
2022-10-21 11:01:04 +08:00
//什么是护理站
.nursetation {
2022-10-13 16:31:59 +08:00
width: 80%;
position: absolute;
2022-10-21 11:01:04 +08:00
top: 20px;
left: 10%;
float: left;
2022-10-13 11:30:22 +08:00
border: 1px solid #f0f0f0;
border-radius: 20rpx;
2022-10-21 11:01:04 +08:00
background-color: #ffffff;
z-index: 100;
2022-10-21 11:01:04 +08:00
height: 85rpx;
line-height: 85rpx;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
.what {
margin-left: 10%;
display: inline-block;
}
.icon {
display: inline-block;
height: 85rpx;
line-height: 85rpx;
margin-left: 45%;
}
2022-10-13 11:30:22 +08:00
}
</style>