Browse Source

no message

featrue/v4.2
xpz2018 5 years ago
parent
commit
0fb2839913
6 changed files with 2 additions and 300 deletions
  1. 1
      app.json
  2. 180
      pages/home/pauthory/index.js
  3. 6
      pages/home/pauthory/index.json
  4. 61
      pages/home/pauthory/index.wxml
  5. 50
      pages/home/pauthory/index.wxss
  6. 4
      pages/home/pindex/index.js

1
app.json

@ -9,7 +9,6 @@
"pages/home/password/index", "pages/home/password/index",
"pages/home/setting/index", "pages/home/setting/index",
"pages/home/authory/index", "pages/home/authory/index",
"pages/home/pauthory/index",
"pages/home/idcard/index", "pages/home/idcard/index",
"pages/home/info/index", "pages/home/info/index",
"pages/home/pinfo/index", "pages/home/pinfo/index",

180
pages/home/pauthory/index.js

@ -1,180 +0,0 @@
// pages/home/authory/index.js
import { personalAuth } from "../../api/saas"
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
form: {
authType: 0,
},
typeList: [{text: '身份证', value: 1}, {text: '身份证', value: 2}],
flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑
imgList: [null, null],
loadingWidth: math.divide(690, 2) - 16,
pathList: new Array(),
taskArray: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
},
showPicker: function (e) {
if (this.data.flag) {
return
}
this.pickerView.showPicker(this.data.typeList, null, 1)
},
onPickerChange: function (e) {
if (!e.detail) {
return
}
if (e.detail.type == 1) {
this.setData({ ['form.bankName']: e.detail.text, ['form.bankId']: Number(e.detail.value) })
}
},
bindForm: function (e) {
// var form_data = 'form.' + e.target.id
this.data.form[e.target.id] = e.detail.value
},
submitForm: function(){
if (util.isEmpty(this.data.form.userName)) {
util.showToast('请输入真实姓名')
return
}
if (util.isEmpty(this.data.form.idCard)) {
util.showToast('请输入身份证号码')
return
}
if (util.checkId(this.data.form.idCard).status == 0) {
util.showToast('身份证号码有误')
return
}
if (util.isEmpty(this.data.pathList[0]) || util.isEmpty(this.data.pathList[0].url)) {
util.showToast('请上传身份证正面照片')
return
}
this.data.form.cardFront = this.data.pathList[0].url
if (util.isEmpty(this.data.pathList[1]) || util.isEmpty(this.data.pathList[1].url)) {
util.showToast('请上传身份证背面照片')
return
}
this.data.form.cardReverse = this.data.pathList[1].url
// /front/customer/personalAuth 个人会员认证
wx.showLoading({ title: '处理中', mask: true })
personalAuth(this.data.form).then(res => {
wx.hideLoading()
app.globalData.userInfo.isAuth = 1
util.showBackToast('上传成功')
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
},
/*******************************************************图片上传************************************************************/
uploadImage: function (index, path) {
var _this = this
_this.setData({
['pathList[' + index + ']']: { status: 1, url: '' }
})
// /utils/uploadImage 统一上传图片接口
var task = wx.uploadFile({
url: app.httpUrl + '/saas-user/utils/uploadImage',
filePath: path,
name: 'image',
header: {
"Content-Type": "multipart/form-data",
appversion: app.version
},
success: function (result) {
var resp = JSON.parse(result.data)
if (resp.code === 0) {
_this.setData({
['pathList[' + index + '].status']: 8,
['pathList[' + index + '].url']: resp.data
})
if(_this.data.id > 0){
var _index = Number(index) + 1
_this.setData({
['form.fileUrl' + _index]: resp.msg
})
}
}
},
fail: function (res) {
_this.setData({
['pathList[' + index + '].status']: -1
})
},
complete: function (res) {
for (let i = 0; i < _this.data.taskArray.length; i++) {
if (_this.data.taskArray[i].path === path) {
_this.data.taskArray.splice(i, 1);
break
}
}
_this.setData({
taskArray: _this.data.taskArray
})
},
})
_this.data.taskArray.push({ path: path, task: task })
_this.setData({
taskArray: _this.data.taskArray
})
},
chooseImage(e) {
if (this.data.flag) {
return
}
var index = e.currentTarget.dataset.index
wx.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: (res) => {
this.setData({ ['imgList[' + index + ']']: res.tempFilePaths[0] })
for (let i = 0; i < res.tempFilePaths.length; i++) {
this.uploadImage(index, res.tempFilePaths[i])
}
}
});
},
viewImage(e) {
var urlList = []
for (var i = 0; i < this.data.imgList.length; i++) {
if (!util.isEmpty(this.data.imgList[i])) {
urlList.push(this.data.imgList[i])
}
}
wx.previewImage({ urls: urlList, current: e.currentTarget.dataset.url });
},
deleteImg(e) {
var index = e.currentTarget.dataset.index
// 如果是正在上传的;
if (this.data.pathList[index] && this.data.pathList[index].status === 1) {
if (this.data.taskArray[index]) {
this.data.taskArray[index].abort() // 取消上传任务
}
this.data.taskArray.splice(index, 1);
}
this.data.imgList[index] = null;
if (this.data.pathList.length > index){
this.data.pathList.splice(index, 1);
}
this.setData({
imgList: this.data.imgList,
pathList: this.data.pathList,
taskArray: this.data.taskArray
})
}
})

6
pages/home/pauthory/index.json

@ -1,6 +0,0 @@
{
"usingComponents": {
"picker-view": "/components/picker-view/index",
"wux-button": "/components/button/index"
}
}

61
pages/home/pauthory/index.wxml

@ -1,61 +0,0 @@
<!--pages/home/authory/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">实名认证</view>
</cu-custom>
<view class="cu-list menu no-card sm-border margin-top">
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:170rpx">姓名:</view>
<input id="userName" maxlength="8" style="width:65%" placeholder="请输入真实姓名" bindinput="bindForm"></input>
</view>
</view>
<!-- <view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx" bindtap="showPicker">
<view style="min-width:170rpx">证件类型:</view>
<input style="flex:1" disabled="true" bindblur="inputBlur" placeholder="请选择证件类型"></input>
<text class="cuIcon-right text-gray" style="font-size:18px"></text>
</view>
</view> -->
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:170rpx">身份证号码:</view>
<input id="idCard" maxlength="19" style="width:65%" type="idcard" bindblur="inputBlur" placeholder="请输入身份证号码" bindinput="bindForm"></input>
</view>
</view>
</view>
<view class="cu-bar bg-white margin-top" style="min-height:90rpx">
<view class="action" style="color:#333333">上传身份证</view>
<view class="action text-gray" style="font-size:12px">正反面共2张</view>
</view>
<view class="cu-form-group">
<view class="flex flex-justify" style="width:100%;padding-bottom:30rpx">
<view class="image-reader-item" bindtap="chooseImage" data-index="0" wx:if="{{!imgList[0]}}">
<text class="cuIcon-cameraadd md-icon" style="font-size:50rpx" wx:if="{{!flag}}"></text>
<text class="md-hint" wx:if="{{!flag}}">身份证正面</text>
</view>
<view class="image-reader-item" style="background-image:url({{imgList[0]}})" bindtap="viewImage" data-url="{{imgList[0]}}" wx:else >
<view class="delete" catchtap="deleteImg" data-index="0" wx:if="{{!flag}}">
<text class="cuIcon-close {{pathList[0].status===-1?'text-red':'text-white'}}"></text>
</view>
<view class="md-load load-spinner text-white" wx:if="{{pathList[0].status===1}}"/>
</view>
<view class="image-reader-item" bindtap="chooseImage" data-index="1" wx:if="{{!imgList[1]}}">
<text class="cuIcon-cameraadd md-icon" style="font-size:50rpx" wx:if="{{!flag}}"></text>
<text class="md-hint" wx:if="{{!flag}}">身份证背面</text>
</view>
<view class="image-reader-item" style="background-image:url({{imgList[1]}})" bindtap="viewImage" data-url="{{imgList[1]}}" wx:else>
<view class="delete" catchtap="deleteImg" data-index="1" wx:if="{{!flag}}">
<text class="cuIcon-close {{pathList[1].status===-1?'text-red':'text-white'}}"></text>
</view>
<view class="md-load load-spinner text-white" wx:if="{{pathList[1].status===1}}"/>
</view>
</view>
</view>
<view class="flex flex-direction" style="padding: 72rpx 32rpx">
<wux-button block type="positive" bind:click="submitForm">提交</wux-button>
</view>
<picker-view id="picker-view" bindcustomevent="onPickerChange"></picker-view>

50
pages/home/pauthory/index.wxss

@ -1,50 +0,0 @@
/* pages/home/authory/index.wxss */
.image-reader-item {
position: relative;
width: 49%;
height: 128px;
background-color: #f8f8f8;
box-sizing: border-box;
list-style: none;
background-size: cover;
border-radius: 6rpx;
}
.image-reader-item .md-icon {
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0.5;
}
.image-reader-item .md-load {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.image-reader-item .md-hint {
position: absolute;
top: 50%;
left: 0;
width: 100%;
margin-top: 10px;
font-size: 12px;
color: #bababa;
text-align: center;
}
.image-reader-item .delete {
position: absolute;
top: 0px;
right: 0px;
opacity: 0.8;
border-top-right-radius: 6rpx;
border-bottom-left-radius: 8rpx;
padding: 6rpx 12rpx;
height: auto;
background-color: rgba(0, 0, 0, 0.5);
}

4
pages/home/pindex/index.js

@ -71,7 +71,7 @@ Component({
return return
} }
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){
wx.navigateTo({ url: '/pages/home/pauthory/index' })
wx.navigateTo({ url: '/pages/home/idcard/index' })
} else { } else {
wx.navigateTo({ url: '/pages/home/pinfo/index' }) wx.navigateTo({ url: '/pages/home/pinfo/index' })
} }
@ -82,7 +82,7 @@ Component({
return return
} }
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){
wx.navigateTo({ url: '/pages/home/pauthory/index' })
wx.navigateTo({ url: '/pages/home/idcard/index' })
} else { } else {
wx.navigateTo({ url: '/pages/home/pinfo/index' }) wx.navigateTo({ url: '/pages/home/pinfo/index' })
} }

Loading…
Cancel
Save