页面修改
This commit is contained in:
parent
a59c789cd8
commit
59f356fa2e
|
@ -40,6 +40,7 @@ export const listForType = (data) => syhttp.get('/action/listForType', data)
|
||||||
|
|
||||||
//首页
|
//首页
|
||||||
export const lindexist = (data) => syhttp.get('/index/index', data)
|
export const lindexist = (data) => syhttp.get('/index/index', data)
|
||||||
|
|
||||||
//产品列表
|
//产品列表
|
||||||
export const landproduct = (data) => syhttp.get('/land/product', data)
|
export const landproduct = (data) => syhttp.get('/land/product', data)
|
||||||
|
|
||||||
|
@ -63,5 +64,3 @@ export const towns = (data) => http.get('/common/geo/towns', data)
|
||||||
export const villages = (data) => http.get('/common/geo/villages', data)
|
export const villages = (data) => http.get('/common/geo/villages', data)
|
||||||
//小组
|
//小组
|
||||||
export const groups = (data) => http.get('/common/geo/groups', data)
|
export const groups = (data) => http.get('/common/geo/groups', data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -364,10 +364,19 @@
|
||||||
}
|
}
|
||||||
const location = () => {
|
const location = () => {
|
||||||
|
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/addLand/select_address_n'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '获取位置中'
|
title: '获取位置中'
|
||||||
})
|
})
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
geocode: true,
|
geocode: true,
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
|
@ -441,7 +450,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
|
console.log(options || "")
|
||||||
provincen()
|
provincen()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -17,65 +17,26 @@
|
||||||
<view class="re-location">
|
<view class="re-location">
|
||||||
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
|
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
|
||||||
<view style="flex: 1;">
|
<view style="flex: 1;">
|
||||||
<text
|
<text class="text">{{address}}</text>
|
||||||
class="text">{{locationInfo.formatted_addresses?locationInfo.formatted_addresses.recommend:locationInfo.address}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="re-btn" @click="reGetLocation">
|
<view class="re-btn" @click="reGetLocation">
|
||||||
<image class="re-address-img" src="@/static/images/re_address.png"></image><text
|
<text class="text">重新定位</text>
|
||||||
class="text">重新定位</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-button text="确认" @click="submitAddress"></u-button>
|
<u-button text="确认" @click="submitAddress"></u-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="address-box" v-if="current==1">
|
|
||||||
<view class="head_item_tips">
|
|
||||||
<view><text class="text">泸州区县</text></view>
|
|
||||||
</view>
|
|
||||||
<view class="area">
|
|
||||||
<view class="area-item" :class="{'area-item-on': item.code==area_change}"
|
|
||||||
v-for="(item, index) in areaList" :key="index" @click="changeArea(item)">
|
|
||||||
<text class="text">{{item.name}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="head_item_tips">
|
|
||||||
<view><text class="text">选择街道/镇</text></view>
|
|
||||||
</view>
|
|
||||||
<view class="street">
|
|
||||||
<view class="letter-item" v-for="key in mapKey" :key="key">
|
|
||||||
<view class="letter"><text class="text">{{key}}</text></view>
|
|
||||||
<view class="item-box">
|
|
||||||
<view class="street-item" v-for="item in mapList[key]" :key="item.code"
|
|
||||||
@click="changeStreet(item)">
|
|
||||||
<text class="text">{{item.name}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
|
||||||
getGeocoder,
|
|
||||||
merClassifly,
|
|
||||||
getProductslist
|
|
||||||
} from '@/api/store.js';
|
|
||||||
import {
|
|
||||||
getArea,
|
|
||||||
getStreet
|
|
||||||
} from "@/api/article.js";
|
|
||||||
import {
|
|
||||||
Toast
|
|
||||||
} from '@/libs/uniApi';
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabsList: [{
|
tabsList: [{
|
||||||
name: '地图定位',
|
name: '地图定位',
|
||||||
}, {
|
|
||||||
name: '泸州区县',
|
|
||||||
}],
|
}],
|
||||||
current: 0,
|
current: 0,
|
||||||
latitude: '28.87',
|
latitude: '28.87',
|
||||||
|
@ -88,20 +49,14 @@
|
||||||
width: 28,
|
width: 28,
|
||||||
height: 28
|
height: 28
|
||||||
},
|
},
|
||||||
|
address: "",
|
||||||
locationInfo: {},
|
locationInfo: {},
|
||||||
town: '',
|
|
||||||
street_id: '',
|
|
||||||
street: '',
|
street: '',
|
||||||
areaList: [],
|
|
||||||
streetList: [],
|
|
||||||
mapList: {},
|
mapList: {},
|
||||||
area_change: '',
|
|
||||||
street_change: '',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.getLoaction();
|
this.getLoaction();
|
||||||
this.loadArea();
|
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -114,104 +69,46 @@
|
||||||
this.current = e.index;
|
this.current = e.index;
|
||||||
},
|
},
|
||||||
getLoaction() {
|
getLoaction() {
|
||||||
|
let that = this
|
||||||
this.street = '定位中'
|
this.street = '定位中'
|
||||||
this.locationInfo = {};
|
this.locationInfo = {};
|
||||||
this.locationInfo.formatted_addresses = {};
|
this.locationInfo.formatted_addresses = {};
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位中'
|
this.locationInfo.formatted_addresses.recommend = '定位中'
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
timeout: '4',
|
geocode: true,
|
||||||
|
isHighAccuracy: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
let latitude, longitude;
|
let latitude, longitude;
|
||||||
latitude = res.latitude.toString();
|
latitude = res.latitude.toString();
|
||||||
longitude = res.longitude.toString();
|
longitude = res.longitude.toString();
|
||||||
this.latitude = res.latitude.toFixed(6);
|
this.latitude = res.latitude.toFixed(6);
|
||||||
this.longitude = res.longitude.toFixed(6);
|
this.longitude = res.longitude.toFixed(6);
|
||||||
this.$store.commit('setLocation', {
|
uni.request({
|
||||||
lat: res.latitude.toFixed(6),
|
url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${res.longitude},${res.latitude}&key=976a447183ed0d384e1c5b6448b8a75d&radius=1000&extensions=all`, //仅为示例,并非真实接口地址。
|
||||||
long: res.longitude.toFixed(6),
|
success: (res) => {
|
||||||
|
that.address = res.data.regeocode.formatted_address
|
||||||
|
// console.log();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
getGeocoder({
|
|
||||||
lat: latitude,
|
|
||||||
long: longitude
|
|
||||||
}).then(res => {
|
|
||||||
this.locationInfo = res.data;
|
|
||||||
this.town = res.data.address_reference.town.title
|
|
||||||
this.street_id = res.data.address_reference.town.id
|
|
||||||
this.street = res.data.address_reference.town.title;
|
|
||||||
}).catch(err => {
|
|
||||||
uni.showToast({
|
|
||||||
title: err,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
this.street = '定位失败'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.log('定位失败');
|
|
||||||
this.isshow = false
|
this.isshow = false
|
||||||
Toast('定位失败,请检查定位权限是否开启')
|
// Toast('定位失败,请检查定位权限是否开启')
|
||||||
this.street = '定位失败'
|
this.street = '定位失败'
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
||||||
|
|
||||||
// uni.showToast({
|
|
||||||
// title: "获取定位超时",
|
|
||||||
// icon: 'none',
|
|
||||||
// duration: 2000
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reGetLocation() {
|
reGetLocation() {
|
||||||
this.getLoaction()
|
this.getLoaction()
|
||||||
},
|
},
|
||||||
loadArea() {
|
|
||||||
getArea({
|
|
||||||
city_code: 510500
|
|
||||||
}).then((res) => {
|
|
||||||
this.areaList = res.data;
|
|
||||||
this.changeArea(this.areaList[0]);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
loadStreet(area_code) {
|
|
||||||
this.street_change = '';
|
|
||||||
getStreet({
|
|
||||||
area_code
|
|
||||||
}).then((res) => {
|
|
||||||
this.streetList = res.data;
|
|
||||||
this.initPinyin();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
initPinyin() {
|
|
||||||
this.mapList = {};
|
|
||||||
this.streetList.forEach((item) => {
|
|
||||||
let str = item.pinyin?.toUpperCase();
|
|
||||||
str = str ? str : '#';
|
|
||||||
if (this.mapList[str]) {
|
|
||||||
this.mapList[str].push(item);
|
|
||||||
} else {
|
|
||||||
this.mapList[str] = [];
|
|
||||||
this.mapList[str].push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeArea(item) {
|
|
||||||
this.area_change = item.code;
|
|
||||||
this.loadStreet(this.area_change);
|
|
||||||
},
|
|
||||||
// 选择位置
|
|
||||||
changeStreet(item) {
|
|
||||||
uni.navigateBack({
|
|
||||||
success: () => {
|
|
||||||
uni.$emit('changeAddress', {
|
|
||||||
area: this.area_change,
|
|
||||||
street: item
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 点击地图
|
// 点击地图
|
||||||
handleMapTap(e) {
|
handleMapTap(e) {
|
||||||
|
let that = this
|
||||||
// console.log('点击地图', e);
|
// console.log('点击地图', e);
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
return Toast('H5暂不支持选择坐标');
|
return Toast('H5暂不支持选择坐标');
|
||||||
|
@ -220,49 +117,37 @@
|
||||||
let latitude = e.detail.latitude;
|
let latitude = e.detail.latitude;
|
||||||
this.markers.longitude = longitude;
|
this.markers.longitude = longitude;
|
||||||
this.markers.latitude = latitude;
|
this.markers.latitude = latitude;
|
||||||
// console.log('修改成功', this.markers);
|
this.longitude = longitude
|
||||||
getGeocoder({
|
this.latitude = latitude
|
||||||
lat: latitude,
|
uni.request({
|
||||||
long: longitude
|
url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${longitude},${latitude}&key=976a447183ed0d384e1c5b6448b8a75d&radius=1000&extensions=all`, //仅为示例,并非真实接口地址。
|
||||||
}).then(res => {
|
success: (res) => {
|
||||||
// console.log(res);
|
console.log(res)
|
||||||
this.locationInfo = res.data;
|
that.address = res.data.regeocode.formatted_address
|
||||||
}).catch(err => {
|
}
|
||||||
uni.showToast({
|
});
|
||||||
title: err,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
this.locationInfo = {};
|
|
||||||
this.locationInfo.formatted_addresses = {};
|
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
submitAddress() {
|
submitAddress() {
|
||||||
console.log(this.locationInfo);
|
|
||||||
try {
|
// console.log(this.latitude)
|
||||||
this.town = this.locationInfo.address_reference.town.title;
|
// console.log(this.longitude)
|
||||||
this.street_id = this.locationInfo.address_reference.town.id;
|
// console.log(this.address)
|
||||||
this.street = this.locationInfo.address_reference.town.title;
|
|
||||||
let obj = {
|
let data = {
|
||||||
area: this.locationInfo.ad_info.adcode,
|
lat: this.latitude,
|
||||||
street: {
|
lon: this.longitude,
|
||||||
name: this.street,
|
address: this.address
|
||||||
code: this.street_id
|
|
||||||
},
|
|
||||||
latitude: this.latitude,
|
|
||||||
longitude: this.longitude
|
|
||||||
}
|
|
||||||
console.log({
|
|
||||||
...obj
|
|
||||||
});
|
|
||||||
uni.navigateBack({
|
|
||||||
success: () => {
|
|
||||||
uni.$emit('changeAddress', obj)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/addLand/addLand" + JSON.stringify(data)
|
||||||
})
|
})
|
||||||
} catch (e) {
|
|
||||||
return Toast('地址有误,请重新选择')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
searchMap() {
|
searchMap() {
|
||||||
uni.request({
|
uni.request({
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<view class="nav-con" style="justify-content: space-between;">
|
<view class="nav-con" style="justify-content: space-between;">
|
||||||
<view class="" v-if="Object.keys(dataobj).length>0"
|
<view class="" v-if="Object.keys(dataobj).length>0"
|
||||||
style="padding-left: 20rpx;display: flex;color: white;" @click="show=true">
|
style="padding-left: 20rpx;display: flex;color: white;" @click="show=true">
|
||||||
<u--image :src="u('qhtd')" width="38.55rpx" @click="scanFn" height="38.55rpx"
|
<u--image :src="u('qhtd')" width="38.55rpx" height="38.55rpx"
|
||||||
style="margin-right: 20rpx;"></u--image>
|
style="margin-right: 20rpx;"></u--image>
|
||||||
{{dataobj.title}}
|
{{dataobj.title}}
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="color:#73DFB2">
|
<view class="" style="color:#73DFB2">
|
||||||
|
<text v-if="item.num==0">{{item.num+item.unit}}</text>
|
||||||
{{ item.num?item.num+item.unit:'--' }}
|
<text v-else>{{ item.num?item.num+item.unit:'--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -427,7 +427,7 @@
|
||||||
|
|
||||||
])
|
])
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getlist()
|
// getlist()
|
||||||
getlist1()
|
getlist1()
|
||||||
getlist2()
|
getlist2()
|
||||||
|
|
||||||
|
@ -445,12 +445,10 @@
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
if (Object.keys(res.data).length > 0) {
|
if (Object.keys(res.data).length > 0) {
|
||||||
getlist3(res.data.id)
|
getlist3(res.data.id)
|
||||||
|
|
||||||
Object.assign(dataobj, res.data);
|
Object.assign(dataobj, res.data);
|
||||||
|
|
||||||
if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
|
if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
|
||||||
soilList[0].num = res.data.monitor.soil_monitor_data.temperature
|
soilList[0].num = res.data.monitor.soil_monitor_data.soil_temperature
|
||||||
soilList[1].num = res.data.monitor.soil_monitor_data.moisture
|
soilList[1].num = res.data.monitor.soil_monitor_data.soil_moisture
|
||||||
soilList[2].num = res.data.monitor.soil_monitor_data.conductivity
|
soilList[2].num = res.data.monitor.soil_monitor_data.conductivity
|
||||||
soilList[3].num = res.data.monitor.soil_monitor_data.ph
|
soilList[3].num = res.data.monitor.soil_monitor_data.ph
|
||||||
soilList[4].num = res.data.monitor.soil_monitor_data.n_content
|
soilList[4].num = res.data.monitor.soil_monitor_data.n_content
|
||||||
|
@ -460,13 +458,12 @@
|
||||||
if (res.data && res.data.monitor && res.data.monitor.air_monitor_data) {
|
if (res.data && res.data.monitor && res.data.monitor.air_monitor_data) {
|
||||||
environmentList[0].num = res.data.monitor.air_monitor_data.wind_speed
|
environmentList[0].num = res.data.monitor.air_monitor_data.wind_speed
|
||||||
environmentList[1].num = res.data.monitor.air_monitor_data.wind_direction
|
environmentList[1].num = res.data.monitor.air_monitor_data.wind_direction
|
||||||
environmentList[2].num = res.data.monitor.air_monitor_data.temperature
|
environmentList[2].num = res.data.monitor.air_monitor_data.air_temperature
|
||||||
environmentList[3].num = res.data.monitor.air_monitor_data.moisture
|
environmentList[3].num = res.data.monitor.air_monitor_data.air_moisture
|
||||||
environmentList[4].num = res.data.monitor.air_monitor_data.co2_content
|
environmentList[4].num = res.data.monitor.air_monitor_data.co2_content
|
||||||
environmentList[5].num = res.data.monitor.air_monitor_data.pressure
|
environmentList[5].num = res.data.monitor.air_monitor_data.pressure
|
||||||
environmentList[6].num = res.data.monitor.air_monitor_data.rainfall
|
environmentList[6].num = res.data.monitor.air_monitor_data.rainfall
|
||||||
environmentList[7].num = res.data.monitor.air_monitor_data.light_intensity
|
environmentList[7].num = res.data.monitor.air_monitor_data.light_intensity
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,6 +479,9 @@
|
||||||
keyword: ''
|
keyword: ''
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
|
|
||||||
|
tdId.value = res.data[0].id
|
||||||
|
getlist()
|
||||||
if (res.data.length > 0) {
|
if (res.data.length > 0) {
|
||||||
columns.splice(0, columns.length, ...res.data.map((step, index) => {
|
columns.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||||
return {
|
return {
|
||||||
|
@ -604,7 +604,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const navgo = () => {
|
const navgo = () => {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/landDetail/index?id=' + dataobj.id
|
url: '/pages/landDetail/index?id=' + dataobj.id
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
Promise.resolve("./pages/live/live.js").then((res) => {
|
Promise.resolve("./pages/live/live.js").then((res) => {
|
||||||
res.length;
|
res.length;
|
||||||
});
|
});
|
||||||
|
Promise.resolve("./pages/addLand/select_address_n.js").then((res) => {
|
||||||
|
res.length;
|
||||||
|
});
|
||||||
Promise.resolve("./app.css.js").then(() => {
|
Promise.resolve("./app.css.js").then(() => {
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue