houwei 4 år sedan
förälder
incheckning
f91ab2ce70

+ 0 - 1
app.js

@@ -20,7 +20,6 @@ App({
             success: res => {
               // 可以将 res 发送给后台解码出 unionId
               this.globalData.userInfo = res.userInfo
-
               // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
               // 所以此处加入 callback 以防止这种情况
               if (this.userInfoReadyCallback) {

+ 2 - 2
app.json

@@ -1,9 +1,9 @@
 {
   "pages": [
-    "pages/index/index",
-    "pages/onSiteActivity/onSiteActivity",
     "pages/targetInfo/targetInfo",
+    "pages/index/index",
     "pages/personInfoDetail/personInfoDetail",
+    "pages/onSiteActivity/onSiteActivity",
     "pages/activeDetail/activeDetail",
     "pages/personal/personal",
     "pages/personInfo/personInfo",

BIN
images/morenImg.jpg


BIN
images/morenImg.png


+ 7 - 2
pages/InfoType/InfoType.js

@@ -1,6 +1,6 @@
 const app = require('../../utils/util.js');
+const tool = require('../../utils/tool.js');
 Page({
-
   /**
    * 页面的初始数据
    */
@@ -26,7 +26,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+    })
   },
 
   /**

+ 10 - 10
pages/activeDetail/activeDetail.js

@@ -8,7 +8,6 @@ Page({
 
   },
   baoming() {
-    // /wx/actives/{openId}/{activeId}/enter
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
       method: "get",
@@ -26,14 +25,17 @@ Page({
    * 生命周期函数--监听页面加载
    */
   async onLoad(options) {
-    console.log(options)
-    const getOpenid = await tool.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+      this.getActivies(options.id);
     })
+  },
+  getActivies(id2){
     wx.request({
-      url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + options.id + '/detail',
+      url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + id2 + '/detail',
       method: "get",
       success: (res) => {
         if (res.data.code == 0) {
@@ -45,15 +47,13 @@ Page({
             activeStart:res.data.activeRoll.activeStart,
             address:res.data.activeRoll.address,
             remark:res.data.activeRoll.remark,
-            openId:options.openId
+            openId:id2
           })
           console.log(this.data.openId)
         }
       }
     })
-
   },
-
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 65 - 14
pages/index/index.js

@@ -4,13 +4,17 @@ Page({
   data: {
     currentIndex: 0,
     arr: [],
-    arr1: []
+    arr1: [],
+    isInfo: false,
+    isTargetInfo: false
   },
+  // 轮播
   handleChange: function (e) {
     this.setData({
       currentIndex: e.detail.current
     })
   },
+  // 跳转活动详情页面
   goActive(e) {
     console.log(e)
     let id = e.currentTarget.dataset.id
@@ -19,42 +23,89 @@ Page({
       url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
     })
   },
-  async onLoad() {
-    const getOpenid = await tool.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
-    })
+  // 获取活动列表
+  getActivies() {
     wx.request({
       url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
       method: "get",
       data: {
         activeStatus: 0
       },
+      success: (res) => {
+        console.log(res)
+        if (res.data.code == 0) {
+          let arr1 = res.data.actives;
+          wx.request({
+            url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
+            method: "get",
+            data: {
+              activeStatus: 1
+            },
+            success: (res1) => {
+              if (res1.data.code == 0) {
+                this.setData({
+                  arr: arr1.concat(res1.data.actives)
+                })
+                wx.hideLoading();
+              }
+            }
+          })
+        }
+      }
+    })
+  },
+  //判断是否登录
+
+  // 判断是否完善个人信息
+  isFinishInfo() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "get",
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
           this.setData({
-            arr1: res.data.actives
+            isInfo: true
+          })
+        } else {
+          this.setData({
+            isInfo: false
           })
         }
       }
     })
+  },
+  //判断是否完善择偶信息
+  isFinishTargetInfo() {
     wx.request({
-      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
       method: "get",
-      data: {
-        activeStatus: 1
-      },
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
           this.setData({
-            arr: this.data.arr1.concat(res.data.actives)
+            isTargetInfo: true
+          })
+        } else {
+          this.setData({
+            isTargetInfo: false
           })
         }
       }
     })
-
+  },
+  async onShow() {
+    wx.showLoading({
+      title: '加载中',
+    })
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+      this.getActivies();
+      this.isFinishInfo();
+      this.isFinishTargetInfo();
+    })
   }
 })

+ 3 - 3
pages/myActive/myActive.js

@@ -10,9 +10,9 @@ Page({
   },
   goActive(e){
     console.log(e.currentTarget.dataset.id)
-    // wx.redirectTo({
-    //   url: '/pages/onSiteActivity/onSiteActivity?id='+e.currentTarget.dataset.id,
-    // })
+    wx.redirectTo({
+      url: '/pages/onSiteActivity/onSiteActivity?id='+e.currentTarget.dataset.id,
+    })
   },
   /**
    * 生命周期函数--监听页面加载

+ 69 - 27
pages/onSiteActivity/onSiteActivity.js

@@ -2,12 +2,20 @@ const app = require('../../utils/util.js');
 const tool = require('../../utils/tool.js');
 Page({
   data: {
-    checkArr: []
+    checkArr: [],
+    member: [],
+    planHeart: 0,
+    heartTime: 0,
+    myNum: 0
+  },
+  goTousu() {
+    wx.switchTab({
+      url: '/pages/service/service',
+    })
   },
   love(e) {
-    console.log(e.currentTarget.dataset.index)
-    console.log(e.currentTarget.dataset.id)
-    let status=this.data.checkArr[e.currentTarget.dataset.index]
+    console.log(e)
+    let status = this.data.checkArr[e.currentTarget.dataset.index]
     let statusValue = 'checkArr[' + e.currentTarget.dataset.index + ']'
     console.log(status)
     if (status) {
@@ -15,51 +23,65 @@ Page({
         [statusValue]: false
       })
       wx.request({
-        url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/unfollow',
+        url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/unfollow',
         method: "get",
-        data:{
-          targetId:e.currentTarget.dataset.id
+        data: {
+          targetId: e.currentTarget.dataset.openid
         },
         success: (res) => {
           if (res.data.code == 0) {
             console.log(res, '我取消心动了')
+            this.getMyheartNowTimes();
           }
         }
       })
-    }else{
+    } else {
       this.setData({
         [statusValue]: true
       })
       wx.request({
-        url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/heartbeat',
+        url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/heartbeat',
         method: "get",
-        data:{
-          targetId:e.currentTarget.dataset.id
+        data: {
+          targetId: e.currentTarget.dataset.openid
         },
         success: (res) => {
           if (res.data.code == 0) {
             console.log(res, '我心动了')
+            this.getMyheartNowTimes();
           }
         }
       })
     }
   },
-  async onLoad (options) {
-    const getOpenid = await tool.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1],
-      activeId:options.id
+  // 获取我的心动次数
+  getMyheartNowTimes(){
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/myHearts',
+      method: "get",
+      success: (res) => {
+        console.log(res, '查询目前心动次数')
+        if (res.data.code == 0) {
+          this.setData({
+            heartTime: res.data.heartCount
+          })
+        }
+      }
+    })
+  },
+  getActivies() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/detail',
+      method: "get",
+      success: (res) => {
+        console.log(res, '查询活动详情获取心动上限次数')
+        if (res.data.code == 0) {
+          this.setData({
+            planHeart: Number(res.data.activeRoll.planHeart)
+          })
+        }
+      }
     })
-    // wx.request({
-    //   url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/sign',
-    //   method: "get",
-    //   success: (res) => {
-    //     if (res.data.code == 0) {
-    //       console.log(res, '我来到现场了')
-    //     }
-    //   }
-    // })
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/members',
       method: "get",
@@ -67,11 +89,20 @@ Page({
         if (res.data.code == 0) {
           console.log(res.data.members, '我获取人员名单')
           this.setData({
-            member:res.data.menmbers
+            member: res.data.members
           })
+          console.log(this.data.member)
           let checkArr1 = [];
           for (let i = 0; i < res.data.members.length; i++) {
             checkArr1[i] = false;
+            console.log(res.data.members[i].openId)
+            console.log(this.data.openid)
+            if (res.data.members[i].openId == this.data.openid) {
+              console.log(res.data.members[i])
+              this.setData({
+                myNum: res.data.members[i].activeNumber
+              })
+            }
           }
           this.setData({
             checkArr: checkArr1
@@ -80,6 +111,17 @@ Page({
       }
     })
   },
+  async onLoad(options) {
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1],
+        activeId: options.id
+      })
+      this.getActivies();
+      this.getMyheartNowTimes();
+    })
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 10 - 10
pages/onSiteActivity/onSiteActivity.wxml

@@ -1,27 +1,27 @@
 <view class="container">
-	<view class="title">签到成功!本场编号为001</view>
-	<view class="subtitle">请给你喜欢的嘉宾点击心动,心动上限为个</view>
+	<view class="title">本场编号为{{myNum}}</view>
+	<view class="subtitle">请给你喜欢的嘉宾点击心动,心动上限为{{planHeart}}个</view>
 	<scroll-view scroll-x="true" enable-flex="true" style="margin-top:40rpx">
   <view class="heartbox">
-		<view wx:for="{{5}}" wx:key="index" style="z-index:10;">
+		<view wx:for="{{heartTime}}" wx:key="index" style="z-index:10;">
 			<image src="../../images/heart.png" style="width:50rpx;height:50rpx"></image>
 		</view>
-		<view wx:for="{{5}}"  wx:key="index" style="z-index:10;">
+		<view wx:for="{{planHeart-heartTime}}"  wx:key="index" style="z-index:10;">
 			<image src="../../images/gray.png" style="width:35rpx;height:35rpx"></image>
 		</view>
 		<view class="line"></view>
     </view>
 	</scroll-view>
   <view class="num"> 
-  <view class='allnum'>嘉宾: {{members.length}}名</view>
-  <view class="tousu">投诉反馈</view>
+  <view class='allnum'>嘉宾: {{member.length}}名</view>
+  <view class="tousu" bindtap="goTousu">投诉反馈</view>
   </view>
   </view>
   <view class="photobox">
-  	<view wx:for="{{members}}" wx:key="index" data-index="{{index}}" data-index='{{id}}' bindtap="love" style="text-align:center;width: 140rpx;position:relative">
-			<image src="../../images/photo.jpg" style="width:110rpx;height:110rpx;border-radius:50%;margin-top:20rpx" mode="aspectFit"></image>
-      <view style="color:#4d4d4d;font-size:28rpx;margin-top:5rpx">001</view>
-      <view style="color:#4d4d4d;font-size:28rpx;padding-bottom:35rpx">小红阿</view>
+  	<view wx:for="{{member}}" wx:key="index" data-index="{{index}}" data-openId='{{item.openId}}' bindtap="love" style="text-align:center;width: 140rpx;position:relative">
+			<image src="{{item.memberAvatar}}" style="width:110rpx;height:110rpx;border-radius:50%;margin-top:20rpx" mode="aspectFit"></image>
+      <view style="color:#4d4d4d;font-size:28rpx;margin-top:5rpx">{{item.activeNumber}}</view>
+      <view style="color:#4d4d4d;font-size:28rpx;padding-bottom:35rpx">{{item.memberName}}</view>
       <view class="grayCircle"></view>
       <image src="../../images/love.png" class="loveCircle" wx:if="{{checkArr[index]}}"></image>
 		</view>

+ 56 - 22
pages/personInfo/personInfo.js

@@ -1,6 +1,6 @@
 import WxValidate from '../../utils/WxValidate.js';
 const app = require('../../utils/util.js');
-const tools = require('../../utils/tool.js');
+const tool = require('../../utils/tool.js');
 const COS = require('../../utils/cos.js');
 Page({
   data: {
@@ -23,7 +23,6 @@ Page({
       "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座", "水瓶座", "双鱼座。"
     ],
     form: {
-      // member: {
       idFront: '',
       idCard: '',
       name: '',
@@ -33,7 +32,6 @@ Page({
       nation: '',
       birthday: '',
       constellation: ''
-      // }
     }
   },
   nationPicker(e) {
@@ -82,7 +80,6 @@ Page({
       success: (res) => {
         let tempFilePaths = res.tempFilePaths[0]
         console.log(tempFilePaths, '图片的临时路径')
-
         this.toCos(tempFilePaths)
       }
     })
@@ -199,10 +196,10 @@ Page({
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
-          let res1=JSON.parse(res.data.cardMessage)
-          let sexTurn=0;
-          if(res1.words_result['性别'].words=='男'){
-            sexTurn=1;
+          let res1 = JSON.parse(res.data.cardMessage)
+          let sexTurn = 0;
+          if (res1.words_result['性别'].words == '男') {
+            sexTurn = 1;
           }
           let idFront = 'form.idFront'
           let idCard = 'form.idCard'
@@ -218,7 +215,7 @@ Page({
             [idCard]: res1.words_result['公民身份号码'].words,
             [name]: res1.words_result['姓名'].words,
             [sex]: sexTurn,
-            [age]: tools.formatTime(new Date()) - res1.words_result['出生'].words.substring(0, 4),
+            [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),
@@ -311,6 +308,50 @@ Page({
     }
     this.WxValidate = new WxValidate(rules, messages)
   },
+  getInfos() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "get",
+      success: (res) => {
+        console.log(res, '我是获取的信息')
+        if (res.data.code == 0) {
+          const items = this.data.questionList
+          const values = res.data.info.sex
+          for (let i = 0, lenI = items.length; i < lenI; ++i) {
+            items[i].checked = false
+            for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+              if (items[i].value === values[j]) {
+                items[i].checked = true
+                break
+              }
+            }
+          }
+          let idFront = 'form.idFront'
+          let idCard = 'form.idCard'
+          let name = 'form.name'
+          let sex = 'form.sex'
+          let age = 'form.age'
+          let nativePlace = 'form.nativePlace'
+          let nation = 'form.nation'
+          let birthday = 'form.birthday'
+          let constellation = 'form.constellation'
+          this.setData({
+            imgsrc: res.data.info.idFront,
+            [idFront]: res.data.info.idFront,
+            [idCard]: res.data.info.idCard,
+            [name]: res.data.info.name,
+            [sex]: res.data.info.sex,
+            questionList: this.data.questionList,
+            [age]: tool.formatTime(new Date()) - res.data.info.idCard.substring(6, 10),
+            [nativePlace]: res.data.info.nativePlace,
+            [nation]: res.data.info.nation,
+            [birthday]: res.data.info.birthday,
+            [constellation]: res.data.info.constellation
+          })
+        }
+      }
+    })
+  },
   // 表单提交事件
   formSubmit(e) {
     console.log(e.detail.value)
@@ -348,21 +389,14 @@ Page({
   },
   async onLoad(options) {
     this.initValidate()
-    const getOpenid = await tools.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+      this.getInfos();
     })
-    wx.request({
-      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
-      method: "get",
-      success: (res) => {
-        console.log(res)
-        if (res.data.code == 0) {
 
-        }
-      }
-    })
   },
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 479 - 188
pages/personInfoDetail/personInfoDetail.js

@@ -1,4 +1,5 @@
 import WxValidate from '../../utils/WxValidate.js';
+// import { readSync } from 'fs';
 const app = require('../../utils/util.js');
 const request = require('../../utils/request.js');
 const COS = require('../../utils/cos.js');
@@ -14,7 +15,7 @@ Page({
       marriage: '',
       children: '',
       assetHouse: '',
-      assetArea: '',
+      assetHouseArea: '',
       assetHouseLoan: '',
       assetCar: '',
       assetCarValue: '',
@@ -26,12 +27,12 @@ Page({
       company: '',
       parents: '',
       fatherWork: '',
-      motherWork: '',
+      matherWork: '',
       parentAssets: '',
       composition: '',
       motionState: '',
       hobby: '',
-      photo: ''
+      // photoUrl: ''
     },
     heightArr: [],
     weightArr: [],
@@ -45,17 +46,23 @@ Page({
     assetCarArr: [],
     assetCarValueArr: [],
     assetCarLoanArr: [],
-    isCommenArr: ['一起', '没有'],
+    isCommenArr: ['没有', '一起'],
     controlTimeArr: [],
     workStatusArr: [],
     companyNatureArr: [],
     parentsArr: [],
     fatherWorkArr: [],
-    motherWorkArr: [],
+    matherWorkArr: [],
     parentAssetsArr: [],
     compositionArr: [],
     figureArr: ['龟息养生从不运动', '三天打鱼偶尔运动', '动如脱兔成天运动']
   },
+  phoneChange(e) {
+    let phone = 'form.phone'
+    this.setData({
+      [phone]: e.detail.value
+    })
+  },
   heightPicker(e) {
     let height = 'form.height'
     this.setData({
@@ -108,14 +115,15 @@ Page({
   },
   assetAreaPickerChange(e) {
     console.log(e)
-    let assetArea = 'form.assetArea'
+    let assetHouseArea = 'form.assetHouseArea'
     this.setData({
       assetAreaLabel: this.data.assetAreaArr[e.detail.value],
-      [assetArea]: this.data.assetAreaArrValue[e.detail.value]
+      [assetHouseArea]: this.data.assetAreaArrValue[e.detail.value]
     })
   },
   assetHouseLoanPickerChange(e) {
-    console.log(e)
+    console.log(this.data.assetHouseLoanArr)
+    console.log(this.data.assetHouseLoanArrValue)
     let assetHouseLoan = 'form.assetHouseLoan'
     this.setData({
       assetHouseLoanLabel: this.data.assetHouseLoanArr[e.detail.value],
@@ -149,12 +157,14 @@ Page({
   isCommenChange(e) {
     let isCommen = 'form.isCommen'
     this.setData({
-      [isCommen]: this.data.isCommenArr[e.detail.value]
+      [isCommen]: e.detail.value,
+      isCommenLabel: this.data.isCommenArr[e.detail.value],
     })
   },
   controlTimeChange(e) {
     const items = this.data.controlTimeArr;
     const values = e.detail.value;
+    let controlTime = 'form.controlTime'
     for (let i = 0, lenI = items.length; i < lenI; ++i) {
       items[i].checked = false
       for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
@@ -164,20 +174,10 @@ Page({
         }
       }
     }
-    let indexArr = [];
-    for (let i = 0; i < e.detail.value.length; i++) {
-      indexArr.push(this.data.controlTimeArrLabel.indexOf(e.detail.value[i]))
-    }
-    let value = [];
-    for (let i = 0; i < indexArr.length; i++) {
-      value.push(this.data.controlTimeArrValue[indexArr[i]])
-    }
-    let controlTime = 'form.controlTime'
     this.setData({
       controlTimeArr: this.data.controlTimeArr,
-      [controlTime]: value
+      [controlTime]: e.detail.value
     })
-    console.log(this.data.form.controlTime)
   },
   workStatusChange(e) {
     console.log(e.detail.value)
@@ -192,20 +192,11 @@ Page({
         }
       }
     }
-    let indexArr = [];
-    for (let i = 0; i < e.detail.value.length; i++) {
-      indexArr.push(this.data.workStatusArrLabel.indexOf(e.detail.value[i]))
-    }
-    let value = [];
-    for (let i = 0; i < indexArr.length; i++) {
-      value.push(this.data.workStatusArrValue[indexArr[i]])
-    }
     let workStatus = 'form.workStatus'
     this.setData({
-      [workStatus]: value,
+      [workStatus]: e.detail.value,
       workStatusArr: this.data.workStatusArr
     })
-    console.log(this.data.form.workStatus)
   },
   companyNaturePicker(e) {
     let companyNature = 'form.companyNature'
@@ -214,6 +205,12 @@ Page({
       [companyNature]: this.data.companyNatureArrValue[e.detail.value]
     })
   },
+  companyChange(e) {
+    let company = 'form.company'
+    this.setData({
+      [company]: e.detail.value
+    })
+  },
   parentsPicker(e) {
     let parents = 'form.parents'
     this.setData({
@@ -228,11 +225,11 @@ Page({
       [fatherWork]: this.data.fatherWorkArrValue[e.detail.value]
     })
   },
-  motherworkPicker(e) {
-    let motherWork = 'form.motherWork'
+  matherworkPicker(e) {
+    let matherWork = 'form.matherWork'
     this.setData({
-      motherWorkLabel: this.data.motherWorkArr[e.detail.value],
-      [motherWork]: this.data.motherWorkArrValue[e.detail.value]
+      matherWorkLabel: this.data.matherWorkArr[e.detail.value],
+      [matherWork]: this.data.matherWorkArrValue[e.detail.value]
     })
   },
   parentAssetsPicker(e) {
@@ -255,18 +252,10 @@ Page({
         }
       }
     }
-    let indexArr = [];
-    for (let i = 0; i < e.detail.value.length; i++) {
-      indexArr.push(this.data.compositionArrLabel.indexOf(e.detail.value[i]))
-    }
-    let value = [];
-    for (let i = 0; i < indexArr.length; i++) {
-      value.push(this.data.compositionArrValue[indexArr[i]])
-    }
     let composition = 'form.composition'
     this.setData({
       compositionArr: this.data.compositionArr,
-      [composition]: value
+      [composition]: e.detail.value
     })
   },
   figurePicker(e) {
@@ -275,10 +264,436 @@ Page({
       [motionState]: this.data.figureArr[e.detail.value]
     })
   },
+  hobbyChange(e) {
+    let hobby = 'form.hobby'
+    this.setData({
+      [hobby]: e.detail.value
+    })
+  },
+  // 获取手机号
+  getPhoneNumber(e) {
+    console.log(e)
+    if (e.detail.errMsg == "getPhoneNumber:ok") {
+      wx.request({
+        url: app.globalData.publicUrl + '/wx/user/wxbfa171fdd4000e03/phone',
+        header: {
+          'content-type': 'application/x-www-form-urlencoded',
+        },
+        data: {
+          sessionKey: this.data.sessionkey,
+          signature: this.data.signature,
+          rawData: this.data.rawData,
+          encryptedData: e.detail.encryptedData,
+          iv: e.detail.iv
+        },
+        method: "POST",
+        success: (res) => {
+          console.log(res.data.phoneNumber, '我是解析的手机号');
+          let phone = 'form.phone'
+          this.setData({
+            [phone]: res.data.phoneNumber
+          })
+        }
+      })
+    }
+    // console.log(e.detail.iv)
+    // console.log(e.detail.encryptedData)
+  },
+  getInfos() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "get",
+      success: (res) => {
+        console.log(res.data.info, '我是获取的信息')
+        let phone = 'form.phone'
+        let height = 'form.height'
+        let weight = 'form.weight'
+        let education = 'form.education'
+        let income = 'form.income'
+        let marriage = 'form.marriage'
+        let children = 'form.children'
+        let assetHouse = 'form.assetHouse'
+        let assetHouseArea = 'form.assetHouseArea'
+        let assetHouseLoan = 'form.assetHouseLoan'
+        let assetCar = 'form.assetCar'
+        let assetCarValue = 'form.assetCarValue'
+        let assetCarLoan = 'form.assetCarLoan'
+        let isCommen = 'form.isCommen'
+        let controlTime = 'form.controlTime'
+        let workStatus = 'form.workStatus'
+        let companyNature = 'form.companyNature'
+        let company = 'form.company'
+        let parents = 'form.parents'
+        let fatherWork = 'form.fatherWork'
+        let matherWork = 'form.matherWork'
+        let parentAssets = 'form.parentAssets'
+        let composition = 'form.composition'
+        let motionState = 'form.motionState'
+        let hobby = 'form.hobby'
+        tool.formDetails('he_body_height').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.height) {
+              this.setData({
+                heightLabel: result[0][i],
+                [height]: result[1][i],
+                heightArr: result[0],
+                heightArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_body_weight').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.weight) {
+              this.setData({
+                weightLabel: result[0][i],
+                [weight]: result[1][i],
+                weightArr: result[0],
+                weightArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_education').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.education) {
+              this.setData({
+                educationLabel: result[0][i],
+                [education]: result[1][i],
+                educationArr: result[0],
+                educationArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_income').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.income) {
+              this.setData({
+                incomeLabel: result[0][i],
+                [income]: result[1][i],
+                incomeArr: result[0],
+                incomeArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_marriage').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.marriage) {
+              this.setData({
+                marriageLabel: result[0][i],
+                [marriage]: result[1][i],
+                marriageList: result[0],
+                marriageListValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_children').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.children) {
+              this.setData({
+                childrenLabel: result[0][i],
+                [children]: result[1][i],
+                childrenArr: result[0],
+                childrenArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_house').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetHouse) {
+              this.setData({
+                assetHouseLabel: result[0][i],
+                [assetHouse]: result[1][i],
+                assetHouseArr: result[0],
+                assetHouseArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_house_area').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetHouseArea) {
+              this.setData({
+                assetAreaLabel: result[0][i],
+                [assetHouseArea]: result[1][i],
+                assetAreaArr: result[0],
+                assetAreaArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_house_loan').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetHouseLoan) {
+              this.setData({
+                assetHouseLoanLabel: result[0][i],
+                [assetHouseLoan]: result[1][i],
+                assetHouseLoanArr: result[0],
+                assetHouseLoanArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_car').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetCar) {
+              this.setData({
+                assetCarLabel: result[0][i],
+                [assetCar]: result[1][i],
+                assetCarArr: result[0],
+                assetCarArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_car_value').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetCarValue) {
+              this.setData({
+                assetCarValueLabel: result[0][i],
+                [assetCarValue]: result[1][i],
+                assetCarValueArr: result[0],
+                assetCarValueArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_asset_car_loan').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.assetCarLoan) {
+              this.setData({
+                assetCarLoanLabel: result[0][i],
+                [assetCarLoan]: result[1][i],
+                assetCarLoanArr: result[0],
+                assetCarLoanArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_control_time').then(result => {
+          let controlTimeArr = result[0].map((item, index) => {
+            return Object.assign({}, {
+              'name': item,
+              'value': item,
+              'checked': false
+            })
+          })
+          let resControlTime = res.data.info.controlTime.split(",");
+          let resControlTimeIndexArr = [];
+          for (let i = 0; i < resControlTime.length; i++) {
+            for (let j = 0; j < result[1].length; j++) {
+              if (resControlTime[i] == result[1][j]) {
+                resControlTimeIndexArr.push(i)
+              }
+            }
+          }
+          let resControlTimeLabel = [];
+          for (let i = 0; i < resControlTimeIndexArr.length; i++) {
+            resControlTimeLabel.push(result[0][resControlTimeIndexArr[i]])
+          }
+          for (let i = 0; i < resControlTimeLabel.length; i++) {
+            if (resControlTimeLabel[i] == controlTimeArr[i].value) {
+              controlTimeArr[i].checked = true;
+            }
+          }
+          this.setData({
+            controlTimeArr: controlTimeArr,
+            controlTimeArrLabel: result[0],
+            controlTimeArrValue: result[1],
+            [controlTime]: resControlTimeLabel
+          })
+        })
+        tool.formDetails('he_work_status').then(result => {
+          let workStatusArr = result[0].map((item, index) => {
+            return Object.assign({}, {
+              'name': item,
+              'value': item,
+              'checked': false
+            })
+          })
+          let resWorkStatus = res.data.info.workStatus.split(",");
+          let resWorkStatusIndexArr = [];
+          for (let i = 0; i < resWorkStatus.length; i++) {
+            for (let j = 0; j < result[1].length; j++) {
+              if (resWorkStatus[i] == result[1][j]) {
+                resWorkStatusIndexArr.push(i)
+              }
+            }
+          }
+          let resWorkStatusLabel = [];
+          for (let i = 0; i < resWorkStatusIndexArr.length; i++) {
+            resWorkStatusLabel.push(result[0][resWorkStatusIndexArr[i]])
+          }
+          for (let i = 0; i < resWorkStatusLabel.length; i++) {
+            if (resWorkStatusLabel[i] == workStatusArr[i].value) {
+              workStatusArr[i].checked = true;
+            }
+          }
+          this.setData({
+            workStatusArr: workStatusArr,
+            workStatusArrLabel: result[0],
+            workStatusArrValue: result[1],
+            [workStatus]: resWorkStatusLabel
+          })
+        })
+        tool.formDetails('he_company_nature').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.companyNature) {
+              this.setData({
+                companyNatureLabel: result[0][i],
+                [companyNature]: result[1][i]
+              })
+            }
+          }
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.fatherWork) {
+              this.setData({
+                fatherWorkLabel: result[0][i],
+                [fatherWork]: result[1][i]
+              })
+            }
+          }
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.matherWork) {
+              this.setData({
+                matherWorkLabel: result[0][i],
+                [matherWork]: result[1][i]
+              })
+            }
+          }
+          this.setData({
+            companyNatureArr: result[0],
+            companyNatureArrValue: result[1],
+            fatherWorkArr: result[0],
+            fatherWorkArrValue: result[1],
+            matherWorkArr: result[0],
+            matherWorkArrValue: result[1]
+          })
+        })
+        this.setData({
+          [phone]: res.data.info.tel,
+          [company]: res.data.info.company,
+          [motionState]: res.data.info.motionState,
+          [hobby]: res.data.info.hobby,
+          [isCommen]: res.data.info.isCommen,
+          isCommenLabel: this.data.isCommenArr[res.data.info.isCommen],
+        })
+        tool.formDetails('he_parents').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.parents) {
+              this.setData({
+                parentsLabel: result[0][i],
+                [parents]: result[1][i],
+                parentsArr: result[0],
+                parentsArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_parent_assets').then(result => {
+          for (let i = 0; i < result[0].length; i++) {
+            if (result[1][i] == res.data.info.parentAssets) {
+              this.setData({
+                parentAssetsLabel: result[0][i],
+                [parentAssets]: result[1][i],
+                parentAssetsArr: result[0],
+                parentAssetsArrValue: result[1]
+              })
+            }
+          }
+        })
+        tool.formDetails('he_composition').then(result => {
+          let compositionArr = result[0].map((item, index) => {
+            return Object.assign({}, {
+              'name': item,
+              'value': item,
+              'checked': false
+            })
+          })
+          let resComposition = res.data.info.composition.split(",");
+          let resCompositionIndexArr = [];
+          for (let i = 0; i < resComposition.length; i++) {
+            for (let j = 0; j < result[1].length; j++) {
+              if (resComposition[i] == result[1][j]) {
+                resCompositionIndexArr.push(i)
+              }
+            }
+          }
+          let resCompositionLabel = [];
+          for (let i = 0; i < resCompositionIndexArr.length; i++) {
+            resCompositionLabel.push(result[0][resCompositionIndexArr[i]])
+          }
+          for (let i = 0; i < resCompositionLabel.length; i++) {
+            if (resCompositionLabel[i] == compositionArr[i].value) {
+              compositionArr[i].checked = true;
+            }
+          }
+          this.setData({
+            compositionArr: compositionArr,
+            compositionArrLabel: result[0],
+            compositionArrValue: result[1],
+            [composition]: resCompositionLabel
+          })
+        })
+      }
+    })
+  },
   // 提交
   formSubmit(e) {
+    console.log(e)
     const params = e.detail.value
-    console.log(params)
+    let controlTime = 'form.controlTime';
+    let workStatus = 'form.workStatus';
+    let composition = 'form.composition'
+    let indexArr = [];
+    for (let i = 0; i < params.controlTime.length; i++) {
+      indexArr.push(this.data.controlTimeArrLabel.indexOf(params.controlTime[i]))
+    }
+    let value = [];
+    for (let i = 0; i < indexArr.length; i++) {
+      value.push(this.data.controlTimeArrValue[indexArr[i]])
+    }
+    let str = '';
+    for (let i = 0; i < value.length; i++) {
+      str += value[i] + ','
+    }
+
+    let indexArr2 = [];
+    for (let i = 0; i < params.workStatus.length; i++) {
+      indexArr2.push(this.data.workStatusArrLabel.indexOf(params.workStatus[i]))
+    }
+    let value2 = [];
+    for (let i = 0; i < indexArr2.length; i++) {
+      value2.push(this.data.workStatusArrValue[indexArr2[i]])
+    }
+    let str2 = '';
+    for (let i = 0; i < value2.length; i++) {
+      str2 += value2[i] + ','
+    }
+
+    let indexArr3 = [];
+    for (let i = 0; i < params.composition.length; i++) {
+      indexArr3.push(this.data.compositionArrLabel.indexOf(params.composition[i]))
+    }
+    let value3 = [];
+    for (let i = 0; i < indexArr3.length; i++) {
+      value3.push(this.data.compositionArrValue[indexArr3[i]])
+    }
+    let str3 = '';
+    for (let i = 0; i < value3.length; i++) {
+      str3 += value3[i] + ','
+    }
+
+    this.setData({
+      [controlTime]: str.slice(0, str.length - 1),
+      [workStatus]: str2.slice(0, str2.length - 1),
+      [composition]: str3.slice(0, str3.length - 1),
+    })
+    console.log(this.data.form)
     //校验表单
     if (!this.WxValidate.checkForm(params)) {
       const error = this.WxValidate.errorList[0]
@@ -291,7 +706,7 @@ Page({
       header: {
         'content-type': 'application/x-www-form-urlencoded',
       },
-      data: params,
+      data: this.data.form,
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
@@ -344,7 +759,7 @@ Page({
       assetHouse: {
         required: true
       },
-      assetArea: {
+      assetHouseArea: {
         required: true
       },
       assetHouseLoan: {
@@ -386,7 +801,7 @@ Page({
       hobby: {
         required: true
       }
-      // photo: {
+      // photoUrl: {
       //   required: true
       // }
     }
@@ -415,7 +830,7 @@ Page({
       assetHouse: {
         required: '请选择是否买房子'
       },
-      assetArea: {
+      assetHouseArea: {
         required: '请选择房子多大面积'
       },
       assetHouseLoan: {
@@ -457,7 +872,7 @@ Page({
       hobby: {
         required: '请填写您的爱好'
       }
-      // photo: {
+      // photoUrl: {
       //   required: '请上传您的照片'
       // }
     }
@@ -465,145 +880,21 @@ Page({
   },
   async onLoad(options) {
     this.initValidate();
-    const getOpenid = await tool.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
-    })
-    tool.formDetails('he_body_height').then(result => {
-      this.setData({
-        heightArr: result[0],
-        heightArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_body_weight').then(result => {
-      this.setData({
-        weightArr: result[0],
-        weightArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_education').then(result => {
-      this.setData({
-        educationArr: result[0],
-        educationArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_income').then(result => {
+    tool.openidStatus().then(result => {
       this.setData({
-        incomeArr: result[0],
-        incomeArrValue: result[1]
+        openid: result[0],
+        sessionkey: result[1]
       })
-    })
-    tool.formDetails('he_marriage').then(result => {
-      this.setData({
-        marriageList: result[0],
-        marriageListValue: result[1]
-      })
-    })
-    tool.formDetails('he_children').then(result => {
-      this.setData({
-        childrenArr: result[0],
-        childrenArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_house').then(result => {
-      this.setData({
-        assetHouseArr: result[0],
-        assetHouseArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_house_area').then(result => {
-      this.setData({
-        assetAreaArr: result[0],
-        assetAreaArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_house_loan').then(result => {
-      this.setData({
-        assetHouseLoanArr: result[0],
-        assetHouseLoanArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_car').then(result => {
-      this.setData({
-        assetCarArr: result[0],
-        assetCarArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_car_value').then(result => {
-      this.setData({
-        assetCarValueArr: result[0],
-        assetCarValueArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_asset_car_loan').then(result => {
-      this.setData({
-        assetCarLoanArr: result[0],
-        assetCarLoanArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_control_time').then(result => {
-      let controlTimeArr = result[0].map((item, index) => {
-        return Object.assign({}, {
-          'name': item,
-          'value': item,
-          'checked': false
-        })
-      })
-      this.setData({
-        controlTimeArr: controlTimeArr,
-        controlTimeArrLabel: result[0],
-        controlTimeArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_work_status').then(result => {
-      let workStatusArr = result[0].map((item, index) => {
-        return Object.assign({}, {
-          'name': item,
-          'value': item,
-          'checked': false
-        })
-      })
-      this.setData({
-        workStatusArr: workStatusArr,
-        workStatusArrLabel: result[0],
-        workStatusArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_company_nature').then(result => {
-      this.setData({
-        companyNatureArr: result[0],
-        companyNatureArrValue: result[1],
-        fatherWorkArr: result[0],
-        fatherWorkArrValue: result[1],
-        motherWorkArr: result[0],
-        motherWorkArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_parents').then(result => {
-      this.setData({
-        parentsArr: result[0],
-        parentsArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_parent_assets').then(result => {
-      this.setData({
-        parentAssetsArr: result[0],
-        parentAssetsArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_composition').then(result => {
-      let compositionArr = result[0].map((item, index) => {
-        return Object.assign({}, {
-          'name': item,
-          'value': item,
-          'checked': false
-        })
-      })
-      this.setData({
-        compositionArr: compositionArr,
-        compositionArrLabel: result[0],
-        compositionArrValue: result[1]
+      // this.getForm();
+      this.getInfos();
+      wx.getUserInfo({
+        success: (res) => {
+          console.log(res)
+          this.setData({
+            rawData: res.rawData,
+            signature: res.signature
+          })
+        }
       })
     })
   },
@@ -705,9 +996,9 @@ Page({
         },
         success: (res) => {
           console.log(res.header.Location)
-          let photo = 'form.photo'
+          let photoUrl = 'form.photoUrl'
           this.setData({
-            [photo]: res.header.Location
+            [photoUrl]: res.header.Location
           })
           // this.tj(params, res.header.Location)
         },

+ 14 - 13
pages/personInfoDetail/personInfoDetail.wxml

@@ -3,7 +3,8 @@
 			<view class="block">
 				<view class='left' style="width:40%">咋联系你呢</view>
 				<view class='right' style="width:60%">
-					<input name="phone" value="{{form.phone}}" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
+					<input name="phone" wx:if="{{form.phone}}" value="{{form.phone}}" bindblur="phoneChange" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
+					<button wx:else open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" id="photo_btn">未填写</button>
 				</view>
 			</view>
 			<view class="block">
@@ -69,7 +70,7 @@
 			<view class="block">
 				<view class='left' style="width:50%">关于小红本本</view>
 				<view class='right' style="width:50%">
-						<picker bindchange="marriageChange" range="{{marriageList}}" name='marriage' value="{{form.marriage}}">
+					<picker bindchange="marriageChange" range="{{marriageList}}" name='marriage' value="{{form.marriage}}">
 						<view style="text-align:right">
 							<view wx:if="{{marriageLabel}}">{{marriageLabel}}</view>
 							<view wx:else class='placeStyle'>
@@ -84,7 +85,7 @@
 			<view class="block">
 				<view class='left' style="width:30%">亲生的小祖宗</view>
 				<view class='right' style="width:70%">
-				<picker bindchange="childrenChange" range="{{childrenArr}}" name='children' value="{{form.children}}">
+					<picker bindchange="childrenChange" range="{{childrenArr}}" name='children' value="{{form.children}}">
 						<view style="text-align:right">
 							<view wx:if="{{childrenLabel}}">{{childrenLabel}}</view>
 							<view wx:else class='placeStyle'>
@@ -112,7 +113,7 @@
 			<view class="block">
 				<view class='left' style="width:35%">房子多大啊</view>
 				<view class='right' style="width:65%">
-					<picker bindchange="assetAreaPickerChange" range="{{assetAreaArr}}" name='assetArea' value="{{form.assetArea}}">
+					<picker bindchange="assetAreaPickerChange" range="{{assetAreaArr}}" name='assetHouseArea' value="{{form.assetHouseArea}}">
 						<view wx:if="{{assetAreaLabel}}">{{assetAreaLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
@@ -208,7 +209,7 @@
 			<view class="block">
 				<view class='left' style="width:40%">具体卖命单位</view>
 				<view class='right' style="width:60%">
-					<input name="company" value="{{form.company}}" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
+					<input name="company" bindblur="companyChange" value="{{form.company}}" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
 				</view>
 			</view>
 			<view class="block">
@@ -232,7 +233,7 @@
 					<view class='left' style="width:35%">和父母一起住没</view>
 					<view class='right' style="width:65%">
 						<picker bindchange="isCommenChange" range="{{isCommenArr}}" name='isCommen' value="{{form.isCommen}}">
-							<view wx:if="{{form.isCommen}}">{{form.isCommen}}</view>
+							<view wx:if="{{isCommenLabel}}">{{isCommenLabel}}</view>
 							<view wx:else class='placeStyle'>
 								<view class="redpoint"></view>
 								<view class="placetext">未选择</view>
@@ -259,9 +260,9 @@
 				<view class="block">
 					<view class='left' style="width:40%">那么妈咪呢</view>
 					<view class='right' style="width:60%">
-						<picker bindchange="motherworkPicker" range="{{motherWorkArr}}" name='motherWork' value="{{form.motherWork}}">
+						<picker bindchange="matherworkPicker" range="{{matherWorkArr}}" name='matherWork' value="{{form.matherWork}}">
 							<view style="text-align:right">
-								<view wx:if="{{motherWorkLabel}}">{{motherWorkLabel}}</view>
+								<view wx:if="{{matherWorkLabel}}">{{matherWorkLabel}}</view>
 								<view wx:else class='placeStyle'>
 									<view class="redpoint"></view>
 									<view class="placetext">未选择</view>
@@ -313,13 +314,13 @@
 			<view class="block">
 				<view class='left' style="width:40%">喜欢铜鼓点啥</view>
 				<view class='right' style="width:60%">
-					<input name="hobby" value="{{form.hobby}}" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
+					<input name="hobby" value="{{form.hobby}}" bindblur="hobbyChange" placeholder="未填写" placeholder-class="iconfont icon-jianjiaohao1 icon-tubiaozhizuo-1"></input>
 				</view>
 			</view>
-			<view class="block" style="height:350rpx">
+			<!-- <view class="block" style="height:350rpx">
 				<view class='left' style="width:40%">上传一张您的照片吧</view>
 				<view class='right' style="width:59%;color:#656565;height:80rpx" bindtap="uploadPhoto">
-					<image wx:if='{{form.photo}}' mode="aspectFit" src="{{form.photo}}" style="width:200rpx;height:350rpx;"></image>
+					<image wx:if='{{form.photoUrl}}' mode="aspectFit" src="{{form.photoUrl}}" style="width:200rpx;height:350rpx;"></image>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未上传</view>
@@ -328,8 +329,8 @@
 				</view>
 			</view>
 			<view style="display:none">
-			<input name='photo' value="{{form.photo}}"></input>
-			</view>
+			<input name='photoUrl' value="{{form.photoUrl}}"></input>
+			</view> -->
 			<button form-type="submit" id="sunbmit">确认,去填写择偶意向</button>
 		</form>
 	</view>

+ 8 - 3
pages/personInfoDetail/personInfoDetail.wxss

@@ -55,16 +55,13 @@
   padding: 8rpx 20rpx;
   margin-right: 10rpx;
 }
-
 .checkboxbox {
   background: -webkit-linear-gradient(left, #bd64ff, #8873ff);
   color: white;
 }
-
 .parameter-wrap radio {
   display: none;
 }
-
 .parameter-wrap checkbox {
   display: none;
 }
@@ -77,4 +74,12 @@
   border-radius: 50rpx!important;
   font-weight: normal!important;
   margin: 60rpx 75rpx;
+}
+#photo_btn{
+  background: #fff!important;
+  /* border: 1px solid red; */
+  font-weight: normal!important;
+  font-size: 28rpx;
+  text-align: right;
+  color: #4d4d4d;
 }

+ 122 - 62
pages/personal/personal.js

@@ -2,34 +2,34 @@ const app = require('../../utils/util.js');
 const tool = require('../../utils/tool.js');
 Page({
   data: {
-    // myHeartTimes:0,
+    avatarUrl: '../../images/morenImg.jpg',
     tabArr: [{
-      name: '我的信息',
-      img: '../../images/icon1.png',
-      url: '/pages/InfoType/InfoType'
-    }, {
-      name: '我的活动',
-      img: '../../images/icon2.png',
-      url: '/pages/myActive/myActive'
-    }, {
-      name: '心动0次',
-      img: '../../images/icon3.png',
-      url: ''
-    }, {
-      name: '被心动0次',
-      img: '../../images/icon4.png',
-      url: ''
-    },
-    //  {
-    //   name: '投诉',
-    //   img: '../../images/icon5.png',
-    //   url: '/pages/complaint/complaint'
-    // }, {
-    //   name: '推荐好友',
-    //   img: '../../images/icon6.png',
-    //   url: '/pages/share/share'
-    // }
-  ]
+        name: '我的信息',
+        img: '../../images/icon1.png',
+        url: '/pages/InfoType/InfoType'
+      }, {
+        name: '我的活动',
+        img: '../../images/icon2.png',
+        url: '/pages/myActive/myActive'
+      }, {
+        name: '心动0次',
+        img: '../../images/icon3.png',
+        url: ''
+      }, {
+        name: '被心动0次',
+        img: '../../images/icon4.png',
+        url: ''
+      },
+      //  {
+      //   name: '投诉',
+      //   img: '../../images/icon5.png',
+      //   url: '/pages/complaint/complaint'
+      // }, {
+      //   name: '推荐好友',
+      //   img: '../../images/icon6.png',
+      //   url: '/pages/share/share'
+      // }
+    ]
   },
   goTab(e) {
     wx.navigateTo({
@@ -71,29 +71,67 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  async onLoad(options) {
-    const getOpenid = await tool.openidStatus();
+  bindGetUserInfo: function (e) {
+    console.log(e.detail.userInfo)
     this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
+      nick: e.detail.userInfo.nickName,
+      avatarUrl: e.detail.userInfo.avatarUrl
+    })
+    this.upload(e.detail.userInfo.nickName, e.detail.userInfo.avatarUrl);
+    // 直接跳转页面(拒绝了授权)
+    // wx.reLaunch({
+    //   url: '/pages/menu/homePage/homePage',
+    // })
+  },
+  getNick() {
+    wx.getSetting({
+      success: (res) => {
+        if (res.authSetting['scope.userInfo']) {
+          wx.getUserInfo({
+            success: (res) => {
+              this.setData({
+                nick: res.userInfo.nickName,
+                avatarUrl: res.userInfo.avatarUrl
+              })
+            }
+          })
+        } else {
+          console.log(res)
+        }
+      }
+    })
+  },
+  upload(nickName, avatar) {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "POST",
+      header: {
+        'content-type': 'application/x-www-form-urlencoded',
+      },
+      data: {
+        nickName,
+        avatar
+      },
+      success: (res) => {
+        console.log(res)
+        if (res.data.code == 0) {
+          console.log('上传头像昵称成功')
+        }
+      }
     })
+  },
+  getTimes() {
     let myHeartTimes = 'tabArr[2].name'
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/0/myHearts',
       method: "get",
       success: (res) => {
-        console.log(res)
         if (res.data.code == 0) {
-          if (res.data.data) {
-            this.setData({
-              [myHeartTimes]: '心动' + res.data.data + '次'
-            })
-          } else {
-            this.setData({
-              [myHeartTimes]: '心动0次'
-            })
-          }
+          this.setData({
+            [myHeartTimes]: '心动' + res.data.heartCount + '次'
+          })
         }
+        console.log(this.data.tabArr[2].name)
       }
     })
     let myHeartedTimes = 'tabArr[3].name'
@@ -101,21 +139,54 @@ Page({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/0/myHearted',
       method: "get",
       success: (res) => {
-        console.log(res)
         if (res.data.code == 0) {
-          if (res.data.data) {
-            this.setData({
-              [myHeartedTimes]: '被心动' + res.data.data + '次'
-            })
-          } else {
-            this.setData({
-              [myHeartedTimes]: '被心动0次'
-            })
-          }
+          this.setData({
+            [myHeartedTimes]: '被心动' + res.data.heartedCount + '次'
+          })
+          console.log(this.data.tabArr[3].name)
         }
       }
     })
   },
+  getPhoneNumber(e) {
+    console.log(e)
+    console.log(e.detail.errMsg == "getPhoneNumber:ok");
+    if (e.detail.errMsg == "getPhoneNumber:ok") {
+      wx.request({
+        url: app.globalData.publicUrl + '/wx/user/wxbfa171fdd4000e03/phone',
+        // data: {
+        //   encryptedData: e.detail.encryptedData,
+        //   iv: e.detail.iv,
+        //   sessionKey: that.data.session_key,
+        //   uid: "",
+        // },
+        data: {
+          appid: 'wxbfa171fdd4000e03',
+          sessionKey: this.data.sessionKey,
+          signature,
+          rawData,
+          encryptedData: e.detail.encryptedData,
+          iv: e.detail.iv
+        },
+        method: "get",
+        success: function (res) {
+          console.log(res);
+        }
+      })
+    }
+    // console.log(e.detail.iv)
+    // console.log(e.detail.encryptedData)
+  },
+  async onShow() {
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+      this.getNick();
+      this.getTimes();
+    })
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
@@ -123,17 +194,6 @@ Page({
   onReady: function () {
 
   },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
   onHide: function () {
 
   },

+ 6 - 4
pages/personal/personal.wxml

@@ -1,11 +1,13 @@
 <view class="bj">
 	<image src="../../images/person_bj.png" style="width:750rpx;height:380rpx"></image>
 	<view class="top">
-		<view class="img">
-			<open-data type="userAvatarUrl"></open-data>
-		</view>
+		<image class="img" src="{{avatarUrl}}"></image>
 		<view class="nick">
-			<open-data type="userNickName" lang="zh_CN"></open-data>
+			<view wx:if="{{nick}}">{{nick}}</view>
+			<button wx:else open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" id="login_btn">
+				[点击登陆账户]
+			</button>
+			<!-- <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button> -->
 		</view>
 	</view>
 	<view class="middle">

+ 3 - 0
pages/personal/personal.wxss

@@ -62,4 +62,7 @@
 }
 .nick{
   color:#111111;font-size:35rpx;text-align:center;margin-top:270rpx
+}
+#login_btn{
+  background: rgba(0,0,0,0);
 }

+ 224 - 239
pages/targetInfo/targetInfo.js

@@ -23,131 +23,49 @@ Page({
       companyNature: '',
       parents: '',
       composition: '',
-      isCommen: ''
+      isCommen: '',
+      // id:''
     },
-    heightArr: [
-      '都行',
-      '150-155',
-      '155-160',
-      '160-165',
-      '165-170',
-      '170-175',
-      '175-185',
-      '185-190'
-    ],
-    educationArr: ["都行", "初中", "中专", "高中", "大专", "本科", "硕士", "博士"],
-    incomeArr: ["挣不挣都行", "2000-5000", "5000-10000", "10000-20000", "20000以上"],
-    nativePlaceArr: ['咋的都行', '本地', '外地'],
-    marriageArr: ["不行", "行"],
-    constellationArr: [{
-        name: '不限',
-        value: '不限',
-        checked: true
-      },
-      {
-        name: '白羊座',
-        value: '白羊座',
-        checked: false
-      },
-      {
-        name: '金牛座',
-        value: '金牛座',
-        checked: false
-      },
-      {
-        name: '双子座',
-        value: '双子座',
-        checked: false
-      },
-      {
-        name: '巨蟹座',
-        value: '巨蟹座',
-        checked: false
-      },
-      {
-        name: '狮子座',
-        value: '狮子座',
-        checked: false
-      },
-      {
-        name: '处女座',
-        value: '处女座',
-        checked: false
-      },
-      {
-        name: '天秤座',
-        value: '天秤座',
-        checked: false
-      },
-      {
-        name: '天蝎座',
-        value: '天蝎座',
-        checked: false
-      },
-      {
-        name: '射手座',
-        value: '射手座',
-        checked: false
-      },
-      {
-        name: '摩羯座',
-        value: '摩羯座',
-        checked: false
-      },
-      {
-        name: '水瓶座',
-        value: '水瓶座',
-        checked: false
-      },
-      {
-        name: '双鱼座',
-        value: '双鱼座',
-        checked: false
-      }
-    ],
-    // 工作时间自由、朝九晚五、偶尔加班、经常加班、偶尔出差、经常出差、常有应酬
-    workStatusArr: [{
-        name: '工作时间自由',
-        value: '工作时间自由',
-        checked: true
-      },
-      {
-        name: '朝九晚五',
-        value: '朝九晚五',
-        checked: false
-      }, {
-        name: '偶尔加班',
-        value: '偶尔加班',
-        checked: false
-      }, {
-        name: '经常加班',
-        value: '经常加班',
-        checked: false
-      },
-      {
-        name: '偶尔出差',
-        value: '偶尔出差',
-        checked: false
-      }, {
-        name: '经常出差',
-        value: '经常出差',
-        checked: false
-      }, {
-        name: '常有应酬',
-        value: '常有应酬',
-        checked: false
-      }
-    ],
-    assetHouseArr: ['租房', '购房'],
-    assetAreaArr: ['80平以下', '80-120平', '120平以上'],
-    assetHouseLoanArr: ['有', '没有'],
-    assetCarArr: ['有', '没有'],
-    assetCarValueArr: ['10万以下', '10-20万', '20-30万', '30-40万', '40-50万', '50-60万', '60-70万', '70-80万', '80-90万', '90-100万', '100万以上'],
-    assetCarLoanArr: ['有贷款', '无贷款'],
-    companyNatureArr: ['政府机关', '事业单位', '外企企业', '世界500强', '上市公司', '国有企业', '私营企业', '个体'],
-    parentsArr: ['均有退休金', '均无退休金', '父亲有退休金', '母亲有退休金'],
+    educationArr: [],
+    incomeArr: [],
+    nativePlaceArr: ['外地', '本地', '咋的都行'],
+    marriageArr: ["不行", "行", '咋的都行'],
+    constellationArr: [],
+    workStatusArr: [],
+    assetHouseArr: ['租房', '购房', '咋的都行'],
+    assetAreaArr: [],
+    assetHouseLoanArr: ['有', '没有', '咋的都行'],
+    assetCarArr: ['有', '没有', '咋的都行'],
+    assetCarValueArr: [],
+    assetCarLoanArr: ['不行', '行', '咋的都行'],
+    companyNatureArr: [],
+    parentsArr: [],
     compositionArr: ['老几都行', '必须独苗一根'],
-    isCommenArr: ['愿意', '不愿意']
+    isCommenArr: ['愿意', '不愿意', '咋的都行']
+  },
+  ageMinChange(e) {
+    let ageMin = 'form.ageMin'
+    this.setData({
+      [ageMin]: e.detail.value
+    })
+  },
+  ageMaxChange(e) {
+    let ageMax = 'form.ageMax'
+    this.setData({
+      [ageMax]: e.detail.value
+    })
+  },
+  heightMinChange(e) {
+    let heightMin = 'form.heightMin'
+    this.setData({
+      [heightMin]: e.detail.value
+    })
+  },
+  heightMaxChange(e) {
+    let heightMax = 'form.heightMax'
+    this.setData({
+      [heightMax]: e.detail.value
+    })
   },
   educationPicker(e) {
     let education = 'form.education'
@@ -164,77 +82,84 @@ Page({
     })
   },
   nativePlacePicker(e) {
-    let nativePlace = 'form.nativePlace'
+    let nativePlace = 'form.nativePlace';
     this.setData({
-      [nativePlace]: this.data.nativePlaceArr[e.detail.value]
+      nativePlaceLabel: this.data.nativePlaceArr[e.detail.value]
     })
+    if (e.detail.value != 2) {
+      this.setData({
+        [nativePlace]: e.detail.value
+      })
+    }
   },
   marriageChange(e) {
-    let marriage = 'form.marriage'
+    let marriage = 'form.marriage';
     this.setData({
-      [marriage]: this.data.marriageArr[e.detail.value]
+      marriageLabel: this.data.marriageArr[e.detail.value]
     })
-  },
-  marriagePickerColumnChange(e) {
-    console.log(e)
-    if (e.detail.column == 0 && e.detail.value == 1) {
-      this.setData({
-        marriageArr: [
-          ["行", "不行"],
-          ["有小祖宗不行", "有小祖宗也行"]
-        ]
-      })
-    }
-    if (e.detail.column == 0 && e.detail.value == 0) {
+    if (e.detail.value != 2) {
       this.setData({
-        marriageArr: [
-          ["行", "不行"],
-          []
-        ]
+        [marriage]: e.detail.value
       })
     }
   },
   assetHousePickerChange(e) {
-    console.log(e)
-    let assetHouse = 'form.assetHouse'
+    let assetHouse = 'form.assetHouse';
     this.setData({
-      [assetHouse]: this.data.assetHouseArr[e.detail.value]
+      assetHouseLabel: this.data.assetHouseArr[e.detail.value]
     })
+    if (e.detail.value != 2) {
+      this.setData({
+        [assetHouse]: e.detail.value
+      })
+    }
   },
   assetAreaPickerChange(e) {
-    console.log(e)
     let assetArea = 'form.assetArea'
     this.setData({
-      [assetArea]: this.data.assetAreaArr[e.detail.value]
+      assetAreaLabel: this.data.assetAreaArr[e.detail.value],
+      [assetArea]: this.data.assetAreaArrValue[e.detail.value]
     })
   },
   assetHouseLoanPickerChange(e) {
-    console.log(e)
-    let assetHouseLoan = 'form.assetHouseLoan'
+    let assetHouseLoan = 'form.assetHouseLoan';
     this.setData({
-      [assetHouseLoan]: this.data.assetHouseLoanArr[e.detail.value]
+      assetHouseLoanLabel: this.data.assetHouseLoanArr[e.detail.value]
     })
+    if (e.detail.value != 2) {
+      this.setData({
+        [assetHouseLoan]: e.detail.value
+      })
+    }
   },
   assetCarPickerChange(e) {
-    console.log(e)
-    let assetCar = 'form.assetCar'
+    let assetCar = 'form.assetCar';
     this.setData({
-      [assetCar]: this.data.assetCarArr[e.detail.value]
+      assetCarLabel: this.data.assetCarArr[e.detail.value]
     })
+    if (e.detail.value != 2) {
+      this.setData({
+        [assetCar]: e.detail.value
+      })
+    }
   },
   assetCarValuePickerChange(e) {
-    console.log(e)
     let assetCarValue = 'form.assetCarValue'
     this.setData({
-      [assetCarValue]: this.data.assetCarValueArr[e.detail.value]
+      assetCarValueLabel: this.data.assetCarValueArr[e.detail.value],
+      [assetCarValue]: this.data.assetCarValueArrValue[e.detail.value]
     })
   },
   assetCarLoanPickerChange(e) {
-    console.log(e)
-    let assetCarLoan = 'form.assetCarLoan'
+    let assetCarLoan = 'form.assetCarLoan';
     this.setData({
-      [assetCarLoan]: this.data.assetCarLoanArr[e.detail.value]
+      assetCarLoanLabel: this.data.assetCarLoanArr[e.detail.value]
     })
+    if (e.detail.value != 2) {
+      this.setData({
+        [assetCarLoan]: e.detail.value
+      })
+    }
   },
   constellationPicker(e) {
     console.log(e.detail.value)
@@ -249,18 +174,10 @@ Page({
         }
       }
     }
-    let indexArr = [];
-    for (let i = 0; i < e.detail.value.length; i++) {
-      indexArr.push(this.data.constellationArrLabel.indexOf(e.detail.value[i]))
-    }
-    let value = [];
-    for (let i = 0; i < indexArr.length; i++) {
-      value.push(this.data.constellationArrValue[indexArr[i]])
-    }
     let constellation = 'form.constellation'
     this.setData({
       constellationArr: this.data.constellationArr,
-      [constellation]: value
+      [constellation]: e.detail.value
     })
   },
   workStatusChange(e) {
@@ -276,32 +193,23 @@ Page({
         }
       }
     }
-    let indexArr = [];
-    for (let i = 0; i < e.detail.value.length; i++) {
-      indexArr.push(this.data.workStatusArrLabel.indexOf(e.detail.value[i]))
-    }
-    let value = [];
-    for (let i = 0; i < indexArr.length; i++) {
-      value.push(this.data.workStatusArrValue[indexArr[i]])
-    }
     let workStatus = 'form.workStatus'
     this.setData({
       workStatusArr: this.data.workStatusArr,
-      [workStatus]: value
+      [workStatus]: e.detail.value
     })
-
   },
   companyNaturePicker: function (e) {
     let companyNature = 'form.companyNature'
     this.setData({
-      companyNatureLabel:this.data.companyNatureArr[e.detail.value],
+      companyNatureLabel: this.data.companyNatureArr[e.detail.value],
       [companyNature]: this.data.companyNatureArrValue[e.detail.value]
     })
   },
   parentsPicker(e) {
     let parents = 'form.parents'
     this.setData({
-      parentsLabel:this.data.parentsArr[e.detail.value],
+      parentsLabel: this.data.parentsArr[e.detail.value],
       [parents]: this.data.parentsArrValue[e.detail.value]
     })
   },
@@ -317,21 +225,147 @@ Page({
       [isCommen]: this.data.isCommenArr[e.detail.value]
     })
   },
+  getForm() {
+    // tool.formDetails('he_education').then(result => {
+    //   this.setData({
+    //     educationArr: ['咋的都行'].concat(result[0]),
+    //     educationArrValue: [''].concat(result[1])
+    //   })
+    // })
+    tool.formDetails('he_income').then(result => {
+      this.setData({
+        incomeArr: ['咋的都行'].concat(result[0]),
+        incomeArrValue: [''].concat(result[1])
+      })
+    })
+    tool.formDetails('he_asset_house_area').then(result => {
+      this.setData({
+        assetAreaArr: ['咋的都行'].concat(result[0]),
+        assetAreaArrValue: [''].concat(result[1])
+      })
+    })
+    tool.formDetails('he_asset_car_value').then(result => {
+      this.setData({
+        assetCarValueArr: ['咋的都行'].concat(result[0]),
+        assetCarValueArrValue: [''].concat(result[1])
+      })
+    })
+
+    tool.formDetails('he_astrology').then(result => {
+      let constellationArr = result[0].map((item, index) => {
+        return Object.assign({}, {
+          'name': item,
+          'value': item,
+          'checked': false
+        })
+      })
+      console.log(result);
+      this.setData({
+        constellationArr: constellationArr,
+        constellationArrLabel: result[0],
+        constellationArrValue: result[1]
+      })
+    })
+    tool.formDetails('he_work_status').then(result => {
+      let workStatusArr = result[0].map((item, index) => {
+        return Object.assign({}, {
+          'name': item,
+          'value': item,
+          'checked': false
+        })
+      })
+      this.setData({
+        workStatusArr: workStatusArr,
+        workStatusArrLabel: result[0],
+        workStatusArrValue: result[1]
+      })
+    })
+    tool.formDetails('he_company_nature').then(result => {
+      this.setData({
+        companyNatureArr: result[0],
+        companyNatureArrValue: result[1]
+      })
+    })
+    tool.formDetails('he_parent_assets').then(result => {
+      this.setData({
+        parentsArr: result[0],
+        parentsArrValue: result[1]
+      })
+    })
+  },
+  getInfos() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
+      method: "get",
+      success: (res) => {
+        console.log(res.data.standard, '我是获取的信息')
+        let ageMin = 'form.ageMin';
+        let ageMax = 'form.ageMax';
+        let heightMin = 'form.heightMin';
+        let heightMax = 'from.heightMax';
+        this.setData({
+          [ageMin]: res.data.standard.ageMIn,
+          [ageMax]: res.data.standard.ageMax,
+          [heightMin]: res.data.standard.heightMin,
+          [heightMax]: res.data.standard.heightMax,
+        })
+        tool.formDetails('he_education').then(result => {
+          this.setData({
+            educationArr: ['咋的都行'].concat(result[0]),
+            educationArrValue: [''].concat(result[1])
+          })
+        })
+      }
+    })
+  },
   formSubmit(e) {
     const params = e.detail.value
     //校验表单
-    if (!this.WxValidate.checkForm(params)) {
-      const error = this.WxValidate.errorList[0]
-      this.showModal(error)
-      return false
+    // if (!this.WxValidate.checkForm(params)) {
+    //   const error = this.WxValidate.errorList[0]
+    //   this.showModal(error)
+    //   return false
+    // }
+    let constellation = 'form.constellation'
+    let workStatus = 'form.workStatus'
+    let indexArr = [];
+    for (let i = 0; i < params.constellation.length; i++) {
+      indexArr.push(this.data.constellationArrLabel.indexOf(params.constellation[i]))
+    }
+    let value = [];
+    for (let i = 0; i < indexArr.length; i++) {
+      value.push(this.data.constellationArrValue[indexArr[i]])
+    }
+    let str = '';
+    for (let i = 0; i < value.length; i++) {
+      str += value[i] + ','
+    }
+
+    let indexArr2 = [];
+    for (let i = 0; i < params.workStatus.length; i++) {
+      indexArr2.push(this.data.workStatusArrLabel.indexOf(params.workStatus[i]))
+    }
+    let value2 = [];
+    for (let i = 0; i < indexArr2.length; i++) {
+      value2.push(this.data.workStatusArrValue[indexArr2[i]])
+    }
+    let str2 = '';
+    for (let i = 0; i < value2.length; i++) {
+      str2 += value2[i] + ','
     }
+
+    this.setData({
+      [constellation]: str.slice(0, str.length - 1),
+      [workStatus]: str2.slice(0, str2.length - 1)
+    })
+    console.log(this.data.form)
     wx.request({
       url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
       method: "POST",
       header: {
         'content-type': 'application/x-www-form-urlencoded',
       },
-      data: params,
+      data: this.data.form,
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
@@ -486,62 +520,13 @@ Page({
   },
   async onLoad(options) {
     this.initValidate()
-    const getOpenid = await tool.openidStatus();
-    this.setData({
-      openid: getOpenid[0],
-      sessionkey: getOpenid[1]
-    })
-    tool.formDetails('he_education').then(result => {
-      this.setData({
-        educationArr: result[0],
-        educationArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_income').then(result => {
+    tool.openidStatus().then(result => {
       this.setData({
-        incomeArr: result[0],
-        incomeArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_astrology').then(result => {
-      let constellationArr = result[0].map((item, index) => {
-        return Object.assign({}, {
-          'name': item,
-          'value': item,
-          'checked': false
-        })
-      })
-      this.setData({
-        constellationArr: constellationArr,
-        constellationArrLabel: result[0],
-        constellationArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_work_status').then(result => {
-      let workStatusArr = result[0].map((item, index) => {
-        return Object.assign({}, {
-          'name': item,
-          'value': item,
-          'checked': false
-        })
-      })
-      this.setData({
-        workStatusArr: workStatusArr,
-        workStatusArrLabel: result[0],
-        workStatusArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_company_nature').then(result => {
-      this.setData({
-        companyNatureArr: result[0],
-        companyNatureArrValue: result[1]
-      })
-    })
-    tool.formDetails('he_parents').then(result => {
-      this.setData({
-        parentsArr: result[0],
-        parentsArrValue: result[1]
+        openid: result[0],
+        sessionkey: result[1]
       })
+      // this.getForm();
+      this.getInfos();
     })
   },
   /**

+ 12 - 12
pages/targetInfo/targetInfo.wxml

@@ -3,15 +3,15 @@
 		<view class="block" style="position:relative">
 			<view class='left' style="width:40%">多大岁数你能行</view>
 			<view style="position:absolute;right:0;top:0;width:200rpx;height:100%;display:flex;">
-				<input name="ageMin" value="{{form.ageMin}}" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input> 至
-				<input name="ageMax" value="{{form.ageMax}}" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input>
+				<input name="ageMin" value="{{form.ageMin}}" bindblur="ageMinChange" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input> 至
+				<input name="ageMax" value="{{form.ageMax}}" bindblur="ageMaxChange" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input>
 			</view>
 		</view>
 		<view class="block" style="position:relative">
 			<view class='left' style="width:50%">多高你能行</view>
 			<view style="position:absolute;right:0;top:0;width:200rpx;height:100%;display:flex;">
-				<input name="heightMin" value="{{form.heightMin}}" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input> 至
-				<input name="heightMax" value="{{form.heightMax}}" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input>
+				<input name="heightMin" value="{{form.heightMin}}" bindblur="heightMinChange" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input> 至
+				<input name="heightMax" value="{{form.heightMax}}" bindblur="heightMaxChange" style="width:100rpx;height:80rpx;border-bottom:1px solid #999;text-align:center;"></input>
 			</view>
 		</view>
 		<view class="block">
@@ -49,7 +49,7 @@
 			<view class='right' style="width:35%">
 				<picker bindchange="nativePlacePicker" range="{{nativePlaceArr}}" name='nativePlace' value="{{form.nativePlace}}">
 					<view style="text-align:right">
-						<view wx:if="{{form.nativePlace}}">{{form.nativePlace}}</view>
+						<view wx:if="{{nativePlaceLabel}}">{{nativePlaceLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
 							<view class="placetext">未选择</view>
@@ -64,7 +64,7 @@
 			<view class='right' style="width:40%">
 					<picker bindchange="marriageChange" range="{{marriageArr}}" name='marriage' value="{{form.marriage}}">
 					<view style="text-align:right">
-						<view wx:if="{{form.marriage}}">{{form.marriage}}</view>
+						<view wx:if="{{marriageLabel}}">{{marriageLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
 							<view class="placetext">未选择</view>
@@ -79,7 +79,7 @@
 			<view class='right' style="width:65%">
 				<picker bindchange="assetHousePickerChange" range="{{assetHouseArr}}" name='assetHouse' value="{{form.assetHouse}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetHouse}}">{{form.assetHouse}}</view>
+					<view wx:if="{{assetHouseLabel}}">{{assetHouseLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -94,7 +94,7 @@
 			<view class='right' style="width:65%">
 				<picker bindchange="assetAreaPickerChange" range="{{assetAreaArr}}" name='assetArea' value="{{form.assetArea}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetArea}}">{{form.assetArea}}</view>
+					<view wx:if="{{assetAreaLabel}}">{{assetAreaLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -109,7 +109,7 @@
 			<view class='right' style="width:65%">
 				<picker bindchange="assetHouseLoanPickerChange" range="{{assetHouseLoanArr}}" name='assetHouseLoan' value="{{form.assetHouseLoan}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetHouseLoan}}">{{form.assetHouseLoan}}</view>
+					<view wx:if="{{assetHouseLoanLabel}}">{{assetHouseLoanLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -124,7 +124,7 @@
 			<view class='right' style="width:65%">
 				<picker bindchange="assetCarPickerChange" range="{{assetCarArr}}" name='assetCar' value="{{form.assetCar}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetCar}}">{{form.assetCar}}</view>
+					<view wx:if="{{assetCarLabel}}">{{assetCarLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -139,7 +139,7 @@
 			<view class='right' style="width:55%">
 				<picker bindchange="assetCarValuePickerChange" range="{{assetCarValueArr}}" name='assetCarValue' value="{{form.assetCarValue}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetCarValue}}">{{form.assetCarValue}}</view>
+					<view wx:if="{{assetCarValueLabel}}">{{assetCarValueLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -154,7 +154,7 @@
 			<view class='right' style="width:55%">
 				<picker bindchange="assetCarLoanPickerChange" range="{{assetCarLoanArr}}" name='assetCarLoan' value="{{form.assetCarLoan}}">
 				<view style="text-align:right">
-					<view wx:if="{{form.assetCarLoan}}">{{form.assetCarLoan}}</view>
+					<view wx:if="{{assetCarLoanLabel}}">{{assetCarLoanLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>

+ 1 - 1
project.config.json

@@ -4,7 +4,7 @@
 		"ignore": []
 	},
 	"setting": {
-		"urlCheck": false,
+		"urlCheck": true,
 		"es6": true,
 		"postcss": true,
 		"preloadBackgroundData": false,

+ 49 - 32
utils/tool.js

@@ -1,34 +1,33 @@
 const util = require('../utils/util.js');
 const openidStatus = () => {
-  if (wx.getStorageSync('openId')) {
-    return [wx.getStorageSync('openId'), wx.getStorageSync('sessionKey')]
-  } else {
-    return new Promise((resolve, reject) => {
-      wx.login({
-        success: (res) => {
-          if (res.code) {
-            wx.request({
-              url: util.globalData.publicUrl + '/wx/user/wxbfa171fdd4000e03/login',
-              method: "GET",
-              data: {
-                code: res.code
-              },
-              success: res => {
-                console.log(res)
-                if (res.statusCode == 200) {
-                  wx.setStorageSync('openId', res.data.openid)
-                  wx.setStorageSync('sessionKey', res.data.sessionKey)
-                  return [res.data.openid, res.data.sessionKey];
-                }
+  return new Promise((resolve, reject) => {
+    // if (wx.getStorageSync('openId')) {
+    //   resolve([wx.getStorageSync('openId'), wx.getStorageSync('sessionKey')]);
+    // } else {
+    wx.login({
+      success: (res) => {
+        if (res.code) {
+          wx.request({
+            url: util.globalData.publicUrl + '/wx/user/wxbfa171fdd4000e03/login',
+            method: "GET",
+            data: {
+              code: res.code
+            },
+            success: res => {
+              console.log(res)
+              if (res.statusCode == 200) {
+                wx.setStorageSync('openId', res.data.openid)
+                wx.setStorageSync('sessionKey', res.data.sessionKey)
+                resolve([res.data.openid, res.data.sessionKey]);
               }
-            });
-          } else {
-            console.log('获取用户登录态失败!' + res.errMsg);
-          }
+            }
+          });
+        } else {
+          reject(res.errMsg);
         }
-      })
+      }
     })
-  }
+  })
 };
 
 function formatTime(date) {
@@ -38,32 +37,50 @@ function formatTime(date) {
 const formDetails = (type) => {
   return new Promise((resolve, reject) => {
     wx.request({
-      url: util.globalData.publicUrl + '/wx/member/'+ wx.getStorageSync('openId') +'/options',
+      url: util.globalData.publicUrl + '/wx/member/' + wx.getStorageSync('openId') + '/options',
       method: "GET",
       data: {
         type
       },
       success: res => {
-        console.log(res)
+        // console.log(res)
         if (res.data.code == 0) {
-          if(res.data.options){
+          if (res.data.options) {
             let labelArr = res.data.options.map((obj, index) => {
               return obj.dictLabel;
             })
             let valueArr = res.data.options.map((obj, index) => {
               return obj.dictValue;
             })
-            resolve([labelArr,valueArr])
+            resolve([labelArr, valueArr])
           }
-        }else{
+        } else {
           reject(res)
         }
       }
     })
   })
 };
+// 判断是否完善个人信息
+const isFinishInfo = () =>  {
+  return new Promise((resolve, reject) => {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "get",
+      success: (res) => {
+        console.log(res)
+        if (res.data.code == 0) {
+          resolve(res.data.info)
+        } else {
+          reject(res.code)
+        }
+      }
+    })
+  })
+};
 module.exports = {
   openidStatus,
   formDetails,
-  formatTime
+  formatTime,
+  isFinishInfo
 }