123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- const app = getApp();
- Page({
- data: {
-
-
- scsfzImages: [],
-
- scsfzImagesNum: false,
- scsfzimg: true,
- scsfzinitial: true,
-
- sfztxyImages: [],
- sfztxyImagesNum: false,
- sfztxyimg: true,
-
-
- sfzfmImages: [],
- sfzfmImagesNum: false,
- sfzfmimg: true,
-
-
- maxImages: 1,
- loadingHidden: false,
- name: '',
- number: '',
- hold: '',
- positive: '',
- opposite: '',
- initial: [],
- SubmissionHidden: true,
- isShow: false,
- },
-
- onLoad: function (options) {
- var that = this;
-
- let initial_url = 'my/authentication/ididentitychange';
- let initial_data = {
- };
- app.postRequest(initial_url, initial_data, function (res) {
- if (res.code == 201) {
- console.log(res.data.hold);
- that.setData({
- initial: res.data,
- initialcode: res,
- name: res.data.name,
- number: res.data.number,
- })
- }
- if (res.data.save_status == 2){
- that.setData({
- SubmissionHidden: false
- })
- } else if (res.code != 201) {
- that.setData({
- SubmissionHidden: false
- })
- }else{
- that.setData({
- SubmissionHidden: true
- })
- }
- })
- },
-
- ObtainName: function (e) {
- var name = e.detail.value;
- console.log(name);
- this.setData({
- name: name
- });
- },
-
- Obtainsfz: function (e) {
- var number = e.detail.value;
- console.log(number);
- this.setData({
- number: number
- });
- },
-
- 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;
- }
- wx.showToast({
- title: '上传中...',
- icon: 'loading'
- });
-
- let dt_url = 'my/images/tempimages';
- let dt_filePath = res.tempFilePaths[0];
- app.Multigraph(dt_url, dt_filePath,function(res){
-
- if (res.code==201){
-
- _this.setData({
- scsfzImages: dt_filePath,
- scsfzImagesNum: true,
- scsfzimg: false,
- hold:res.data.img_name,
- });
-
- wx.showToast({
- title: '上传成功',
- icon: 'none',
- duration: 2000
- })
- }
- });
-
- }
- })
- },
-
- sfztxyclick: 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;
- }
- wx.showToast({
- title: '上传中...',
- icon: 'loading'
- });
-
- let dt_url = 'my/images/tempimages';
- let dt_filePath = res.tempFilePaths[0];
- app.Multigraph(dt_url, dt_filePath, function (res) {
- if (res.code == 201) {
-
- _this.setData({
- sfztxyImages: dt_filePath,
- sfztxyImagesNum: true,
- sfztxyimg: false,
- positive: res.data.img_name,
- });
- wx.showToast({
- title: '上传成功',
- icon: 'none',
- duration: 2000
- })
- }
- });
- }
- })
- },
-
- sfzfmclick: 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;
- }
-
- wx.showToast({
- title: '上传中...',
- icon: 'loading'
- });
-
- let dt_url = 'my/images/tempimages';
- let dt_filePath = res.tempFilePaths[0];
- app.Multigraph(dt_url, dt_filePath, function (res) {
- if (res.code == 201) {
-
- _this.setData({
- sfzfmImages:dt_filePath,
- sfzfmImagesNum: true,
- sfzfmimg: false,
- opposite:res.data.img_name,
- });
-
- wx.showToast({
- title: '上传成功',
- icon: 'none',
- duration: 2000
- })
- }
- });
- }
- })
- },
-
- Submission: function (e) {
- var _this =this;
- console.log(this.data.name)
- console.log(this.data.number)
- console.log(this.data.hold)
- console.log(this.data.positive)
- console.log(this.data.opposite)
- if (this.data.name == '') {
- var _name = '请填写您的真实姓名'
- Tips(_name)
- } else if (this.data.number == '') {
- var _number = '请填写本人身份证号码'
- Tips(_number)
- } else if (this.data.hold == '') {
- var _hold = '请上传手持身份证'
- Tips(_hold)
- } else if (this.data.positive == '') {
- var _positive = '请上传身份证头像页'
- Tips(_positive)
- } else if (this.data.opposite == '') {
- var _opposite = '请上传身份证反面页'
- Tips(_opposite)
- } else {
- let income_url = 'my/authentication/ididentity';
- let income_data = {
- name: this.data.name,
- number: this.data.number,
- hold: this.data.hold,
- positive: this.data.positive,
- opposite: this.data.opposite,
- };
- app.postRequest(income_url, income_data, function (res) {
- console.log(res)
- if (res.code == 201) {
- wx.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000
- })
- _this.onLoad();
- return
- }
-
-
- if (res.data.name){
- _this.setData({
- text1: res.data.name,
- isShow: true,
- });
- }
- if (res.data.number) {
- _this.setData({
- text2: res.data.number,
- isShow: true,
- });
- }
- setTimeout(function () {
- _this.setData({
- text1: '',
- text2: '',
- isShow: false,
- });
- }, 2000)
-
- })
- }
- },
- })
- function Tips(text) {
- wx.showToast({
- title: text,
- icon: 'none',
- duration: 2500
- })
- }
|