zengh
2021-08-05 015723541ee16f1047a9fe7362bd108d046497da
pages/registerUser/registerUser.vue
@@ -1,15 +1,14 @@
<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" :required="item.requireds"
            v-for="(item, index) in list" :key="index">
            <u-input v-model="form[item.froms]"  :placeholder="item.placeholder" />
         <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-form-item>
         <u-form-item label="部门" left-icon="account-fill" label-width="200" :required="true">
            <u-input v-model="form.obj" type="select" placeholder="请选择部门" :border="true" @click="depl" />
            <u-select v-model="show" mode="mutil-column-auto" :list="listbm" @confirm="confirm"></u-select>
         </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">
@@ -18,8 +17,9 @@
            </u-radio-group>
         </u-form-item>
      </u-form>
      <u-button class="submit" @click="zc">
         注册{{faceMsg}}</u-button>
         下一步</u-button>
      <!-- <u-button class="submit" @click="submit">提交</u-button> -->
   </view>
</template>
@@ -35,41 +35,42 @@
                  title: '账号',
                  img: 'man-add-fill',
                  froms: 'user',
                  requireds:true,
                  requireds: true,
                  placeholder: '请输入帐号'
               },
               {
                  title: '密码',
                  img: 'lock-fill',
                  froms: 'pass',
                  requireds:true,
                  requireds: true,
                  placeholder: '请输入密码'
               },
               {
                  title: '确认密码',
                  img: 'lock-fill',
                  froms: 'passTwo',
                  requireds:true,
                  requireds: true,
                  placeholder: '请确认密码'
               },
               {
                  title: '姓名',
                  img: 'account',
                  froms: 'name',
                  requireds:true,
                  requireds: true,
                  placeholder: '请输入姓名'
               },
               // {
               //    title: '身份证',
               //    img: 'fingerprint',
               //    froms: 'carId',
               //    placeholder: '请输入身份证'
               // },
               {
                  title: '身份证',
                  img: 'fingerprint',
                  froms: 'carId',
                  requireds: true,
                  placeholder: '请输入身份证'
               },
               {
                  title: '手机号',
                  img: 'phone-fill',
                  froms: 'phone',
                  requireds:false,
                  requireds: false,
                  placeholder: '请输入手机号'
               },
               // {
@@ -78,7 +79,7 @@
               //    froms: 'depl',
               //    placeholder: '请选择部门'
               // },
            ],
            sex: [{
                  name: '男',
@@ -189,57 +190,29 @@
         };
      },
      methods: {
         zc(){
         zc() {
            var that = this;
            if(that.form.obj == "" || that.form.obj == null){
               uni.showToast({
                  title: '请选择部门',
                  icon:'none',
                  duration: 2000
               });
               return;
            }
            // if (that.form.obj == "" || that.form.obj == null) {
            //    uni.showToast({
            //       title: '请选择部门',
            //       icon: 'none',
            //       duration: 2000
            //    });
            //    return;
            // }
            this.$refs.uForm.validate(valid => {
               if (valid) {
            console.log(this.form);
            var d = this.form;
            var url = 'http://s16s652780.51mypc.cn/api/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
               }
            uni.request({
               url: url,
               method: 'POST',
               data: data,
               success: (res) => {
                  uni.showToast({
                     title: '注册成功,请等待审核',
                     icon:'none',
                     duration: 2000
               if (true) {
                  var d = this.form;
                  uni.navigateTo({
                     url: '/pages/registerUser/idphoto?data= '+encodeURIComponent(JSON.stringify(d))
                  });
                  setTimeout(function(){
                     uni.navigateTo({
                        url: '/pages/loging/loging'
                     })
                  },2000);
               }
            });
            }
         });
         },
         depl(){
         depl() {
            var that = this;
            uni.request({
               url: "http://s16s652780.51mypc.cn/api/blade-system/dept/trees",
               url: that.$store.state.piAPI + "/blade-system/dept/trees",
               method: 'get',
               success: (res) => {
                  var routerArr = res.data.data;
@@ -258,26 +231,31 @@
            for (var i = 0; i < e.length; i++) {
               arr += e[i].value + ",";
            }
            var obj = arr.substr(0,arr.length-1);
            var obj = arr.substr(0, arr.length - 1);
            this.form.objId = obj;
         },
         formatRoutes(routerArr){
         formatRoutes(routerArr) {
            var that = this;
            const arr = [];
            let obj = {};
            routerArr.forEach(router => {
               const tmp = { ...router };
            let obj = {};
            routerArr.forEach(router => {
               const tmp = {
                  ...router
               };
               if (tmp.hasChildren == true) {
                  tmp.children = that.formatRoutes(tmp.children);
                  const {id, title} = router;
                  const {
                     id,
                     title
                  } = router;
                  obj = {
                     label: tmp.title,
                     value: tmp.id,
                     children: tmp.children
                  }
               }else if(tmp.hasChildren == false){
                  }
               } else if (tmp.hasChildren == false) {
                  obj = {
                     label: tmp.title,
                     value: tmp.id,
@@ -291,7 +269,7 @@
            let that = this;
            uni.showToast({
               title: '功能研发中',
               icon:'none',
               icon: 'none',
               duration: 2000
            });
            // uni.showLoading({
@@ -390,7 +368,7 @@
                  // console.log('验证通过');
                  console.log(this.form);
                  var d = this.form;
                  var url = 'http://s16s652780.51mypc.cn/api/zc/inster',
                  var url = that.$store.state.piAPI + '/zc/inster',
                     data = {
                        // deptid: ,
                        password: d.pass,
@@ -450,6 +428,19 @@
</script>
<style lang="scss" scoped>
   .warp {
         display: flex;
         align-items: center;
         justify-content: center;
         height: 100%;
      }
      .rect {
         text-align: center;
         width: 120px;
         height: 120px;
      }
   .submit {
      margin: 30rpx 50rpx 0;
      border: none;
@@ -460,15 +451,15 @@
      border-radius: 15rpx;
      background-color: #14b9c8;
      color: #ffffff;
      &::after {
         content: none;
      }
      &::before {
         content: none;
      }
      &[disabled='true'] {
         background: #e4e4e4;
         font-size: 36rpx;
@@ -477,6 +468,7 @@
         color: #ffffff;
      }
   }
   .registerUser {
      padding: 0 1.2rem;
   }