From 8ea19a6bb34daab1410f6186992a4c1e90299c92 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Wed, 14 Sep 2022 08:54:44 +0800
Subject: [PATCH] 服务器配置
---
pages/registerUser/registerUser.vue | 404 ++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 286 insertions(+), 118 deletions(-)
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 90909d2..eb5281d 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -14,34 +14,25 @@
:required="true">
<u-input v-model="form.signals" placeholder="请输入警号" />
</u-form-item>
- <u-form-item label="工作单位" left-icon="home-fill" label-width="200" :required="true">
- <u-radio-group v-model="jobValue">
- <u-radio v-for="(item, index) in jobList" :key="index" :name="item.name" :disabled="item.disabled">
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </u-form-item>
- <u-form-item v-show="jobValue == '有'" label="单位名称" prop="jobUnit" label-width="200" left-icon="home"
+ <u-form-item v-show="form.role == '民警'" label="工作单位" prop="xq" left-icon="map" label-width="200"
:required="true">
- <u-input v-model="form.jobUnit" placeholder="请输入单位名称" />
+ <u-input v-model="form.xq" type="select" placeholder="请选择工作单位" :border="true"
+ @click="showxq = 'true'" />
+ <u-select v-model="showxq" mode="mutil-column-auto" :list="listxq" @confirm="confirmxq"></u-select>
</u-form-item>
- <u-form-item v-show="jobValue == '有'" label="工作地点" prop="xq" left-icon="map-fill" label-width="200"
+ <u-form-item v-show="form.role != '民警'" label="服务范围" prop="address" left-icon="map" label-width="200"
:required="true">
- <u-field :disabled="true" style="width: 100%;" label-width="0" v-model="form.xq" type="textarea"
- placeholder="请选择工作地点" :fixed="true">
- <u-icon @click="regionClick" name="map-fill" slot="right" size="44" label="定位" label-pos="bottom"
- label-color="#103289" color="#103289"></u-icon>
- </u-field>
+ <u-input v-model="form.address" type="select" placeholder="请选择服务范围" :border="true"
+ @click="showxq = 'true'" />
+ <u-select v-model="showxq" mode="mutil-column-auto" :list="listxq" @confirm="confirmxq"></u-select>
</u-form-item>
- <u-form-item label="居住地" prop="address" left-icon="map" label-width="200" :required="true">
- <u-field :disabled="true" style="width: 100%;" label-width="0" v-model="form.address" type="textarea"
- placeholder="请选择居住地" :fixed="true">
- <u-icon @click="placeClick" name="map-fill" slot="right" size="44" label="定位" label-pos="bottom"
- label-color="#103289" color="#103289"></u-icon>
- </u-field>
+ <u-form-item label="所属队伍" prop="teamName" left-icon="map" label-width="200" :required="true">
+ <u-input v-model="form.teamName" type="select" placeholder="请选择所属队伍" :border="true"
+ @click="openTeamPopup" />
+
</u-form-item>
<u-form-item label="性别" label-width="200" left-icon="man">
@@ -71,8 +62,25 @@
</u-checkbox>
</view>
+ <u-popup v-model="showTeam" border-radius="14" length="60%" mode="bottom" zIndex="9999" closeable="true"
+ @close="showTeam = false">
+ <view class="team-popup">
+ <view class="title">
+ 选择所属队伍
+ </view>
+
+ <scroll-view scroll-y="true" style="height: calc(100% - 88rpx);">
+ <view @click="currentTeam(item)" v-for="(item, index) in teamList" :key="index">
+ <u-icon v-show="item.isBrand == '1'" size="40" name="/static/images/icon/medal.png"></u-icon>
+ {{item.name}}
+ </view>
+ </scroll-view>
+ </view>
+ </u-popup>
+
<u-button class="submit" @click="zc">
注册</u-button>
+
</view>
</template>
@@ -92,7 +100,7 @@
// return callback(new Error('手机号格式不正确'));
// }
// }
-
+
if (identity.test(value)) {
this.form.carId = value;
return true
@@ -101,7 +109,7 @@
}
// if (value.length > 11) {
-
+
// }
};
@@ -114,6 +122,7 @@
liveLng: '',
liveLat: '',
+ teamList: '',
userConsent: false,
jobValue: '无',
jobList: [{
@@ -143,7 +152,14 @@
deptXb: "",
flag: false,
list: [{
- title: '账号',
+ title: '手机号',
+ img: 'phone-fill',
+ froms: 'phone',
+ requireds: true,
+ placeholder: '请输入真实手机号'
+ },
+ {
+ title: '身份证',
img: 'man-add-fill',
froms: 'user',
requireds: true,
@@ -171,13 +187,6 @@
froms: 'name',
requireds: true,
placeholder: '请输入真实姓名'
- },
- {
- title: '手机号',
- img: 'phone-fill',
- froms: 'phone',
- requireds: false,
- placeholder: '请输入真实手机号'
},
// {
// title: '部门',
@@ -210,7 +219,9 @@
address: '',
jobUnit: '',
signals: '',
- workjurisdiction: ''
+ workjurisdiction: '',
+ teamName: '',
+ teamId: '',
},
rules: {
user: [{
@@ -258,6 +269,24 @@
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
+ phone: [{
+ required: true,
+ message: '请输入正确的手机号',
+ // 可以单个或者同时写两个触发验证方式
+ trigger: ['change', 'blur'],
+ }, {
+ validator: (rule, value, callback) => {
+ var phone = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
+
+ if (phone.test(value)) {
+ this.form.phone = value;
+ return true
+ } else {
+ return callback(new Error('手机号格式不正确'));
+ }
+ },
+ trigger: ['change', 'blur'],
+ }],
jobUnit: [{
required: false,
message: '请输入单位名称',
@@ -265,8 +294,8 @@
trigger: ['change', 'blur'],
}],
address: [{
- required: true,
- message: '请选择居住地',
+ required: false,
+ message: '请选择服务范围',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -284,7 +313,13 @@
}],
xq: [{
required: false,
- message: '请选择工作地点',
+ message: '请选择工作单位',
+ // 可以单个或者同时写两个触发验证方式
+ trigger: ['change', 'blur'],
+ }],
+ teamName: [{
+ required: true,
+ message: '请选择所属队伍',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -301,44 +336,149 @@
faceco: '#000',
faceMsg: '',
roleList: [{
- label: '平安志愿者',
- value: "1416225906918195201"
- }, {
- label: '民警',
- value: "1417092295132561409"
- },
- {
- label: '治保会队伍',
- value: "1495714130024673282"
- },
- {
- label: '内保干部队伍',
- value: "1495714221926068225"
- },
- {
- label: '治安巡防队伍',
- value: "1495714272471625729"
- },
- {
- label: '信息员队伍',
- value: "1495714309071122434"
- },
- {
- label: '保安员队伍',
- value: "1495714343888039937"
- },
- {
- label: '警务辅助队伍',
- value: "1495714378025480193"
- }
- ],
+ label: '洪城义警',
+ value: "1416225906918195201"
+ }, {
+ label: '民警',
+ value: "1417092295132561409"
+ }],
+ showTeam: false
};
},
+ onLoad() {
+ this.deplxq();
+ },
methods: {
+ /**
+ * 当前选中的队伍
+ */
+ currentTeam(params) {
+ this.form.teamId = params.id
+ this.form.teamName = params.name
+ this.showTeam = false
+ },
+ /**
+ * 所属队伍的弹窗
+ */
+ openTeamPopup() {
+ var that = this;
+ var data = that.form;
+ var xq = "";
+ if (data.role == "民警") {
+ xq = data.xq
+ } else if (data.role == "洪城义警") {
+ xq = data.jurisdiction
+ }
+
+ if (xq == "") {
+ uni.showToast({
+ title: "请先选择角色或服务范围",
+ icon: 'none',
+ duration: 2000
+ });
+ return
+ }
+
+ uni.request({
+ url: that.$store.state.piAPI + "/team/page?current=1&size=999&police=" + xq,
+ method: 'get',
+ success: (res) => {
+ that.teamList = res.data.data.records;
+ that.showTeam = true;
+ }
+ })
+ },
agreement(e) {
uni.navigateTo({
url: '/pages/registerUser/agreement?e=' + e
});
+ },
+ confirmxq(e) {
+ var arr = "";
+ var data = [];
+ // for (var i = 0; i < e.length; i++) {
+ // if (e[i].value != "0") {
+ // arr += e[i].value + ",";
+ // data.push(e[i]);
+ // }
+ // }
+ // var obj = arr.substr(0, arr.length - 1);
+ // this.form.xqobjId = e[2].value;
+
+ if (this.form.role == "民警") {
+ this.form.xq = e[2].label;
+ this.form.workjurisdiction = e[2].value;
+
+ this.form.address = "";
+ this.form.jurisdiction = "";
+ } else {
+ this.form.address = e[2].label;
+ this.form.jurisdiction = e[2].value;
+
+ this.form.xq = "";
+ this.form.workjurisdiction = "";
+ }
+
+ console.log(this.form.xqobjId)
+ },
+ deplxq() {
+ var that = this;
+ uni.request({
+ url: that.$store.state.piAPI + "/jurisdiction/tree",
+ method: 'get',
+ success: (res) => {
+ var routerArr = res.data.data;
+ var arr = that.formatRoutes(routerArr);
+ var list = [];
+ list.push(arr);
+ // for (var i = 0; i < arr.length; i++) {
+ // arr[i].children.unshift({
+ // label: '--请选择--',
+ // value: 0,
+ // children: []
+ // })
+ // for (var j = 0; j < arr[i].children.length; j++) {
+ // arr[i].children[j].children.unshift({
+ // label: '--请选择--',
+ // value: 0,
+ // })
+ // }
+ // }
+ that.listxq = arr;
+ }
+ })
+ },
+ formatRoutes(routerArr) {
+ var that = this;
+ const arr = [];
+ let obj = {};
+ routerArr.forEach(router => {
+ const tmp = {
+ ...router
+ };
+ if (tmp.hasChildren == true) {
+ tmp.children = that.formatRoutes(tmp.children);
+
+ const {
+ id,
+ title
+ } = router;
+
+ obj = {
+ label: tmp.title,
+ value: tmp.id,
+ children: tmp.children
+ }
+ } else if (tmp.hasChildren == false || typeof(tmp.hasChildren) == 'undefined') {
+ obj = {
+ label: tmp.title,
+ value: tmp.id,
+ // children: []
+ }
+ }
+ arr.push(obj);
+ })
+ return arr;
},
regionClick() {
let that = this;
@@ -386,58 +526,41 @@
return
}
var that = this;
-
+
//判断是否必填警号和工作地点
- if(that.form.role == "民警"){
+ if (that.form.role == "民警") {
that.rules.signals[0].required = true;
- }
-
- if(that.jobValue == "有"){
- that.rules.jobUnit[0].required = true;
+ // that.rules.jobUnit[0].required = true;
that.rules.xq[0].required = true;
+ that.rules.address[0].required = false;
+ } else {
+ that.rules.address[0].required = true;
+ that.rules.xq[0].required = false;
}
-
+
+ // if (that.jobValue == "有") {
+ // that.rules.jobUnit[0].required = true;
+ // that.rules.xq[0].required = true;
+ // }
+
that.$refs.uForm.validate(valid => {
if (valid) {
that.registerEvent()
- }else{
+ } else {
return
}
});
-
-
- uni.request({
- url: that.$store.state.piAPI + '/zc/inspect',
- method: 'GET',
- data: {
- username: this.form.user
- },
- success: (res) => {
- if (res.data.code == 400) {
- uni.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 2000
- });
-
- return
-
- }
-
- // that.$refs.uForm.validate(valid => {
- // if (valid) {
- // var d = that.form;
- // uni.navigateTo({
- // url: '/pages/registerUser/idphoto?data= ' +
- // encodeURIComponent(JSON.stringify(
- // d))
- // });
- // }
- // });
-
- }
- });
+ // that.$refs.uForm.validate(valid => {
+ // if (valid) {
+ // var d = that.form;
+ // uni.navigateTo({
+ // url: '/pages/registerUser/idphoto?data= ' +
+ // encodeURIComponent(JSON.stringify(
+ // d))
+ // });
+ // }
+ // });
},
@@ -465,23 +588,47 @@
workaddress: d.xq,
// 工作辖区
workjurisdiction: d.workjurisdiction,
- signals: d.signals
+ signals: d.signals,
+ team: d.teamId
}
uni.request({
url: url,
method: 'POST',
data: data,
success: (result) => {
- uni.showToast({
- title: '注册成功,请等待审核',
- icon: 'none',
- duration: 2000
- });
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/loging/loging'
- })
- }, 2000);
+
+ if (result.data.code == 400) {
+ uni.showToast({
+ title: result.data.msg,
+ icon: 'none',
+ duration: 2000
+ });
+
+ return
+
+ }
+
+ if (result.data.code == 200) {
+
+ uni.showToast({
+ title: '注册成功,请等待审核',
+ icon: 'none',
+ duration: 2000
+ });
+ setTimeout(function() {
+ uni.navigateTo({
+ url: '/pages/loging/loging'
+ })
+ }, 2000);
+
+ } else {
+ uni.showToast({
+ title: '注册失败,请确认信息后重试',
+ icon: 'none',
+ duration: 2000
+ });
+ }
+
}
});
@@ -585,4 +732,25 @@
color: #103289;
}
}
+
+ .team-popup {
+ height: 100%;
+ overflow: hidden;
+
+ .title {
+ font-size: 30rpx;
+ font-weight: bold;
+ text-align: center;
+ border-bottom: 1rpx solid #ccc;
+ height: 88rpx;
+ line-height: 88rpx;
+ }
+
+ view {
+ padding: 0 20rpx;
+ height: 72rpx;
+ line-height: 72rpx;
+ vertical-align: middle;
+ }
+ }
</style>
--
Gitblit v1.9.3