houwei 4 年之前
父节点
当前提交
a8173848c6

+ 2 - 1
app.json

@@ -1,7 +1,8 @@
 {
   "pages": [
-    "pages/targetInfo/targetInfo",
     "pages/index/index",
+    "pages/targetInfo/targetInfo",
+   
     "pages/personInfoDetail/personInfoDetail",
     "pages/onSiteActivity/onSiteActivity",
     "pages/activeDetail/activeDetail",

二进制
images/demo.png


二进制
images/morenImg.jpg


二进制
images/morenImg.png


二进制
images/remarked.png


+ 47 - 11
pages/InfoType/InfoType.js

@@ -7,19 +7,54 @@ Page({
   data: {
 
   },
-  goMyinfo(){
-    wx.navigateTo({
-      url: '/pages/personInfo/personInfo',
-    })
+  goMyinfo() {
+    // if (this.data.arr.length == 0) {
+      wx.navigateTo({
+        url: '/pages/personInfo/personInfo',
+      })
+    // } else {
+    //   wx.showModal({
+    //     title: '您当前有正在参加的活动,暂时不可修改个人信息哦',
+    //     showCancel: false
+    //   })
+    // }
   },
-  goMyinfoDetail(){
-    wx.navigateTo({
-      url: '/pages/personInfoDetail/personInfoDetail',
-    })
+  goMyinfoDetail() {
+    // if (this.data.arr.length == 0) {
+      wx.navigateTo({
+        url: '/pages/personInfoDetail/personInfoDetail',
+      })
+    // } else {
+    //   wx.showModal({
+    //     title: '您当前有正在参加的活动,暂时不可修改个人信息哦',
+    //     showCancel: false
+    //   })
+    // }
+  },
+  goMyTargetInfo() {
+    // if (this.data.arr.length == 0) {
+      wx.navigateTo({
+        url: '/pages/targetInfo/targetInfo',
+      })
+    // } else {
+    //   wx.showModal({
+    //     title: '您当前有正在参加的活动,暂时不可修改目标信息哦',
+    //     showCancel: false
+    //   })
+    // }
   },
-  goMyTargetInfo(){
-    wx.navigateTo({
-      url: '/pages/targetInfo/targetInfo',
+  getActivies() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/myActive',
+      method: "get",
+      success: (res) => {
+        console.log(res)
+        if (res.data.code == 0) {
+          this.setData({
+            arr: res.data.actives
+          })
+        }
+      }
     })
   },
   /**
@@ -31,6 +66,7 @@ Page({
         openid: result[0],
         sessionkey: result[1]
       })
+      this.getActivies();
     })
   },
 

+ 64 - 19
pages/activeDetail/activeDetail.js

@@ -1,29 +1,74 @@
 const app = require('../../utils/util.js');
 const tool = require('../../utils/tool.js');
 Page({
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
+  data: {},
   baoming() {
+    tool.isLogin().then(result => {
+      console.log('我登录成功了')
+      tool.isFinishInfo().then(result2 => {
+        tool.isFinishTargetInfo().then(redult3 => {}).catch(err => {
+          wx.showModal({
+            title: '您还未完善择偶信息',
+            showCancel: false,
+            success(res) {
+              if (res.confirm) {
+                wx.switchTab({
+                  url: '/pages/targetInfo/targetInfo',
+                })
+              }
+            }
+          })
+          return false;
+        })
+      }).catch(err => {
+        wx.showModal({
+          title: '您还未完善个人信息',
+          showCancel: false,
+          success(res) {
+            if (res.confirm) {
+              wx.switchTab({
+                url: '/pages/personInfo/personInfo',
+              })
+            }
+          }
+        })
+        return false;
+      })
+    }).catch(err => {
+      wx.showModal({
+        title: '您还未登录',
+        showCancel: false,
+        success(res) {
+          if (res.confirm) {
+            wx.switchTab({
+              url: '/pages/personal/personal',
+            })
+          }
+        }
+      })
+      return false;
+    })
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
       method: "get",
       success: (res) => {
         if (res.data.code == 0) {
           console.log(res, '报名成功了')
-          wx.redirectTo({
-            url: '/pages/registrationSuccess/registrationSuccess',
+          
+          // wx.redirectTo({
+          //   url: '/pages/registrationSuccess/registrationSuccess',
+          // })
+        }else{
+          wx.requestSubscribeMessage({
+            tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
+            success(res) {
+              console.log(res)
+            }
           })
         }
       }
     })
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
   async onLoad(options) {
     tool.openidStatus().then(result => {
       this.setData({
@@ -33,7 +78,7 @@ Page({
       this.getActivies(options.id);
     })
   },
-  getActivies(id2){
+  getActivies(id2) {
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + id2 + '/detail',
       method: "get",
@@ -41,13 +86,13 @@ Page({
         if (res.data.code == 0) {
           console.log(res, '查询活动详情')
           this.setData({
-            id:res.data.activeRoll.id,
-            actualCount:res.data.activeRoll.actualCount,
-            planCount:res.data.activeRoll.planCount,
-            activeStart:res.data.activeRoll.activeStart,
-            address:res.data.activeRoll.address,
-            remark:res.data.activeRoll.remark,
-            openId:id2
+            id: res.data.activeRoll.id,
+            actualCount: res.data.activeRoll.actualCount,
+            planCount: res.data.activeRoll.planCount,
+            activeStart: res.data.activeRoll.activeStart,
+            address: res.data.activeRoll.address,
+            remark: res.data.activeRoll.remark,
+            openId: id2
           })
           console.log(this.data.openId)
         }

+ 6 - 4
pages/activeDetail/activeDetail.wxml

@@ -1,5 +1,6 @@
 <view style="background:#fff">
-	<image src="../../images/activeimg.png" style="width:690rpx;height:400rpx;margin-left:35rpx"></image>
+	<image src="../../images/activeimg.png" style="width:690rpx;height:360rpx;margin-left:35rpx"></image>
+	<image src="../../images/remarked.png" class="remarkImg"  wx:if="{{openId!='null'}}"></image>
 	<view class="line">
 		<van-icon name="like-o" size="40rpx" color="#906cff" style="margin-left:35rpx;margin-bottom:35rpx" />
 		<p style='margin-left:35rpx'>已报名{{actualCount}}/{{planCount}}</p>
@@ -21,8 +22,9 @@
 	<view style="color:#999999;margin:35rpx;font-size:30rpx">
 		{{remark}}
 	</view>
-	<view class="btn_area">
-		<view class="btn" bindtap="baoming" wx:if="{{openId=='null'}}">报名</view>
-		<view class="btn" wx:else>已报名</view>
+	<!-- wx:if="{{openId=='null'}}" -->
+	<view class="btn_area" wx:if="{{openId=='null'}}">
+		<view class="btn" bindtap="baoming">报名</view>
+		<!-- <view class="btn" wx:else>已报名</view> -->
 	</view>
 </view>

+ 7 - 0
pages/activeDetail/activeDetail.wxss

@@ -34,4 +34,11 @@
   position: absolute;
   top: 35rpx;
   left: 35rpx;
+}
+.remarkImg{
+  width: 243rpx;
+  height: 243rpx;
+  position: fixed;
+  bottom: 100rpx;
+  right: 50rpx;
 }

+ 7 - 47
pages/index/index.js

@@ -31,65 +31,27 @@ Page({
       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({
-            isInfo: true
-          })
-        } else {
-          this.setData({
-            isInfo: false
+            arr: res.data.actives
           })
         }
       }
     })
-  },
-  //判断是否完善择偶信息
-  isFinishTargetInfo() {
     wx.request({
-      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
       method: "get",
+      data: {
+        activeStatus: 1
+      },
       success: (res) => {
-        console.log(res)
         if (res.data.code == 0) {
           this.setData({
-            isTargetInfo: true
-          })
-        } else {
-          this.setData({
-            isTargetInfo: false
+            arr1: res.data.actives
           })
+          wx.hideLoading();
         }
       }
     })
@@ -104,8 +66,6 @@ Page({
         sessionkey: result[1]
       })
       this.getActivies();
-      this.isFinishInfo();
-      this.isFinishTargetInfo();
     })
   }
 })

+ 21 - 1
pages/index/index.wxml

@@ -28,4 +28,24 @@
 			<view style="margin-left:15rpx">活动地点:{{item.address}}</view>
 		</view>
 	</view>
-</view>
+	<view wx:for="{{arr1}}" wx:key="index" class="box" bindtap="goActive" data-id='{{item.id}}' data-openId='{{item.openId}}'>
+		<view class="top">
+			<image src="../../images/activephoto.png" style="width:80rpx;height:80rpx;"></image>
+			<view class="text">
+				<view class="title">{{item.title}}</view>
+				<view class="remark">{{item.remark}}</view>
+			</view>
+			<view wx:if="{{item.openId==null}}" class="btn btn1">报名</view>
+			<view wx:else class="btn btn2">已报名</view>
+		</view>
+		<image src="../../images/activeimg.png" class="img2"></image>
+		<view class="p1">
+			<van-icon name="clock-o" color="#a267ff" size="35rpx" />
+			<view style="margin-left:15rpx">活动时间:{{item.activeTime}}</view>
+		</view>
+		<view class="p1">
+			<van-icon name="location-o" color="#a267ff" size="35rpx" />
+			<view style="margin-left:15rpx">活动地点:{{item.address}}</view>
+		</view>
+	</view>
+</view>

+ 20 - 9
pages/myActive/myActive.js

@@ -8,27 +8,22 @@ Page({
   data: {
     arr: []
   },
-  goActive(e){
+  goActive(e) {
     console.log(e.currentTarget.dataset.id)
     wx.redirectTo({
-      url: '/pages/onSiteActivity/onSiteActivity?id='+e.currentTarget.dataset.id,
+      url: '/pages/onSiteActivity/onSiteActivity?id=' + e.currentTarget.dataset.id,
     })
   },
   /**
    * 生命周期函数--监听页面加载
    */
-  async onLoad (options) {
-    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 + '/myActive',
       method: "get",
       success: (res) => {
         console.log(res)
-        if(res.data.code==0){
+        if (res.data.code == 0) {
           this.setData({
             arr: res.data.actives
           })
@@ -36,6 +31,22 @@ Page({
       }
     })
   },
+  onLoad(options) {
+    tool.openidStatus().then(result => {
+      this.setData({
+        openid: result[0],
+        sessionkey: result[1]
+      })
+      this.getActivies();
+    })
+    
+    // const getOpenid = await tool.openidStatus();
+    // this.setData({
+    //   openid: getOpenid[0],
+    //   sessionkey: getOpenid[1]
+    // })
+
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 17 - 20
pages/onSiteActivity/onSiteActivity.js

@@ -15,13 +15,10 @@ Page({
   },
   love(e) {
     console.log(e)
-    let status = this.data.checkArr[e.currentTarget.dataset.index]
-    let statusValue = 'checkArr[' + e.currentTarget.dataset.index + ']'
+    let status = this.data.member[e.currentTarget.dataset.index].hearted
+    let status1 = 'member['+e.currentTarget.dataset.index+'].hearted'
     console.log(status)
-    if (status) {
-      this.setData({
-        [statusValue]: false
-      })
+    if (status == 0) {
       wx.request({
         url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/unfollow',
         method: "get",
@@ -31,14 +28,16 @@ Page({
         success: (res) => {
           if (res.data.code == 0) {
             console.log(res, '我取消心动了')
+            this.setData({
+              [status1]:1,
+              member:this.data.member
+            })
+            console.log(this.data.member)
             this.getMyheartNowTimes();
           }
         }
       })
     } else {
-      this.setData({
-        [statusValue]: true
-      })
       wx.request({
         url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/heartbeat',
         method: "get",
@@ -48,6 +47,11 @@ Page({
         success: (res) => {
           if (res.data.code == 0) {
             console.log(res, '我心动了')
+            this.setData({
+              [status1]:0,
+              member:this.data.member
+            })
+            console.log(this.data.member)
             this.getMyheartNowTimes();
           }
         }
@@ -55,7 +59,7 @@ Page({
     }
   },
   // 获取我的心动次数
-  getMyheartNowTimes(){
+  getMyheartNowTimes() {
     wx.request({
       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/myHearts',
       method: "get",
@@ -88,24 +92,17 @@ Page({
       success: (res) => {
         if (res.data.code == 0) {
           console.log(res.data.members, '我获取人员名单')
-          this.setData({
-            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
               })
+              // 删除自己
+            //  res.data.members.splice(i,1);
             }
           }
           this.setData({
-            checkArr: checkArr1
+            member: res.data.members
           })
         }
       }

+ 22 - 22
pages/onSiteActivity/onSiteActivity.wxml

@@ -2,27 +2,27 @@
 	<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="{{heartTime}}" wx:key="index" style="z-index:10;">
-			<image src="../../images/heart.png" style="width:50rpx;height:50rpx"></image>
+		<view class="heartbox">
+			<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="{{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>
-		<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'>嘉宾: {{member.length}}名</view>
-  <view class="tousu" bindtap="goTousu">投诉反馈</view>
-  </view>
-  </view>
-  <view class="photobox">
-  	<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>
-  </view>
+	<view class="num">
+		<view class='allnum'>嘉宾: {{member.length}}名</view>
+		<view class="tousu" bindtap="goTousu">投诉反馈</view>
+	</view>
+</view>
+<view class="photobox">
+	<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="{{item.hearted==0}}"></image>
+	</view>
+</view>

+ 294 - 199
pages/personInfoDetail/personInfoDetail.js

@@ -1,5 +1,4 @@
 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');
@@ -20,7 +19,7 @@ Page({
       assetCar: '',
       assetCarValue: '',
       assetCarLoan: '',
-      isCommen: '',
+      isCommon: '',
       controlTime: '',
       workStatus: '',
       companyNature: '',
@@ -46,7 +45,7 @@ Page({
     assetCarArr: [],
     assetCarValueArr: [],
     assetCarLoanArr: [],
-    isCommenArr: ['没有', '一起'],
+    isCommonArr: ['没有', '一起'],
     controlTimeArr: [],
     workStatusArr: [],
     companyNatureArr: [],
@@ -55,7 +54,7 @@ Page({
     matherWorkArr: [],
     parentAssetsArr: [],
     compositionArr: [],
-    figureArr: ['龟息养生从不运动', '三天打鱼偶尔运动', '动如脱兔成天运动']
+    motionStateArr: []
   },
   phoneChange(e) {
     let phone = 'form.phone'
@@ -154,11 +153,11 @@ Page({
       [assetCarLoan]: this.data.assetCarLoanArrValue[e.detail.value]
     })
   },
-  isCommenChange(e) {
-    let isCommen = 'form.isCommen'
+  isCommonChange(e) {
+    let isCommon = 'form.isCommon'
     this.setData({
-      [isCommen]: e.detail.value,
-      isCommenLabel: this.data.isCommenArr[e.detail.value],
+      [isCommon]: e.detail.value,
+      isCommonLabel: this.data.isCommonArr[e.detail.value],
     })
   },
   controlTimeChange(e) {
@@ -261,7 +260,8 @@ Page({
   figurePicker(e) {
     let motionState = 'form.motionState'
     this.setData({
-      [motionState]: this.data.figureArr[e.detail.value]
+      [motionState]: e.detail.value,
+      motionStateLabel: this.data.motionStateArr[e.detail.value],
     })
   },
   hobbyChange(e) {
@@ -304,7 +304,7 @@ Page({
       url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
       method: "get",
       success: (res) => {
-        console.log(res.data.info, '我是获取的信息')
+        console.log(res, '我是获取的信息')
         let phone = 'form.phone'
         let height = 'form.height'
         let weight = 'form.weight'
@@ -318,7 +318,7 @@ Page({
         let assetCar = 'form.assetCar'
         let assetCarValue = 'form.assetCarValue'
         let assetCarLoan = 'form.assetCarLoan'
-        let isCommen = 'form.isCommen'
+        let isCommon = 'form.isCommon'
         let controlTime = 'form.controlTime'
         let workStatus = 'form.workStatus'
         let companyNature = 'form.companyNature'
@@ -331,146 +331,197 @@ Page({
         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]
-              })
+          this.setData({
+            heightArr: result[0],
+            heightArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            weightArr: result[0],
+            weightArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            educationArr: result[0],
+            educationArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            incomeArr: result[0],
+            incomeArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            marriageList: result[0],
+            marriageListValue: result[1]
+          })
+          if (res.data.info) {
+            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]
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            childrenArr: result[0],
+            childrenArrValue: result[1]
+          })
+          if (res.data.info) {
+            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]
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetHouseArr: result[0],
+            assetHouseArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetAreaArr: result[0],
+            assetAreaArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetHouseLoanArr: result[0],
+            assetHouseLoanArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetCarArr: result[0],
+            assetCarArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetCarValueArr: result[0],
+            assetCarValueArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            assetCarLoanArr: result[0],
+            assetCarLoanArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
@@ -482,29 +533,34 @@ Page({
               '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)
+
+          if (res.data.info) {
+            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;
+            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({
+              [controlTime]: resControlTimeLabel
+            })
           }
           this.setData({
             controlTimeArr: controlTimeArr,
             controlTimeArrLabel: result[0],
             controlTimeArrValue: result[1],
-            [controlTime]: resControlTimeLabel
           })
         })
         tool.formDetails('he_work_status').then(result => {
@@ -515,54 +571,60 @@ Page({
               '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)
+          if (res.data.info) {
+            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;
+            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({
+              [workStatus]: resWorkStatusLabel
+            })
           }
           this.setData({
             workStatusArr: workStatusArr,
             workStatusArrLabel: result[0],
-            workStatusArrValue: result[1],
-            [workStatus]: resWorkStatusLabel
+            workStatusArrValue: result[1]
           })
         })
         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]
-              })
+          if (res.data.info) {
+            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.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]
-              })
+            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({
@@ -574,35 +636,45 @@ Page({
             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],
-        })
+        if (res.data.info) {
+          this.setData({
+            [phone]: res.data.info.tel,
+            [company]: res.data.info.company,
+            [hobby]: res.data.info.hobby,
+            [isCommon]: res.data.info.isCommon,
+            isCommonLabel: this.data.isCommonArr[res.data.info.isCommon],
+          })
+        }
         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]
-              })
+          this.setData({
+            parentsArr: result[0],
+            parentsArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+                })
+              }
             }
           }
         })
         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]
-              })
+          this.setData({
+            parentAssetsArr: result[0],
+            parentAssetsArrValue: result[1]
+          })
+          if (res.data.info) {
+            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],
+
+                })
+              }
             }
           }
         })
@@ -614,30 +686,53 @@ Page({
               '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)
+          if (res.data.info) {
+            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;
+            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({
+              [composition]: resCompositionLabel
+            })
           }
           this.setData({
             compositionArr: compositionArr,
             compositionArrLabel: result[0],
             compositionArrValue: result[1],
-            [composition]: resCompositionLabel
+
+          })
+        })
+        tool.formDetails('he_sports').then(result => {
+          console.log(result)
+          this.setData({
+            motionStateArr: result[0],
+            motionStateValue: result[1]
           })
+          if (res.data.info) {
+            for (let i = 0; i < result[0].length; i++) {
+              if (result[1][i] == res.data.info.motionState) {
+                console.log(i)
+                this.setData({
+                  motionStateLabel: result[0][i],
+                  [motionState]: result[1][i],
+                })
+              }
+            }
+          }
         })
       }
     })
@@ -774,7 +869,7 @@ Page({
       assetCarLoan: {
         required: true
       },
-      isCommen: {
+      isCommon: {
         required: true
       },
       controlTime: {
@@ -845,7 +940,7 @@ Page({
       assetCarLoan: {
         required: '请选择车子贷款了没'
       },
-      isCommen: {
+      isCommon: {
         required: '请选择是否与父母同住'
       },
       controlTime: {

+ 4 - 4
pages/personInfoDetail/personInfoDetail.wxml

@@ -232,8 +232,8 @@
 				<view class="block">
 					<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="{{isCommenLabel}}">{{isCommenLabel}}</view>
+						<picker bindchange="isCommonChange" range="{{isCommonArr}}" name='isCommon' value="{{form.isCommon}}">
+							<view wx:if="{{isCommonLabel}}">{{isCommonLabel}}</view>
 							<view wx:else class='placeStyle'>
 								<view class="redpoint"></view>
 								<view class="placetext">未选择</view>
@@ -299,9 +299,9 @@
 			<view class="block">
 				<view class='left' style="width:40%">你这身材可以啊</view>
 				<view class='right' style="width:60%">
-					<picker bindchange="figurePicker" range="{{figureArr}}" name='motionState' value="{{form.motionState}}">
+					<picker bindchange="figurePicker" range="{{motionStateArr}}" name='motionState' value="{{form.motionState}}">
 						<view style="text-align:right">
-							<view wx:if="{{form.motionState}}">{{form.motionState}}</view>
+							<view wx:if="{{motionStateLabel}}">{{motionStateLabel}}</view>
 							<view wx:else class='placeStyle'>
 								<view class="redpoint"></view>
 								<view class="placetext">未选择</view>

+ 12 - 10
pages/personal/personal.js

@@ -2,7 +2,7 @@ const app = require('../../utils/util.js');
 const tool = require('../../utils/tool.js');
 Page({
   data: {
-    avatarUrl: '../../images/morenImg.jpg',
+    avatarUrl: '../../images/morenImg.png',
     tabArr: [{
         name: '我的信息',
         img: '../../images/icon1.png',
@@ -24,11 +24,12 @@ Page({
       //   name: '投诉',
       //   img: '../../images/icon5.png',
       //   url: '/pages/complaint/complaint'
-      // }, {
-      //   name: '推荐好友',
-      //   img: '../../images/icon6.png',
-      //   url: '/pages/share/share'
-      // }
+      // }, 
+      {
+        name: '推荐好友',
+        img: '../../images/icon6.png',
+        url: '/pages/share/share'
+      }
     ]
   },
   goTab(e) {
@@ -102,16 +103,17 @@ Page({
     })
   },
   upload(nickName, avatar) {
+    const form = {
+      nickName: nickName,
+      avatar: 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
-      },
+      data: form,
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {

+ 53 - 108
pages/share/share.js

@@ -1,108 +1,39 @@
 const app = require('../../utils/util.js');
 Page({
   data: {
-    codeImg: '../../images/ewm.png'
+    codeImg: '../../images/ewm.png',
+    bj: '../../images/ewmbj.png'
   },
   save() {
-    let that= this;
-    wx.getSetting({
-      success: (res) => {
-        console.log(res)
-        if (!res.authSetting['scope.writePhotosAlbum']) {
-          wx.authorize({
-            scope: 'scope.writePhotosAlbum',
-            success() {
-              console.log(res, "我点击同意啦")
-              wx.showLoading({
-                title: '保存中...'
-              })
-              let imgSrc = that.data.codeImg;
-              wx.downloadFile({
-                url: imgSrc,
-                success: function (res) {
-                  console.log(res, '我下载完成啦');
-                  //图片保存到本地
-                  wx.saveImageToPhotosAlbum({
-                    filePath: res.tempFilePath,
-                    success: function (data) {
-                      console.log(data, '我保存成功啦')
-                      wx.hideLoading();
-                      wx.showToast({
-                        title: '保存成功',
-                        icon: 'success',
-                        duration: 2000
-                      })
-                    },
-                    fail: function (err) {
-                      console.log(err, '我保存失败啦')
-                      wx.hideLoading();
-                      if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
-                        console.log("当初用户拒绝,再次发起授权")
-                        wx.openSetting({
-                          success(settingdata) {
-                            console.log(settingdata)
-                            if (settingdata.authSetting['scope.writePhotosAlbum']) {
-                              console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
-                            } else {
-                              console.log('获取权限失败,给出不给权限就无法正常使用的提示')
-                            }
-                          }
-                        })
-                      }
-                    },
-                    complete(res) {
-                      console.log(res);
-                    }
-                  })
-                },
-                complete(res) {
-                  wx.hideLoading()
-                }
-              })
-            }
-          })
-        } else {
-          wx.showLoading({
-            title: '保存中...'
-          })
-          console.log(this.data.classInfo.codeImg)
-          let imgSrc = this.data.classInfo.codeImg
-          wx.downloadFile({
-            url: imgSrc,
-            success: function (res) {
-              console.log(res, '我下载完成啦');
-              wx.hideLoading();
-              //图片保存到本地
-              wx.saveImageToPhotosAlbum({
-                filePath: res.tempFilePath,
-                success: function (data) {
-                  console.log(data, '我保存成功啦')
-                  wx.hideLoading();
-                  wx.showToast({
-                    title: '保存成功',
-                    icon: 'success',
-                    duration: 2000
-                  })
-                },
-                fail: function (err) {
-                  console.log(err, '我保存失败啦')
-                  wx.hideLoading();
-                  if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
-                    console.log("当初用户拒绝,再次发起授权")
-                    wx.openSetting({
-                      success(settingdata) {
-                        console.log(settingdata)
-                        if (settingdata.authSetting['scope.writePhotosAlbum']) {
-                          console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
-                        } else {
-                          console.log('获取权限失败,给出不给权限就无法正常使用的提示')
-                        }
-                      }
-                    })
+    wx.saveImageToPhotosAlbum({
+      filePath: this.data.imagePath,
+      success:(data)=> {
+        console.log(data)
+        let fileMgr = wx.getFileSystemManager()
+        fileMgr.unlink({
+          filePath: this.data.imagePath,
+          success() {
+            wx.showToast({
+              title: '已保存',
+              duration: 2000
+            })
+          }
+        })
+      },
+      fail(err) {
+        if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") {
+          wx.showModal({
+            title: '提示',
+            content: '需要您授权保存相册',
+            showCancel: false,
+            success: modalSuccess => {
+              wx.openSetting({
+                success(settingdata) {
+                  if (settingdata.authSetting['scope.writePhotosAlbum']) {
+                    console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
+                  } else {
+                    console.log('获取权限失败,给出不给权限就无法正常使用的提示')
                   }
-                },
-                complete(res) {
-                  console.log(res);
                 }
               })
             }
@@ -115,7 +46,29 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    wx.showLoading();
+    console.log('1111111')
+    const ctx = wx.createCanvasContext('myCanvasId');
+    ctx.drawImage(this.data.bj, 0, 0, 302, 256); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
+    ctx.drawImage(this.data.codeImg, 88, 114, 114, 114);
+    ctx.draw();
+    this.save();
+    setTimeout(() => {
+      wx.canvasToTempFilePath({
+        canvasId: 'myCanvasId',
+        success: (res) => {
+          var tempFilePath = res.tempFilePath;
+          this.setData({
+            imagePath: tempFilePath
+          })
+          wx.hideLoading();
+        },
+        fail: (res) => {
+          console.log(res);
+          wx.hideLoading();
+        }
+      });
+    }, 200);
   },
 
   /**
@@ -138,17 +91,9 @@ Page({
   onHide: function () {
 
   },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
   onUnload: function () {
 
   },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
   onPullDownRefresh: function () {
 
   },

+ 4 - 2
pages/share/share.wxml

@@ -1,5 +1,7 @@
 <view style="position:relative">
-	<image src='../../images/ewmbj.png' style="width:604rpx;height:512rpx;margin:100rpx 73rpx" />
-	<image src="{{codeImg}}" style="position:absolute;top:328rpx;left:248rpx;width:220rpx;height:220rpx;"/>
+	<!-- <image src='{{bj}}' style="width:604rpx;height:512rpx;margin:100rpx 73rpx" />
+	<image src="{{codeImg}}" style="position:absolute;top:328rpx;left:248rpx;width:220rpx;height:220rpx;"/> -->
+
+	<canvas canvas-id="myCanvasId" style="width:604rpx;height:512rpx;margin:100rpx auto 30rpx auto;"></canvas>
 	<button id="sunbmit" bindtap="save">保存二维码</button>
 </view>

+ 247 - 104
pages/targetInfo/targetInfo.js

@@ -13,7 +13,7 @@ Page({
       nativePlace: '',
       marriage: '',
       assetHouse: '',
-      assetArea: '',
+      assetHouseArea: '',
       assetHouseLoan: '',
       assetCar: '',
       assetCarValue: '',
@@ -21,10 +21,10 @@ Page({
       constellation: '',
       workStatus: '',
       companyNature: '',
-      parents: '',
+      parentAssets: '',
       composition: '',
-      isCommen: '',
-      // id:''
+      isCommon: '',
+      id: ''
     },
     educationArr: [],
     incomeArr: [],
@@ -33,15 +33,15 @@ Page({
     constellationArr: [],
     workStatusArr: [],
     assetHouseArr: ['租房', '购房', '咋的都行'],
-    assetAreaArr: [],
+    assetHouseAreaArr: [],
     assetHouseLoanArr: ['有', '没有', '咋的都行'],
     assetCarArr: ['有', '没有', '咋的都行'],
     assetCarValueArr: [],
     assetCarLoanArr: ['不行', '行', '咋的都行'],
     companyNatureArr: [],
-    parentsArr: [],
+    parentAssetsArr: [],
     compositionArr: ['老几都行', '必须独苗一根'],
-    isCommenArr: ['愿意', '不愿意', '咋的都行']
+    isCommonArr: ['愿意', '不愿意', '咋的都行']
   },
   ageMinChange(e) {
     let ageMin = 'form.ageMin'
@@ -114,11 +114,11 @@ Page({
       })
     }
   },
-  assetAreaPickerChange(e) {
-    let assetArea = 'form.assetArea'
+  assetHouseAreaPickerChange(e) {
+    let assetHouseArea = 'form.assetHouseArea'
     this.setData({
-      assetAreaLabel: this.data.assetAreaArr[e.detail.value],
-      [assetArea]: this.data.assetAreaArrValue[e.detail.value]
+      assetHouseAreaLabel: this.data.assetHouseAreaArr[e.detail.value],
+      [assetHouseArea]: this.data.assetHouseAreaArrValue[e.detail.value]
     })
   },
   assetHouseLoanPickerChange(e) {
@@ -206,91 +206,25 @@ Page({
       [companyNature]: this.data.companyNatureArrValue[e.detail.value]
     })
   },
-  parentsPicker(e) {
-    let parents = 'form.parents'
+  parentAssetsPicker(e) {
+    let parentAssets = 'form.parentAssets'
     this.setData({
-      parentsLabel: this.data.parentsArr[e.detail.value],
-      [parents]: this.data.parentsArrValue[e.detail.value]
+      parentAssetsLabel: this.data.parentAssetsArr[e.detail.value],
+      [parentAssets]: this.data.parentAssetsArrValue[e.detail.value]
     })
   },
   compositionPicker(e) {
     let composition = 'form.composition'
     this.setData({
-      [composition]: this.data.compositionArr[e.detail.value]
+      [composition]: e.detail.value,
+      compositionLabel: this.data.compositionArr[e.detail.value],
     })
   },
-  isCommenPicker(e) {
-    let isCommen = 'form.isCommen'
+  isCommonPicker(e) {
+    let isCommon = 'form.isCommon'
     this.setData({
-      [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]
-      })
+      [isCommon]: e.detail.value,
+      isCommonLabel: this.data.isCommonArr[e.detail.value]
     })
   },
   getInfos() {
@@ -299,22 +233,231 @@ Page({
       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,
-        })
+      
+          let ageMin = 'form.ageMin';
+          let ageMax = 'form.ageMax';
+          let heightMin = 'form.heightMin';
+          let heightMax = 'form.heightMax';
+          let income = 'form.income';
+          let nativePlace = 'form.nativePlace';
+          let education = 'form.education';
+          let marriage = 'form.marriage';
+          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 constellation = 'form.constellation';
+          let workStatus = 'form.workStatus';
+          let companyNature = 'form.companyNature';
+          let composition = 'form.composition';
+          let parentAssets = 'form.parentAssets';
+          let isCommon = 'form.isCommon';
+          let id = 'form.id'
+          if (res.data.standard) {
+          this.setData({
+            [ageMin]: res.data.standard.ageMin,
+            [ageMax]: res.data.standard.ageMax,
+            [heightMin]: res.data.standard.heightMin,
+            [heightMax]: res.data.standard.heightMax,
+            nativePlaceLabel: this.data.nativePlaceArr[res.data.standard.nativePlace],
+            [nativePlace]: res.data.standard.nativePlace,
+            marriageLabel: this.data.marriageArr[res.data.standard.marriage],
+            [marriage]: res.data.standard.marriage,
+            assetHouseLabel: this.data.assetHouseArr[res.data.standard.assetHouse],
+            [assetHouse]: res.data.standard.assetHouse,
+            assetHouseAreaLabel: this.data.assetHouseAreaArr[res.data.standard.assetHouseArea],
+            [assetHouseArea]: res.data.standard.assetHouseArea,
+            assetHouseLoanLabel: this.data.assetHouseLoanArr[res.data.standard.assetHouseLoan],
+            [assetHouseLoan]: res.data.standard.assetHouseLoan,
+            assetCarLabel: this.data.assetCarArr[res.data.standard.assetCar],
+            [assetCar]: res.data.standard.assetCar,
+            assetCarLoanLabel: this.data.assetCarLoanArr[res.data.standard.assetCarLoan],
+            [assetCarLoan]: res.data.standard.assetCarLoan,
+            compositionLabel: this.data.compositionArr[res.data.standard.composition],
+            [composition]: res.data.standard.composition,
+            isCommonLabel: this.data.isCommonArr[res.data.standard.isCommon],
+            [isCommon]: res.data.standard.isCommon,
+            [id]: res.data.standard.id
+          })
+        }
         tool.formDetails('he_education').then(result => {
+          console.log(result)
           this.setData({
             educationArr: ['咋的都行'].concat(result[0]),
-            educationArrValue: [''].concat(result[1])
+            educationArrValue: [''].concat(result[1]),
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.education == [''].concat(result[1])[i]) {
+                this.setData({
+                  educationLabel: ['咋的都行'].concat(result[0])[i],
+                  [education]: res.data.standard.education
+                })
+              }
+            }
+          }
+        })
+        tool.formDetails('he_income').then(result => {
+          this.setData({
+            incomeArr: ['咋的都行'].concat(result[0]),
+            incomeArrValue: [''].concat(result[1])
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.income == [''].concat(result[1])[i]) {
+                this.setData({
+                  incomeLabel: ['咋的都行'].concat(result[0])[i],
+                  [income]: res.data.standard.income
+                })
+              }
+            }
+          }
+        })
+        tool.formDetails('he_asset_house_area').then(result => {
+          this.setData({
+            assetHouseAreaArr: ['咋的都行'].concat(result[0]),
+            assetHouseAreaArrValue: [''].concat(result[1])
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.assetHouseArea == [''].concat(result[1])[i]) {
+                this.setData({
+                  assetHouseAreaLabel: ['咋的都行'].concat(result[0])[i],
+                  [assetHouseArea]: res.data.standard.assetHouseArea
+                })
+              }
+            }
+          }
+        })
+        tool.formDetails('he_asset_car_value').then(result => {
+          this.setData({
+            assetCarValueArr: ['咋的都行'].concat(result[0]),
+            assetCarValueArrValue: [''].concat(result[1])
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.assetCarValue == [''].concat(result[1])[i]) {
+                this.setData({
+                  assetCarValueLabel: ['咋的都行'].concat(result[0])[i],
+                  [assetCarValue]: res.data.standard.assetCarValue
+                })
+              }
+            }
+          }
+        })
+        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);
+          if (res.data.standard) {
+            let resComposition = res.data.standard.constellation.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] == constellationArr[i].value) {
+                constellationArr[i].checked = true;
+              }
+            }
+            this.setData({
+              [constellation]: resCompositionLabel
+            })
+          }
+          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
+            })
+          })
+          if (res.data.standard) {
+            let resWorkStatus = res.data.standard.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({
+              [workStatus]: resWorkStatusLabel
+            })
+          }
+          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]
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.companyNature == [''].concat(result[1])[i]) {
+                this.setData({
+                  companyNatureLabel: ['咋的都行'].concat(result[0])[i],
+                  [companyNature]: res.data.standard.companyNature
+                })
+              }
+            }
+          }
+        })
+        tool.formDetails('he_parent_assets').then(result => {
+          this.setData({
+            parentAssetsArr: ['咋的都行'].concat(result[0]),
+            parentAssetsArrValue: [''].concat(result[1])
+          })
+          if (res.data.standard) {
+            for (let i = 0; i < [''].concat(result[1]).length; i++) {
+              if (res.data.standard.parentAssets == [''].concat(result[1])[i]) {
+                this.setData({
+                  parentAssetsLabel: ['咋的都行'].concat(result[0])[i],
+                  [parentAssets]: res.data.standard.parentAssets
+                })
+              }
+            }
+          }
+        })
+
       }
     })
   },
@@ -420,7 +563,7 @@ Page({
       assetHouse: {
         required: true
       },
-      assetArea: {
+      assetHouseArea: {
         required: true
       },
       assetHouseLoan: {
@@ -444,13 +587,13 @@ Page({
       companyNature: {
         required: true
       },
-      parents: {
+      parentAssets: {
         required: true
       },
       composition: {
         required: true
       },
-      isCommen: {
+      isCommon: {
         required: true
       }
     }
@@ -482,7 +625,7 @@ Page({
       assetHouse: {
         required: '请选择您可以接受的房子状态'
       },
-      assetArea: {
+      assetHouseArea: {
         required: '请选择您可以接受的房子面积'
       },
       assetHouseLoan: {
@@ -506,13 +649,13 @@ Page({
       companyNature: {
         required: '请选择您能接受的单位性质'
       },
-      parents: {
+      parentAssets: {
         required: '请选择您能接受的父母状态'
       },
       composition: {
         required: '请选择您可以接受的家庭构成'
       },
-      isCommen: {
+      isCommon: {
         required: '请选择您是否接受与父母同住'
       }
     }

+ 7 - 7
pages/targetInfo/targetInfo.wxml

@@ -92,9 +92,9 @@
 		<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="assetHouseAreaPickerChange" range="{{assetHouseAreaArr}}" name='assetHouseArea' value="{{form.assetHouseArea}}">
 				<view style="text-align:right">
-					<view wx:if="{{assetAreaLabel}}">{{assetAreaLabel}}</view>
+					<view wx:if="{{assetHouseAreaLabel}}">{{assetHouseAreaLabel}}</view>
 					<view wx:else class='placeStyle'>
 						<view class="redpoint"></view>
 						<view class="placetext">未选择</view>
@@ -200,7 +200,7 @@
 			<view class='right' style="width:35%">
 				<picker bindchange="compositionPicker" range="{{compositionArr}}" name='composition' value="{{form.composition}}">
 					<view style="text-align:right">
-						<view wx:if="{{form.composition}}">{{form.composition}}</view>
+						<view wx:if="{{compositionLabel}}">{{compositionLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
 							<view class="placetext">未选择</view>
@@ -213,9 +213,9 @@
 		<view class="block">
 			<view class='left' style="width:45%">父母经济</view>
 			<view class='right' style="width:55%">
-				<picker bindchange="parentsPicker" range="{{parentsArr}}" name='parents' value="{{form.parents}}">
+				<picker bindchange="parentAssetsPicker" range="{{parentAssetsArr}}" name='parentAssets' value="{{form.parentAssets}}">
 					<view style="text-align:right">
-						<view wx:if="{{parentsLabel}}">{{parentsLabel}}</view>
+						<view wx:if="{{parentAssetsLabel}}">{{parentAssetsLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
 							<view class="placetext">未选择</view>
@@ -228,9 +228,9 @@
 				<view class="block">
 			<view class='left' style="width:45%">是否愿意与父母同住</view>
 			<view class='right' style="width:55%">
-				<picker bindchange="isCommenPicker" range="{{isCommenArr}}" name='isCommen' value="{{form.isCommen}}">
+				<picker bindchange="isCommonPicker" range="{{isCommonArr}}" name='isCommon' value="{{form.isCommon}}">
 					<view style="text-align:right">
-						<view wx:if="{{form.isCommen}}">{{form.isCommen}}</view>
+						<view wx:if="{{isCommonLabel}}">{{isCommonLabel}}</view>
 						<view wx:else class='placeStyle'>
 							<view class="redpoint"></view>
 							<view class="placetext">未选择</view>

+ 44 - 9
utils/tool.js

@@ -61,26 +61,61 @@ const formDetails = (type) => {
     })
   })
 };
+// 判断是否登录
+const isLogin = () => {
+  return new Promise((resolve, reject) => {
+    wx.request({
+      url: util.globalData.publicUrl + '/wx/member/' + wx.getStorageSync('openId') + '/info',
+      method: "get",
+      success: (res) => {
+        console.log(res)
+        if (res.data.code == 0 && res.data.info.avatar) {
+          resolve(res.data.info.avatar);
+        } else {
+          reject(res)
+        }
+      }
+    })
+  })
+};
 // 判断是否完善个人信息
-const isFinishInfo = () =>  {
+const isFinishInfo = () => {
   return new Promise((resolve, reject) => {
     wx.request({
-      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      url: util.globalData.publicUrl + '/wx/member/' + wx.getStorageSync('openId') + '/info',
       method: "get",
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
           resolve(res.data.info)
         } else {
-          reject(res.code)
+          reject(res.data.code)
         }
       }
     })
   })
 };
-module.exports = {
-  openidStatus,
-  formDetails,
-  formatTime,
-  isFinishInfo
-}
+const isFinishTargetInfo = () => {
+    return new Promise((resolve, reject) => {
+      wx.request({
+        url: util.globalData.publicUrl + '/wx/member/' + wx.getStorageSync('openId') + '/standard',
+        method: "get",
+        success: (res) => {
+          console.log(res)
+          if (res.data.code == 0) {
+            resolve(res.data.standard);
+          } else {
+            reject(res.data.code)
+          }
+        }
+      })
+    })
+  };
+  module.exports = {
+    openidStatus,
+    formDetails,
+    formatTime,
+    isLogin,
+    isFinishInfo,
+    isFinishTargetInfo
+  }