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 | 631 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 351 insertions(+), 280 deletions(-)
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 0fc39fc..eb5281d 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -14,29 +14,27 @@
: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-input v-model="form.xq" type="select" placeholder="请选择工作地点" :border="true"
- @click="regionClick('工作地点')" />
+ <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-input v-model="form.address" type="select" placeholder="请选择居住地" :border="true"
- @click="placeClick('居住地')" />
+
+ <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">
<u-radio-group v-model="form.sex">
<u-radio v-for="(item, index) in sex" :key="index" :name="item.name" :disabled="item.disabled">
@@ -64,26 +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>
- <map v-show="signLocation" id="SignLocationMap"
- style="position: fixed; left: 0; width: 100%; z-index: 99;"
- :style="{height: screenHeight + 'px', top: screenTop + 'px'}"
- @regionchange="regionChange" :latitude="latitude" :longitude="longitude" :scale="scale">
-
- <cover-view class="dingwBut">
- <cover-image class="location-log" src="../../static/img/location.png">
- </cover-image>
- </cover-view>
-
- <cover-view class="confirmBtn" @click="confirmChangeBtn">
- 获取地址
- </cover-view>
- </map>
-
- <!-- <u-button @click="signLocation = true">dakai</u-button> -->
- <!-- <u-button class="submit" @click="submit">提交</u-button> -->
</view>
</template>
@@ -95,43 +92,37 @@
var identity =
/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
- if (value.length <= 11) {
- if (phone.test(value)) {
- this.form.phone = value;
- return true
- } else {
- return callback(new Error('手机号格式不正确'));
- }
+ // if (value.length <= 11) {
+ // if (phone.test(value)) {
+ // this.form.phone = value;
+ // return true
+ // } else {
+ // return callback(new Error('手机号格式不正确'));
+ // }
+ // }
+
+ if (identity.test(value)) {
+ this.form.carId = value;
+ return true
+ } else {
+ return callback(new Error('身份证号格式不正确'));
}
- if (value.length > 11) {
- if (identity.test(value)) {
- this.form.carId = value;
- return true
- } else {
- return callback(new Error('身份证号格式不正确'));
- }
- }
+ // if (value.length > 11) {
+
+ // }
};
return {
- // 设置高度, TOP值
- screenHeight: 0,
- screenTop: 0,
-
- // 记录地区获取居住地
- regionOrPlace: '',
+ // 工作地点经纬度
+ jobLng: '',
+ jobLat: '',
+ // 居住地经纬度
+ liveLng: '',
+ liveLat: '',
- // 地图相关
- scale: 15, //缩放级别
- signLocation: false,
- latitude: 28.678983439095823,
- longitude: 115.84414205551147,
- mapLocationName: '',
- mapLocationLatitude: '',
- mapLocationLongitude: '',
-
+ teamList: '',
userConsent: false,
jobValue: '无',
jobList: [{
@@ -143,7 +134,6 @@
disabled: false
}
],
- regionName: '',
radioList: [{
name: '是',
disabled: false
@@ -162,11 +152,18 @@
deptXb: "",
flag: false,
list: [{
- title: '账号',
+ title: '手机号',
+ img: 'phone-fill',
+ froms: 'phone',
+ requireds: true,
+ placeholder: '请输入真实手机号'
+ },
+ {
+ title: '身份证',
img: 'man-add-fill',
froms: 'user',
requireds: true,
- placeholder: '请输入身份证号或手机号'
+ placeholder: '请输入身份证号'
},
{
title: '密码',
@@ -190,13 +187,6 @@
froms: 'name',
requireds: true,
placeholder: '请输入真实姓名'
- },
- {
- title: '手机号',
- img: 'phone-fill',
- froms: 'phone',
- requireds: false,
- placeholder: '请输入真实手机号'
},
// {
// title: '部门',
@@ -229,7 +219,9 @@
address: '',
jobUnit: '',
signals: '',
- workjurisdiction: ''
+ workjurisdiction: '',
+ teamName: '',
+ teamId: '',
},
rules: {
user: [{
@@ -261,7 +253,6 @@
trigger: ['change', 'blur'],
}, {
validator: (rule, value, callback) => {
- console.log(this.form.pass, value)
if (this.form.pass == value) {
return true
} else {
@@ -278,15 +269,33 @@
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
- jobUnit: [{
+ 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: '请输入单位名称',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
address: [{
required: false,
- message: '请输入居住地',
+ message: '请选择服务范围',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -297,14 +306,20 @@
trigger: ['change', 'blur'],
}],
signals: [{
- required: true,
+ required: false,
message: '请输入警号',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
xq: [{
+ required: false,
+ message: '请选择工作单位',
+ // 可以单个或者同时写两个触发验证方式
+ trigger: ['change', 'blur'],
+ }],
+ teamName: [{
required: true,
- message: '请选择辖区',
+ message: '请选择所属队伍',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -321,52 +336,184 @@
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
});
},
- regionClick(e) {
- this.regionOrPlace = e
- this.signLocation = true
+ 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)
},
- placeClick(e) {
- this.regionOrPlace = e
- this.signLocation = true
+ 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;
+
+ //监听事件
+ uni.$on('getLocation', (res) => {
+ that.form.xq = res.mapLocationName
+ that.form.workjurisdiction = res.regionID
+ that.jobLng = res.mapLocationLongitude
+ that.jobLat = res.mapLocationLatitude
+ //清除监听,不清除会消耗资源
+ uni.$off('getLocation');
+ })
+
+ uni.navigateTo({
+ url: '/pages/registerUser/map?lng=' + that.jobLng + '&lat=' + that.jobLat,
+ });
+ },
+ placeClick() {
+ let that = this;
+
+ //监听事件
+ uni.$on('getLocation', (res) => {
+ that.form.address = res.mapLocationName
+ that.form.jurisdiction = res.regionID
+ that.liveLng = res.mapLocationLongitude
+ that.liveLat = res.mapLocationLatitude
+ //清除监听,不清除会消耗资源
+ uni.$off('getLocation');
+ })
+
+ uni.navigateTo({
+ // url: '/pages/registerUser/map'
+ url: '/pages/registerUser/map?lng=' + that.liveLng + '&lat=' + that.liveLat
+ });
},
zc() {
if (this.userConsent == false) {
@@ -379,46 +526,48 @@
return
}
var that = this;
- 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
- });
+ //判断是否必填警号和工作地点
+ if (that.form.role == "民警") {
+ that.rules.signals[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;
+ }
- return
+ // if (that.jobValue == "有") {
+ // that.rules.jobUnit[0].required = true;
+ // that.rules.xq[0].required = true;
+ // }
- }
-
+ that.$refs.uForm.validate(valid => {
+ if (valid) {
that.registerEvent()
-
- // that.$refs.uForm.validate(valid => {
- // if (valid) {
- // var d = that.form;
- // uni.navigateTo({
- // url: '/pages/registerUser/idphoto?data= ' +
- // encodeURIComponent(JSON.stringify(
- // d))
- // });
- // }
- // });
-
+ } else {
+ return
}
});
+ // that.$refs.uForm.validate(valid => {
+ // if (valid) {
+ // var d = that.form;
+ // uni.navigateTo({
+ // url: '/pages/registerUser/idphoto?data= ' +
+ // encodeURIComponent(JSON.stringify(
+ // d))
+ // });
+ // }
+ // });
+
},
-
+
registerEvent() {
- var d = this.form;
- var url = this.$store.state.piAPI + '/zc/inster',
+ var that = this;
+ var d = that.form;
+ var url = that.$store.state.piAPI + '/zc/inster',
data = {
// deptid: ,
password: d.pass,
@@ -439,29 +588,53 @@
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) => {
- console.log(result, 456)
- 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
+ });
+ }
+
}
});
-
+
+
},
-
+
depl() {
this.show = true;
},
@@ -472,85 +645,13 @@
this.form.jsid = e[0].value
this.show = false;
- },
- regionChange() { // 移动地图后重新获取门店
- var that = this
- uni.createMapContext('SignLocationMap', this).getCenterLocation({
- success: res => {
- that.getLocationInfor(res.longitude, res.latitude)
- },
- fail: res => {
- uni.showModal({
- content: '获取位置失败',
- showCancel: false
- })
- }
- })
- },
-
- getLocationInfor(longitude, latitude) {
- var that = this
- var point = new plus.maps.Point(longitude, latitude);
- plus.maps.Map.reverseGeocode(
- point, {},
- function(event) {
- var address = event.address; // 转换后的地理位置
- var point = event.coord; // 转换后的坐标信息
- var coordType = event.coordType; // 转换后的坐标系类型
-
-
- that.mapLocationName = address
- that.mapLocationLongitude = point.longitude
- that.mapLocationLatitude = point.latitude
-
- },
- function(e) {}
- );
- },
-
- confirmChangeBtn() {
- var that = this
- if (this.mapLocationName == "") {
- this.getLocationInfor(this.longitude, this.latitude)
- }
-
- if (this.regionOrPlace == "工作地点") {
- this.form.xq = this.mapLocationName
- } else {
- this.form.address = this.mapLocationName
- }
-
- uni.request({
- url: that.$store.state.piAPI + '/jurisdiction/isOnArea',
- method: 'get',
- data: {
- jd: that.mapLocationLongitude,
- wd: that.mapLocationLatitude
- },
- success: (res) => {
- if (this.regionOrPlace == "工作地点") {
- this.form.workjurisdiction = res.data.data[0].id
- } else {
- this.form.jurisdiction = res.data.data[0].id
- }
- }
- });
-
- this.signLocation = false
}
},
onReady() {
- var that = this
this.$refs.uForm.setRules(this.rules);
-
- uni.getSystemInfo({success: function (res) {
- that.screenHeight = res.windowHeight
- that.screenTop = res.windowTop
- }})
},
watch: {
faceState() {
- // console.log(this.faceState);
if (this.faceState == -1) {
this.facebc = '#ff7f29';
this.faceco = '#fff';
@@ -632,54 +733,24 @@
}
}
+ .team-popup {
+ height: 100%;
+ overflow: hidden;
- @keyframes StartJump {
- 0% {
- transform: translateY(-22px);
+ .title {
+ font-size: 30rpx;
+ font-weight: bold;
+ text-align: center;
+ border-bottom: 1rpx solid #ccc;
+ height: 88rpx;
+ line-height: 88rpx;
}
- 50% {
- transform: translateY(-32px);
+ view {
+ padding: 0 20rpx;
+ height: 72rpx;
+ line-height: 72rpx;
+ vertical-align: middle;
}
-
- 100% {
- transform: translateY(-22px);
- }
- }
-
- .dingwBut {
- width: 48px;
- height: 48px;
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- z-index: 999;
- transform: translateY(-22px);
- }
-
- .confirmBtn {
- width: 96px;
- height: 36px;
- line-height: 32px;
- position: absolute;
- top: auto;
- left: 0;
- right: 0;
- bottom: 18rpx;
- margin: auto;
- z-index: 999;
- text-align: center;
-
- background: #103289;
- color: #fff;
-
- border-radius: 5px;
-
}
</style>
--
Gitblit v1.9.3