|
|
|
@ -3,8 +3,11 @@ |
|
|
|
|
<view class="home-navbar"> |
|
|
|
|
<u-navbar :is-back="false"> |
|
|
|
|
<view class="slot-wrap"> |
|
|
|
|
<view class="address" @click="openPage(2)"> |
|
|
|
|
<view class="address" v-if="city" @click="openPage(2)"> |
|
|
|
|
<image src="@/static/dingwei.png"></image>{{city}} |
|
|
|
|
</view> |
|
|
|
|
<view class="address" v-else @click="getLocation()"> |
|
|
|
|
<image src="@/static/dingwei.png"></image>获取定位 |
|
|
|
|
</view> |
|
|
|
|
<view class="search" @click="openPage(3)"> |
|
|
|
|
<image src="@/static/icon-search.png"></image> |
|
|
|
@ -39,10 +42,17 @@ |
|
|
|
|
<view class="empty" v-if="total == 0 "> |
|
|
|
|
<image src="@/static/empty.png"></image> |
|
|
|
|
<view class="txt">暂无数据</view> |
|
|
|
|
</view> |
|
|
|
|
<view style="padding: 250rpx 0 0;"> |
|
|
|
|
<u-empty v-if="!city" text="请开启定位权限" mode="data"> |
|
|
|
|
<view slot="bottom" style="margin-top: 30rpx;"> |
|
|
|
|
<u-button @click="getLocation()">获取定位</u-button> |
|
|
|
|
</view> |
|
|
|
|
</u-empty> |
|
|
|
|
</view> |
|
|
|
|
<unverified :isPopup="isPopup" /> |
|
|
|
|
<u-popup v-model="show" mode="top" :mask-close-able='false' :zIndex="5"> |
|
|
|
|
<view class="permissions_box"> |
|
|
|
|
<view class="permissions_box" :style="{'padding-top': (statusBarHeight+64)+'px'}"> |
|
|
|
|
当您使用APP时,应用程序可以提供基于位置的服务、定位导航、附近搜索等功能。 |
|
|
|
|
</view> |
|
|
|
|
</u-popup> |
|
|
|
@ -51,7 +61,9 @@ |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
<script> |
|
|
|
|
const systemInfoSync = uni.getSystemInfoSync() |
|
|
|
|
import permision from "@/js_sdk/wa-permission/permission.js" |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -68,7 +80,8 @@ |
|
|
|
|
show: false, |
|
|
|
|
total: 1, |
|
|
|
|
sellerUserList: [], |
|
|
|
|
userInfo: {} |
|
|
|
|
userInfo: {}, |
|
|
|
|
statusBarHeight: 0 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onPullDownRefresh() { |
|
|
|
@ -80,42 +93,10 @@ |
|
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
|
},2000) |
|
|
|
|
}, |
|
|
|
|
onLoad() { |
|
|
|
|
const that = this; |
|
|
|
|
that.city = uni.getStorageSync("jingweiInfo")?uni.getStorageSync("jingweiInfo").formatted:"" |
|
|
|
|
if(!that.city){ |
|
|
|
|
// APP检查权限 |
|
|
|
|
if(uni.getSystemInfoSync().platform == 'android') { |
|
|
|
|
plus.android.checkPermission( |
|
|
|
|
'android.permission.ACCESS_FINE_LOCATION', |
|
|
|
|
granted => { |
|
|
|
|
if (granted.checkResult==-1){ |
|
|
|
|
that.show=true |
|
|
|
|
that.getLocation(); |
|
|
|
|
}else{ |
|
|
|
|
that.show=false |
|
|
|
|
// 此为uView的跳转方法,详见"文档-JS"部分,也可以用uni的uni.navigateTo |
|
|
|
|
that.getLocation(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error => { |
|
|
|
|
console.error('Error checking permission:', error.message); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
that.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION') |
|
|
|
|
return ; |
|
|
|
|
}else{ |
|
|
|
|
that.getLocation(); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
that.getList(); |
|
|
|
|
that.getsellerUserList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onLoad() {}, |
|
|
|
|
onShow() { |
|
|
|
|
if(uni.getStorageSync("userInfo").id){ |
|
|
|
|
that.getUserInfo(); |
|
|
|
|
this.getUserInfo(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
@ -148,6 +129,39 @@ |
|
|
|
|
}, 1000); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getLocation() { |
|
|
|
|
const that = this; |
|
|
|
|
that.statusBarHeight = systemInfoSync.statusBarHeight; |
|
|
|
|
that.city = uni.getStorageSync("jingweiInfo")?uni.getStorageSync("jingweiInfo").formatted:"" |
|
|
|
|
if(!that.city){ |
|
|
|
|
// APP检查权限 |
|
|
|
|
if(uni.getSystemInfoSync().platform == 'android') { |
|
|
|
|
plus.android.checkPermission( |
|
|
|
|
'android.permission.ACCESS_FINE_LOCATION', |
|
|
|
|
granted => { |
|
|
|
|
if (granted.checkResult==-1){ |
|
|
|
|
that.show=true |
|
|
|
|
that.getLocation(); |
|
|
|
|
}else{ |
|
|
|
|
that.show=false |
|
|
|
|
// 此为uView的跳转方法,详见"文档-JS"部分,也可以用uni的uni.navigateTo |
|
|
|
|
that.getLocation(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error => { |
|
|
|
|
console.error('Error checking permission:', error.message); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
that.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION') |
|
|
|
|
return ; |
|
|
|
|
}else{ |
|
|
|
|
that.getLocation(); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
that.getList(); |
|
|
|
|
that.getsellerUserList(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//实时上传轨迹 |
|
|
|
|
trackUpload(res){ |
|
|
|
|
this.$api.trackUpload({ |
|
|
|
@ -262,7 +276,11 @@ |
|
|
|
|
this.sellerUserList = this.arrayUnique([...this.sellerUserList,...data.list],'id') |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
openPage(index,id){ |
|
|
|
|
openPage(index,id){ |
|
|
|
|
if(!that.city){ |
|
|
|
|
that.getLocation(); |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(index == 1){ |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: "/pages/peiwan/detail?id="+id |
|
|
|
|