|
@@ -4,7 +4,7 @@ const tool = require('../../utils/tool.js');
|
|
|
const COS = require('../../utils/cos.js');
|
|
|
Page({
|
|
|
data: {
|
|
|
- myInfo:[],
|
|
|
+ myInfo: [],
|
|
|
imgsrc: '../../images/cardModel.png',
|
|
|
photo: '../../images/cardModel.png',
|
|
|
questionList: [{
|
|
@@ -214,6 +214,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
toJx(location) {
|
|
|
+ console.log(location)
|
|
|
wx.request({
|
|
|
url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/ocrCard',
|
|
|
method: "POST",
|
|
@@ -238,44 +239,59 @@ Page({
|
|
|
let constellation = 'form.constellation'
|
|
|
let res1 = JSON.parse(res.data.cardMessage)
|
|
|
let sexTurn = 0;
|
|
|
- if (res1.words_result['性别'].words == '男') {
|
|
|
- sexTurn = 1;
|
|
|
- }
|
|
|
- let xz = this.getXingzuo(res1.words_result['出生'].words.substring(4, 6), res1.words_result['出生'].words.substring(6, 8));
|
|
|
- console.log(xz)
|
|
|
- for (let i = 0; i < this.data.constellationArr.length; i++) {
|
|
|
- console.log(this.data.constellationArr[i])
|
|
|
- if (this.data.constellationArr[i] == xz) {
|
|
|
- this.setData({
|
|
|
- constellationLabel: this.data.constellationArr[i],
|
|
|
- [constellation]: this.data.constellationArrValue[i]
|
|
|
- })
|
|
|
+ console.log(res1)
|
|
|
+ if (res1.words_result) {
|
|
|
+ console.log('我识别成功了')
|
|
|
+ if (res1.words_result['性别'].words == '男') {
|
|
|
+ sexTurn = 1;
|
|
|
}
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- [idFront]: location,
|
|
|
- [idCard]: res1.words_result['公民身份号码'].words,
|
|
|
- [name]: res1.words_result['姓名'].words,
|
|
|
- [sex]: sexTurn,
|
|
|
- [age]: tool.formatTime(new Date()) - res1.words_result['出生'].words.substring(0, 4),
|
|
|
- [nativePlace]: res1.words_result['住址'].words,
|
|
|
- [nation]: res1.words_result['民族'].words,
|
|
|
- [birthday]: res1.words_result['出生'].words.substring(0, 4) + '-' + res1.words_result['出生'].words.substring(4, 6) + '-' + res1.words_result['出生'].words.substring(6, 8)
|
|
|
+ let xz = this.getXingzuo(res1.words_result['出生'].words.substring(4, 6), res1.words_result['出生'].words.substring(6, 8));
|
|
|
+ console.log(xz)
|
|
|
+ for (let i = 0; i < this.data.constellationArr.length; i++) {
|
|
|
+ console.log(this.data.constellationArr[i])
|
|
|
+ if (this.data.constellationArr[i] == xz) {
|
|
|
+ this.setData({
|
|
|
+ constellationLabel: this.data.constellationArr[i],
|
|
|
+ [constellation]: this.data.constellationArrValue[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ [idFront]: location,
|
|
|
+ [idCard]: res1.words_result['公民身份号码'].words,
|
|
|
+ [name]: res1.words_result['姓名'].words,
|
|
|
+ [sex]: sexTurn,
|
|
|
+ [age]: tool.formatTime(new Date()) - res1.words_result['出生'].words.substring(0, 4),
|
|
|
+ [nativePlace]: res1.words_result['住址'].words,
|
|
|
+ [nation]: res1.words_result['民族'].words,
|
|
|
+ [birthday]: res1.words_result['出生'].words.substring(0, 4) + '-' + res1.words_result['出生'].words.substring(4, 6) + '-' + res1.words_result['出生'].words.substring(6, 8)
|
|
|
|
|
|
- })
|
|
|
- const items = this.data.questionList;
|
|
|
- const values = res1.words_result['性别'].words;
|
|
|
- for (let i = 0, lenI = items.length; i < lenI; ++i) {
|
|
|
- items[i].checked = false
|
|
|
- if (items[i].name == values) {
|
|
|
- items[i].checked = true
|
|
|
+ })
|
|
|
+ const items = this.data.questionList;
|
|
|
+ const values = res1.words_result['性别'].words;
|
|
|
+ for (let i = 0, lenI = items.length; i < lenI; ++i) {
|
|
|
+ items[i].checked = false
|
|
|
+ if (items[i].name == values) {
|
|
|
+ items[i].checked = true
|
|
|
+ }
|
|
|
}
|
|
|
+ this.setData({
|
|
|
+ questionList: this.data.questionList
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('我识别失败了')
|
|
|
+ let idFront = 'form.idFront';
|
|
|
+ this.setData({
|
|
|
+ [idFront]: location
|
|
|
+ })
|
|
|
+ console.log(this.data.form)
|
|
|
}
|
|
|
- this.setData({
|
|
|
- questionList: this.data.questionList
|
|
|
- })
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+ // fail:(err)=>{
|
|
|
+
|
|
|
+ // },
|
|
|
complete: () => {
|
|
|
wx.hideLoading()
|
|
|
}
|
|
@@ -458,13 +474,13 @@ Page({
|
|
|
wx.showModal({
|
|
|
title: '信息提交成功了呦',
|
|
|
showCancel: false,
|
|
|
- success:(res)=> {
|
|
|
+ success: (res) => {
|
|
|
if (res.confirm) {
|
|
|
- if(this.data.myInfo&&this.data.myInfo.height){
|
|
|
+ if (this.data.myInfo && this.data.myInfo.height) {
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/index/index',
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/personInfoDetail/personInfoDetail',
|
|
|
})
|
|
@@ -476,11 +492,11 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- goxy() {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/infoAgreement/infoAgreement',
|
|
|
- })
|
|
|
- },
|
|
|
+ // goxy() {
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url: '/pages/infoAgreement/infoAgreement',
|
|
|
+ // })
|
|
|
+ // },
|
|
|
async onLoad(options) {
|
|
|
this.initValidate()
|
|
|
tool.openidStatus().then(result => {
|