123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- const app = getApp();
- Page({
- data: {
- //身份证手持页
- // 上传的案例图片集合
- scsfzImages: [],
- // 案例图片数目是否达到了最大数目
- scsfzImagesNum: false, //加号图标 显示
- scsfzimg: true, //上传图片 隐藏
- scsfzinitial: true, //初始图片 隐藏
- // 设置上传案例图片的最大数目
- maxImages: 1,
- img1: '', //手持身份证
- initial: [], //头部信息
- SubmissionHidden: true, //提交隐藏显示
- },
- onLoad: function (options) {
- var that = this;
- // // 获取信息
- let initial_url = 'my/authentication/educationchange';
- let initial_data = {
- };
- app.postRequest(initial_url, initial_data, function (res) {
- if (res.code == 201) {
- console.log(res.data.status);
- that.setData({
- initial: res.data, // 初始数据
- initialcode: res, //获取未上传状态
- })
- }
- if (res.data.status == 2) { //如果审核未通过 显示提交按钮
- that.setData({
- SubmissionHidden: false
- })
- } else if (res.code != 201) {
- that.setData({
- SubmissionHidden: false
- })
- }else{
- that.setData({
- SubmissionHidden: true
- })
- }
- })
- },
- // 上传学历
- scsfzclick: function (e) {
- var _this = this;
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success(res) {
- let tempFilesSize = res.tempFiles[0].size;
- if (tempFilesSize > 1024 * 1024 * 3) {
- wx.showModal({
- title: '提示',
- content: '图片不得超过3MB',
- showCancel: false,
- })
- return;
- }
- _this.setData({
- scsfzImages: res.tempFilePaths[0],
- scsfzImagesNum: true,
- scsfzimg: false,
- img1: res.tempFilePaths[0],
- });
- }
- })
- },
- // //最后提交认证
- Submission: function (e) {
- var _this =this;
- console.log(this.data.img1)
- if (this.data.img1 == '') {
- var _qrcode = '请上传学历证明'
- getApp().Tips(_qrcode);
- }else{
- // console.log(this.data.img1)
- //上传图片
- wx.uploadFile({
- url: app.globalData.url + 'my/authentication/education',
- filePath: this.data.img1,
- name: 'img1',
- formData: {
- key: wx.getStorageSync('access_key'),
- token: wx.getStorageSync('access_token')
- },
- success: function (res) {
- var data = JSON.parse(res.data);
- if (data.code == 201) {
- wx.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000
- })
- _this.onLoad();
- return
- }
- var _qrcode = data.msg
- getApp().Tips(_qrcode);
- }, fail: function (d) {
- wx.showToast({ //这里提示失败
- title: '上传失败',
- icon: 'none', // 不显示图标
- duration: 2000
- })
- }
- })
- }
- },
- })
|