Browse Source

完善信息改版

master
lihenian 5 years ago
parent
commit
e0cb81c86b
  1. 412
      pages/complete/complete.js
  2. 13
      pages/complete/complete.json
  3. 117
      pages/complete/complete.wxml
  4. 306
      pages/complete/complete.wxss
  5. 15
      pages/complete/components/organization/organization.js
  6. 3
      pages/complete/components/organization/organization.json
  7. 10
      pages/complete/components/organization/organization.wxml
  8. 31
      pages/complete/components/organization/organization.wxss
  9. 588
      pages/complete/components/personalInfo/personalInfo.js
  10. 3
      pages/complete/components/personalInfo/personalInfo.json
  11. 98
      pages/complete/components/personalInfo/personalInfo.wxml
  12. 219
      pages/complete/components/personalInfo/personalInfo.wxss
  13. 439
      pages/complete_bk/complete.js
  14. 12
      pages/complete_bk/complete.json
  15. 97
      pages/complete_bk/complete.wxml
  16. 278
      pages/complete_bk/complete.wxss
  17. 6
      project.config.json
  18. 35
      utils/api.js
  19. 4
      utils/config.js

412
pages/complete/complete.js

@ -1,392 +1,40 @@
var api = require('../../utils/api.js')
var global = require('../../utils/config.js')
const app = getApp()
import { $wuxActionSheet } from '../../dist/index'
Page({
data: {
gridName: '',
gridId: '',
idCard: '',
userName: '',
sex: '',
mobile: '',
smsCode: '',
street: '',
community: '',
building: '',
submitEvent: false,
partyMember: false,
isPartyMember: '0',
wait: 60,
btntxt: '获取验证码',
tabType: 'tab1',
state: '',
unionIdStatus: '0',
encryptedData: '',
iv: '',
wxCode: '',
gridList: [],
changeGridList: []
},
onLoad() {
this.getPrepareComplete().then(res => {
this.getGridList()
})
this.checkWxUnionId()
this.getWxCode()
},
// 拉取 用户信息
getPrepareComplete() {
return new Promise((resolve, reject) => {
api.prepareComplete().then(res => {
console.log('拉取用户信息', res)
this.setData({
idCard: res.data.identityNo,
userName: res.data.realName,
sex: res.data.sex,
mobile: res.data.mobile,
street: res.data.road,
community: res.data.villageName,
building: res.data.dwellingPlace,
state: res.data.state,
gridId: res.data.gridId,
gridName: res.data.gridName
})
resolve(true)
}).catch(err => {
reject(false)
})
})
},
adInputIdCard: function (e) {
this.setData({
idCard: e.detail.value
})
},
adInputUserName: function (e) {
this.setData({
userName: e.detail.value
})
},
adChangeSex: function (e) {
this.setData({
sex: e.currentTarget.dataset.sex
})
},
adInputMobile: function (e) {
this.setData({
mobile: e.detail.value
})
},
adInputSmsCode: function (e) {
this.setData({
smsCode: e.detail.value
})
},
adInputStreet: function (e) {
this.setData({
street: e.detail.value
})
},
adInputCommunity: function (e) {
this.setData({
community: e.detail.value
})
},
adInputBuilding: function (e) {
this.setData({
building: e.detail.value
})
},
// 我是居民/我是党员 切换
onChange(e) {
if (e.detail.key == 'tab2') {
this.setData({
partyMember: true,
isPartyMember: '1',
tabType: 'tab2'
})
console.log('this', this.data.partyMember)
} else {
this.setData({
partyMember: false,
isPartyMember: '0',
tabType: 'tab1',
idCard: ''
})
console.log('this', this.data.partyMember)
}
},
outtime() {
let that = this
if (that.data.wait === 0) {
that.setData({
wait: 60,
btntxt: '获取验证码'
})
} else {
that.setData({
wait: that.data.wait - 1
})
setTimeout(() => {
that.outtime()
}, 1000)
}
},
toRegister() {
if (this.data.partyMember) {
if (this.data.idCard === '') {
selectTab: 'resident',
gridList: [], // 当前用户所拥有的网格
changeGridList: [], // 筛选掉当前选择的网格的网格列表
moreThanOneGrid: false,
gridInfo: {
gridName: '', // 网格名称
gridId: '' // 网格id
},
partyFlag: '0'
},
// 我是居民/我是党员/我是企业 tab切换
onTabChange (e) {
if (e.currentTarget.dataset.tab === 'resident') {
if (this.data.partyFlag === '1') {
wx.showToast({
title: '请先输入身份证号',
title: '您已是党员,不可认证居民',
icon: 'none',
duration: 3000
duration: 2000
})
return false
}
}
if (this.data.userName === '') {
wx.showToast({
title: '请先输入姓名',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.sex === '') {
wx.showToast({
title: '请选择性别',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.mobile === '') {
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.smsCode === '') {
wx.showToast({
title: '请先输入验证码',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.street === '') {
wx.showToast({
title: '请先输入所在街道',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.street.length > 30) {
wx.showToast({
title: '所在街道不超过30字',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.submitEvent === true) {
wx.showToast({
title: '加载中...',
icon: 'none',
duration: 3000
})
return false
}
wx.showLoading({
title: '加载中...'
})
const para = {
partyFlag: this.data.isPartyMember,
identityNo: this.data.idCard,
mobile: this.data.mobile,
smsCode: this.data.smsCode,
realName: this.data.userName,
sex: this.data.sex,
road: this.data.street,
villageName: this.data.community,
dwellingPlace: this.data.building,
gridId: this.data.gridId,
wxCode: this.data.unionIdStatus === '1' ? '' : this.data.wxCode,
encryptedData: this.data.unionIdStatus === '1' ? '' : this.data.encryptedData,
iv: this.data.unionIdStatus === '1' ? '' : this.data.iv
}
console.log(this.data.tabType)
if (this.data.tabType == 'tab1'){
api.completeResidentInfo(para).then(function (res) {
// console.log(res.data.resultCode)
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '党员认证失败',
showCancel: false,
content: res.data.resultMsg,
success: function (res) {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 3000,
complete: function () {
setTimeout(function () {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 3000);
}
})
}
})
}else{
api.completePartyInfo(para).then(function (res) {
// console.log(res.data.resultCode)
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '党员认证失败',
showCancel: false,
content: res.data.resultMsg,
success: function (res) {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 3000,
complete: function () {
setTimeout(function () {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 3000);
}
})
}
})
}
// api.completeInfo(para).then(function (res) {
// // console.log(res.data.resultCode)
// wx.hideLoading()
// if (res.data.resultCode == 1) {
// wx.showModal({
// title: '党员认证失败',
// showCancel: false,
// content: res.data.resultMsg,
// success: function (res) {
// wx.reLaunch({
// url: '/pages/index/index'
// })
// }
// })
// } else {
// wx.showToast({
// title: '认证成功',
// icon: 'none',
// duration: 3000,
// complete: function () {
// setTimeout(function () {
// wx.reLaunch({
// url: '/pages/index/index'
// })
// }, 3000);
// }
// })
// }
// })
},
getSmsCode() {
console.log(this.data.mobile)
if (this.data.mobile === '') {
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 3000
})
return false
} else if (this.data.mobile.length !== 11) {
wx.showToast({
title: '请先输入正确手机号',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.wait < 60) {
wx.showToast({
title: '请' + this.data.wait + '秒后再试',
duration: 2000,
icon: 'none'
})
return
}
this.outtime()
api.sendSms(this.data.mobile).then(function (res) {
console.log('已经成功发送验证码')
console.log(res)
})
},
// 性别选择
radioChange(e) {
this.setData({
sex: e.detail.value
})
},
// 查看用户是否完善个人信息
checkWxUnionId() {
api.checkWxUnionId().then(res => {
console.log('查看用户是否已保存unionId', res)
this.setData({
unionIdStatus: res.data
})
}).catch(err => {
this.setData({
unionIdStatus: '0'
})
console.log(err)
})
},
// 获取用户信息
getUserInfo(e) {
this.setData({
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
})
this.toRegister()
},
// 获取wxCode
getWxCode() {
const that = this
wx.login({
success(res) {
that.setData({
wxCode: res.code
})
}
selectTab: e.currentTarget.dataset.tab
})
},
// 获取所有网格
getGridList() {
// 获取当前用户所有网格
getGridList(e) {
api.getGridList().then(res => {
console.log('获取所有网格', res)
const buttonList = []
res.data.forEach(item => {
if (item.gridId !== this.data.gridId) {
if (item.gridId !== e.detail.gridId) {
buttonList.push({
id: item.gridId,
text: item.grid
@ -395,17 +43,19 @@ Page({
})
this.setData({
gridList: res.data,
changeGridList: buttonList
changeGridList: buttonList,
moreThanOneGrid: buttonList.length > 0
})
}).catch(err => {
this.setData({
gridList: []
gridList: [],
changeGridList: []
})
console.log(err)
})
},
// 切换网格
changeGrid() {
changeGrid(e) {
const buttonList = []
this.data.gridList.forEach(item => {
buttonList.push({
@ -413,7 +63,7 @@ Page({
text: item.grid
})
})
const index = buttonList.findIndex(item => item.id === this.data.gridId)
const index = buttonList.findIndex(item => item.id === e.detail.gridId)
if (index > -1) {
buttonList.splice(index, 1)
}
@ -426,8 +76,8 @@ Page({
className: 'dialog-class',
buttonClicked(index, item) {
that.setData({
gridId: item.id,
gridName: item.text
'gridInfo.gridId': item.id,
'gridInfo.gridName': item.text
})
return true
},
@ -435,5 +85,11 @@ Page({
cancel() { },
destructiveButtonClicked() { },
})
},
selectTabChange (e) {
this.setData({
selectTab: e.detail.tab,
partyFlag: e.detail.partyFlag
})
}
})

13
pages/complete/complete.json

@ -1,12 +1,9 @@
{
"navigationBarTitleText": "完善个人信息",
"usingComponents": {
"wux-tabs": "../../dist/tabs/index",
"wux-tab": "../../dist/tab/index",
"wux-badge": "../../dist/badge/index",
"wux-cell-group": "../../dist/cell-group/index",
"wux-cell": "../../dist/cell/index",
"wux-input": "../../dist/input/index",
"personal-info": "./components/personalInfo/personalInfo",
"wux-button": "../../dist/button/index",
"organization": "./components/organization/organization",
"wux-actionsheet": "../../dist/actionsheet/index"
}
},
"navigationBarTitleText": "完善个人信息"
}

117
pages/complete/complete.wxml

@ -1,95 +1,32 @@
<view class="container">
<view class="topfixed">
<wux-tabs defaultCurrent="tab1" bindchange="onChange">
<wux-tab key="tab1" title="我是居民"></wux-tab>
<wux-tab key="tab2">
<view class="tab2" style="color: {{tabType == 'tab2' ? '#f00' : '#999'}}">
我是党员
<!-- <view class="status pass" wx:if="{{state === '3' && idCard}}">
<image src="../../images/mine/party-pass.png" />
<view>认证通过</view>
</view>
<view class="status unpass" wx:if="{{state === '2' && idCard}}">
<image src="../../images/mine/party-unpass.png" />
<view>认证不通过</view>
</view> -->
</view>
</wux-tab>
</wux-tabs>
</view>
<view class="card cardcon margintop">
<view class="content">
<wux-cell hover-class="none" wx:if="{{partyMember}}">
<span class="xing">*</span>
<wux-input label="身份证号" placeholder="实名认证请输入身份证" controlled value="{{idCard}}" bind:change="adInputIdCard"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<wux-input label="姓名" placeholder="请输入姓名" controlled value="{{userName}}" bind:change="adInputUserName"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<view class="sex-content">
<view>性别</view>
<radio-group class="radio-group" bindchange="radioChange">
<radio value="1" color="#F82525" checked="{{sex === '1'}}">
<text style="color: {{sex == 1 ? '#333' : '#999'}}">男</text>
</radio>
<radio value="0" color="#F82525" checked="{{sex === '0'}}">
<text style="color: {{sex === '0' ? '#333' : '#999'}}">女</text>
</radio>
</radio-group>
</view>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<wux-input label="手机号" placeholder="请输入手机号" controlled value="{{mobile}}" bind:change="adInputMobile"></wux-input>
</wux-cell>
<wux-cell hover-class="none" class="yzm">
<span class="xing">*</span>
<view class="verify-content">
<view>验证码</view>
<view class="verify-code">
<input type="text" placeholder="请输入验证码" placeholder-class="scode" bind:change="adInputSmsCode"/>
<view class="getcode" bindtap="getSmsCode">
<span wx:if="{{wait>=60}}">获取验证码</span>
<span wx:else>{{wait}}秒...</span>
</view>
</view>
</view>
</wux-cell>
</view>
</view>
<view class="card cardcon">
<view class="jzdz">
<view class="address">
<view class="left">居住地址</view>
<view class="right" bindtap="changeGrid" wx:if="{{changeGridList.length > 0}}">
<view class="change-grid">切换网格</view>
<image src="../../images/mine/ic_qiehuan@2x.png" />
</view>
</view>
<view>{{gridName}}</view>
</view>
<view class="content">
<wux-cell hover-class="none">
<wux-input placeholder="*请填写所在小区" controlled value="{{street}}" bind:change="adInputStreet"></wux-input>
</wux-cell>
<!-- <wux-cell hover-class="none">
<wux-input placeholder="小区名称" controlled value="{{community}}" bind:change="adInputCommunity"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<wux-input placeholder="楼栋号-单元室(如5号楼701)" controlled value="{{building}}" bind:change="adInputBuilding"></wux-input>
</wux-cell> -->
</view>
</view>
<view class="tap">*请填写您的真实信息,我们会严格保密,请您放心</view>
<view class="submit-btn" wx:if="{{unionIdStatus === '1'}}">
<button hover-class="hover-button" bindtap="toRegister">提交</button>
<view class="complete-info">
<view class="tab-bar">
<view
class="tab {{selectTab === 'resident' ? 'select-tab ' : ''}}"
data-tab="resident"
bindtap="onTabChange">我是居民</view>
<view
class="tab {{selectTab === 'partyMember' ? 'select-tab ' : ''}}"
data-tab="partyMember"
bindtap="onTabChange">我是党员</view>
<!-- <view
class="tab {{selectTab === 'organization' ? 'select-tab ' : ''}}"
data-tab="organization"
bindtap="onTabChange">我是企业</view> -->
<view class="select-bar {{selectTab === 'resident' ? 'tab1' : selectTab === 'partyMember' ? 'tab2' : selectTab === 'organization' ? 'tab3' : 'tab1'}}"></view>
</view>
<view class="submit-btn" wx:elif="{{unionIdStatus === '0'}}">
<button hover-class="hover-button" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交</button>
<view class="content">
<personal-info
wx:if="{{selectTab === 'resident' || selectTab === 'partyMember'}}"
bind:selectTabChange="selectTabChange"
selectedGrid="{{gridInfo}}"
moreThanOneGrid="{{moreThanOneGrid}}"
bind:getGridList="getGridList"
bind:changeGrid="changeGrid"
type="{{selectTab}}">
</personal-info>
<organization wx:else></organization>
</view>
</view>

306
pages/complete/complete.wxss

@ -1,278 +1,82 @@
.topfixed {
position: fixed;
top: 0;
width: 100%;
z-index: 999999;
}
.margintop {
margin-top: 60px;
}
.tab2 {
color: #999;
font-size: 0.975rem;
position: relative;
}
.tab2 .status.pass {
position: absolute;
width: 74rpx;
height: 32rpx;
top: 10%;
left: 100%;
}
.tab2 .status.pass image {
position: absolute;
page {
width: 100%;
height:100%;
object-fit: cover;
left: 0;
top: 0;
height: auto;
overflow-y: auto;
}
.tab2 .status.pass view {
position: relative;
z-index: 100;
.complete-info {
width: 100%;
height: 100%;
line-height: 27rpx;
text-align: center;
font-size: 16rpx;
color: #06B5A4;
background: #f7f7f7;
}
.tab2 .status.unpass {
position: absolute;
width: 90rpx;
height: 32rpx;
top: 10%;
left: 100%;
}
.tab2 .status.unpass image {
position: absolute;
.tab-bar {
width: 100%;
height:100%;
object-fit: cover;
left: 0;
top: 0;
}
.tab2 .status.unpass view {
height: 100rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-around;
position: relative;
position: fixed;
top: 0;
left: 0;
z-index: 100;
width: 100%;
height: 100%;
line-height: 27rpx;
text-align: center;
font-size: 16rpx;
color: #E74848;
}
.jzdz {
font-size: 0.975rem;
padding: 10px 0 0 10px;
color: #333;
}
.content {
width: 670rpx;
padding-top: 5px;
padding-bottom: 10px;
padding-right: 30rpx;
padding-left: 10rpx;
}
.cardcon {
height: auto;
}
.btn1 {
margin-top: 40rpx;
}
.logo-layout {
height: 136rpx;
width: 159rpx;
margin: 0 auto;
padding: 60rpx 0 80rpx 0;
}
.logo {
height: 136rpx;
width: 159rpx;
}
.tap {
font-size: 12px;
color: #999;
padding: 0 10px 0 10px;
}
.input-placeholder {
color: #999;
text-align: right;
font-size: 0.875rem;
}
.scode {
text-align: left !important;
}
.wux-tabs__tab-title {
.tab-bar .tab {
flex: 1;
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
color: #999;
font-size: 0.975rem;
}
.wux-tabs__tab--balanced .wux-tabs__tab-bar {
background: #f00 !important;
color: #f00 !important;
}
.wux-tabs__tab--current .wux-tabs__tab-title {
color: #f00 !important;
}
.wux-input__label {
font-size: 0.975rem;
color: #333;
}
.wux-input__item {
text-align: right;
}
.yzm .wux-input__item {
text-align: left;
width: 50%;
text-align: center;
}
.xing {
color: #f00;
float: left;
width: 10px;
.tab-bar .tab.select-tab {
color: #F82525;
font-size: 32rpx;
font-weight: bold;
}
.sex-select {
width: 100%;
.tab-bar .select-bar {
width: 80rpx;
height: 6rpx;
position: absolute;
top: 5rpx;
right: 0px;
text-align: right;
z-index: 999;
}
.select-img {
width: 40rpx;
height: 40rpx;
bottom: 0rpx;
border-radius: 3rpx;
background: #F82525;
}
.select-text {
padding: 15rpx;
/** .tab-bar .select-bar.tab1 {
left: calc(17% - 40rpx);
transition: left 0.4s ease-out;
}
.float-right {
float: right;
.tab-bar .select-bar.tab2 {
left: calc(50% - 40rpx);
transition: left 0.4s ease-out;
}
.tab-bar .select-bar.tab3 {
left: calc(83% - 40rpx);
transition: left 0.4s ease-out;
} */
/* 弹性盒子 */
.flex {
display: -webkit-box;
display: flex;
}
/* 垂直水平居中 */
.flex-container {
justify-content: center;
align-items: center;
flex-wrap: wrap;
.tab-bar .select-bar.tab1 {
left: calc(25% - 40rpx);
transition: left 0.4s ease-out;
}
/* 等宽排列 */
.justify-space-between {
justify-content: space-between;
.tab-bar .select-bar.tab2 {
left: calc(75% - 40rpx);
transition: left 0.4s ease-out;
}
.sex-content {
display: flex;
align-items: center;
justify-content: space-between;
}
radio {
font-size: 30rpx;
color: #999;
}
radio + radio {
margin-left: 30rpx;
}
.verify-content {
display: flex;
justify-content: space-between;
align-items: center;
}
.verify-content .verify-code {
height: 100%;
display: flex;
align-items: center;
}
.verify-content .verify-code input {
width: 190rpx;
text-align: right;
margin-right: 20rpx;
}
.verify-content .verify-code .getcode {
background: #f30;
color: #fff;
font-size: 24rpx;
border-radius: 8rpx;
height: 50rpx;
line-height: 50rpx;
padding: 6rpx 20rpx 6rpx 20rpx;
}
.submit-btn {
.content {
width: 100%;
height: 85rpx;
display: flex;
justify-content: center;
align-items:center;
margin-top: 40rpx;
}
.submit-btn button {
background: linear-gradient(to right, #f51010, #ff4c4c);
width: 560rpx;
height: 85rpx;
border-radius: 16rpx;
line-height: 85rpx;
font-size: 36rpx;
color: #fff;
text-align: center;
margin: 0;
padding: 0;
outline: 0;
}
.submit-btn .hover-button {
background: red;
min-height: calc(100vh - 100rpx);
margin-top: 100rpx;
}
.jzdz .address {
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
padding-right: 30rpx;
height: 60rpx;
}
.jzdz .address .right {
display: flex;
align-items: center;
justify-content: flex-end;
}
.jzdz .address .right .change-grid {
color: #999;
margin-right: 10rpx;
font-size: 25rpx;
}
.jzdz .address .right image {
width: 22rpx;
height: 22rpx;
object-fit: cover;
}
.wux-actionsheet__button {
font-size: 34rpx !important;
color: #333 !important;
}
.wux-actionsheet__group--options {
max-height: 50vh !important;
overflow-y: auto !important;
}

15
pages/complete/components/organization/organization.js

@ -0,0 +1,15 @@
Component({
data: {},
methods: {
navigationOrganizationBasicInfo () {
wx.navigateTo({
url: '/subpages/mine/pages/company/company'
})
},
navigateOrganizationMoreinfo () {
wx.navigateTo({
url: '/subpages/mine/pages/companyInfo/companyInfo'
})
}
}
})

3
pages/complete/components/organization/organization.json

@ -0,0 +1,3 @@
{
"component": true
}

10
pages/complete/components/organization/organization.wxml

@ -0,0 +1,10 @@
<view class="organization">
<view class="item" hover-start-time="150" hover-class="hover-item" bindtap="navigationOrganizationBasicInfo">
<view class="tit">认证企业基础信息</view>
<image src="/images/home/next.png" />
</view>
<view class="item" hover-start-time="150" hover-class="hover-item" bindtap="navigateOrganizationMoreinfo">
<view class="tit">完善企业更多信息</view>
<image src="/images/home/next.png" />
</view>
</view>

31
pages/complete/components/organization/organization.wxss

@ -0,0 +1,31 @@
.organization {
width: 100%;
min-height: calc(100vh - 100vh);
box-sizing: border-box;
padding: 20rpx;
}
.organization .item {
width: 100%;
height: 100rpx;
border-radius: 16rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 20rpx;
}
.organization .item + .item {
margin-top: 20rpx;
}
.organization .item .name {
color: #333;
font-size: 34rpx;
}
.organization .item image {
width:18rpx;
height: 24rpx;
}
.organization .hover-item {
background: #f7f7f7;
}

588
pages/complete/components/personalInfo/personalInfo.js

@ -0,0 +1,588 @@
var api = require('../../../../utils/api.js')
Component({
data: {
personalInfo: {
identityNo: '', // 身份证号
realName: '', // 姓名
sex: '', // 性别
mobile: '', // 手机号
smsCode: '', // 验证码
road: '', // 什么路
villageName: '', // 小区
dwellingPlace: '', // 楼栋号-单元室
partyFlag: '0'
},
gridInfo: {
gridName: '', // 网格名称
gridId: '' // 网格id
},
wxInfo: {
encryptedData:'',// 完整信息的加密数据
iv: '', // 初始向量
wxCode: '', // 微信cod
},
smsCodeText: '获取验证码', // 获取验证码button内容
unionIdStatus: '0', // 是否完善过个人信息,完善过更新,未完善过增加
getMobileType: 'wx' // 获取手机号的方式,默认从微信获取,但是微信新获取部分用户会有各种莫名其妙的bug,所以增加手机号/验证码的方式
},
properties: {
type: {
type: String,
value: 'resident'
},
moreThanOneGrid: {
type: Boolean,
value: false
},
selectedGrid: {
type: Object,
observer: function (value) {
this.setData({
gridInfo: value
})
}
}
},
lifetimes:{
attached () {
this.getPersonalInfo().then(res => {
this.getGridList()
})
this.checkWxUnionId()
this.getWxCode()
}
},
methods: {
// 身份证号 双向绑定
bindIdentityNoInput (e) {
this.setData({
'personalInfo.identityNo': e.detail.value
})
console.log(this.data.personalInfo)
},
// 姓名 双向绑定
bindRealNameInput (e) {
this.setData({
'personalInfo.realName': e.detail.value
})
console.log(this.data.personalInfo)
},
// 选择性别回调
bindSexChange (e) {
this.setData({
'personalInfo.sex': e.detail.value
})
console.log(this.data.personalInfo)
},
// 手机号 双向绑定
bindMobileInput (e) {
this.setData({
'personalInfo.mobile': e.detail.value
})
console.log(this.data.personalInfo)
},
// 验证码 双向绑定
bindSmsCodeInput (e) {
this.setData({
'personalInfo.smsCode': e.detail.value
})
console.log(this.data.personalInfo)
},
// 路 双向绑定
bindRoadInput (e) {
this.setData({
'personalInfo.road': e.detail.value
})
console.log(this.data.personalInfo)
},
// 小区 双向绑定
bindVillageNameInput (e) {
this.setData({
'personalInfo.villageName': e.detail.value
})
console.log(this.data.personalInfo)
},
// 楼栋号-单元室 双向绑定
bindDwellingPlaceInput (e) {
this.setData({
'personalInfo.dwellingPlace': e.detail.value
})
console.log(this.data.personalInfo)
},
// 获取验证码
getSmsCode () {
if (!this.data.personalInfo.mobile) {
this.showToast('请先输入手机号')
return false
}
this.setData({
smsCodeText: '获取中...'
})
const mobile = this.data.personalInfo.mobile
api.sendSms(mobile).then(res => {
this.showToast('验证码发送成功')
let num = 60
this.setData({
smsCodeText: "60s后重新获取"
})
const timer = setInterval(() => {
if (num >= 1) {
this.setData({
smsCodeText: `${num}s后重新获取`
})
--num
} else {
clearInterval(timer)
this.setData({
smsCodeText: '获取验证码'
})
}
}, 1000)
}).catch(err =>{
console.log(err)
this.setData({
smsCodeText: '获取验证码'
})
})
},
// 获取手机号
getPhoneNumber (e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const para = {
wxCode: '',
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
}
const that = this
wx.login({
success (res) {
para.wxCode = res.code
api.getWxPhone(para).then(data => {
console.log('获取微信手机号', data)
that.setData({
'personalInfo.mobile': data.data
})
}).catch(err => {
console.log(err)
})
}
})
}
},
// 获取之前完善的个人信息
getPersonalInfo () {
return new Promise((resolve, reject) => {
api.prepareComplete().then(res => {
console.log('获取个人信息', res)
for(const key in this.data.personalInfo) {
this.data.personalInfo[key] = res.data[key]
}
for(const key in this.data.gridInfo) {
this.data.gridInfo[key] = res.data[key]
}
this.setData({
personalInfo: this.data.personalInfo,
gridInfo: this.data.gridInfo
})
if (this.data.personalInfo.partyFlag === '1') {
this.triggerEvent('selectTabChange', {tab: 'partyMember', partyFlag: '1' })
}
resolve(true)
}).catch(err => {
console.log(err)
reject(false)
})
})
},
// 查看用户是否完善个人信息
checkWxUnionId() {
api.checkWxUnionId().then(res => {
console.log('查看用户是否已保存unionId', res)
this.setData({
unionIdStatus: res.data
// unionIdStatus: '0'
})
}).catch(err => {
this.setData({
unionIdStatus: '0'
})
console.log(err)
})
},
// 获取用户信息
getUserInfo(e) {
if (e.detail.errMsg === 'getUserInfo:ok') {
this.setData({
'wxInfo.encryptedData': e.detail.encryptedData,
'wxInfo.iv': e.detail.iv
})
this.getWxCode().then(() => {
this.submitPersonalInfo()
}).catch(() => {
this.showToast('获取wxCode失败,请重新提交')
})
} else {
this.showToast('请授权,再完善个人信息')
return false
}
},
// 获取wxCode
getWxCode() {
const that = this
return new Promise((resolve, reject) => {
wx.login({
success(res) {
that.setData({
'wxInfo.wxCode': res.code
})
console.log('wxInfo', that.data.wxInfo)
resolve(true)
},
fail (err) {
reject(false)
}
})
})
},
// 切换网格
changeGrid() {
this.triggerEvent('changeGrid', { gridId: this.data.gridInfo.gridId })
},
// 获取当前用户所有网格
getGridList() {
this.triggerEvent('getGridList', { gridId: this.data.gridInfo.gridId })
},
// 提交完善信息-从微信获取手机号方式
submitPersonalInfoByWx () {
if (!this.data.personalInfo.identityNo) {
if (this.data.type === 'partyMember') {
this.showToast('请输入身份证号')
return false
}
}
if (!this.data.personalInfo.realName) {
this.showToast('请填写姓名')
return false
}
if (!this.data.personalInfo.sex) {
this.showToast('请选择性别')
return false
}
if (!this.data.personalInfo.mobile) {
this.showToast('请填写手机号')
return false
}
// if (!this.data.personalInfo.smsCode) {
// this.showToast('请填写验证码')
// return false
// }
if (!this.data.personalInfo.road) {
this.showToast('请填写所在街道')
return false
}
const para = {
partyFlag: this.data.type === 'partyMember' ? '1' : '0',
identityNo: this.data.personalInfo.identityNo,
mobile: this.data.personalInfo.mobile,
smsCode: this.data.personalInfo.smsCode,
realName: this.data.personalInfo.realName,
sex: this.data.personalInfo.sex,
road: this.data.personalInfo.road,
villageName: this.data.personalInfo.villageName,
dwellingPlace: this.data.personalInfo.dwellingPlace,
gridId: this.data.gridInfo.gridId,
wxCode: this.data.unionIdStatus === '0' ? this.data.wxInfo.wxCode : '',
encryptedData: this.data.unionIdStatus === '0' ? this.data.wxInfo.encryptedData : '',
iv: this.data.unionIdStatus === '0' ? this.data.wxInfo.iv : ''
}
if (this.data.personalInfo.partyFlag === '1' && this.data.type === 'resident') {
wx.showModal({
content: '您已是党员,无须进行居民认证,居民认证后会取消党员身份,是否继续?',
showCancel: true,
cancelText: '否',
confirmText: '是',
confirmColor: '#000000',
success: (e) => {
if (e.confirm) {
wx.showLoading({
title: '提交中...'
})
api.completeResidentInfoV2(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
} else if (e.cancel) {
return false
}
},
})
} else {
wx.showLoading({
title: '提交中...'
})
if (this.data.type === 'partyMember') {
api.completePartyInfoV2(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
} else if (this.data.type === 'resident') {
api.completeResidentInfoV2(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
}
}
},
// 提交完善信息,手机号输入方式
submitPersonalInfoBySelf () {
if (!this.data.personalInfo.identityNo) {
if (this.data.type === 'partyMember') {
this.showToast('请输入身份证号')
return false
}
}
if (!this.data.personalInfo.realName) {
this.showToast('请填写姓名')
return false
}
if (!this.data.personalInfo.sex) {
this.showToast('请选择性别')
return false
}
if (!this.data.personalInfo.mobile) {
this.showToast('请填写手机号')
return false
}
if (!this.data.personalInfo.smsCode) {
this.showToast('请填写验证码')
return false
}
if (!this.data.personalInfo.road) {
this.showToast('请填写所在街道')
return false
}
const para = {
partyFlag: this.data.type === 'partyMember' ? '1' : '0',
identityNo: this.data.personalInfo.identityNo,
mobile: this.data.personalInfo.mobile,
smsCode: this.data.personalInfo.smsCode,
realName: this.data.personalInfo.realName,
sex: this.data.personalInfo.sex,
road: this.data.personalInfo.road,
villageName: this.data.personalInfo.villageName,
dwellingPlace: this.data.personalInfo.dwellingPlace,
gridId: this.data.gridInfo.gridId,
wxCode: this.data.unionIdStatus === '0' ? this.data.wxInfo.wxCode : '',
encryptedData: this.data.unionIdStatus === '0' ? this.data.wxInfo.encryptedData : '',
iv: this.data.unionIdStatus === '0' ? this.data.wxInfo.iv : ''
}
if (this.data.personalInfo.partyFlag === '1' && this.data.type === 'resident') {
wx.showModal({
content: '您已是党员,无须进行居民认证,居民认证后会取消党员身份,是否继续?',
showCancel: true,
cancelText: '否',
confirmText: '是',
confirmColor: '#000000',
success: (e) => {
if (e.confirm) {
wx.showLoading({
title: '提交中...'
})
api.completeResidentInfo(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
} else if (e.cancel) {
return false
}
},
})
} else {
wx.showLoading({
title: '提交中...'
})
if (this.data.type === 'partyMember') {
api.completePartyInfo(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
} else if (this.data.type === 'resident') {
api.completeResidentInfo(para).then(res => {
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '认证信息提交成功',
showCancel: false,
content: res.data.resultMsg,
success: res => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 2000,
complete: () => {
setTimeout(() => {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 2000)
}
})
}
})
}
}
},
submitPersonalInfo () {
if (this.data.getMobileType === 'wx') {
this.submitPersonalInfoByWx()
} else if (this.data.getMobileType === 'self') {
this.submitPersonalInfoBySelf()
}
},
// 代码简化,弹窗统一封装
showToast (title) {
wx.showToast({
title: title,
icon: 'none',
duration: 2000
})
},
changeGetMobileType () {
let type = 'wx'
if (this.data.getMobileType === 'wx') {
type = 'self'
} else if (this.data.getMobileType === 'self') {
type = 'wx'
}
this.setData({
getMobileType: type
})
}
}
})

3
pages/complete/components/personalInfo/personalInfo.json

@ -0,0 +1,3 @@
{
"component": true
}

98
pages/complete/components/personalInfo/personalInfo.wxml

@ -0,0 +1,98 @@
<view class="personal-info">
<view class="basic-info">
<view class="list-item identity-no" wx:if="{{type === 'partyMember'}}">
<view class="left">
<text class="must">*</text>
<view class="title">身份证号</view>
</view>
<view class="right">
<input type="idcard" bindblur="bindIdentityNoInput" bindinput="bindIdentityNoInput" value="{{personalInfo.identityNo}}" placeholder-class="placeholder-style" placeholder="实名认证请输入身份证" />
</view>
</view>
<view class="list-item real-name">
<view class="left">
<text class="must">*</text>
<view class="title">姓名</view>
</view>
<view class="right">
<input confirm-type="next" bindblur="bindRealNameInput" bindinput="bindRealNameInput" value="{{personalInfo.realName}}" placeholder-class="placeholder-style" placeholder="请输入姓名" />
</view>
</view>
<view class="list-item sex">
<view class="left">
<text class="must">*</text>
<view class="title">性别</view>
</view>
<view class="right">
<radio-group class="radio-group" bindchange="bindSexChange">
<radio checked="{{personalInfo.sex === '1'}}" value="1" color="#F82525" class="radio">男</radio>
<radio checked="{{personalInfo.sex === '0'}}" value="0" color="#F82525" class="radio">女</radio>
</radio-group>
</view>
</view>
<view class="list-item mobile" wx:if="{{getMobileType === 'wx'}}">
<view class="left">
<text class="must">*</text>
<view class="title">手机号</view>
</view>
<view class="right">
<input wx:if="{{personalInfo.mobile}}" disabled="{{true}}" type="number" bindblur="bindMobileInput" bindinput="bindMobileInput" value="{{personalInfo.mobile}}" placeholder-class="placeholder-style" placeholder="请获取手机号" />
<button hover-class="button-hover" class="get-code" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">{{personalInfo.mobile ? '重新获取' : '获取手机号'}}</button>
</view>
</view>
<view class="list-item mobile" wx:if="{{getMobileType === 'self'}}">
<view class="left">
<text class="must">*</text>
<view class="title">手机号</view>
</view>
<view class="right" >
<input type="number" bindblur="bindMobileInput" bindinput="bindMobileInput" value="{{personalInfo.mobile}}" placeholder-class="placeholder-style" placeholder="请输入手机号" />
</view>
</view>
<view class="list-item sms-code" wx:if="{{getMobileType === 'self'}}">
<view class="left">
<text class="must">*</text>
<view class="title">验证码</view>
</view>
<view class="right code">
<input bindblur="bindSmsCodeInput" bindinput="bindSmsCodeInput" value="{{personalInfo.smsCode}}" placeholder-class="placeholder-style" placeholder="请输入验证码" />
<button disabled="{{smsCodeText !== '获取验证码'}}" bindtap="getSmsCode" hover-class="button-hover" class="get-code">{{smsCodeText}}</button>
</view>
</view>
</view>
<view class="note" bindtap="changeGetMobileType">{{getMobileType === 'wx' ? '*如若获取手机号异常,请点击切换至手机号/验证码注册方式' : '*点击可切回至从微信获取手机号注册方式'}}</view>
<view class="address-info">
<view class="header">
<view class="title">居住地址</view>
<view bindtap="changeGrid" class="change-grid" wx:if="{{moreThanOneGrid}}">
<text>切换网格</text>
<image src="../../../../images/mine/ic_qiehuan@2x.png" />
</view>
</view>
<view class="list-item">
<view class="grid-name">{{gridInfo.gridName}}</view>
</view>
<view class="list-item">
<input bindblur="bindRoadInput" bindinput="bindRoadInput" value="{{personalInfo.road}}" placeholder-class="placeholder-style" placeholder="请输入所在小区" />
</view>
<!-- <view class="list-item">
<input bindblur="bindVillageNameInput" bindinput="bindVillageNameInput" value="{{personalInfo.villageName}}" placeholder-class="placeholder-style" placeholder="小区名称" />
</view>
<view class="list-item">
<input bindblur="bindDwellingPlaceInput" bindinput="bindDwellingPlaceInput" value="{{personalInfo.dwellingPlace}}" placeholder-class="placeholder-style" placeholder="楼栋号-单元室 (如5号楼701)" />
</view> -->
</view>
<view class="note">*请填写您的真实信息,我们会严格保密,请您放心</view>
<view class="submit-button" wx:if="{{unionIdStatus === '1'}}">
<button bindtap="submitPersonalInfo" hover-class="hover-submit">提交</button>
</view>
<view class="submit-button" wx:if="{{unionIdStatus === '0'}}">
<button hover-class="hover-submit" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交</button>
</view>
</view>

219
pages/complete/components/personalInfo/personalInfo.wxss

@ -0,0 +1,219 @@
.personal-info {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 20rpx;
overflow: hidden;
}
.basic-info {
width: 100%;
background: #fff;
border-radius: 16rpx;
box-sizing: border-box;
padding: 0 20rpx;
margin-top: 20rpx;
}
.basic-info .list-item {
width: 100%;
height: 100rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.basic-info .list-item + .list-item {
border-top: 1rpx solid #eaeaea;
}
.basic-info .list-item .left {
display: flex;
align-items: center;
height: 100rpx;
}
.basic-info .list-item .left .must {
color: #F61616;
font-size: 30rpx;
}
.basic-info .list-item .left .title {
color: #333;
font-size: 34rpx;
}
.basic-info .list-item .right {
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.basic-info .list-item .right.code {
width: calc(100% - 120rpx);
overflow: hidden;
}
.basic-info .list-item .right .placeholder-style {
font-size: 28rpx;
color: #999;
}
.basic-info .list-item .right input {
text-align: right;
font-size: 34rpx;
color: #333;
height: 100%;
width: 100%;
}
.basic-info .list-item .right.code input {
width: calc(100% - 300rpx);
}
.basic-info .list-item .right radio-group {
height: 100%;
display: flex;
align-items: center;
color: #999;
font-size: 28rpx;
}
.basic-info .list-item .right radio-group radio + radio {
margin-left: 20rpx;
}
.basic-info .list-item .right .get-code {
padding: 0 15rpx;
height: 60rpx;
line-height: 60rpx;
background: linear-gradient(to right, #F40C0C, #FF4E4E);
color: #fff;
font-size: 24rpx;
border-radius: 6rpx;
margin: 0;
margin-left: 25rpx;
}
.basic-info .list-item .right .button-hover {
background: rgb(175, 1, 1);
}
.basic-info .list-item.identity-no .left {
width: 160rpx;
}
.basic-info .list-item.identity-no .right {
width: calc(100% - 160rpx);
}
.basic-info .list-item.real-name .left {
width: 140rpx;
}
.basic-info .list-item.real-name .right {
width: calc(100% - 140rpx);
}
.basic-info .list-item.sex .left {
width: 140rpx;
}
.basic-info .list-item.sex .right {
width: calc(100% - 140rpx);
}
.basic-info .list-item.mobile .left {
width: 140rpx;
}
.basic-info .list-item.mobile .right {
width: calc(100% - 140rpx);
}
.basic-info .list-item.mobile .right input {
width: calc(100% - 25rpx - 200rpx);
}
.basic-info .list-item.sms-code .left {
width: 140rpx;
}
.basic-info .list-item.sms-code .right {
width: calc(100% - 140rpx);
}
.address-info {
width: 100%;
background: #fff;
border-radius: 16rpx;
box-sizing: border-box;
padding: 0 20rpx;
margin-top: 20rpx;
}
.address-info .header {
width: 100%;
height: 78rpx;
display: flex;
justify-content: space-between;
box-sizing: border-box;
padding-top: 24rpx;
}
.address-info .header .title {
height: 54rpx;
font-size: 34rpx;
color: #333;
line-height: 54rpx;
}
.address-info .header .change-grid {
display: flex;
height: 54rpx;
align-items: center;
justify-content: flex-end;
}
.address-info .header .change-grid text {
font-size: 28rpx;
color: #999;
}
.address-info .header .change-grid image {
width: 28rpx;
height: 28rpx;
margin-left: 10rpx;
position: relative;
}
.address-info .list-item {
width: 100%;
height: 100rpx;
align-items: center;
justify-content: flex-end;
}
.address-info .list-item + .list-item {
border-top: 1rpx solid #eaeaea;
}
.address-info .list-item .grid-name {
color: #333;
font-size: 32rpx;
height: 100rpx;
line-height: 100rpx;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.address-info .list-item input {
height: 100%;
text-align: right;
font-size: 34rpx;
color: #333;
width: 100%;
}
.address-info .list-item .placeholder-style {
font-size: 28rpx;
color: #999;
}
.note {
font-size: 22rpx;
color: #999;
line-height: 62rpx;
}
.submit-button {
width: 100%;
height: 84rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx 0 65rpx;
}
.submit-button button {
height: 84rpx;
line-height: 84rpx;
width: 560rpx;
padding: 0;
text-align: center;
color: #fff;
font-size: 33rpx;
border-radius: 16rpx;
background: linear-gradient(to right, #F40C0C, #FF4E4E);
}
.submit-button .hover-submit {
background: rgb(175, 1, 1);
}

439
pages/complete_bk/complete.js

@ -0,0 +1,439 @@
var api = require('../../utils/api.js')
var global = require('../../utils/config.js')
const app = getApp()
import { $wuxActionSheet } from '../../dist/index'
Page({
data: {
gridName: '',
gridId: '',
idCard: '',
userName: '',
sex: '',
mobile: '',
smsCode: '',
street: '',
community: '',
building: '',
submitEvent: false,
partyMember: false,
isPartyMember: '0',
wait: 60,
btntxt: '获取验证码',
tabType: 'tab1',
state: '',
unionIdStatus: '0',
encryptedData: '',
iv: '',
wxCode: '',
gridList: [],
changeGridList: []
},
onLoad() {
this.getPrepareComplete().then(res => {
this.getGridList()
})
this.checkWxUnionId()
this.getWxCode()
},
// 拉取 用户信息
getPrepareComplete() {
return new Promise((resolve, reject) => {
api.prepareComplete().then(res => {
console.log('拉取用户信息', res)
this.setData({
idCard: res.data.identityNo,
userName: res.data.realName,
sex: res.data.sex,
mobile: res.data.mobile,
street: res.data.road,
community: res.data.villageName,
building: res.data.dwellingPlace,
state: res.data.state,
gridId: res.data.gridId,
gridName: res.data.gridName
})
resolve(true)
}).catch(err => {
reject(false)
})
})
},
adInputIdCard: function (e) {
this.setData({
idCard: e.detail.value
})
},
adInputUserName: function (e) {
this.setData({
userName: e.detail.value
})
},
adChangeSex: function (e) {
this.setData({
sex: e.currentTarget.dataset.sex
})
},
adInputMobile: function (e) {
this.setData({
mobile: e.detail.value
})
},
adInputSmsCode: function (e) {
this.setData({
smsCode: e.detail.value
})
},
adInputStreet: function (e) {
this.setData({
street: e.detail.value
})
},
adInputCommunity: function (e) {
this.setData({
community: e.detail.value
})
},
adInputBuilding: function (e) {
this.setData({
building: e.detail.value
})
},
// 我是居民/我是党员 切换
onChange(e) {
if (e.detail.key == 'tab2') {
this.setData({
partyMember: true,
isPartyMember: '1',
tabType: 'tab2'
})
console.log('this', this.data.partyMember)
} else {
this.setData({
partyMember: false,
isPartyMember: '0',
tabType: 'tab1',
idCard: ''
})
console.log('this', this.data.partyMember)
}
},
outtime() {
let that = this
if (that.data.wait === 0) {
that.setData({
wait: 60,
btntxt: '获取验证码'
})
} else {
that.setData({
wait: that.data.wait - 1
})
setTimeout(() => {
that.outtime()
}, 1000)
}
},
toRegister() {
if (this.data.partyMember) {
if (this.data.idCard === '') {
wx.showToast({
title: '请先输入身份证号',
icon: 'none',
duration: 3000
})
return false
}
}
if (this.data.userName === '') {
wx.showToast({
title: '请先输入姓名',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.sex === '') {
wx.showToast({
title: '请选择性别',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.mobile === '') {
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.smsCode === '') {
wx.showToast({
title: '请先输入验证码',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.street === '') {
wx.showToast({
title: '请先输入所在街道',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.street.length > 30) {
wx.showToast({
title: '所在街道不超过30字',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.submitEvent === true) {
wx.showToast({
title: '加载中...',
icon: 'none',
duration: 3000
})
return false
}
wx.showLoading({
title: '加载中...'
})
const para = {
partyFlag: this.data.isPartyMember,
identityNo: this.data.idCard,
mobile: this.data.mobile,
smsCode: this.data.smsCode,
realName: this.data.userName,
sex: this.data.sex,
road: this.data.street,
villageName: this.data.community,
dwellingPlace: this.data.building,
gridId: this.data.gridId,
wxCode: this.data.unionIdStatus === '1' ? '' : this.data.wxCode,
encryptedData: this.data.unionIdStatus === '1' ? '' : this.data.encryptedData,
iv: this.data.unionIdStatus === '1' ? '' : this.data.iv
}
console.log(this.data.tabType)
if (this.data.tabType == 'tab1'){
api.completeResidentInfo(para).then(function (res) {
// console.log(res.data.resultCode)
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '党员认证失败',
showCancel: false,
content: res.data.resultMsg,
success: function (res) {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 3000,
complete: function () {
setTimeout(function () {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 3000);
}
})
}
})
}else{
api.completePartyInfo(para).then(function (res) {
// console.log(res.data.resultCode)
wx.hideLoading()
if (res.data.resultCode == 1) {
wx.showModal({
title: '党员认证失败',
showCancel: false,
content: res.data.resultMsg,
success: function (res) {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}
})
} else {
wx.showToast({
title: '认证成功',
icon: 'none',
duration: 3000,
complete: function () {
setTimeout(function () {
wx.reLaunch({
url: '/pages/indexNew/indexNew'
})
}, 3000);
}
})
}
})
}
// api.completeInfo(para).then(function (res) {
// // console.log(res.data.resultCode)
// wx.hideLoading()
// if (res.data.resultCode == 1) {
// wx.showModal({
// title: '党员认证失败',
// showCancel: false,
// content: res.data.resultMsg,
// success: function (res) {
// wx.reLaunch({
// url: '/pages/index/index'
// })
// }
// })
// } else {
// wx.showToast({
// title: '认证成功',
// icon: 'none',
// duration: 3000,
// complete: function () {
// setTimeout(function () {
// wx.reLaunch({
// url: '/pages/index/index'
// })
// }, 3000);
// }
// })
// }
// })
},
getSmsCode() {
console.log(this.data.mobile)
if (this.data.mobile === '') {
wx.showToast({
title: '请先输入手机号',
icon: 'none',
duration: 3000
})
return false
} else if (this.data.mobile.length !== 11) {
wx.showToast({
title: '请先输入正确手机号',
icon: 'none',
duration: 3000
})
return false
}
if (this.data.wait < 60) {
wx.showToast({
title: '请' + this.data.wait + '秒后再试',
duration: 2000,
icon: 'none'
})
return
}
this.outtime()
api.sendSms(this.data.mobile).then(function (res) {
console.log('已经成功发送验证码')
console.log(res)
})
},
// 性别选择
radioChange(e) {
this.setData({
sex: e.detail.value
})
},
// 查看用户是否完善个人信息
checkWxUnionId() {
api.checkWxUnionId().then(res => {
console.log('查看用户是否已保存unionId', res)
this.setData({
unionIdStatus: res.data
})
}).catch(err => {
this.setData({
unionIdStatus: '0'
})
console.log(err)
})
},
// 获取用户信息
getUserInfo(e) {
this.setData({
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
})
this.toRegister()
},
// 获取wxCode
getWxCode() {
const that = this
wx.login({
success(res) {
that.setData({
wxCode: res.code
})
}
})
},
// 获取所有网格
getGridList() {
api.getGridList().then(res => {
console.log('获取所有网格', res)
const buttonList = []
res.data.forEach(item => {
if (item.gridId !== this.data.gridId) {
buttonList.push({
id: item.gridId,
text: item.grid
})
}
})
this.setData({
gridList: res.data,
changeGridList: buttonList
})
}).catch(err => {
this.setData({
gridList: []
})
console.log(err)
})
},
// 切换网格
changeGrid() {
const buttonList = []
this.data.gridList.forEach(item => {
buttonList.push({
id: item.gridId,
text: item.grid
})
})
const index = buttonList.findIndex(item => item.id === this.data.gridId)
if (index > -1) {
buttonList.splice(index, 1)
}
this.setData({
changeGridList: buttonList
})
const that = this
$wuxActionSheet().showSheet({
buttons: this.data.changeGridList,
className: 'dialog-class',
buttonClicked(index, item) {
that.setData({
gridId: item.id,
gridName: item.text
})
return true
},
cancelText: '取消',
cancel() { },
destructiveButtonClicked() { },
})
}
})

12
pages/complete_bk/complete.json

@ -0,0 +1,12 @@
{
"navigationBarTitleText": "完善个人信息",
"usingComponents": {
"wux-tabs": "../../dist/tabs/index",
"wux-tab": "../../dist/tab/index",
"wux-badge": "../../dist/badge/index",
"wux-cell-group": "../../dist/cell-group/index",
"wux-cell": "../../dist/cell/index",
"wux-input": "../../dist/input/index",
"wux-actionsheet": "../../dist/actionsheet/index"
}
}

97
pages/complete_bk/complete.wxml

@ -0,0 +1,97 @@
<view class="container">
<view class="topfixed">
<wux-tabs defaultCurrent="tab1" bindchange="onChange">
<wux-tab key="tab1" title="我是居民"></wux-tab>
<wux-tab key="tab2">
<view class="tab2" style="color: {{tabType == 'tab2' ? '#f00' : '#999'}}">
我是党员
<!-- <view class="status pass" wx:if="{{state === '3' && idCard}}">
<image src="../../images/mine/party-pass.png" />
<view>认证通过</view>
</view>
<view class="status unpass" wx:if="{{state === '2' && idCard}}">
<image src="../../images/mine/party-unpass.png" />
<view>认证不通过</view>
</view> -->
</view>
</wux-tab>
</wux-tabs>
</view>
<view class="card cardcon margintop">
<view class="content">
<wux-cell hover-class="none" wx:if="{{partyMember}}">
<span class="xing">*</span>
<wux-input label="身份证号" placeholder="实名认证请输入身份证" controlled value="{{idCard}}" bind:change="adInputIdCard"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<wux-input label="姓名" placeholder="请输入姓名" controlled value="{{userName}}" bind:change="adInputUserName"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<view class="sex-content">
<view>性别</view>
<radio-group class="radio-group" bindchange="radioChange">
<radio value="1" color="#F82525" checked="{{sex === '1'}}">
<text style="color: {{sex == 1 ? '#333' : '#999'}}">男</text>
</radio>
<radio value="0" color="#F82525" checked="{{sex === '0'}}">
<text style="color: {{sex === '0' ? '#333' : '#999'}}">女</text>
</radio>
</radio-group>
</view>
</wux-cell>
<wux-cell hover-class="none">
<span class="xing">*</span>
<wux-input label="手机号" placeholder="请输入手机号" controlled value="{{mobile}}" bind:change="adInputMobile"></wux-input>
</wux-cell>
<wux-cell hover-class="none" class="yzm">
<span class="xing">*</span>
<view class="verify-content">
<view>验证码</view>
<view class="verify-code">
<input type="text" placeholder="请输入验证码" placeholder-class="scode" bind:change="adInputSmsCode"/>
<view class="getcode" bindtap="getSmsCode">
<span wx:if="{{wait>=60}}">获取验证码</span>
<span wx:else>{{wait}}秒...</span>
</view>
</view>
</view>
</wux-cell>
</view>
</view>
<view class="card cardcon">
<view class="jzdz">
<view class="address">
<view class="left">居住地址</view>
<view class="right" bindtap="changeGrid" wx:if="{{changeGridList.length > 0}}">
<view class="change-grid">切换网格</view>
<image src="../../images/mine/ic_qiehuan@2x.png" />
</view>
</view>
<view>{{gridName}}</view>
</view>
<view class="content">
<wux-cell hover-class="none">
<wux-input placeholder="*请填写所在小区" controlled value="{{street}}" bind:change="adInputStreet"></wux-input>
</wux-cell>
<!-- <wux-cell hover-class="none">
<wux-input placeholder="小区名称" controlled value="{{community}}" bind:change="adInputCommunity"></wux-input>
</wux-cell>
<wux-cell hover-class="none">
<wux-input placeholder="楼栋号-单元室(如5号楼701)" controlled value="{{building}}" bind:change="adInputBuilding"></wux-input>
</wux-cell> -->
</view>
</view>
<view class="tap">*请填写您的真实信息,我们会严格保密,请您放心</view>
<view class="submit-btn" wx:if="{{unionIdStatus === '1'}}">
<button hover-class="hover-button" bindtap="toRegister">提交</button>
</view>
<view class="submit-btn" wx:elif="{{unionIdStatus === '0'}}">
<button hover-class="hover-button" open-type="getUserInfo" bindgetuserinfo="getUserInfo">提交</button>
</view>
</view>
<wux-actionsheet id="wux-actionsheet" />

278
pages/complete_bk/complete.wxss

@ -0,0 +1,278 @@
.topfixed {
position: fixed;
top: 0;
width: 100%;
z-index: 999999;
}
.margintop {
margin-top: 60px;
}
.tab2 {
color: #999;
font-size: 0.975rem;
position: relative;
}
.tab2 .status.pass {
position: absolute;
width: 74rpx;
height: 32rpx;
top: 10%;
left: 100%;
}
.tab2 .status.pass image {
position: absolute;
width: 100%;
height:100%;
object-fit: cover;
left: 0;
top: 0;
}
.tab2 .status.pass view {
position: relative;
z-index: 100;
width: 100%;
height: 100%;
line-height: 27rpx;
text-align: center;
font-size: 16rpx;
color: #06B5A4;
}
.tab2 .status.unpass {
position: absolute;
width: 90rpx;
height: 32rpx;
top: 10%;
left: 100%;
}
.tab2 .status.unpass image {
position: absolute;
width: 100%;
height:100%;
object-fit: cover;
left: 0;
top: 0;
}
.tab2 .status.unpass view {
position: relative;
z-index: 100;
width: 100%;
height: 100%;
line-height: 27rpx;
text-align: center;
font-size: 16rpx;
color: #E74848;
}
.jzdz {
font-size: 0.975rem;
padding: 10px 0 0 10px;
color: #333;
}
.content {
width: 670rpx;
padding-top: 5px;
padding-bottom: 10px;
padding-right: 30rpx;
padding-left: 10rpx;
}
.cardcon {
height: auto;
}
.btn1 {
margin-top: 40rpx;
}
.logo-layout {
height: 136rpx;
width: 159rpx;
margin: 0 auto;
padding: 60rpx 0 80rpx 0;
}
.logo {
height: 136rpx;
width: 159rpx;
}
.tap {
font-size: 12px;
color: #999;
padding: 0 10px 0 10px;
}
.input-placeholder {
color: #999;
text-align: right;
font-size: 0.875rem;
}
.scode {
text-align: left !important;
}
.wux-tabs__tab-title {
color: #999;
font-size: 0.975rem;
}
.wux-tabs__tab--balanced .wux-tabs__tab-bar {
background: #f00 !important;
color: #f00 !important;
}
.wux-tabs__tab--current .wux-tabs__tab-title {
color: #f00 !important;
}
.wux-input__label {
font-size: 0.975rem;
color: #333;
}
.wux-input__item {
text-align: right;
}
.yzm .wux-input__item {
text-align: left;
}
.xing {
color: #f00;
float: left;
width: 10px;
}
.sex-select {
width: 100%;
position: absolute;
top: 5rpx;
right: 0px;
text-align: right;
z-index: 999;
}
.select-img {
width: 40rpx;
height: 40rpx;
}
.select-text {
padding: 15rpx;
}
.float-right {
float: right;
}
/* 弹性盒子 */
.flex {
display: -webkit-box;
display: flex;
}
/* 垂直水平居中 */
.flex-container {
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
/* 等宽排列 */
.justify-space-between {
justify-content: space-between;
}
.sex-content {
display: flex;
align-items: center;
justify-content: space-between;
}
radio {
font-size: 30rpx;
color: #999;
}
radio + radio {
margin-left: 30rpx;
}
.verify-content {
display: flex;
justify-content: space-between;
align-items: center;
}
.verify-content .verify-code {
height: 100%;
display: flex;
align-items: center;
}
.verify-content .verify-code input {
width: 190rpx;
text-align: right;
margin-right: 20rpx;
}
.verify-content .verify-code .getcode {
background: #f30;
color: #fff;
font-size: 24rpx;
border-radius: 8rpx;
height: 50rpx;
line-height: 50rpx;
padding: 6rpx 20rpx 6rpx 20rpx;
}
.submit-btn {
width: 100%;
height: 85rpx;
display: flex;
justify-content: center;
align-items:center;
margin-top: 40rpx;
}
.submit-btn button {
background: linear-gradient(to right, #f51010, #ff4c4c);
width: 560rpx;
height: 85rpx;
border-radius: 16rpx;
line-height: 85rpx;
font-size: 36rpx;
color: #fff;
text-align: center;
margin: 0;
padding: 0;
outline: 0;
}
.submit-btn .hover-button {
background: red;
}
.jzdz .address {
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
padding-right: 30rpx;
height: 60rpx;
}
.jzdz .address .right {
display: flex;
align-items: center;
justify-content: flex-end;
}
.jzdz .address .right .change-grid {
color: #999;
margin-right: 10rpx;
font-size: 25rpx;
}
.jzdz .address .right image {
width: 22rpx;
height: 22rpx;
object-fit: cover;
}
.wux-actionsheet__button {
font-size: 34rpx !important;
color: #333 !important;
}

6
project.config.json

@ -79,6 +79,12 @@
"pathName": "pages/indexNew/indexNew",
"query": "",
"scene": null
},
{
"id": -1,
"name": "完善信息",
"pathName": "pages/complete/complete",
"scene": null
}
]
}

35
utils/api.js

@ -46,7 +46,9 @@ module.exports = {
unpassActivityDetail: unpassActivityDetail,
completeInfoV2: completeInfoV2,
getTokenV3: getTokenV3,
getWxPhone: getWxPhone
getWxPhone: getWxPhone,
completeResidentInfoV2: completeResidentInfoV2,
completePartyInfoV2: completePartyInfoV2
}
function getToken(wxCode) {
@ -128,17 +130,6 @@ function gridLeaderRegister(mobile, smsCode, wxCode) {
})
}
function completeInfo(data) {
return fly.post('app-user/user/completeInfo', data)
}
//用户完善个人信息 v2
function completeResidentInfo(data) {
return fly.post('app-user/user/completeResidentInfo', data)
}
//党员完善个人信息: v2
function completePartyInfo(data) {
return fly.post('app-user/user/completePartyInfo', data)
}
function prepareComplete() {
@ -420,6 +411,26 @@ function unpassActivityDetail(id) {
function completeInfoV2(para) {
return fly.post('app-user/user/v2/completeInfo', para)
}
function completeInfo(data) {
return fly.post('app-user/user/completeInfo', data)
}
//居民 完善个人信息
function completeResidentInfo(data) {
return fly.post('app-user/user/completeResidentInfo', data)
}
//党员 完善个人信息
function completePartyInfo(data) {
return fly.post('app-user/user/completePartyInfo', data)
}
// 居民 完善个人信息v2 不需要穿验证码
function completeResidentInfoV2(para) {
return fly.post('app-user/user/v2/completeResidentInfo', para)
}
// 党员 完善个人信息 v2 不需要穿验证码
function completePartyInfoV2(para) {
return fly.post('app-user/user/v2/completePartyInfo', para)
}
/**
* 获取Token v3 网格码和邀请码合二为一

4
utils/config.js

@ -6,13 +6,13 @@ module.exports = {
};
function BASEURL() {
// return 'https://eug-test.elinkit.com.cn/js/epdc-api/api/' // 锦水测试环境
return 'https://eug-test.elinkit.com.cn/js/epdc-api/api/' // 锦水测试环境
// return 'https://eug-test.elinkit.com.cn/epdc-api/api/' // 测试环境 接口地址
// return "http://219.146.91.110:9094/epdc-api/api/" // 测试环境 ip接口地址
// return "https://epdc.elinkservice.cn/epdc-api/api/" // 正式环境 接口地址
// return 'https://epdc-app.qingdaoshibei.cn/epdc-api/api/' // 电政办 正式环境 接口地址
// return 'https://epdc-shibei.elinkservice.cn/epdc-api/api/' // 电政办 正式环境 接口地址
return 'https://epdc-jinshui.elinkservice.cn/epdc-api/api/' // 锦水正式环境接口地址
// return 'https://epdc-jinshui.elinkservice.cn/epdc-api/api/' // 锦水正式环境接口地址
}
function WEBROOT() {

Loading…
Cancel
Save