128 lines
3.3 KiB
Vue
128 lines
3.3 KiB
Vue
|
<template>
|
||
|
<view v-cloak>
|
||
|
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="false" backgroundColor="#FFFFFF">
|
||
|
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
|
||
|
<view style="padding-left: 15rpx;" @click="goBack()">
|
||
|
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
|
||
|
</view>
|
||
|
<view style="width: 83%;font-weight: bold;">
|
||
|
<text>信息补充</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</tn-nav-bar>
|
||
|
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
|
||
|
<view style="padding: 30rpx;">
|
||
|
<tn-form ref="form" :labelWidth="150">
|
||
|
<tn-form-item label="公司地址" required>
|
||
|
<view @click="openLocation" class="tn-flex tn-flex-row-right tn-flex-center tn-flex-col-center">
|
||
|
<view style="font-size: 28rpx; color: rgba(102, 102, 102, 1);">
|
||
|
{{formData.enterprise_location}}
|
||
|
</view>
|
||
|
<view class="tn-icon-right" style="margin-left: 20rpx;"></view>
|
||
|
</view>
|
||
|
</tn-form-item>
|
||
|
</tn-form>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view
|
||
|
style="z-index: 200;;position: fixed;bottom:0px;width: 100%;background-color: #FFFFFF;box-shadow: 0rpx -2rpx 4rpx 0rpx rgba(186,189,199,0.2);padding:30rpx 30rpx 40rpx 30rpx;">
|
||
|
<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-center">
|
||
|
<view @click="insArea()"
|
||
|
style="line-height: 80rpx;height: 80rpx;font-size: 32rpx;font-weight: bold;text-align: center;width: 80%;color: #ffffff;;background: #3056D3;border: 1rpx solid #3056D3;border-radius: 90rpx;">
|
||
|
<text>提交</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import {
|
||
|
userEditArea
|
||
|
} from '@/util/api.js';
|
||
|
import store from '@/store/index.js'
|
||
|
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
apiImgUrl: this.$store.state.imgUrl,
|
||
|
formData: {
|
||
|
longitude: '',
|
||
|
dimension: '',
|
||
|
enterprise_location: '',
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
|
||
|
},
|
||
|
onLoad(d) {
|
||
|
var uid = uni.getStorageSync('uid');
|
||
|
this.uid = d.uid;
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
openLocation() {
|
||
|
var that = this;
|
||
|
uni.chooseLocation({
|
||
|
success(res) {
|
||
|
console.log(res);
|
||
|
console.log('位置名称:' + res.name);
|
||
|
console.log('详细地址:' + res.address);
|
||
|
console.log('纬度:' + res.latitude);
|
||
|
console.log('经度:' + res.longitude);
|
||
|
that.formData.enterprise_location = res.address;
|
||
|
that.formData.longitude = res.longitude;
|
||
|
that.formData.dimension = res.latitude;
|
||
|
},
|
||
|
fail(res) {
|
||
|
console.log(res);
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
insArea() {
|
||
|
this.formData.id = this.uid;
|
||
|
this.formData.association_id = store.state.Gid;
|
||
|
if (this.formData.dimension == '' || this.formData.longitude == '') {
|
||
|
uni.showToast({
|
||
|
title: '请选择公司地址',
|
||
|
icon: 'none',
|
||
|
duration: 2000
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
userEditArea(this.formData)
|
||
|
.then(res => {
|
||
|
if (res.code == 1) {
|
||
|
uni.showToast({
|
||
|
title: '信息填充成功!',
|
||
|
duration: 2000
|
||
|
});
|
||
|
}
|
||
|
console.log(res);
|
||
|
})
|
||
|
.catch(error => {
|
||
|
uni.showToast({
|
||
|
title: error,
|
||
|
icon: 'none',
|
||
|
duration: 2000
|
||
|
});
|
||
|
})
|
||
|
},
|
||
|
goBack() {
|
||
|
if (getCurrentPages().length > 1) {
|
||
|
uni.navigateBack()
|
||
|
} else {
|
||
|
uni.redirectTo({
|
||
|
url: '/pages/index/index'
|
||
|
})
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
|
||
|
</style>
|