jhwxapp/miniprogram/pageage/lw-jibenxinxi/lw-jibenxinxi.js

480 lines
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// // pages/lw-jibenxinxi/lw-jibenxinxi.js
// const app = getApp()
// Page({
// /**
// * 页面的初始数据
// */
// data: {
// radio: '1',
// nameGz:'请选择工种',
// showGz: false,
// columnsGz:[],
// nameGx:'请选择班组',
// showGx: false,
// columnsGx:[],
// nameLwgs:'请选择劳务公司',
// showLwgs: false,
// columnsLwgs:[],
// date:'请选择入场时间',
// showDate: false,
// today:'',
// minDate: new Date(2020, 0, 1).getTime(),
// maxDate: new Date().getTime(),
// //上传证件
// tempFilePaths: '',
// sourceType: ['album', 'camera'],
// FilePaths:'',
// recitePaths:'',
// photographImg:'',
// idCardPositiveMap:{},
// idCardVersoMap:{},
// facePhotos:{},
// idCardPositiveErrorMap:{},
// idCardVersoErrorMap:{},
// facePhotosError:{},
// //个人信息
// phone:'',
// teamid:'',
// worktypeid:'',
// labourId:'',
// loadShow:false,
// },
// onClickShow() {
// this.setData({ loadShow: true });
// },
// onClickHide() {
// this.setData({ loadShow: false });
// },
// onChange(event) {
// this.setData({
// radio: event.detail,
// });
// },
// onClose() {
// this.setData({ showGz: false });
// this.setData({ showGx: false });
// this.setData({ showLwgs : false });
// this.setData({ showDate: false });
// },
// //劳务工种
// showPopupGz() {
// this.setData({ showGz: true });
// },
// onChangeGz(event) {
// this.setData({ nameGz: event.detail.value.text,worktypeid:event.detail.value.id });
// this.setData({ showGz: false });
// },
// //劳务班组
// showPopupGx() {
// this.setData({ showGx: true });
// },
// onChangeGx(event) {
// this.setData({ nameGx: event.detail.value.text,teamid: event.detail.value.id});
// this.setData({ showGx: false });
// },
// //劳务公司
// showPopupLwgs () {
// this.setData({ showLwgs : true });
// },
// onChangeLwgs (event) {
// this.setData({ nameLwgs : event.detail.value.text,labourId:event.detail.value.id });
// this.setData({ showLwgs : false });
// this.setData({ nameGx : '请选择班组' });
// this.selectLabourGroupAll(app.globalData.projectId,event.detail.value.id);
// },
// //入场时间
// onDisplay() {
// this.setData({ showDate: true });
// },
// formatDate(date) {
// date = new Date(date);
// var dateYaer = date.getFullYear();
// var dateMonth = date.getMonth() + 1;
// var dateDay = date.getDate();
// if(dateMonth < 10 ){
// dateMonth = '0' + dateMonth;
// }
// if(dateDay < 10 ){
// dateDay = '0' + dateDay;
// }
// return dateYaer+'-'+dateMonth+ '-'+dateDay;
// },
// onConfirm(event) {
// this.setData({
// showDate: false,
// date: this.formatDate(event.detail),
// });
// },
// frontimage: function () {
// this.onClickShow();
// var _this = this;
// var Type = _this.data.sourceType
// wx.chooseImage({
// count: 1, // 默认9
// sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
// sourceType: Type, // 可以指定来源是相册还是相机,默认二者都有
// success: function (res) {
// // 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
// _this.setData({
// FilePaths: res.tempFilePaths
// })
// _this.selectIDCardInfo(res.tempFilePaths,'1');
// }
// })
// },
// reciteimage: function () {
// this.onClickShow();
// var _this = this;
// var Type = _this.data.sourceType
// wx.chooseImage({
// count: 1, // 默认9
// sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
// sourceType: Type, // 可以指定来源是相册还是相机,默认二者都有
// success: function (res) {
// // 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
// _this.setData({
// recitePaths: res.tempFilePaths
// })
// _this.selectIDCardInfo(res.tempFilePaths,'2');
// }
// })
// },
// photograph: function () {
// this.onClickShow();
// var _this = this;
// var Type = _this.data.sourceType
// wx.chooseImage({
// count: 1, // 默认9
// sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
// sourceType: Type, // 可以指定来源是相册还是相机,默认二者都有
// success: function (res) {
// // 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
// _this.setData({
// photographImg: res.tempFilePaths
// })
// _this.selectIDCardInfo(res.tempFilePaths,'');
// }
// })
// },
// /**
// * 人员电话信息
// * @param {} even
// */
// phone:function(even){
// this.setData({
// phone:even.detail.value
// })
// },
// /**
// * 生命周期函数--监听页面加载
// */
// onLoad: function (options) {
// this.onClickShow();
// var date = new Date();
// var dateYaer = date.getFullYear();
// var dateMonth = date.getMonth() + 1;
// var dateDay = date.getDate();
// if(dateMonth < 10 ){
// dateMonth = '0' + dateMonth;
// }
// if(dateDay < 10 ){
// dateDay = '0' + dateDay;
// }
// this.setData({
// today:dateYaer+'-'+dateMonth+ '-'+dateDay,
// })
// this.selectLabourWorkAll();
// this.selectLabourUnitAll(app.globalData.projectId);
// },
// /**
// * 查询全量工种信息
// */
// selectLabourWorkAll:function(){
// var that = this;
// wx.request({
// url: app.globalData.reqUrl+'/weixin/labour/selectLabourWorkAll',
// method:"GET",
// success:function(res){
// if(res.data.code == '200'){
// that.setData({
// columnsGz:res.data.data
// })
// }
// }
// })
// },
// /**
// * 根据项目id查询出参建单位信息
// * @param {*} projectId 项目id
// */
// selectLabourUnitAll:function(projectId){
// var that = this;
// wx.request({
// url: app.globalData.reqUrl+'/weixin/labour/selectLabourUnitAll',
// data:{
// "projectId":projectId
// },
// method:"GET",
// success:function(res){
// that.onClickHide();
// if(res.data.code == '200'){
// that.setData({
// columnsLwgs:res.data.data
// })
// }
// }
// })
// },
// /**
// * 查询出班组信息
// * @param {*} projectId 项目id
// * @param {*} unitId 劳务公司id
// */
// selectLabourGroupAll:function(projectId,unitId){
// var that = this;
// wx.request({
// url: app.globalData.reqUrl+'/weixin/labour/selectLabourGroupAll',
// data:{
// "projectId":projectId,
// "unitId":unitId
// },
// method:"GET",
// success:function(res){
// if(res.data.code == '200'){
// that.setData({
// columnsGx:res.data.data
// })
// }
// }
// })
// },
// /**
// * 身份证识别
// * file 图片地址
// * type == 1 身份证正面
// * type == 2 身份证反面
// * type == "" 人脸图片
// */
// selectIDCardInfo:function(file,type){
// var that = this;
// wx.uploadFile({
// url: app.globalData.reqUrl+'/weixin/labour/selectIDCardInfo',
// header: {
// "Content-Type": "application/x-www-form-urlencoded"
// },
// filePath: file[0],
// name: 'file',
// formData: {'type':type},
// method:"post",
// success:function(res){
// that.onClickHide();
// var json = JSON.parse(res.data);
// if(json.code == "200"){
// if(type == "1"){
// that.setData({
// idCardPositiveMap:json.data,
// idCardPositiveErrorMap:{}
// })
// }else if(type == "2"){
// that.setData({
// idCardVersoMap:json.data,
// idCardVersoErrorMap:{}
// })
// }else{
// that.setData({
// facePhotos:json.data,
// facePhotosError:{}
// })
// }
// }else{
// if(type == "1"){
// that.setData({
// idCardPositiveMap:{},
// idCardPositiveErrorMap:json
// })
// }else if(type == "2"){
// that.setData({
// idCardVersoMap:{},
// idCardVersoErrorMap:json
// })
// }else{
// that.setData({
// facePhotos:{},
// facePhotosError:json
// })
// }
// app.toast(json.msg);
// }
// },
// })
// },
// /**
// * 人员注册
// */
// add:function(){
// var that = this;
// //验证
// var FilePaths = this.data.FilePaths;
// var recitePaths = this.data.recitePaths;
// var photographImg = this.data.photographImg;
// var phone = this.data.phone;
// var nameGz = this.data.nameGz;
// var nameLwgs = this.data.nameLwgs;
// var nameGx = this.data.nameGx;
// var date = this.data.date;
// var teamid = this.data.teamid;
// var worktypeid = this.data.worktypeid;
// var labourId = this.data.labourId;
// var idCardPositiveMap = this.data.idCardPositiveMap;
// var idCardVersoMap = this.data.idCardVersoMap;
// var facePhotos = this.data.facePhotos;
// //异常信息
// var idCardPositiveErrorMap = this.data.idCardPositiveErrorMap;
// var idCardVersoErrorMap = this.data.idCardVersoErrorMap;
// var facePhotosError = this.data.facePhotosError;
// if(FilePaths == ""){
// app.toast("请上传身份证正面照片!");
// return;
// }if(recitePaths == ""){
// app.toast("请上传身份证反面照片!");
// return;
// }if(photographImg == ""){
// app.toast("请上传人脸照片!");
// return;
// }if(phone == "" || phone.length != 11){
// app.toast("请填写正确的电话号码!");
// return;
// }if(nameGz == "请选择工种"){
// app.toast("请选择工种信息!");
// return;
// }if(nameLwgs == "请选择劳务公司"){
// app.toast("请选择劳务公司!");
// return;
// }if(nameGx == "请选择班组"){
// app.toast("请选择班组!");
// return;
// }if(date == "请选择入场时间"){
// app.toast("请选择入场时间");
// return;
// }if(idCardPositiveErrorMap !='' && idCardPositiveErrorMap.code == "300"){
// app.toast(idCardPositiveErrorMap.msg);
// return;
// }if(idCardVersoErrorMap !='' && idCardVersoErrorMap.code == "300"){
// app.toast(idCardVersoErrorMap.msg);
// return;
// }if(idCardVersoErrorMap != '' && facePhotosError.code == "300"){
// app.toast(facePhotosError.msg);
// return;
// }
// /************对比照片是否为同一人********/
// this.onClickShow();
// //定义数组
// var list =new Array();
// var userData = {
// "image":facePhotos.pathUrl,
// "image_type":"BASE64",
// "face_type":"LIVE",
// };
// var idcardimgData = {
// "image":idCardPositiveMap.pathUrl,
// "image_type":"BASE64",
// "face_type":"CERT",
// }
// list.push(idcardimgData);
// list.push(userData);
// wx.request({
// url: app.globalData.reqUrl+'/weixin/labour/imgContrast',
// header: {
// "Content-Type": "application/x-www-form-urlencoded"
// },
// data:{
// "parame":JSON.stringify(list)
// },
// method:"POST",
// success:function(res){
// if(res.data.code == '200'){
// //同步数据
// wx.request({
// url: app.globalData.reqUrl+'/weixin/labour/addUserData',
// header: {
// "Content-Type": "application/x-www-form-urlencoded"
// },
// data:{
// "id":app.globalData.projectId,
// "idcardnum":idCardPositiveMap.cardNum,
// "name":idCardPositiveMap.name,
// "teamid":teamid,
// "userphone":phone,
// "userphotoSpare":facePhotos.pathUrl,
// "enterdate":date,
// "worktypeid":worktypeid,
// "sex":idCardPositiveMap.sex,
// "nation":idCardPositiveMap.nation,
// "birthday":idCardPositiveMap.birthday,
// "address":idCardPositiveMap.address,
// "organization":idCardVersoMap.organization,
// "useStarttime":idCardVersoMap.use_starttime,
// "useEndtime":idCardVersoMap.use_endTime,
// "idcardimgSpare":idCardPositiveMap.pathUrl,
// "idcardimgSpare2":idCardVersoMap.pathUrl
// },
// method:"POST",
// success:function(res){
// that.onClickHide();
// if(res.data.code == "200"){
// app.toast("注册成功");
// wx.redirectTo({
// url: '../lw-jibenxinxi/lw-jibenxinxi',
// })
// }else{
// app.toast(res.data.msg);
// return;
// }
// }
// })
// }else{
// that.onClickHide();
// app.toast(res.data.msg);
// return;
// }
// }
// })
// },
// /**
// * 返回劳务管控页面
// */
// goBack:function(){
// wx.redirectTo({
// url: '../lw-index/lw-index',
// })
// }
// })