You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

250 lines
5.7 KiB

<template>
<view class="container">
<uni-forms ref="form" :modelValue="form" :rules="rules" class="padding-wrap" label-position="top">
<uni-forms-item label="账号" name="employeeId" label-width="200upx">
<uni-easyinput trim="all" v-model="form.employeeId" placeholder="请输入账号"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="名称" name="name" label-width="200upx">
<uni-easyinput trim="all" v-model="form.name" placeholder="请输入名称"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="经纬度" label-width="200upx">
<view class="choose-map" @click="goMap" :style="{color:form.xy? '#000' : '#C4C7CB'}">{{form.xy ? form.xy : '请选择地图定位'}}</view>
</uni-forms-item>
<view class="btn-box">
<view class="submit-btn" @click="submit"> </view>
</view>
</uni-forms>
</view>
</template>
<script>
export default {
data() {
return {
form: {
employeeId: '1001',
name: '1001',
buildId: '1',
floorNo: '1',
longidute: '120.61988850529002',
latidute: '31.37531834395683',
xy: ''
},
rules: {
longidute: {
rules: [{
required: true,
errorMessage: "请输入经度"
}]
},
latidute: {
rules: [{
required: true,
errorMessage: "请输入纬度"
}]
}
}
}
},
onShow() {
uni.$on('mapData',(data) => {
let obj = JSON.parse(data.data[0].detail);
console.log('监听到事件来自返回的参数:', obj);
this.form.xy = obj.x + ',' + obj.y;
this.form.latidute = obj.y;
this.form.longidute = obj.x;
})
},
onLoad() {
let userInfo = uni.getStorageSync('mobileInfo');
if(userInfo){
this.userInfo = JSON.parse(userInfo);
this.form.employeeId = this.userInfo.employeeId;
this.form.name = this.userInfo.name;
this.form.latidute = this.userInfo.latidute;
this.form.longidute = this.userInfo.longidute;
this.form.xy = this.form.longidute + ',' + this.form.latidute;
}
},
onUnload() {
console.log('释放监听')
uni.$off('mapData');
},
methods: {
//跳到地图页面获取定位
goMap() {
console.log('页面跳转')
uni.navigateTo({
url: '/pages/map/map'
})
},
submit() {
this.$refs.form.validate().then(res => {
if(this.form.xy == ''){
uni.showToast({
title: '请选择地图定位',
icon: 'none'
})
return;
}
uni.setStorageSync("mobileInfo",JSON.stringify(this.form));//测试使用
uni.navigateBack();
// uni.request({
// url: getApp().globalData.mobileUrl + '/employee/modify',
// data: this.form,
// method: "POST",
// success: (res) => {
// console.log(res.data);
// uni.showToast({
// title: '设置成功'
// });
// uni.setStorageSync("mobileInfo",JSON.stringify(this.form));
// // this.getEmployeeInfo();
// }
// });
}).catch(err => {
console.log('表单错误信息:', err);
uni.showToast({
title: err
});
})
}
},
//获取成员信息
getEmployeeInfo(){
uni.request({
url: getApp().globalData.mobileUrl + '/api/userManage/getEmployeeByEID?employeeId='+this.form.employeeId,
method: "GET",
success: (res) => {
console.log(res.data);
// uni.setStorageSync("groupNum",res.data.groupNum);
}
});
}
}
</script>
<style lang="scss" scoped>
page,
.container {
min-height: 100vh;
background-color: #FFFFFF;
/deep/.uni-forms-item__label{
color: #031945;
font-size: 28upx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
}
/deep/.uni-easyinput__content{
height: 88upx;
border: 0;
border-bottom: 1px solid #D6D8DF;;
border-radius: 0;
}
/deep/.uni-easyinput__content-input{
font-size: 28upx;
height: 88upx;
}
/deep/.uni-input-placeholder{
color: #90959D;
font-size: 28upx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
}
}
.padding-wrap {
padding: 30upx;
}
.choose-map{
line-height: 88upx;
color: #C4C7CB;
font-size: 28upx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
background: #F6F8FA;
border-radius: 30upx;
padding: 0 15upx 0 30upx;
}
.voice-rocord-box{
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 40upx;
.voice-box{
display: flex;
align-items: center;
justify-content: flex-end;
min-width: 300px;
height: 90upx;
background: #338AF8 url(@/static/voive_bg.png) 40upx 28upx no-repeat;
background-size: 226upx 34upx;
border-radius: 100upx;
.voice-mins{
color: #FFFFFF;
font-size: 28upx;
font-family: Arial-Regular, Arial;
font-weight: 400;
margin-right: 40upx;
}
}
.voice-del{
color: #B6B8BB;
font-size: 28upx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
margin-left: 20upx;
}
}
.tab-switch {
display: flex;
justify-content: flex-end;
align-items: center;
.tab-btn {
display: flex;
width: 80upx;
height: 40upx;
border-radius: 20upx;
background-color: #eee;
margin-right: 10upx;
.tab-btn-item {
float: right;
width: 36upx;
height: 36upx;
border-radius: 18upx;
background-color: #FFFFFF;
margin: 2upx;
}
&.active {
background-color: #338AF8;
.tab-btn-item {
float: left;
}
}
}
}
.btn-box{
position: fixed;
left: 30upx;
right: 30upx;
bottom: 100upx;
.submit-btn{
color: #FFFFFF;
font-size: 22px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
line-height: 90upx;
text-align: center;
background: #338AF8;
border-radius: 100upx;
}
}
</style>