Browse Source

上传

master
前端-胡立永 4 months ago
parent
commit
5f4c429d6c
30 changed files with 1573 additions and 291 deletions
  1. +21
    -1
      api/api.js
  2. +48
    -15
      components/list/dynamic/dynamicItem.vue
  3. +214
    -0
      components/list/dynamic/dynamicItemEdit.vue
  4. +1
    -1
      components/user/createDetailPopup.vue
  5. +4
    -0
      mixins/sex.js
  6. +30
    -0
      pages.json
  7. +3
    -3
      pages/index/center.vue
  8. +37
    -30
      pages/index/index.vue
  9. +1
    -1
      pages_order/activity/activityDetail.vue
  10. +18
    -0
      pages_order/auth/wxUserInfo.vue
  11. +22
    -0
      pages_order/car/carList.vue
  12. +22
    -0
      pages_order/car/carListDetail.vue
  13. +82
    -0
      pages_order/components/list/comment/commentItem.vue
  14. +111
    -0
      pages_order/components/list/comment/commentList.vue
  15. +7
    -7
      pages_order/components/list/gourmet/gourmetItem.vue
  16. +4
    -5
      pages_order/components/list/scenicSpot/scenicSpotItem.vue
  17. +291
    -0
      pages_order/gourmet/gourmetDetail.vue
  18. +4
    -3
      pages_order/gourmet/gourmetList.vue
  19. +88
    -0
      pages_order/mine/allUser.vue
  20. +49
    -57
      pages_order/post/addPost.vue
  21. +77
    -139
      pages_order/post/postDetail.vue
  22. +45
    -10
      pages_order/renting/rentingDetail.vue
  23. +8
    -2
      pages_order/renting/rentingList.vue
  24. +151
    -0
      pages_order/scenicSpot/scenicSpotDetail.vue
  25. +1
    -0
      pages_order/scenicSpot/scenicSpotList.vue
  26. +34
    -16
      pages_order/work/workDetail.vue
  27. +1
    -1
      pages_order/work/workList.vue
  28. BIN
      static/image/home/phone.png
  29. +9
    -0
      utils/index.js
  30. +190
    -0
      utils/position.js

+ 21
- 1
api/api.js View File

@ -111,11 +111,16 @@ const config = {
url: '/city/getActivityDetail',
method: 'GET',
},
//根据分类获取门店信息列表(美食)
//获取门店信息列表(美食)
getStorePage: {
url: '/city/getStorePage',
method: 'GET',
},
//获取门店详情(美食)
getStoreDetail: {
url: '/city/getStoreDetail',
method: 'GET',
},
//发布按钮列表
getPublishList: {
url: '/city/getPublishList',
@ -131,11 +136,21 @@ const config = {
url: '/city/getScenicPage',
method: 'GET',
},
//获取景点详情
getScenicDetail: {
url: '/city/getScenicDetail',
method: 'GET',
},
//获取评论列表type-0帖子-1租房-2工作-3景点-4美食-5活动
getCommentPage: {
url: '/city/getCommentPage',
method: 'GET',
},
//获取江华人信息接口
getJiangHuInfo: {
url: '/city/getJiangHuInfo',
method: 'GET',
},
@ -148,6 +163,7 @@ const config = {
method: 'POST',
limit : 1000,
auth : true,
showLoading : true,
},
//查询自己发布的动态
getMyPostPage: {
@ -160,6 +176,7 @@ const config = {
url: '/token/deletePost',
method: 'POST',
auth : true,
showLoading : true,
},
//店铺认证
companyAuthentication: {
@ -167,6 +184,7 @@ const config = {
method: 'POST',
limit : 1000,
auth : true,
showLoading : true,
},
//个人认证
personalAuthentication: {
@ -174,6 +192,7 @@ const config = {
method: 'POST',
limit : 1000,
auth : true,
showLoading : true,
},
//获取分享二维码
getQrCode: {
@ -187,6 +206,7 @@ const config = {
method: 'POST',
limit : 1000,
auth : true,
showLoading : true,
},
//获取粉丝列表接口
getFansList: {


+ 48
- 15
components/list/dynamic/dynamicItem.vue View File

@ -3,7 +3,9 @@
<view class="box"
:style="{'--sexcolor' : sex[item.sex].color}">
<view class="headPortraitimg">
<image :src="item.userImage" mode="aspectFill"></image>
<image :src="item.userImage"
@click.stop="previewImage([item.userImage])"
mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
@ -21,9 +23,9 @@
{{ item.yearDate }}
</view>
<view class="inde"
v-if="item.address">
v-if="item.addId">
<!-- 地址 -->
{{ item.address }}
{{ item.addId }}
</view>
<view class="authentication"
v-if="item.isContent">
@ -41,10 +43,21 @@
12:34
</view> -->
</view>
</view>
</view>
<view class="dynamics" v-html="$utils.stringFormatHtml(item.title)">
</view>
<view class="address"
v-if="item.address">
<uv-icon size="30rpx" name="map"></uv-icon>
<view class="text-ellipsis">
{{ item.address }}
</view>
</view>
<view class="Artworkimages">
<view class="wrokimg"
@click.stop="previewImage(item.image, i)"
@ -59,13 +72,11 @@
<view class="browse">
{{ item.isComment }}条评论
</view>
<view class="Leavingamessage">
<uv-icon size="40rpx" name="chat"></uv-icon>
</view>
<view class="Leavingamessage"
v-if="del"
@click.stop="$emit('del')">
<uv-icon size="40rpx" name="trash"></uv-icon>
<view class="phone"
v-if="item.phone"
@click.stop="callPhone">
<image src="/static/image/home/phone.png" mode=""></image>
联系{{ ta[item.sex] }}
</view>
</view>
</view>
@ -77,14 +88,23 @@
mixins: [mixinsSex],
props: {
item: {},
del : {},
},
data() {
return {
}
},
methods: {
callPhone(){
uni.makePhoneCall({
phoneNumber: this.item.phone,
success() {
console.log('安卓拨打成功');
},
fail() {
console.log('安卓拨打失败');
}
})
},
},
}
</script>
@ -189,6 +209,13 @@
// line-height: 35rpx;
letter-spacing: 3rpx;
}
.address{
font-size: 24rpx;
margin-top: 20rpx;
display: flex;
align-items: center;
}
.Artworkimages {
display: flex;
@ -215,10 +242,16 @@
color: rgb(132, 132, 132);
}
.Leavingamessage {
height: 20rpx;
width: 20rpx;
.phone{
background-color: rgba($uni-color, 0.2);
color: $uni-color;
padding: 8rpx 16rpx;
border-radius: 10rpx;
margin-left: auto;
image{
width: 20rpx;
height: 20rpx;
}
}
}
}

+ 214
- 0
components/list/dynamic/dynamicItemEdit.vue View File

@ -0,0 +1,214 @@
<template>
<view class="works" @click="$emit('click')">
<view class="box"
:style="{'--sexcolor' : sex[item.sex].color}">
<view class="headPortraitimg">
<image :src="item.userImage" mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
<view class="username text-ellipsis">
{{ item.userName }}
</view>
<view class="inde"
v-if="item.sex">
<!-- 性别 -->
{{ item.sex }}
</view>
<view class="inde"
v-if="item.yearDate">
<!-- 年份 -->
{{ item.yearDate }}
</view>
<view class="inde"
v-if="item.addId">
<!-- 地址 -->
{{ item.addId }}
</view>
<view class="authentication"
v-if="item.isContent">
<!-- 个人认证 -->
{{ item.isContent }}
</view>
</view>
<view class="Times">
<view class="TimeMonth">
<!-- 10-08 -->
{{ item.createTime }}发布
</view>
<!-- <view class="Month">
12:34
</view> -->
</view>
</view>
</view>
<view class="dynamics" v-html="$utils.stringFormatHtml(item.title)">
</view>
<view class="Artworkimages">
<view class="wrokimg"
@click.stop="previewImage(item.image, i)"
:key="i" v-for="(img, i) in item.image">
<image :src="img" mode="aspectFill"></image>
</view>
</view>
<view class="bottom">
<view class="Leavingamessage"
@click.stop="$emit('del')">
<uv-icon size="40rpx" name="trash"></uv-icon>
</view>
</view>
</view>
</template>
<script>
import mixinsSex from '@/mixins/sex.js'
export default {
mixins: [mixinsSex],
props: {
item: {},
},
data() {
return {
}
},
methods: {
},
}
</script>
<style scoped lang="scss">
.works {
margin: 40rpx 20rpx;
background-color: #fff;
padding: 40rpx;
border-radius: 20rpx;
box-shadow: 0 0 6rpx 6rpx #00000011;
.box {
display: flex;
align-items: center;
.headPortraitimg {
width: 100rpx;
height: 100rpx;
border-radius: 15rpx;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.YaoduUniversalWall {
padding: 0rpx 10rpx;
.username {
max-width: 200rpx;
}
.heide {
display: flex;
justify-content: center;
align-items: center;
}
.inde {
display: flex;
justify-content: center;
align-items: center;
padding: 0rpx 10rpx;
margin: 0rpx 5rpx;
font-size: 20rpx;
height: 30rpx;
color: white;
// background-color: rgb(124, 136, 242);
background-color: var(--sexcolor);
border-radius: 7rpx;
flex-shrink: 0;
}
.authentication {
display: flex;
justify-content: center;
align-items: center;
padding: 0rpx 10rpx;
margin: 0rpx 5rpx;
font-size: 20rpx;
height: 34rpx;
padding: 0rpx 10rpx;
color: white;
background-color: #ffd036;
border-radius: 7rpx;
flex-shrink: 0;
}
.Times {
display: flex;
padding: 5rpx 0rpx;
font-size: 20rpx;
margin-top: 10rpx;
.Month {
margin: 0rpx 15rpx;
}
}
}
}
.personalInformation {
display: flex;
.inde {
font-size: 25rpx;
padding: 0rpx 8rpx;
}
.authentication {
font-size: 25rpx;
}
}
.dynamics {
margin-top: 20rpx;
font-size: 28rpx;
// font-weight: bold;
// line-height: 35rpx;
letter-spacing: 3rpx;
}
.Artworkimages {
display: flex;
flex-wrap: wrap;
.wrokimg {
margin: 10rpx;
image {
height: 190rpx;
width: 190rpx;
border-radius: 20rpx;
}
}
}
.bottom {
display: flex;
margin-top: 20rpx;
font-size: 24rpx;
.browse {
margin: 0rpx 30rpx;
color: rgb(132, 132, 132);
}
.Leavingamessage {
height: 20rpx;
width: 20rpx;
margin-left: auto;
}
}
}
</style>

+ 1
- 1
components/user/createDetailPopup.vue View File

@ -74,7 +74,7 @@
justify-content: center;
align-items: center;
box-shadow: 0 0 10rpx 10rpx rgba(#000, 0.1);
z-index: 99;
z-index: 999;
}
.createDetailPopup {


+ 4
- 0
mixins/sex.js View File

@ -25,6 +25,10 @@ export default {
actColor : '#ff50b3',
},
],
ta : {
: '他',
: '她',
}
}
},
}

+ 30
- 0
pages.json View File

@ -98,6 +98,36 @@
},
{
"path": "mine/promotion"
},
{
"path": "scenicSpot/scenicSpotDetail",
"style": {
"enablePullDownRefresh" : true
}
},
{
"path": "gourmet/gourmetDetail",
"style": {
"enablePullDownRefresh" : true
}
},
{
"path": "mine/allUser",
"style": {
"enablePullDownRefresh" : true
}
},
{
"path": "car/carList",
"style": {
"enablePullDownRefresh" : true
}
},
{
"path": "car/carListDetail",
"style": {
"enablePullDownRefresh" : true
}
}
]
}],


+ 3
- 3
pages/index/center.vue View File

@ -105,7 +105,7 @@
</view>
<view v-if="type == 0">
<dynamicItem
<dynamicItemEdit
:key="index"
@click="$utils.navigateTo('/pages_order/post/addPost?id=' + item.id)"
v-for="(item, index) in list"
@ -125,7 +125,7 @@
<script>
import tabber from '@/components/base/tabbar.vue'
import dynamicItem from '@/components/list/dynamic/dynamicItem.vue'
import dynamicItemEdit from '@/components/list/dynamic/dynamicItemEdit.vue'
import mixinsList from '@/mixins/list.js'
import mixinsSex from '@/mixins/sex.js'
import { mapState } from 'vuex'
@ -133,7 +133,7 @@
mixins: [mixinsList, mixinsSex],
components: {
tabber,
dynamicItem,
dynamicItemEdit,
},
computed: {
...mapState(['userInfo']),


+ 37
- 30
pages/index/index.vue View File

@ -5,8 +5,8 @@
<uv-swiper
:list="bannerList"
indicator
height="520rpx"
indicatorStyle="bottom: 80rpx;"
height="490rpx"
indicatorStyle="bottom: 100rpx;"
keyName="image"></uv-swiper>
</view>
@ -34,7 +34,9 @@
{{headinfo.num}}动态
<text>|</text>
<view>
<view
@click="$utils.navigateTo('/pages_order/mine/allUser')"
>
{{headinfo.userNum}}江华人
</view>
</view>
@ -77,20 +79,22 @@
</view>
<view class="box">
<view class="life">
<view class="mouse" @click="menuClick(item.url)"
:key="index"
v-for="(item, index) in menu">
<view class="RentingAhouseimg">
<image
:src="item.icon"
style="width: 90rpx;height: 90rpx;" mode=""></image>
</view>
<view class="RentingAhouse">
{{ item.title }}
<scroll-view
scroll-x="true">
<view class="life">
<view class="mouse" @click="menuClick(item.url)"
:key="index"
v-for="(item, index) in menu">
<view class="RentingAhouseimg">
<image
:src="item.icon" mode=""></image>
</view>
<view class="RentingAhouse">
{{ item.title }}
</view>
</view>
</view>
</view>
</scroll-view>
<view class="LabelOptions">
<uv-tabs :list="category"
@ -283,7 +287,7 @@
width: 100%;
top: 0;
left: 0;
padding-top: 120rpx;
padding-top: 80rpx;
// background: linear-gradient(to bottom, rgb(85, 94, 123), rgb(45, 51, 73));
.Toggle{
margin: 10rpx 30rpx;
@ -348,32 +352,35 @@
}
.box{
margin-top: -60rpx;
background-color: #f7f7f7;
margin-top: -70rpx;
background-color: #fff;
border-top-left-radius: 40rpx;
border-top-right-radius: 40rpx;
position: relative;
z-index: 9;
overflow: hidden;
.life {
margin-top: 20rpx;
display: flex;
justify-content: space-around;
text-align: center;
flex-wrap: wrap;
padding: 10rpx 0;
.mouse {
width: 20%;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-size: 26rpx;
flex-shrink: 0;
.RentingAhouseimg {
display: flex;
justify-content: center;
align-items: center;
margin: 15rpx;
width: 130rpx;
height: 100rpx;
background-color: #ffffff;
border-top-left-radius: 40rpx;
border-bottom-right-radius: 40rpx;
border-bottom-left-radius: 20rpx;
border-top-right-radius: 20rpx;
flex-direction: column;
image{
width: 70rpx;
height: 70rpx;
}
}
}
}


+ 1
- 1
pages_order/activity/activityDetail.vue View File

@ -1,6 +1,6 @@
<template>
<view class="postDetail">
<navbar leftClick @leftClick="$utils.navigateBack" title="动态详情" />
<navbar leftClick @leftClick="$utils.navigateBack" title="详情" />
<view class="swipe">
<uv-swiper :list="item.image &&


+ 18
- 0
pages_order/auth/wxUserInfo.vue View File

@ -150,6 +150,7 @@
},
onShow() {
this.getCityList()
this.getUserInfo()
},
computed: {},
methods: {
@ -176,6 +177,23 @@
}
})
},
getUserInfo(){
this.$api('getInfo', res => {
if(res.code == 200){
this.form.headImage = res.result.headImage || this.form.headImage
this.form.nickName = res.result.nickName || this.form.nickName
this.form.sex = res.result.sex || this.form.sex
this.form.yearDate = res.result.yearDate &&
this.$dayjs(res.result.yearDate + '-01-01').valueOf() || this.form.yearDate
this.form.address = res.result.address || this.form.address
}
})
},
submit() {
let self = this


+ 22
- 0
pages_order/car/carList.vue View File

@ -0,0 +1,22 @@
<template>
<view class="page pageList">
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>

+ 22
- 0
pages_order/car/carListDetail.vue View File

@ -0,0 +1,22 @@
<template>
<view class="page pageList">
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>

+ 82
- 0
pages_order/components/list/comment/commentItem.vue View File

@ -0,0 +1,82 @@
<template>
<view class="comment">
<view class="box">
<view class="headPortraitimg">
<image :src="item.userHead"
@click.stop="previewImage([item.userHead])"
mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
<view class="username text-ellipsis">
{{ item.userName }}
</view>
</view>
<view class="Times">
<view class="TimeMonth">
{{ item.createTime }}发布
</view>
</view>
</view>
</view>
<view class="dynamics" v-html="$utils.stringFormatHtml(item.userValue)">
</view>
</view>
</template>
<script>
export default {
props : ['item'],
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.comment {
background-color: #fff;
padding: 30rpx 40rpx;
margin-top: 10rpx;
.box {
display: flex;
align-items: center;
.headPortraitimg {
width: 80rpx;
height: 80rpx;
border-radius: 15rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.YaoduUniversalWall {
padding: 0rpx 10rpx;
font-size: 26rpx;
line-height: 40rpx;
.Times {
font-size: 22rpx;
}
}
}
.dynamics {
margin-top: 20rpx;
margin-left: 100rpx;
font-size: 28rpx;
letter-spacing: 3rpx;
}
}
</style>

+ 111
- 0
pages_order/components/list/comment/commentList.vue View File

@ -0,0 +1,111 @@
<template>
<view>
<view class="comment-list">
<commentItem
v-for="(item,index) in list"
:key="index"
:item="item" />
</view>
<view class="submit-box">
<view class="top">
<uv-icon
color="#00cf05"
size="50rpx"
name="weixin-fill"></uv-icon>
<input type="text"
:placeholder="'评论给' + params.name"
v-model="form.userValue"/>
<view class="submit"
@click="submit">
发布
</view>
</view>
</view>
</view>
</template>
<script>
import commentItem from './commentItem.vue'
export default {
components: {
commentItem,
},
props: ['list', 'params'],
data() {
return {
form : {},
}
},
methods: {
submit(){
let data = {
...this.form,
...this.params,
}
if (this.$utils.verificationAll(data, {
userValue: '说点什么吧',
type: '缺少type',
orderId: '缺少orderId',
})) {
return
}
// this.form.image = this.fileList.map((item) => item.url).join(",")
// this.form.orderId = this.params.orderId
// this.form.type = this.params.type
this.$api('addComment', data, res => {
if(res.code == 200){
this.form.userValue = ''
uni.showToast({
title: '发布成功!',
icon: 'none'
})
this.$emit('getData')
}
})
},
}
}
</script>
<style scoped lang="scss">
.comment-list {
margin-top: 20rpx;
padding-bottom: 150rpx;
}
.submit-box {
position: fixed;
bottom: 0;
left: 0;
background-color: #fff;
width: 100%;
box-shadow: 0 0 6rpx 6rpx #00000011;
padding-bottom: env(safe-area-inset-bottom);
.top {
align-items: center;
display: flex;
justify-content: center;
input {
background-color: #f3f3f3;
width: 460rpx;
height: 40rpx;
border-radius: 40rpx;
margin: 20rpx;
padding: 20rpx 30rpx;
font-size: 28rpx;
}
.submit {}
}
}
</style>

+ 7
- 7
pages_order/components/list/gourmet/gourmetItem.vue View File

@ -1,8 +1,8 @@
<template>
<view class="item">
<view class="item" @click="$emit('click')">
<image class="image"
@click.stop="previewImage([item.image])"
:src="item.image" mode="aspectFill"></image>
@click.stop="previewImage([item.logoImage])"
:src="item.logoImage" mode="aspectFill"></image>
<view class="text">
<view class="title">
<view class="">
@ -24,13 +24,13 @@
<view class="list">
<view class="item-detail"
:key="index"
v-for="(t, index) in item.detailsImage">
v-for="(t, index) in item.image">
<image :src="t"
@click.stop="previewImage(item.detailsImage, index)"
@click.stop="previewImage(item.image, index)"
mode="aspectFill"></image>
<view class="text-ellipsis">
<!-- <view class="text-ellipsis">
{{ item.details[index] }}
</view>
</view> -->
</view>
</view>
</scroll-view>


+ 4
- 5
pages_order/components/list/scenicSpot/scenicSpotItem.vue View File

@ -1,6 +1,8 @@
<template>
<view class="item">
<image :src="item.titleImage" mode="aspectFill"></image>
<view class="item" @click="$emit('click')">
<image :src="item.titleImage"
@click.stop="previewImage([item.titleImage])"
mode="aspectFill"></image>
<view class="text">
<view class="title">
{{ item.name }}
@ -10,9 +12,6 @@
<view class="createBy">
{{ item.address }}
</view>
<view class="createBy">
距离30m
</view>
<view class="createTime">
{{ $dayjs(item.createTime).format('YYYY-MM-DD') }}
</view>


+ 291
- 0
pages_order/gourmet/gourmetDetail.vue View File

@ -0,0 +1,291 @@
<template>
<view class="postDetail">
<navbar leftClick @leftClick="$utils.navigateBack" title="详情" />
<view class="works" @click="$emit('click')">
<view class="box" :style="{'--sexcolor' : sex[detail.sex].color}">
<view class="headPortraitimg">
<image :src="detail.logoImage"
@click.stop="previewImage([item.logoImage])"
mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
<view class="username text-ellipsis">
{{ detail.title }}
</view>
<view class="inde" v-if="detail.sex">
<!-- 性别 -->
{{ detail.sex }}
</view>
<view class="inde" v-if="detail.yearDate">
<!-- 年份 -->
{{ detail.yearDate }}
</view>
<view class="inde" v-if="detail.address">
<!-- 地址 -->
{{ detail.address }}
</view>
<view class="authentication" v-if="detail.isContent">
<!-- 个人认证 -->
{{ detail.isContent }}
</view>
</view>
<view class="Times">
<view class="TimeMonth">
营业时间{{ detail.workTime }}
</view>
</view>
</view>
</view>
<!-- <view class="dynamics" v-html="$utils.stringFormatHtml(detail.title)">
</view> -->
<view class="dynamics">
地址{{ detail.address }}
</view>
<view class="Artworkimages">
<view class="wrokimg" @click.stop="previewImage(detail.detailsImage, i)" :key="i"
v-for="(img, i) in detail.detailsImage">
<image :src="img" mode="aspectFill"></image>
</view>
</view>
<view class="bottom">
<view class="browse">
{{ detail.isBrowse }}浏览
</view>
<view class="browse">
{{ detail.isComment }}条评论
</view>
<view class="Leavingamessage"
@click="openLocation(detail.latitude, detail.longitude)"
v-if="detail.latitude && detail.longitude">
<uv-icon size="40rpx" name="map"></uv-icon>
导航
</view>
</view>
</view>
<commentList
@getData="getData"
:list="list"
:params="params"
/>
</view>
</template>
<script>
import mixinsSex from '@/mixins/sex.js'
import mixinsList from '@/mixins/list.js'
import commentList from '../components/list/comment/commentList.vue'
export default {
mixins: [mixinsSex, mixinsList],
components: {
commentList
},
data() {
return {
detail: {},
mixinsListApi : 'getCommentPage',
params : {
type : '4',
orderId : '',
name : '',
},
id : 0,
}
},
onLoad(options) {
// this.$route.query
console.log(options)
this.id = options.id
this.queryParams.type = this.params.type
this.queryParams.orderId = options.id
this.params.orderId = options.id
},
onPullDownRefresh() {
this.getDetail()
},
onShow() {
this.getDetail()
},
onShareAppMessage(res) {
// return {
// title: this.item.title,
// desc: this.item.content && this.item.content.slice(0, 30),
// path: '/pages/publish/postDetail?id=' + this.id
// }
},
methods: {
getDetail() {
this.$api('getStoreDetail', {
id: this.id
}, res => {
uni.stopPullDownRefresh()
if (res.code == 200) {
this.params.name = res.result.title
// res.result.image =
// res.result.image ?
// res.result.image.split(',') : [],
res.result.detailsImage =
res.result.detailsImage ?
res.result.detailsImage.split(',') : [],
// res.result.details =
// res.result.details ?
// res.result.details.split(',') : []
this.detail = res.result
}
})
},
}
}
</script>
<style lang="scss" scoped>
.postDetail {
padding-bottom: env(safe-area-inset-bottom);
.works {
background-color: #fff;
padding: 40rpx;
border-radius: 20rpx;
.box {
display: flex;
align-items: center;
.headPortraitimg {
width: 100rpx;
height: 100rpx;
border-radius: 15rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.YaoduUniversalWall {
padding: 0rpx 10rpx;
.username {
max-width: 200rpx;
}
.heide {
display: flex;
align-items: center;
}
.inde {
display: flex;
justify-content: center;
align-items: center;
padding: 0rpx 10rpx;
margin: 0rpx 5rpx;
font-size: 20rpx;
height: 30rpx;
color: white;
// background-color: rgb(124, 136, 242);
background-color: var(--sexcolor);
border-radius: 7rpx;
flex-shrink: 0;
}
.authentication {
display: flex;
justify-content: center;
align-items: center;
padding: 0rpx 10rpx;
margin: 0rpx 5rpx;
font-size: 20rpx;
height: 34rpx;
padding: 0rpx 10rpx;
color: white;
background-color: #ffd036;
border-radius: 7rpx;
flex-shrink: 0;
}
.Times {
display: flex;
padding: 5rpx 0rpx;
font-size: 20rpx;
margin-top: 10rpx;
.Month {
margin: 0rpx 15rpx;
}
}
}
}
.personalInformation {
display: flex;
.inde {
font-size: 25rpx;
padding: 0rpx 8rpx;
}
.authentication {
font-size: 25rpx;
}
}
.dynamics {
margin-top: 20rpx;
font-size: 28rpx;
// font-weight: bold;
// line-height: 35rpx;
letter-spacing: 3rpx;
}
.Artworkimages {
display: flex;
flex-wrap: wrap;
.wrokimg {
margin: 10rpx;
image {
height: 190rpx;
width: 190rpx;
border-radius: 20rpx;
}
}
}
.bottom {
display: flex;
margin-top: 20rpx;
font-size: 24rpx;
.browse {
margin: 0rpx 30rpx;
color: rgb(132, 132, 132);
}
.Leavingamessage {
margin-left: auto;
display: flex;
align-items: center;
}
}
}
}
</style>

+ 4
- 3
pages_order/gourmet/gourmetList.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page pageList">
<navbar title="美食" leftClick @leftClick="$utils.navigateBack" />
<navbar title="店铺" leftClick @leftClick="$utils.navigateBack" />
<view
style="padding: 10rpx 20rpx;">
@ -18,6 +18,7 @@
:key="index"
v-for="(item, index) in list"
:item="item"
@click="$utils.navigateTo('/pages_order/gourmet/gourmetDetail?id=' + item.id)"
/>
</view>
@ -40,8 +41,8 @@
methods: {
getDataThen(list){
list.forEach(n => {
n.detailsImage = n.detailsImage ? n.detailsImage.split(',') : []
n.details = n.details ? n.details.split(',') : []
n.image = n.image ? n.image.split(',') : []
// n.details = n.details ? n.details.split(',') : []
})
},
}


+ 88
- 0
pages_order/mine/allUser.vue View File

@ -0,0 +1,88 @@
<template>
<view class="page pageList">
<navbar title="江华人" leftClick @leftClick="$utils.navigateBack" />
<view style="padding: 10rpx 30rpx;">
<uv-search bgColor="#fff" @search="getData" @custom="getData" searchIconSize="30rpx"
placeholder="请输入搜索关键字..." v-model="queryParams.title"></uv-search>
</view>
<view class="fansList">
<view class="fanst" v-for="(item,index) in list">
<view class=" profilepicture">
<image :src="item.headImage" mode="aspectFill"></image>
</view>
<view class="name">
<view class="namea">
{{ item.nickName }}
</view>
<view class="nameb">
<!-- 感悟哲理积极面对人生传递正能量 -->
{{ item.createTime }}
</view>
</view>
<view class="Dot">
<uv-icon name="more-dot-fill"></uv-icon>
</view>
</view>
</view>
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
export default {
mixins: [mixinsList],
data() {
return {
mixinsListApi : 'getJiangHuInfo',
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.fansList {
margin: 20rpx 10rpx;
background-color: white;
.fanst{
margin: 20rpx 0rpx;
display: flex;
align-items: center;
padding: 20rpx;
.profilepicture {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
image{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
}
.name {
letter-spacing: 2rpx;
font-size: 25rpx;
margin-left: 20rpx;
.namea {
font-weight: bold;
}
.nameb {
color: rgba(0, 0, 0, 0.5);
}
}
.Dot{
margin-left: auto;
}
}
}
</style>

+ 49
- 57
pages_order/post/addPost.vue View File

@ -37,7 +37,7 @@
<view class="category">
<view class="title">
选择分
选择分
</view>
<view class="tagList">
<view
@ -50,7 +50,7 @@
</view>
</view>
<view class="category">
<!-- <view class="category">
<view class="title">
选择地区
</view>
@ -63,12 +63,22 @@
{{ t.name }}
</view>
</view>
</view>
</view> -->
<view class="title-input box">
<input type="text" placeholder="手机号码(选填)" v-model="form.phone"/>
</view>
<view class="title-input box"
@click="selectAddr">
<input type="text"
placeholder="选择位置(选填)"
v-model="form.address"/>
<uv-icon
size="40rpx"
name="map"></uv-icon>
</view>
<!-- <view class="upTop"
>
<view class="title">
@ -131,6 +141,7 @@
<script>
import { mapState } from 'vuex'
import Position from '@/utils/position.js'
export default {
components : {
},
@ -140,6 +151,7 @@
title : '',
classId : 0,
address : '',
phone : '',
},
id : 0,
fileList : [],
@ -152,7 +164,7 @@
onLoad(args) {
this.id = args.id
this.form.classId = this.category[0].id
this.form.address = this.cityList[0].name
// this.form.address = this.cityList[0].name
this.imageMax = args.imageMax || 9
this.getDateil()
},
@ -181,6 +193,8 @@
self.form.title = res.result.title
self.form.address = res.result.address || self.form.address
self.form.classId = res.result.classId || self.form.classId
self.form.latitude = res.result.latitude || self.form.latitude
self.form.longitude = res.result.longitude || self.form.longitude
if(res.result.image){
res.result.image.split(',')
@ -207,59 +221,6 @@
})
},
// //
// payOrder(){
// let self = this
// let data = {
// // ...this.form,
// content : this.form.content,
// topId : this.form.topId,
// title : this.form.title,
// isCard : 'Y',
// state : 0,
// image : this.fileList.map((item) => item.url).join(","),
// isTop : this.form.topId ? 'Y' : 'N',
// }
// if(this.id){
// data.id = this.id
// }
// this.$api('infoReleaseTrends', data,
// res => {
// if(res.code == 200){
// if(self.form.topId && !this.id){
// uni.requestPayment({
// provider: 'wxpay', //
// timeStamp: res.result.timeStamp, //
// nonceStr: res.result.nonceStr, //
// package: res.result.packageValue,
// signType: res.result.signType, //
// paySign: res.result.paySign, //
// success: function (res) {
// console.log('',res);
// self.$refs.confirmationPopupUpload.open()
// // self.$refs.confirmationPopup.close()
// },
// fail: function (err) {
// console.log('',err);
// self.$refs.confirmationPopup.close()
// uni.showToast({
// icon:'none',
// title:""
// })
// }
// });
// }else{
// self.$refs.confirmationPopupUpload.open()
// }
// }
// })
// },
//
submit(){
@ -289,6 +250,30 @@
}
})
},
//
selectAddr() {
Position.selectAddress(success => {
this.setAddress(success)
})
},
//
setAddress(res) {
//
this.form.latitude = res.latitude
this.form.longitude = res.longitude
if (!res.address && res.name) { //
return this.form.address = res.name
}
if (res.address || res.name) {
return this.form.address = res.address + res.name
}
this.form.address = '' //
this.form.latitude = ''
this.form.longitude = ''
},
preview(){},
draft(){},
}
@ -317,9 +302,16 @@
padding: 20rpx;
}
.title-input{
margin: 10rpx;
border-bottom: 1px solid #00000015;
padding-bottom: 25rpx;
margin-bottom: 15rpx;
display: flex;
align-items: center;
justify-content: space-between;
input{
width: 100%;
}
}
.content-input{
min-height: 400rpx;


+ 77
- 139
pages_order/post/postDetail.vue View File

@ -5,7 +5,9 @@
<view class="works" @click="$emit('click')">
<view class="box" :style="{'--sexcolor' : sex[detail.sex].color}">
<view class="headPortraitimg">
<image :src="detail.userImage" mode="aspectFill"></image>
<image :src="detail.userImage"
@click.stop="previewImage([item.userImage])"
mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
@ -20,9 +22,9 @@
<!-- 年份 -->
{{ detail.yearDate }}
</view>
<view class="inde" v-if="detail.address">
<view class="inde" v-if="detail.addId">
<!-- 地址 -->
{{ detail.address }}
{{ detail.addId }}
</view>
<view class="authentication" v-if="detail.isContent">
<!-- 个人认证 -->
@ -43,6 +45,16 @@
</view>
<view class="dynamics" v-html="$utils.stringFormatHtml(detail.title)">
</view>
<view class="address"
@click="openLocation(detail.latitude, detail.longitude)"
v-if="detail.address">
<uv-icon size="30rpx" name="map"></uv-icon>
<view class="text-ellipsis">
{{ detail.address }}
</view>
</view>
<view class="Artworkimages">
<view class="wrokimg" @click.stop="previewImage(detail.image, i)" :key="i"
v-for="(img, i) in detail.image">
@ -56,81 +68,63 @@
<view class="browse">
{{ detail.isComment }}条评论
</view>
<view class="Leavingamessage">
<uv-icon size="40rpx" name="chat"></uv-icon>
</view>
<view class="Leavingamessage" v-if="del" @click.stop="$emit('del')">
<uv-icon size="40rpx" name="trash"></uv-icon>
</view>
</view>
</view>
<view class="comment-list">
<view class="comment"
v-for="(item, index) in list">
<view class="box">
<view class="headPortraitimg">
<image :src="item.userHead" mode="aspectFill"></image>
</view>
<view class="YaoduUniversalWall">
<view class="heide">
<view class="username text-ellipsis">
{{ item.userName }}
</view>
</view>
<view class="Times">
<view class="TimeMonth">
{{ item.createTime }}发布
</view>
</view>
</view>
</view>
<view class="dynamics" v-html="$utils.stringFormatHtml(item.userValue)">
</view>
</view>
</view>
<view class="submit-box">
<view class="top">
<uv-icon
color="#00cf05"
size="50rpx"
name="weixin-fill"></uv-icon>
<input type="text"
:placeholder="'评论给' + detail.userName"
v-model="form.userValue"/>
<!-- <view class="Leavingamessage"
@click="openLocation(detail.latitude, detail.longitude)"
v-if="detail.latitude && detail.longitude">
<uv-icon size="40rpx" name="map"></uv-icon>
导航
</view> -->
<view class="submit"
@click="submit">
发布
<view class="phone"
v-if="detail.phone"
@click.stop="callPhone">
<image src="/static/image/home/phone.png" mode=""></image>
联系{{ ta[detail.sex] }}
</view>
</view>
</view>
<commentList
@getData="getData"
:list="list"
:params="params"
/>
</view>
</template>
<script>
import mixinsSex from '@/mixins/sex.js'
import mixinsList from '@/mixins/list.js'
import commentList from '../components/list/comment/commentList.vue'
export default {
mixins: [mixinsSex, mixinsList],
components: {},
components: {
commentList
},
data() {
return {
detail: {},
form : {},
mixinsListApi : 'getCommentPage',
params : {
type : '0',
orderId : '',
name : '',
},
id : 0,
}
},
onLoad(options) {
// this.$route.query
console.log(options)
this.id = options.id
this.queryParams.type = this.params.type
this.queryParams.orderId = options.id
this.queryParams.type = 0
this.params.orderId = options.id
},
onPullDownRefresh() {
this.getDetail()
@ -152,7 +146,9 @@
}, res => {
uni.stopPullDownRefresh()
if (res.code == 200) {
this.params.name = res.result.userName
res.result.image =
res.result.image ?
res.result.image.split(',') : [],
@ -161,23 +157,14 @@
}
})
},
submit(){
if (this.$utils.verificationAll(this.form, {
userValue: '说点什么吧',
})) {
return
}
// this.form.image = this.fileList.map((item) => item.url).join(",")
this.form.orderId = this.id
this.$api('addComment', this.form, res => {
this.form.userValue = ''
if(res.code == 200){
uni.showToast({
title: '发布成功!',
icon: 'none'
})
this.getData()
callPhone(){
uni.makePhoneCall({
phoneNumber: this.detail.phone,
success() {
console.log('安卓拨打成功');
},
fail() {
console.log('安卓拨打失败');
}
})
},
@ -286,6 +273,13 @@
// line-height: 35rpx;
letter-spacing: 3rpx;
}
.address{
font-size: 24rpx;
margin-top: 20rpx;
display: flex;
align-items: center;
}
.Artworkimages {
display: flex;
@ -313,80 +307,24 @@
}
.Leavingamessage {
height: 20rpx;
width: 20rpx;
margin-left: auto;
}
}
}
.comment-list {
margin-top: 20rpx;
padding-bottom: 150rpx;
.comment {
background-color: #fff;
padding: 30rpx 40rpx;
margin-top: 10rpx;
.box {
display: flex;
align-items: center;
.headPortraitimg {
width: 80rpx;
height: 80rpx;
border-radius: 15rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.YaoduUniversalWall {
padding: 0rpx 10rpx;
font-size: 26rpx;
line-height: 40rpx;
.Times{
font-size: 22rpx;
}
}
}
.dynamics {
margin-top: 20rpx;
margin-left: 100rpx;
font-size: 28rpx;
letter-spacing: 3rpx;
.phone{
background-color: rgba($uni-color, 0.2);
color: $uni-color;
padding: 8rpx 16rpx;
border-radius: 10rpx;
margin-left: auto;
image{
width: 20rpx;
height: 20rpx;
}
}
}
}
.submit-box{
position: fixed;
bottom: 0;
left: 0;
background-color: #fff;
width: 100%;
box-shadow: 0 0 6rpx 6rpx #00000011;
padding-bottom: env(safe-area-inset-bottom);
.top{
align-items: center;
display: flex;
justify-content: center;
input{
background-color: #f3f3f3;
width: 460rpx;
height: 40rpx;
border-radius: 40rpx;
margin: 20rpx;
padding: 20rpx 30rpx;
font-size: 28rpx;
}
.submit{
}
}
}
}
</style>

+ 45
- 10
pages_order/renting/rentingDetail.vue View File

@ -92,18 +92,24 @@
</span>
</view>
</view>
<view
style="margin-left: auto;"
class="d-btn" @click="clickService">
<span>打电话</span>
</view>
</view>
</view>
<view class="b-fiexd flex" style="height: 98rpx; z-index: 2;">
<!-- <view class="b-fiexd flex" style="height: 98rpx; z-index: 2;">
<view style="padding-left: 20rpx;">
<image src="/static/logo.png" class="radius80 test" />
</view>
<view style="padding: 12rpx 20rpx; width: 280rpx;
display: flex;align-items: center;">
<view class="font-d">{{ detail.userId }}</view>
<!-- <view class="font-b">新城国际花都</view> -->
</view>
<view style="padding: 20rpx" @click="clickShare()">
<uni-icons type="redo"></uni-icons>
@ -111,24 +117,52 @@
<view class="d-btn" @click="clickService">
<span>打电话</span>
</view>
</view>
</view> -->
<commentList
@getData="getData"
:list="list"
:params="params"
/>
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
import commentList from '../components/list/comment/commentList.vue'
export default {
mixins: [mixinsList],
components : {
commentList,
},
data() {
return {
id : 0,
detail : {},
collectionFlag : false,
mixinsListApi : 'getCommentPage',
params : {
type : '1',
orderId : '',
name : '',
},
}
},
onLoad({id}) {
this.id = id
onLoad(options) {
this.id = options.id
this.queryParams.type = this.params.type
this.queryParams.orderId = options.id
this.params.orderId = options.id
},
onPullDownRefresh() {
this.getDetail()
},
onShow() {
this.getData()
this.getDetail()
},
methods: {
clickShare() {
@ -145,15 +179,16 @@
phoneNumber: this.detail.phone,
});
},
getData(){
getDetail(){
let data = {
id : this.id
}
if(uni.getStorageSync('token')){
data.token = uni.getStorageSync('token')
}
this.$api('getRentDetail', data, res => {
if(res.code == 200){
this.params.name = res.result.title
this.detail = res.result
}
})


+ 8
- 2
pages_order/renting/rentingList.vue View File

@ -41,7 +41,12 @@
:key="index"
@click="clickDetail(item)">
<view>
<image class="imx" :src="item.image &&
<image class="imx"
@click.stop="previewImage([item.image &&
item.image.split(',')[0]])"
:src="item.image &&
item.image.split(',')[0]" />
</view>
<view style="width: calc(100% - 330rpx);">
@ -165,7 +170,8 @@
.imx {
width: 300rpx;
height: 250rpx;
height: 96%;
margin: 2% 0;
}
.t1 {


+ 151
- 0
pages_order/scenicSpot/scenicSpotDetail.vue View File

@ -0,0 +1,151 @@
<template>
<view class="postDetail">
<navbar leftClick @leftClick="$utils.navigateBack" title="详情" />
<view class="swipe">
<uv-swiper
:list="detail.images"
indicator
height="420rpx"></uv-swiper>
</view>
<view class="box">
<view class="title">
{{ detail.name }}
</view>
<view class="createBy">
<view class="">
发布时间{{ $dayjs(detail.createTime).format('YYYY-MM-DD') }}
</view>
</view>
<view class="createBy">
<view class="">
地址{{ detail.address }}
</view>
</view>
<view class="content">
<uv-parse :content="detail.details"></uv-parse>
</view>
</view>
<commentList
@getData="getData"
:list="list"
:params="params"
/>
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
import commentList from '../components/list/comment/commentList.vue'
export default {
mixins: [mixinsList],
components: {
commentList
},
data() {
return {
detail: {},
mixinsListApi : 'getCommentPage',
params : {
type : '3',
orderId : '',
name : '',
},
id : 0,
}
},
onLoad(options) {
// this.$route.query
console.log(options)
this.id = options.id
this.queryParams.type = this.params.type
this.queryParams.orderId = options.id
this.params.orderId = options.id
},
onPullDownRefresh(){
this.getDetail()
},
onShow() {
this.getDetail()
},
onShareAppMessage(res) {
// if (res.from === 'button') {//
// console.log(res.target)
// }
// return {
// title: this.item.title,
// desc: this.item.content && this.item.content.slice(0, 30),
// path: '/pages/publish/postDetail?id=' + this.id
// }
},
methods: {
getDetail() {
this.$api('getScenicDetail', {
id : this.id
}, res => {
uni.stopPullDownRefresh()
if (res.code == 200) {
this.params.name = res.result.name
this.detail = res.result
this.detail.images = res.result.images && res.result.images.split(',')
}
})
},
}
}
</script>
<style lang="scss" scoped>
.postDetail {
.box {
padding: 20rpx;
width: 100vw;
background-color: #fff;
box-sizing: border-box;
.title {
font-size: 34rpx;
font-weight: 600;
color: #000;
}
.createBy {
display: flex;
margin-top: auto;
margin-bottom: 10rpx;
font-size: 24rpx;
margin-top: 20rpx;
color: #555;
&>view {
display: flex;
align-items: center;
justify-content: center;
padding-right: 20rpx;
}
}
.controls {
margin-top: 30rpx;
}
.content {
margin-top: 30rpx;
font-size: 28rpx;
}
}
}
</style>

+ 1
- 0
pages_order/scenicSpot/scenicSpotList.vue View File

@ -18,6 +18,7 @@
:key="index"
v-for="(item, index) in list"
:item="item"
@click="$utils.navigateTo('/pages_order/scenicSpot/scenicSpotDetail?id=' + item.id)"
/>
</view>


+ 34
- 16
pages_order/work/workDetail.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page">
<navbar title="工作详情" leftClick @leftClick="$utils.navigateBack" />
<navbar title="详情" leftClick @leftClick="$utils.navigateBack" />
<view class="box">
<view class="title">
@ -90,37 +90,53 @@
</view>
</view>
<commentList
@getData="getData"
:list="list"
:params="params"
/>
</view>
</template>
<script>
let text = `岗位要求
1全日制大专以上学历艺术设计类相关专业;
2两年以上平面品牌视觉设计等相关工作经验能独立完成项目的设计工作 3C数码/个护健 类产品服务经验优先有乙方工作经验佳;
3具备一定的设计提案能力能完整的呈现设计思路与创意能清晰的表达设计逻辑与思考;
4热爱设计平面基本功扎实拥有优良的审美与创意想法对版式色彩把控能力强;对工作富有责任心具备团队沟通与协作能力;
5精通 PSAICDR 等平面设计软件能独立完成日常平面设计工作内容熟练使用 PPT/Keynote能完成提案内容的材料美化工作
`
import mixinsList from '@/mixins/list.js'
import commentList from '../components/list/comment/commentList.vue'
export default {
mixins: [mixinsList],
components : {
commentList,
},
data() {
return {
text : '',
id : 0,
detail : {},
collectionFlag : false,
mixinsListApi : 'getCommentPage',
params : {
type : '2',
orderId : '',
name : '',
},
}
},
onLoad({id}) {
this.id = id
onLoad(options) {
this.id = options.id
this.queryParams.type = this.params.type
this.queryParams.orderId = options.id
this.params.orderId = options.id
},
onPullDownRefresh() {
this.getDetail()
},
onShow() {
this.text = this.$utils.stringFormatHtml(text)
this.getData()
this.getDetail()
},
methods: {
getData(){
getDetail(){
let data = {
id : this.id
}
@ -129,6 +145,9 @@
}
this.$api('getJobDetail', data, res => {
if(res.code == 200){
this.params.name = res.result.title
this.detail = res.result
this.detail.jobDetails = this.$utils.stringFormatHtml(res.result.jobDetails)
this.collectionFlag = res.result.collectionFlag
@ -141,10 +160,9 @@
<style scoped lang="scss">
.page{
background-color: #fff;
min-height: 100vh;
.box{
padding: 30rpx;
background-color: #fff;
.title{
font-size: 34rpx;
font-weight: 900;


+ 1
- 1
pages_order/work/workList.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page pageList">
<navbar title="工作" leftClick @leftClick="$utils.navigateBack" />
<navbar title="工作" leftClick @leftClick="$utils.navigateBack" />
<view
style="padding: 10rpx 20rpx;">


BIN
static/image/home/phone.png View File

Before After
Width: 24  |  Height: 24  |  Size: 747 B

+ 9
- 0
utils/index.js View File

@ -35,4 +35,13 @@ Vue.prototype.previewImage = (urls, current) => {
urls,
current,
})
}
Vue.prototype.openLocation = (latitude, longitude) => {
if(!latitude || !longitude){
return
}
uni.openLocation({
latitude : Number(latitude),
longitude : Number(longitude),
})
}

+ 190
- 0
utils/position.js View File

@ -0,0 +1,190 @@
import config from '../config.js'
function calculateDistance(lat1, lon1, lat2, lon2) { //计算两点距离
let distance = 0
if (!lat2 || !lon2) return distance
//先强制转换一下(后端给的字符串)
lat1 = parseFloat(lat1)
lon1 = parseFloat(lon1)
lat2 = parseFloat(lat2)
lon2 = parseFloat(lon2)
// 将角度转换为弧度
const R = 6371; // 地球半径,单位公里
const dLat = (lat2 - lat1) * Math.PI / 180;
const dLon = (lon2 - lon1) * Math.PI / 180;
lat1 = lat1 * Math.PI / 180;
lat2 = lat2 * Math.PI / 180;
// Haversine公式
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
// 计算距离
distance = R * c;
return distance.toFixed(0)
}
function getLocation(fn) { //获取用户经纬度
wxGetLocation() //此方法只用于提示用户打开gps
// uni.getLocation({
// type: 'gcj02',
// isHighAccuracy: true,
// highAccuracyExpireTime: 1000,
// success: function(position) {
// fn(position)
// },
// fail: function() { //使用ip获取定位
// let key = config.mapKey; //腾讯地图key
// getUserAddressByIp(key).then(res => {
// fn(res.position) //返回经纬度
// })
// }
// })
uni.getFuzzyLocation({
type: 'gcj02',
// type: 'wgs84',
success (res) {
fn(res)
}
})
}
function getLocationDetail() { //获取用户详细地址
wxGetLocation()
return new Promise((resolve, reject) => {
let key = config.mapKey; //腾讯地图key
// uni.getLocation({
// type: 'gcj02',
// isHighAccuracy: true,
// highAccuracyExpireTime: 1000,
// success: function(position) {
// getUserAddress(position.latitude, position.longitude, key).then(res => {
// resolve(res)
// })
// },
// fail: function() { //使用ip获取定位
// getUserAddressByIp(key).then(res => {
// resolve(res)
// })
// }
// })
getLocation((position) => {
getUserAddress(position.latitude, position.longitude, key).then(res => {
resolve(res)
})
})
})
}
function getUserAddress(latitude, longitude, key) { //通过经纬度获取用户详细地址
return new Promise((resolve, reject) => {
let url = `/ws/geocoder/v1/?location=${latitude},${longitude}&key=${key}`
// #ifndef H5
url = `https://apis.map.qq.com` + url
// #endif
uni.request({
url,
success: (res) => {
let {
lat,
lng
} = res.data.result.ad_info.location;
let data = {
position: {
latitude: lat,
longitude: lng
},
addressDetail: res.data.result.ad_info
}
resolve(data)
},
fail(err) {
reject(err)
}
})
})
}
function getUserAddressByIp(key) { //根据IP获取当前用户位置
return new Promise((resolve, reject) => {
uni.request({
url: 'https://api.ipify.org?format=json',
success: (ipInfo) => {
let url = `/ws/location/v1/ip?ip=${ipInfo.data.ip}&key=${key}`
// #ifndef H5
url = `https://apis.map.qq.com` + url
// #endif
uni.request({
url,
success: (res) => {
let {
lat,
lng
} = res.data.result.location;
let data = {
addressDetail: res.data.result.ad_info,
ip: res.data.result.ip,
position: {
latitude: lat,
longitude: lng
}
}
resolve(data)
},
fail(err) {
reject(err)
}
})
}
})
})
}
//打开地图让用户选择位置
function selectAddress(successCallback) {
uni.chooseLocation({
// longitude, //经度
// latitude, //纬度
success: function(res) {
successCallback && successCallback(res)
}
});
}
//sdk自带获取位置方法(只支持微信环境),这里只当提示在用了(具体获取地址逻辑上面几个方法已完成)
function wxGetLocation(successCallback, failCallback) {
// #ifdef MP-WEIXIN
// #endif
console.log('wx.getLocation');
// wx.getLocation({
// type: 'gcj02',
// isHighAccuracy: true,
// highAccuracyExpireTime: 2000,
// success(res) {},
// fail(err) {
// if(err.errMsg == 'getLocation:gps closed'){
// uni.showToast({
// title: '请打开GPS定位,否则定位不准确',
// icon: 'none'
// })
// }
// }
// })
}
export default {
calculateDistance, //计算两点距离
getLocationDetail, //获取用户详细地址
getLocation, //获取用户经纬度
selectAddress, //打开地图让用户选择位置
wxGetLocation,
}

Loading…
Cancel
Save