优化代码

This commit is contained in:
java110 2021-11-26 19:54:59 +08:00
parent 5975bfa813
commit 3be4cabb9d
4 changed files with 52 additions and 176 deletions

View File

@ -37,30 +37,6 @@
"navigationBarTitleText": "相关门禁"
}
},
// {
// "path": "pages/applicationKeyUser/applicationKeyUser",
// "style": {
// "navigationBarTitleText": "填写信息"
// }
// },
// {
// "path": "pages/applicationKeyProgress/applicationKeyProgress",
// "style": {
// "navigationBarTitleText": "钥匙进度"
// }
// },
// {
// "path": "pages/myApplicationKey/myApplicationKey",
// "style": {
// "navigationBarTitleText": "我的钥匙"
// }
// },
{
"path": "pages/visitorApplicationKey/visitorApplicationKey",
"style": {
"navigationBarTitleText": "访客钥匙"
}
},
{
"path": "pages/location/location",
"style": {
@ -144,12 +120,6 @@
"navigationBarTitleText": "投诉建议"
}
},
{
"path": "pages/viewApplicationKeyUser/viewApplicationKeyUser",
"style": {
"navigationBarTitleText": "我的钥匙"
}
},
{
"path": "pages/complaint/complaint",
"style": {
@ -225,7 +195,7 @@
}, {
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "绑定业主"
"navigationBarTitleText": "注册"
}
}, {
"path": "pages/payFeeDetail/payFeeDetail",

View File

@ -28,7 +28,7 @@
<view class="padding flex flex-direction margin-top">
<button class="cu-btn bg-green lg" @click="_doLogin()">登录</button>
<button class="cu-btn line-orange margin-tb-sm lg" @click="_doRegister()">绑定业主</button>
<button class="cu-btn line-orange margin-tb-sm lg" @click="_doRegister()">注册</button>
<view class="text-center margin-top-sm text-green" @click="_doLoginPhone()">{{phoneLoginName}}</view>
</view>

View File

@ -2,7 +2,6 @@
<view>
<!--index.wxml-->
<view class="user-container bg-white ">
<view class="userinfo">
<block>
<view v-if="login">
@ -21,13 +20,16 @@
</view>
</view>
</block>
</view>
</view>
<view class="cu-list menu margin-top">
<view class="cu-item arrow" @click="myAssets()">
<view class="content">
<text class="cuIcon-profile text-pink"></text>
<text class="text-grey">我的小区</text>
</view>
</view>
<view class="cu-item arrow" @click="myAssets()">
<view class="content">
<text class="cuIcon-profile text-pink"></text>

View File

@ -1,29 +1,10 @@
<template>
<view>
<view class="block__title">选择小区</view>
<view class="cu-form-group arrow">
<view class="title">/</view>
<pickerAddress @change="change" class="text-right" style="width:80%">{{areaName}}</pickerAddress>
<text class='cuIcon-right'></text>
</view>
<view class="cu-form-group" @tap="chooseCommunity">
<view class="title">小区名称</view>
<input v-model="communityName" required readonly label="小区名称" placeholder="请选择小区" name="communityName" icon="arrow"
></input>
<text class='cuIcon-right'></text>
</view>
<view class="block__title">业主信息</view>
<view class="block__title">注册信息</view>
<view class="cu-form-group">
<view class="title">姓名</view>
<input v-model="appUserName" required label="姓名" clearable placeholder="请输入名称" name="appUserName"></input>
<view class="title">手机号</view>
<input v-model="link" required label="手机号" clearable placeholder="请输入手机号"></input>
</view>
<!-- <view class="cu-form-group">
<view class="title">身份证</view>
<input v-model="idCard" required label="身份证" clearable placeholder="请输入身份证" name="idCard"></input>
</view> -->
<view class="cu-form-group">
<view class="title">密码</view>
<input v-model="password" required type="password" label="密码" clearable placeholder="请输入密码"></input>
@ -32,10 +13,6 @@
<view class="title">确认密码</view>
<input v-model="rePassword" required type="password" label="确认密码" clearable placeholder="请输入确认密码"></input>
</view>
<view class="cu-form-group">
<view class="title">手机号</view>
<input v-model="link" required label="手机号" clearable placeholder="请输入手机号"></input>
</view>
<view class="cu-form-group">
<view class="title">验证码</view>
<input v-model="msgCode" placeholder="请输入短信验证码" name="input"></input>
@ -50,21 +27,11 @@
<script>
const context = require("../../context/Java110Context.js");
const constant = context.constant;
import pickerAddress from '../../components/pickerAddress/pickerAddress.vue'
import conf from '../../config.js'
export default {
components: {
pickerAddress
},
data() {
return {
title: 'Hello',
areaCode: '',
areaName: '请选择地区',
communityName: '',
communityId: '',
appUserName: '',
idCard: '',
link: '',
second: 60,
msgCode: '',
@ -73,17 +40,7 @@
btnDisabled: false,
password: '',
rePassword: '',
areaList: {
province_list: {
},
city_list: {
},
county_list: {
}
}
};
},
/**
@ -92,38 +49,15 @@
onLoad: function(options) {
let _that = this;
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
if (this.areaCode == '' || this.areaCode == undefined) {
} else {
let community = uni.getStorageSync("_selectCommunity");
console.log('community', community)
if (community != null && community != undefined) {
this.communityId = community.communityId;
this.communityName = community.name;
}
}
},
methods: {
sendMsgCode: function() {
var _that = this;
let obj = {
tel: this.link,
communityId: this.communityId,
appUserName: this.appUserName,
captchaType: 'ownerBinding'
tel: this.link
};
let msg = "";
if (obj.tel == '') {
msg = '请输入手机号';
} else if (!obj.communityId) {
msg = "请填写小区名称";
} else if (!obj.appUserName) {
msg = "请填写业主名称";
}
if (msg != "") {
wx.showToast({
@ -175,28 +109,16 @@
});
},
_doRegister: function(e) {
let obj = {
"areaCode": this.areaCode,
"communityId": this.communityId,
"communityName": this.communityName,
"appUserName": this.appUserName,
"idCard": this.idCard,
"link": this.link,
"msgCode": this.msgCode,
"password": this.password,
"openId": uni.getStorageSync(constant.mapping.CURRENT_OPEN_ID)
"openId": uni.getStorageSync(constant.mapping.CURRENT_OPEN_ID),
"defaultCommunityId": conf.DEFAULT_COMMUNITY_ID
}
let msg = "";
if (this.password == '' || this.password != this.rePassword) {
msg = "密码和重置密码不一致";
} else if (obj.areaCode == "") {
msg = "请选择地区";
} else if (obj.communityName == "") {
msg = "请填写小区名称";
} else if (obj.appUserName == "") {
msg = "请填写业主名称";
} else if (obj.link == "") {
msg = "请填写手机号";
} else if (obj.msgCode == "") {
@ -208,7 +130,8 @@
icon: 'none',
duration: 2000
})
} else {
return;
}
console.log("提交数据", obj);
uni.showLoading({
title: '加载中',
@ -220,7 +143,6 @@
method: "POST",
data: obj, //
success: function(res) {
console.log(res);
let _data = res.data;
//
wx.hideLoading();
@ -246,34 +168,16 @@
})
}
});
}
},
change: function(data) {
let _that = this;
_that.areaName = '';
data.data.forEach(function(_obj) {
_that.areaName += _obj.name;
});
_that.areaCode = data.data[2].code;
console.log(data);
},
/**
* 选择小区
*/
chooseCommunity: function(e) {
if (this.areaCode == '' || this.areaCode == undefined) {
wx.showToast({
title: '请先选择地区',
icon: 'none'
});
return;
}
wx.navigateTo({
url: '/pages/viewCommunitys/viewCommunitys?areaCode=' + this.areaCode,
})
},
timer: function() {
let promise = new Promise((resolve, reject) => {
let setTimer = setInterval(