From 5424fb6cc7c907ec12025e96bb41146b28e5582c Mon Sep 17 00:00:00 2001
From: xusd <hugeinfo123>
Date: Sun, 08 Sep 2024 10:00:34 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh

---
 gz-wxparty/pages/perfectInformation/index.js |  383 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 201 insertions(+), 182 deletions(-)

diff --git a/gz-wxparty/pages/perfectInformation/index.js b/gz-wxparty/pages/perfectInformation/index.js
index b7bc4bc..422da58 100644
--- a/gz-wxparty/pages/perfectInformation/index.js
+++ b/gz-wxparty/pages/perfectInformation/index.js
@@ -3,198 +3,217 @@
 
 // 保存信息
 function setUserInfoApi(submitData) {
-	return $$.request({ url: 'paUser/perfectInfo', type: 'post', submitData, service: 'cust' });
+  return $$.request({
+    url: 'paUser/perfectInfo',
+    type: 'post',
+    submitData,
+    service: 'cust'
+  });
 }
 
 Page({
-	/**
-	 * 页面的初始数据
-	 */
-	copySubmitData: {}, // 数据复制
-	isCheck: false,
-	data: {
-		submitData: {
-			trueName: '',
-			mobile: '',
-			sex: '09_00003-1',
-			sexName: '男',
-			idcardType: '09_00015-1',
-			idcardTypeName: '身份证',
-			idcard: '',
-			prov: '',
-			provName: '',
-			city: '',
-			cityName: '',
-			area: '',
-			areaName: '',
-			road: '',
-			roadName: '',
-			village: '',
-			villageName: '',
-			addr: '',
-		},
-		popup: {}, // 下拉弹出框数据
-		isCheck: false, // 是否只是查看
-		isImproveData: false, // 是否是完善资料进入,则不显示身份证的修改
-	},
+  /**
+   * 页面的初始数据
+   */
+  copySubmitData: {}, // 数据复制
+  isCheck: false,
+  data: {
+    submitData: {
+      trueName: '',
+      mobile: '',
+      sex: '09_00003-1',
+      sexName: '男',
+      idcardType: '09_00015-1',
+      idcardTypeName: '身份证',
+      idcard: '',
+      prov: '',
+      provName: '',
+      city: '',
+      cityName: '',
+      area: '',
+      areaName: '',
+      road: '',
+      roadName: '',
+      village: '',
+      villageName: '',
+      addr: '',
+    },
+    popup: {}, // 下拉弹出框数据
+    isCheck: false, // 是否只是查看
+    isImproveData: false, // 是否是完善资料进入,则不显示身份证的修改
+  },
 
-	// 展示弹出层
-	handleShowPopup(e) {
-		this.setData({ popup: e.detail });
-	},
+  // 展示弹出层
+  handleShowPopup(e) {
+    this.setData({
+      popup: e.detail
+    });
+  },
 
-	// 关闭弹出层
-	handleClosePopup() {
-		this.data.popup.visible = false;
-		this.setData({ popup: this.data.popup });
-	},
+  // 关闭弹出层
+  handleClosePopup() {
+    this.data.popup.visible = false;
+    this.setData({
+      popup: this.data.popup
+    });
+  },
 
-	// 下拉框确认选择
-	handleConfirmPicker({ detail }) {
-		let type = this.data.popup.type;
-		let value = detail.detail.value;
-		let arr = [];
-		this.data.popup.visible = false;
-		if (type === 'location') {
-			arr = [
-				['prov', 'provName'],
-				['city', 'cityName'],
-				['area', 'areaName'],
-				['road', 'roadName'],
-				['village', 'villageName'],
-			];
-			arr.forEach((x, t) => {
-				this.data.submitData[x[0]] = value[t]?.value || '';
-				this.data.submitData[x[1]] = value[t]?.label || '';
-			});
-		} else {
-			if (type === 'cardType') {
-				arr = ['idcardType', 'idcardTypeName'];
-			} else if (type === 'sex') {
-				arr = ['sex', 'sexName'];
-			}
-			arr.forEach((x, t) => {
-				this.data.submitData[x] = value[t === 0 ? 'value' : 'label'];
-			});
-		}
-		this.setData({ submitData: this.data.submitData, popup: this.data.popup });
-	},
+  // 下拉框确认选择
+  handleConfirmPicker({
+    detail
+  }) {
+    let type = this.data.popup.type;
+    let value = detail.detail.value;
+    let arr = [];
+    this.data.popup.visible = false;
+    if (type === 'location') {
+      arr = [
+        ['prov', 'provName'],
+        ['city', 'cityName'],
+        ['area', 'areaName'],
+        ['road', 'roadName'],
+        ['village', 'villageName'],
+      ];
+      arr.forEach((x, t) => {
+        this.data.submitData[x[0]] = value[t]?.value || '';
+        this.data.submitData[x[1]] = value[t]?.label || '';
+      });
+    } else {
+      if (type === 'cardType') {
+        arr = ['idcardType', 'idcardTypeName'];
+      } else if (type === 'sex') {
+        arr = ['sex', 'sexName'];
+      }
+      arr.forEach((x, t) => {
+        this.data.submitData[x] = value[t === 0 ? 'value' : 'label'];
+      });
+    }
+    this.setData({
+      submitData: this.data.submitData,
+      popup: this.data.popup
+    });
+  },
 
-	// form的change
-	handleChange(e) {
-		const { key, value } = e.detail;
-		this.data.submitData[key] = value;
-		this.setData({ submitData: this.data.submitData });
-	},
+  // form的change
+  handleChange(e) {
+    const {
+      key,
+      value
+    } = e.detail;
+    this.data.submitData[key] = value;
+    this.setData({
+      submitData: this.data.submitData
+    });
+  },
 
-	// 修改picker的列时触发
-	handleChangeColumns(e) {
-		if (this.data.popup.type === 'location') {
-			let selectData = $$.changeLocation(e, this.selectComponent('#personal-data-dom').location, this.data.popup.selectData);
-			this.setData({ popup: { ...this.data.popup, selectData } });
-		}
-	},
+  // 修改picker的列时触发
+  handleChangeColumns(e) {
+    if (this.data.popup.type === 'location') {
+      let selectData = $$.changeLocation(e, this.selectComponent('#personal-data-dom').location, this.data.popup.selectData);
+      this.setData({
+        popup: {
+          ...this.data.popup,
+          selectData
+        }
+      });
+    }
+  },
 
-	// 验证
-	checkSubmitData() {
-		if (this.data.submitData.mobile && !$$.mobileRegExp(this.data.submitData.mobile)) {
-			$$.showToast({ title: '请输入正确的手机号码' });
-			return false;
-		}
-		let userInfo = wx.getStorageSync('userInfo');
-		let that = this;
-		if (userInfo.realStatus === '1' && this.data.submitData.trueName !== this.copySubmitData.trueName) {
-			$$.showModal({
-				content: '您修改了姓名,修改后需重新实名认证,是否继续操作?',
-				success: (res) => {
-					if (res.confirm) {
-						userInfo.realStatus = '99';
-						wx.setStorageSync('userInfo', userInfo);
-						that.handleSave();
-					}
-				},
-			});
-			return false;
-		}
-		if (userInfo.realStatus === '1' && this.data.submitData.idcard !== this.copySubmitData.idcard) {
-			$$.showModal({
-				content: '您修改了身份证号码,修改后需重新实名认证,是否继续操作?',
-				success: (res) => {
-					if (res.confirm) {
-						userInfo.realStatus = '99';
-						wx.setStorageSync('userInfo', userInfo);
-						that.handleSave();
-					}
-				},
-			});
-			return false;
-		}
-		that.handleSave();
-	},
+  // 验证
+  checkSubmitData() {
+    if (this.data.submitData.mobile && !$$.mobileRegExp(this.data.submitData.mobile)) {
+      $$.showToast({
+        title: '请输入正确的手机号码'
+      });
+      return false;
+    }
+    let userInfo = wx.getStorageSync('userInfo');
+    let that = this;
+    if (userInfo.realStatus === '1' && this.data.submitData.trueName !== this.copySubmitData.trueName) {
+      $$.showModal({
+        content: '您修改了姓名,修改后需重新实名认证,是否继续操作?',
+        success: (res) => {
+          if (res.confirm) {
+            userInfo.realStatus = '99';
+            wx.setStorageSync('userInfo', userInfo);
+            that.handleSave();
+          }
+        },
+      });
+      return false;
+    }
+    if (userInfo.realStatus === '1' && this.data.submitData.idcard !== this.copySubmitData.idcard) {
+      $$.showModal({
+        content: '您修改了身份证号码,修改后需重新实名认证,是否继续操作?',
+        success: (res) => {
+          if (res.confirm) {
+            userInfo.realStatus = '99';
+            wx.setStorageSync('userInfo', userInfo);
+            that.handleSave();
+          }
+        },
+      });
+      return false;
+    }
+    that.handleSave();
+  },
 
-	// 保存
-	async handleSave() {
-		$$.showLoading();
-		const res = await setUserInfoApi(this.data.submitData);
-		$$.hideLoading();
-		if (res.type) {
-			$$.showToast({ title: '操作成功', icon: 'success' });
-			let realStatus = wx.getStorageSync('userInfo')?.realStatus;
-			if (realStatus === '99') {
-				$$.showModal({
-					title: '实名认证提醒',
-					content: '检测到您尚未完成实名认证,认证后您将享受到更加完善的调解服务,是否现在前往认证?',
-					cancelText: '暂不认证',
-					confirmText: '前往认证',
-					success: (res) => {
-						if (res.confirm) {
-							wx.navigateTo({
-								url: '../../pages/realNameAuthentication/index?backNum=2',
-							});
-						} else {
-							wx.navigateBack({
-								delta: 1,
-							});
-						}
-					},
-				});
-			} else {
-				await $$.sleep();
-				wx.navigateBack({
-					delta: 1,
-				});
-			}
-		}
-	},
+  // 保存
+  async handleSave() {
+    $$.showLoading();
+    const res = await setUserInfoApi(this.data.submitData);
+    $$.hideLoading();
+    if (res.type) {
+      $$.showToast({
+        title: '操作成功',
+        icon: 'success'
+      });
+      await $$.sleep();
+      wx.navigateBack({
+        delta: 1,
+        success: function (res) {
+          // 返回页面刷新接口
+          wx.emitEvent('getUserInfo', {});
+        }
+      });
+    }
+  },
 
-	// 获取个人信息
-	getUserInfo(e) {
-		let data = e.detail || {};
-		let keys = Object.keys(this.data.submitData);
-		keys.forEach((x) => {
-			if (data[x]) {
-				this.data.submitData[x] = data[x];
-			}
-		});
-		if (this.isCheck && this.data.submitData.idcardType === '09_00015-1') {
-			this.data.submitData.idcard = `${this.data.submitData.idcard?.substring(0, 6)}********${this.data.submitData.idcard?.substring(14)}`;
-		}
-		this.setData({ submitData: this.data.submitData });
-		this.copySubmitData = Object.assign({}, this.data.submitData);
-	},
+  // 获取个人信息
+  getUserInfo(e) {
+    let data = e.detail || {};
+    let keys = Object.keys(this.data.submitData);
+    keys.forEach((x) => {
+      if (data[x]) {
+        this.data.submitData[x] = data[x];
+      }
+    });
+    if (this.isCheck && this.data.submitData.idcardType === '09_00015-1') {
+      this.data.submitData.idcard = `${this.data.submitData.idcard?.substring(0, 6)}********${this.data.submitData.idcard?.substring(14)}`;
+    }
+    this.setData({
+      submitData: this.data.submitData
+    });
+    this.copySubmitData = Object.assign({}, this.data.submitData);
+  },
 
-	// 获取手机号码
-	async handleGetPhoneNumber(e) {
-		let phone = await this.selectComponent('#common-page').handleGetPhoneNumber(e.detail);
-		this.data.submitData.mobile = phone;
-		this.setData({ submitData: this.data.submitData });
-	},
+  // 获取手机号码
+  async handleGetPhoneNumber(e) {
+    let phone = await this.selectComponent('#common-page').handleGetPhoneNumber(e.detail);
+    this.data.submitData.mobile = phone;
+    this.setData({
+      submitData: this.data.submitData
+    });
+  },
 
-	/**
-	 * 生命周期函数--监听页面加载
-	 */
-	onLoad: function (options) {
-		this.setData({ isCheck: !!options.isCheck, isImproveData: !!options.type });
-		this.isCheck = !!options.isCheck;
-	},
-});
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      isCheck: !!options.isCheck,
+      isImproveData: !!options.type
+    });
+    this.isCheck = !!options.isCheck;
+  },
+});
\ No newline at end of file

--
Gitblit v1.8.0