liuyg
2022-02-21 70b1fa32dee4a5c7739016179094ce02ace58d7b
pages/registerUser/registerUser.vue
@@ -1,9 +1,9 @@
<template>
   <view class="registerUser">
      <u-form :model="form" ref="uForm">
         <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img"
         <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img"
            :required="item.requireds" v-for="(item, index) in list" :key="index">
            <u-input v-model="form[item.froms]" :placeholder="item.placeholder" />
            <u-input v-model="form[item.froms]" :placeholder="item.placeholder" :type="item.type" />
         </u-form-item>
         <u-form-item label="角色" prop="role" left-icon="account-fill" label-width="200" :required="true">
            <u-input v-model="form.role" type="select" placeholder="请选择角色" :border="true" @click="depl" />
@@ -15,8 +15,9 @@
            <u-input v-model="form.obj" placeholder="请输入工作单位" />
         </u-form-item>
         <u-form-item label="辖区" prop="xq" left-icon="account-fill" label-width="200" :required="true">
            <u-input v-model="form.xq" type="select" placeholder="请选择辖区" :border="true" @click="openLoginMap" />
            <!-- <u-select v-model="showxq" mode="mutil-column-auto" :list="listxq" @confirm="confirmxq"></u-select> -->
            <u-input v-model="form.xq" type="select" placeholder="请选择辖区" :border="true" @click="regionClick" />
            <u-select v-model="regionShow" mode="mutil-column-auto" :list="regionList" @confirm="regionSelect">
            </u-select>
         </u-form-item>
         <u-form-item label="性别" label-width="200" left-icon="man">
            <u-radio-group v-model="form.sex">
@@ -138,6 +139,7 @@
               },
               {
                  title: '密码',
                  type: 'password',
                  img: 'lock-fill',
                  froms: 'pass',
                  requireds: true,
@@ -145,6 +147,7 @@
               },
               {
                  title: '确认密码',
                  type: 'password',
                  img: 'lock-fill',
                  froms: 'passTwo',
                  requireds: true,
@@ -285,51 +288,104 @@
            faceco: '#000',
            faceMsg: '',
            roleList: [{
                  label: '群众',
                  value: "1416225849858883585"
               }, {
                  label: '民警',
                  value: 1417092295132561409
                  value: "1417092295132561409"
               },
               {
                  label: '治保会队伍',
                  value: 1424615693403414529
                  value: "1495714130024673282"
               },
               {
                  label: '内保干部队伍',
                  value: 1424615773594312705
                  value: "1495714221926068225"
               },
               {
                  label: '治安巡防队伍',
                  value: 1424615835435130881
                  value: "1495714272471625729"
               },
               {
                  label: '信息员队伍',
                  value: 1424615909959524354
                  value: "1495714309071122434"
               },
               {
                  label: '保安员队伍',
                  value: 1424615972718895106
                  value: "1495714343888039937"
               },
               {
                  label: '警务辅助队伍',
                  value: 1424616047083905026
                  value: "1495714378025480193"
               },
               {
                  label: '平安志愿者',
                  value: 1494565079268491266
                  value: "1416225906918195201"
               }
            ]
            ],
            regionList: [{
                  label: '东湖区',
                  value: '1415619841521414145'
               },
               {
                  label: '西湖区',
                  value: '1415619917295710209'
               },
               {
                  label: '青云谱区',
                  value: '1415619986417840129'
               },
               {
                  label: '湾里区',
                  value: '1415620058526314497'
               },
               {
                  label: '青山湖区',
                  value: '1415620118307729409'
               },
               {
                  label: '新建区',
                  value: '1415620188289691649'
               },
               {
                  label: '南昌县',
                  value: '1415620235718881282'
               },
               {
                  label: '安义县',
                  value: '1415620288487419906'
               },
               {
                  label: '进贤县',
                  value: '1415620344112279553'
               },
               {
                  label: '经济技术开发区区',
                  value: '1415620404103409666'
               },
               {
                  label: '红谷滩区',
                  value: '1415620472965492738'
               },
               {
                  label: '高新技术开发区',
                  value: '1415620707473223681'
               }
            ],
            regionShow: false
         };
      },
      onShow() {
         let that = this
         uni.$on('updateDataRegionName', function(data) {
            that.regionName = data
            that.form.xq = that.regionName
         })
      },
      methods: {
         regionClick() {
            this.regionShow = true;
         },
         regionSelect() {
            this.form.xq = e[0].label
            this.form.xqobjId = e[0].value
            this.regionShow = false;
         },
         handleMessage(name) {
            console.log(name)
            if (name.indexOf('区') != -1) {
               that.regionName = name.replace('区', '派出所');
            } else if (name.indexOf('县') != -1) {
@@ -337,53 +393,6 @@
            } else if (name.indexOf('市') != -1) {
               that.regionName = name.replace('市', '市派出所');
            }
         },
         openLoginMap() {
            var that = this
            uni.getLocation({
               type: 'wgs84',
               success: function(res) {
                  console.log('当前位置的经度:' + res.longitude);
                  console.log('当前位置的纬度:' + res.latitude);
                  that.latitude = res.latitude
                  that.longitude = res.longitude
                  that.marker = [{
                     id: 0,
                     latitude: res.latitude, //纬度
                     longitude: res.longitude, //经度
                     iconPath: '/static/img/map/location.png', //显示的图标
                     rotate: 0, // 旋转度数
                     width: 20, //宽
                     height: 20, //高
                     title: '位置', //标注点名
                     alpha: 1, //透明度
                  }]
                  var data = [{
                     "id": '100000',
                     "place": '无数据',
                     "state": '0',
                     "dtype": '0',
                     "size": '300',
                     "jd": res.longitude,
                     "wd": res.latitude
                  }]
                  uni.navigateTo({
                     url: '/pages/currentMap/currentMap?data=' + JSON.stringify(data)
                  })
                  // that.loginMapUrl =
                  //    'http://192.168.0.115:5500/leafletMapOur/loginMap/loginMap.html?data=' + data
                  // // that.loginMapUrl = 'http://223.82.109.183:2082/loginMap/loginMap.html?data=' + data
                  // that.mapShow = true
               }
            })
         },
         zc() {
            var that = this;
@@ -406,101 +415,46 @@
                  }
                  that.$refs.uForm.validate(valid => {
                     if (valid) {
                        var d = that.form;
                        uni.navigateTo({
                           url: '/pages/registerUser/idphoto?data= ' +
                              encodeURIComponent(JSON.stringify(
                                 d))
                  var that = this;
                  var d = that.form;
                  var url = that.$store.state.piAPI + '/zc/inster',
                     data = {
                        // deptid: ,
                        password: d.pass,
                        password2: d.passTwo,
                        phone: d.phone,
                        sex: d.sex == '男' ? 1 : 2,
                        sname: d.name,
                        username: d.user,
                        deptid: d.objId,
                        parentId: d.jsid,
                        jurisdiction: d.xqobjId,
                        cardid: d.carId
                     }
                  uni.request({
                     url: url,
                     method: 'POST',
                     data: data,
                     success: (res) => {
                        uni.showToast({
                           title: '注册成功,请等待审核',
                           icon: 'none',
                           duration: 2000
                        });
                        setTimeout(function() {
                           uni.navigateTo({
                              url: '/pages/loging/loging'
                           })
                        }, 2000);
                     }
                  });
               }
            });
         },
         depl() {
            var that = this;
            that.show = true;
         },
         // depl() {
         //    var that = this;
         //    uni.request({
         //       url: that.$store.state.piAPI + "/blade-system/dept/trees",
         //       method: 'get',
         //       success: (res) => {
         //          var routerArr = res.data.data;
         //          var arr = that.formatRoutes(routerArr);
         //          var list = [];
         //          if (that.deptXb != "") {
         //             list.push(arr[that.deptXb]);
         //             for (var i = 0; i < list.length; i++) {
         //                list[i].children.unshift({
         //                   label: '--请选择--',
         //                   value: 0,
         //                   children: []
         //                })
         //                for (var j = 0; j < list[i].children.length; j++) {
         //                   list[i].children[j].children.unshift({
         //                      label: '--请选择--',
         //                      value: 0,
         //                   })
         //                }
         //             }
         //             that.listbm = list;
         //             that.show = true;
         //          } else {
         //             uni.showToast({
         //                title: '请选择角色',
         //                icon: "none",
         //                duration: 1000
         //             });
         //          }
         //       }
         //    })
         // },
         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;
                  that.showxq = 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.xq = data[data.length - 1].label;
            this.form.xqobjId = obj;
            console.log(obj)
            this.show = true;
         },
         formatRoutes(routerArr) {
            var that = this;
@@ -533,19 +487,6 @@
               arr.push(obj);
            })
            return arr;
         },
         startRecord() {
            this.flag = true;
            // this.$message.success('开始录制')
            this.$refs.video.startRecord();
         },
         stopRecord() {
            this.flag = false;
            // this.$message.success('请看控制台视频文件的base64')
            this.$refs.video.stopRecord();
         },
         dataChange(data) {
            console.log(data);
         },
         // 选中任一radio时,由radio-group触发
         radioGroupChange(e) {