基础接口对接

This commit is contained in:
仲么了
2023-05-25 10:10:22 +08:00
parent cca66bab21
commit e9b1e9a417
11 changed files with 579 additions and 171 deletions

View File

@@ -1,7 +1,7 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='new'>
<Cn-page :loading="loading">
<view slot="body">
<view class="new">
<view class="content">
<uni-forms :label-width="80">
<uni-forms-item label="工程名称">
@@ -17,8 +17,7 @@
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
</uni-forms-item>
<uni-forms-item label="描述">
<uni-easyinput type="textarea" autoHeight v-model="formData.description"
placeholder="请输入工程描述" />
<uni-easyinput type="textarea" autoHeight v-model="formData.description" placeholder="请输入工程描述" />
</uni-forms-item>
</uni-forms>
</view>
@@ -38,10 +37,10 @@ export default {
localdata: area,
loading: false,
formData: {
city: "",
description: "",
name: "",
province: "",
city: '',
description: '',
name: '',
province: '',
},
}
},
@@ -49,40 +48,41 @@ export default {
uni.getLocation({
type: 'wgs84',
success: function (res) {
console.log(res);
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
}
});
console.log(res)
console.log('当前位置的经度:' + res.longitude)
console.log('当前位置的纬度:' + res.latitude)
},
})
// console.log(area);
console.log( this.$util.prePage());
},
methods: {
areaChange(e) {
console.log(e);
console.log(e)
this.formData.province = e.detail.value[0].value
this.formData.city = e.detail.value[1].value
},
select(e) {
console.log(e);
console.log(e)
},
chooseLocation() {
uni.chooseLocation({
success: function (res) {
this.address = res.name
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
}
});
console.log('位置名称:' + res.name)
console.log('详细地址:' + res.address)
console.log('纬度:' + res.latitude)
console.log('经度:' + res.longitude)
},
})
},
async submit() {
console.log(this.formData)
if (!this.formData.name) {
this.$util.toast('请输入工程名称')
return
}
if (!this.formData.province) {
this.$util.toast('请选择区域信息')
return
@@ -91,18 +91,19 @@ export default {
this.$util.toast('请输入工程描述')
return
}
addEngineering(this.formData).then(res => {
addEngineering(this.formData).then((res) => {
console.log(res)
this.$util.toast('工程创建成功')
this.$util.prePage().store?.reload()
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500);
}, 1500)
})
}
}
},
},
}
</script>
<style lang='scss'>
<style lang="scss">
.new {
padding: 34rpx;
@@ -141,4 +142,4 @@ export default {
/deep/ .uni-drawer__content {
width: 100vw !important;
}
</style>
</style>