居民认证
This commit is contained in:
		@@ -30,11 +30,11 @@
 | 
			
		||||
        <div class="auth_title">居民信息认证</div>
 | 
			
		||||
        
 | 
			
		||||
        <div class="auth_form">
 | 
			
		||||
          <div class="form_name">姓名</div>
 | 
			
		||||
          <div class="form_name"><span class="red">*</span>姓名</div>
 | 
			
		||||
          <input class="form_value" type="text" placeholder="请输入姓名" v-model="form.name"/>
 | 
			
		||||
          <div class="form_name">身份证号</div>
 | 
			
		||||
          <div class="form_name"><span class="red">*</span>身份证号</div>
 | 
			
		||||
          <input class="form_value" type="idcard" placeholder="请输入18位身份证号" v-model="form.idNumber"/>
 | 
			
		||||
          <div class="form_name">地区</div>
 | 
			
		||||
          <div class="form_name"><span class="red">*</span>地区</div>
 | 
			
		||||
          <AiAreaPicker class="ai-area" v-model="form.areaId" :fullName.sync="form.areaName" all>
 | 
			
		||||
            <div class="ai-area__wrapper">
 | 
			
		||||
              <span class="label" v-if="form.areaName">{{ form.areaName }}</span>
 | 
			
		||||
@@ -54,6 +54,7 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { mapState } from "vuex"
 | 
			
		||||
export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
@@ -65,21 +66,58 @@ export default {
 | 
			
		||||
        idNumber: '',
 | 
			
		||||
        areaId: '',
 | 
			
		||||
        areaName: '',
 | 
			
		||||
      }
 | 
			
		||||
      },
 | 
			
		||||
      flag: false,
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onLoad() {
 | 
			
		||||
    
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    ...mapState(['user'])
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getList() {
 | 
			
		||||
      console.log('普法考试列表');
 | 
			
		||||
    },
 | 
			
		||||
    handleToTest() {
 | 
			
		||||
      this.$emit('toTest')
 | 
			
		||||
      // 没有认证
 | 
			
		||||
      // if('没有认证') {
 | 
			
		||||
      //   this.showAuth = true;
 | 
			
		||||
      //   已认证
 | 
			
		||||
      // } else { 
 | 
			
		||||
        this.$emit('toTest')
 | 
			
		||||
      // }
 | 
			
		||||
    },
 | 
			
		||||
    comfirm() {
 | 
			
		||||
      if(this.flag) return
 | 
			
		||||
 | 
			
		||||
      if(!this.form.name) {
 | 
			
		||||
        return this.$u.toast('请输入姓名')
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if(!this.form.idNumber) {
 | 
			
		||||
        return this.$u.toast('请输入身份证号')
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if(!this.form.areaId) {
 | 
			
		||||
        return this.$u.toast('请选择地区')
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.flag = true
 | 
			
		||||
      this.$instance.post(`/app/appwechatuserqujing/idNumberAttestation`, this.form).then(res=> {
 | 
			
		||||
        if(res?.code == 0) {
 | 
			
		||||
          this.flag = false
 | 
			
		||||
          this.$u.toast('认证成功')
 | 
			
		||||
          setTimeout(()=> {
 | 
			
		||||
            this.showAuth = false
 | 
			
		||||
            this.$emit('toTest')
 | 
			
		||||
          }, 500)
 | 
			
		||||
        }
 | 
			
		||||
      }).catch((err)=> {
 | 
			
		||||
        this.flag = false
 | 
			
		||||
        this.showAuth = false
 | 
			
		||||
        this.$u.toast(err.msg)
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onReachBottom() {
 | 
			
		||||
@@ -191,6 +229,10 @@ export default {
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        color: #333333;
 | 
			
		||||
        margin-bottom: 16px;
 | 
			
		||||
 | 
			
		||||
        .red {
 | 
			
		||||
          color: #FF4466;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      input {
 | 
			
		||||
 
 | 
			
		||||
@@ -140,30 +140,12 @@ export default {
 | 
			
		||||
    confirm() {
 | 
			
		||||
      uni.navigateTo({url: './result'})
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
   给定一个字符串 s ,找到 它的第一个不重复的字符,并返回它的索引 。如果不存在,则返回 -1 。
 | 
			
		||||
   s = "leetcode" . => 0
 | 
			
		||||
   s = "loveleetcode" => 2
 | 
			
		||||
  */
 | 
			
		||||
    firstUniqChar(str) { 
 | 
			
		||||
      for(let i=0; i<=str.length; i++) {
 | 
			
		||||
        // let sum = 0;
 | 
			
		||||
        for(let x=0;x<str.length;x++) {
 | 
			
		||||
          if(str[i] === str[x] && i!=x) {
 | 
			
		||||
            console.log(i);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      // return -1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onReachBottom() {
 | 
			
		||||
    this.current ++;
 | 
			
		||||
  },
 | 
			
		||||
  onLoad() {
 | 
			
		||||
    // this.createdTime = Date.parse(new Date())
 | 
			
		||||
    this.firstUniqChar('leetcode')
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user