Commit 129e053b by sunchao

申请加盟部分接口对接

parent 3376ea39
......@@ -268,5 +268,9 @@ export default {
// 认证--上传就个人信息
uploadSignUpUserInfo(params){
return request(`${cffpURL}/user/uploadSignUpUserInfo`, "POST", params)
},
//查询申请加盟信息
queryById(params){
return request(`${cffpURL}/partner/queryById/${params}`, "GET")
}
}
......@@ -39,6 +39,154 @@ export default {
}else{
return;
}
}
},
/**
* 身份证号码校验,并获取生日、性别、年龄
* @param code
* @returns {{pass: boolean, msg: string, birthDay: number, gender: null, age: null, ageUnit: string}}
* @constructor
*/
IdCodeValid(code) {
if (code) {
// 身份证号合法性验证
// 支持15位和18位身份证号
// 支持地址编码、出生日期、校验位验证
const city = {
11: '北京',
12: '天津',
13: '河北',
14: '山西',
15: '内蒙古',
21: '辽宁',
22: '吉林',
23: '黑龙江 ',
31: '上海',
32: '江苏',
33: '浙江',
34: '安徽',
35: '福建',
36: '江西',
37: '山东',
41: '河南',
42: '湖北 ',
43: '湖南',
44: '广东',
45: '广西',
46: '海南',
50: '重庆',
51: '四川',
52: '贵州',
53: '云南',
54: '西藏 ',
61: '陕西',
62: '甘肃',
63: '青海',
64: '宁夏',
65: '新疆',
81: '香港',
82: '澳门',
83: '台湾',
91: '国外 '
};
// 出生年月日校验 前正则限制起始年份为1900;
const year = code.substr(6, 4); // 身份证年
const month = code.substr(10, 2); // 身份证月
const date = code.substr(12, 2); // 身份证日
const birth = new Date(year + '-' + month + '-' + date);
const time = Date.parse(year + '-' + month + '-' + date); // 身份证日期时间戳date
const now_time = Date.parse(new Date().toDateString());
const dates = (new Date(year, month, 0)).getDate(); // 身份证当月天数
const gender = code.substr(16, 1);
let row = {
'pass': true,
'msg': '验证成功',
'birthDay': time,
'gender': null,
};
if (parseInt(gender % 2 + '', 0) === 1) {
row.gender = '1';
} else {
row.gender = '2';
}
if (!code || !/^\d{6}(19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(code)) {
row = {
'pass': false,
'msg': '身份证号格式错误',
'birthDay': null,
'gender': null,
};
} else if (!city[code.substr(0, 2)]) {
row = {
'pass': false,
'msg': '身份证号地址编码错误',
'birthDay': null,
'gender': null,
};
} else if (time > now_time || date > dates) {
row = {
'pass': false,
'msg': '出生日期不合规',
'birthDay': null,
'gender': null,
}
} else {
// 18位身份证需要验证最后一位校验位
if (code.length == 18) {
code = code.split('');
// ∑(ai×Wi)(mod 11)
// 加权因子
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
// 校验位
const parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
let sum = 0;
let ai = 0;
let wi = 0;
for (let i = 0; i < 17; i++) {
ai = code[i];
wi = factor[i];
sum += ai * wi;
}
if (parity[sum % 11] != code[17].toUpperCase()) {
row = {
'pass': false,
'msg': '身份证号校验位错误',
'birthDay': null,
'gender': null,
};
}
}
}
return row;
}
},
/**
* 姓名正则(包含公司名)
*/
nameValid(name) {
const NAME_REGEXP = /(^[\u4e00-\u9fa5]{1}[\u4e00-\u9fa5\.·()()。]{0,48}[\u4e00-\u9fa5]{1}$)|(^[a-zA-Z]{1}[a-zA-Z\s]{0,48}[a-zA-Z]{1}$)/;
return NAME_REGEXP.test(name);
},
/**
* 邮箱正则
*/
emailValid(email) {
const EMAIL_REGEXP = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
return EMAIL_REGEXP.test(email);
},
//检测字符串是否只有中文、英文、数字
checkCEN(val) {
const cen_reg = /^[A-Za-z0-9\u4e00-\u9fa5]+$/;
return cen_reg.test(val);
},
/**
* 检测统一社会信用代码只能是数字和字母
* @param val
* @returns {boolean}
*/
checkTaxNo(val) {
const taxNo_reg = /[a-zA-Z0-9]{5,20}/;
return taxNo_reg.test(val);
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@
font-size: 36rpx;
background: #fff;
min-height: 100%;
overflow: auto;
padding-bottom: 80rpx;
.title{
padding: 20rpx 30rpx 0 30rpx;
display: flex;
......@@ -75,6 +77,21 @@
font-size: 12px;
text-align: center;
}
.upLoadMore{
width: 20%;
border: 2rpx #EEEBEB dashed;
text-align: center;
padding: 20rpx 0;
margin: 20rpx auto;
.iconfont{
font-size: 36rpx;
margin-bottom: 20rpx;
}
view:nth-child(2){
font-size: 18rpx;
color: #999999;
}
}
.icon-weibiaoti553{
font-size: 120rpx;
color: #627AB5;
......
......@@ -15,7 +15,7 @@
</view>
<view class="contentItem">
<text>申请身份</text>
<picker @change="changeIdentity" :value="name" :range="identityArr"
<picker @change="changeIdentity" :value="identityIdx" :range="identityArr"
range-key="name">
<view class="uni-input">{{identityArr[identityIdx]['name']}}
<text class="iconfont icon-youjiantou"></text>
......@@ -24,17 +24,26 @@
</view>
<view class="contentItem">
<text>所属组织</text>
<view class="">
银盾工作室
</view>
<picker @change="changeArea" :value="areaIdIdx" :range="cffpAreaQuerys"
range-key="areaName">
<view class="uni-input">{{cffpAreaQuerys[areaIdIdx]['areaName']}}
<text class="iconfont icon-youjiantou"></text>
</view>
</picker>
</view>
<view class="contentItem">
<text>姓名</text>
<input type="text" class="form-control" v-model="applyParam.name" placeholder="请输入姓名" />
<input type="text" class="form-control" v-model="applyParam.name" placeholder="请输入姓名"
auto-blur=true @blur="checkInput(1,applyParam.name)"/>
</view>
<view class="contentItem">
<text>手机号</text>
<input type="text" class="form-control" v-model="applyParam.mobileNumber" placeholder="请输入手机号" maxlength="11"
auto-blur=true @blur="checkInput(2,applyParam.mobileNumber)" />
</view>
<view class="contentItem">
<text>证件类型</text>
<picker @change="changeIdType" :value="name" :range="idTypesList"
<picker @change="changeIdType" :value="idTypeIdx" :range="idTypesList"
range-key="name">
<view class="uni-input">{{idTypesList[idTypeIdx]['name']}}
<text class="iconfont icon-youjiantou"></text>
......@@ -44,7 +53,8 @@
<view class="contentItem">
<text>证件号码</text>
<view>
<input type="text" class="form-control" v-model="applyParam.idNo" placeholder="请输入证件号码" />
<input type="text" class="form-control" v-model="applyParam.idNo" placeholder="请输入证件号码"
auto-blur=true @blur="checkInput(3,applyParam.idNo)"/>
</view>
</view>
<view class="contentItem">
......@@ -69,15 +79,18 @@
<script>
import api from "@/api/api";
import common from '@/common/common.ts';
import util from '@/util/dataHandling';
export default{
data(){
return {
identityIdx:0,
identityArr:[{partnerLevel:null,name:'请选择'},{partnerLevel:'A',name:'事业伙伴'},{partnerLevel:'B1',name:'工作室'}],
identityArr:[{partnerLevel:'A1',name:'事业伙伴'},{partnerLevel:'B1',name:'工作室'}],
applyParam:{
inviterInvitationCode:'',
name:'',
partnerLevel:'',
mobileNumber:'',
partnerLevel:'A1',
idType:'',
idNo:'',
birthday:'',
......@@ -87,11 +100,14 @@
idTypesList:[{id:null,name:'请选择'}],
idTypeIdx:0,
maxDate:`${new Date().getFullYear()}-${new Date().getMonth() + 1}`,
cffpAreaQuerys:[{areaId:null,areaName:"请选择所属组织",levelOrder:null}],
areaIdIdx:0
}
},
components:{},
onLoad(){
this.erpInitialize();
this.queryOrgList();
},
methods:{
erpInitialize(){
......@@ -102,10 +118,24 @@
}
})
},
queryOrgList(){
const param = {
userId:uni.getStorageSync('cffp_userId'),
// userId:1,
partnerLevel:this.applyParam.partnerLevel
}
console.log(param)
api.queryOrgList(param).then((res)=>{
console.log(res)
if(res['success']){
this.cffpAreaQuerys = this.cffpAreaQuerys.concat(res['data']['cffpAreaQuerys'])
}
})
},
changeIdentity: function(e) {
this.identityIdx = e.detail.value;
this.applyParam.partnerLevel = this.identityArr[this.identityIdx]['partnerLevel'];
console.log(this.partnerLevel)
console.log(this.applyParam.partnerLevel)
},
changeIdType:function(e){
this.idTypeIdx = e.detail.value;
......@@ -115,34 +145,130 @@
bindBirthday: function(e) {
this.applyParam.birthday = e.detail.value;
},
changeArea:function(e){
this.areaIdIdx = e.detail.value;
this.applyParam.areaId = this.cffpAreaQuerys[this.areaIdIdx]['areaId'];
console.log(this.applyParam.areaId)
},
checkInput(type,code){
if(type==1){
if(code && !common.nameValid(code)){
uni.showToast({
title: '请输入真实的姓名!',
duration: 2000,
icon: 'none'
})
return;
}
}
if(type==2){
if(code && !common.mobileNoValid(code)){
uni.showToast({
title: '请输入正确的手机号码!',
duration: 2000,
icon: 'none'
})
return;
}
}
if(type == 3){
if(this.applyParam.idType === '身份证'){
if(code && !common.IdCodeValid(code).pass){
uni.showToast({
title: `${common.IdCodeValid(code).msg}`,
duration: 2000,
icon: 'none'
})
return;
}
this.applyParam.birthday = util.dateFormat(common.IdCodeValid(code).birthDay,'yyyy-MM-dd');
console.log(this.applyParam)
}else{
if(code && !common.checkTaxNo(code)){
uni.showToast({
title: '证件号码只能是5-20位的数字字母组合',
duration: 2000,
icon: 'none'
})
return;
}
}
}
},
saveInfo(){
// if(!this.applyParam.name){
// uni.showToast({
// title: '请输入姓名',
// duration: 2000,
// icon: 'none'
// })
// return;
// }
// if(!this.applyParam.idType){
// uni.showToast({
// title: '请选择证件类型',
// duration: 2000,
// icon: 'none'
// })
// return;
// }
// if(!this.applyParam.idNo){
// uni.showToast({
// title: '请输入证件号',
// duration: 2000,
// icon: 'none'
// })
// return;
// }
uni.setStorageSync('applyParam',JSON.stringify(this.applyParam))
uni.navigateTo({
url:'work-experience'
if(!this.applyParam.name){
uni.showToast({
title: '请输入姓名',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.mobileNumber){
uni.showToast({
title: '请输入手机号',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.partnerLevel){
uni.showToast({
title: '请选择申请身份!',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.idType){
uni.showToast({
title: '请选择证件类型',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.idNo){
uni.showToast({
title: '请输入证件号',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.birthday){
uni.showToast({
title: '请选择出生日期',
duration: 2000,
icon: 'none'
})
return;
}
this.applyParam = {
...this.applyParam,
applyType:2,
operatStep:1,
// userId:uni.getStorageSync('cffp_userId'),
userId:42,
hasCrossDistrict:0,
id:17
}
api.saveApplyInfo(this.applyParam).then((res)=>{
if(res['success']){
uni.navigateTo({
// url:`work-experience?id=${res['data']['id']}`
url:`work-experience`
});
uni.setStorageSync('applyId',String(res['data']['id']))
}else{
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
return;
}
})
}
}
......
......@@ -8,44 +8,58 @@
</view>
<view class="content">
<view class="content_wrapper">
<view class="photo">
<view class="photo" v-if="!applyParam.idFrontPageOssPath" @click="upLoadPhoto('front')">
<image src="../../static/front.png" alt="身份证正面" mode="widthFix"></image>
<text class="iconfont icon-weibiaoti553" ></text>
<view class="choseBtn" >点击添加身份证正面</view>
</view>
<!-- <image class="showimage" ></image> -->
<view class="showimage" v-if="applyParam.idFrontPageOssPath">
<image :src="applyParam.idFrontPageOssPath" mode="widthFix"></image>
</view>
<view class="tips">
<view>(正确示例:身份证正面,字体清晰)</view>
<view>(jpg,png 文件大小不大于1mb)</view>
</view>
</view>
<view class="content_wrapper" style="margin-top: 25px;">
<view class="photo">
<view class="photo" v-if="!applyParam.idBackPageOssPath" @click="upLoadPhoto('back')">
<image src="../../static/back.png" alt="身份证反面面" mode="widthFix"></image>
<text class="iconfont icon-weibiaoti553" ></text>
<view class="choseBtn" >点击添加身份证反面</view>
</view>
<!-- <image class="showimage"></image> -->
<view class="showimage" v-if="applyParam.idBackPageOssPath">
<image :src="applyParam.idBackPageOssPath" mode="widthFix"></image>
</view>
<view class="tips">
<view>(正确示例:身份证反面,字体清晰)</view>
<view>(jpg,png 文件大小不大于1mb)</view>
</view>
</view>
</view>
<navigator class="fixed" url="education" @click="saveInfo()">
<view class="fixed" @click="saveInfo()">
保存并下一步
</navigator>
</view>
</view>
</template>
<script>
import { CommonUpload } from '@/util/uploaderFile';
import api from '../../api/api';
export default{
data(){
return {
applyParam:{
idFrontPageOssPath:'',
idBackPageOssPath:''
}
},
dataForm:{
loginId: uni.getStorageSync('cffp_userId'),
targetType: "5",
targetId: uni.getStorageSync('cffp_userId'),
targetNo: "",
targetUseFor: "12",
targetSeq: "0"
},
}
},
components:{},
......@@ -53,8 +67,62 @@
},
methods:{
upLoadPhoto(type){
if(type == 'front'){
this.dataForm.targetNo = 2;
}
if(type == 'back'){
this.dataForm.targetNo = 3;
}
CommonUpload(that.dataForm).then(res => {
if(type == 'front'){
this.applyParam.idFrontPageOssPath = res.data.filePath;
}
if(type == 'back'){
this.applyParam.idBackPageOssPath = res.data.filePath;
}
})
},
saveInfo(){
uni.setStorageSync('applyParam',JSON.stringify(this.applyParam))
if(!this.applyParam.idFrontPageOssPath){
uni.showToast({
title: '请上传身份证正面照片',
duration: 2000,
icon: 'none'
})
return;
}
if(!this.applyParam.idBackPageOssPath){
uni.showToast({
title: '请上传身份证反面照片',
duration: 2000,
icon: 'none'
})
return;
}
this.applyParam = {
...this.applyParam,
applyType:2,
operatStep:3,
// userId:uni.getStorageSync('cffp_userId'),
userId:42,
id:17,
}
api.saveApplyInfo(this.applyParam).then(()=>{
if(res['success']){
uni.navigateTo({
// url:`id-card?id=${res['data']['id']}`
url:`education`
});
}else{
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
return;
}
})
}
}
}
......
......@@ -6,52 +6,60 @@
</view>
<text class="page_mark">2/8</text>
</view>
<view class="content">
<view class="content">
<view class="contentDetail employ">
<view class="contentItem">
<text>职业类型</text>
<picker @change="changeIndustry" :value="industryName" :range="industry"
<picker @change="changeIndustry" :value="industryIdx" :range="industry"
range-key="industryName">
<view class="uni-input">{{industry[industryIdx]['industryName']}}
<text class="iconfont icon-youjiantou"></text>
</view>
</picker>
</view>
<view class="contentItem">
<text>最近一次工作单位</text>
<input type="text" class="form-control" placeholder="非必填" v-model="applyParam.workingCompany" />
</view>
<view class="contentItem">
<text>职位</text>
<input type="text" class="form-control" placeholder="非必填" v-model="applyParam.position"/>
</view>
<view class="contentItem">
<text>任职开始时间</text>
<picker mode="date" :value="applyParam.workingStart" @change="bindWorkingStart">
<view v-if="!applyParam.workingStart">请选择<text class="iconfont icon-youjiantou"></text></view>
<view class="uni-input" v-if="applyParam.workingStart">{{applyParam.workingStart}}<text class="iconfont icon-youjiantou"></text></view>
</picker>
</view>
<view class="contentItem">
<text>结束时间</text>
<picker mode="date" :value="applyParam.workingEnd" @change="bindWorkingEnd">
<view v-if="!applyParam.workingEnd">请选择<text class="iconfont icon-youjiantou"></text></view>
<view class="uni-input" v-if="applyParam.workingEnd">{{applyParam.workingEnd}}<text class="iconfont icon-youjiantou"></text></view>
</picker>
</view>
<view class="contentItem" style="border: 0;">
<text>荣誉证书</text>
</view>
</view>
<view class="contentDetail employ">
<view class="contentItem">
<text>最近一次工作单位</text>
<input type="text" class="form-control" placeholder="非必填" v-model="applyParam.workingCompany" />
</view>
<view class="contentItem">
<text>职位</text>
<input type="text" class="form-control" placeholder="非必填" v-model="applyParam.position"/>
</view>
<view class="contentItem">
<text>任职开始时间</text>
<picker mode="date" :value="applyParam.workingStart" @change="bindWorkingStart">
<view v-if="!applyParam.workingStart">请选择<text class="iconfont icon-youjiantou"></text></view>
<view class="uni-input" v-if="applyParam.workingStart">{{applyParam.workingStart}}<text class="iconfont icon-youjiantou"></text></view>
</picker>
</view>
<view class="contentItem">
<text>结束时间</text>
<picker mode="date" :value="applyParam.workingEnd" @change="bindWorkingEnd">
<view v-if="!applyParam.workingEnd">请选择<text class="iconfont icon-youjiantou"></text></view>
<view class="uni-input" v-if="applyParam.workingEnd">{{applyParam.workingEnd}}<text class="iconfont icon-youjiantou"></text></view>
</picker>
</view>
<view class="contentItem" style="border: 0;">
<text>荣誉证书</text>
</view>
</view>
<view class="photo_wrapper" >
<view class="photo_wrapper" @click="upLoadPhoto()" v-if="!applyParam.certificate">
<text class="iconfont icon-weibiaoti553"></text>
<view style="margin-top: 10px;">点击添加荣誉证书照片</view>
</view>
<view v-if="applyParam.certificate">
<view class="pic_list" v-for="picItem in picList">
<image :src="picItem" mode="widthFix"></image>
</view>
</view>
<view class="tips">
<view>(jpg,png 文件大小不大于1mb)</view>
</view>
<view class="upLoadMore" v-if="applyParam.certificate" @click="upLoadPhoto()">
<view class="iconfont icon-jiahao"></view>
<view>上传更多</view>
</view>
</view>
<view class="fixed" @click="saveInfo()">
保存并下一步
......@@ -61,6 +69,7 @@
<script>
import api from '../../api/api';
import { CommonUpload } from '@/util/uploaderFile';
export default{
data(){
return {
......@@ -73,12 +82,26 @@
workingStart:'',
workingEnd:'',
certificate:'',
}
},
dataForm:{
loginId: uni.getStorageSync('cffp_userId'),
targetType: "5",
targetId: uni.getStorageSync('cffp_userId'),
targetNo: "1",
targetUseFor: "12",
targetSeq: "0"
},
picList:[]
}
},
components:{},
onLoad(){
onLoad(options){
this.occupationQry();
// console.log(options)
// if(options.id){
// this.queryById(options.id)
// }
},
methods:{
changeIndustry: function(e){
......@@ -102,11 +125,65 @@
}
})
},
upLoadPhoto(event){
let that = this;
CommonUpload(that.dataForm).then(res => {
this.applyParam.certificate = res.data.filePath;
this.picList.push(this.applyParam.certificate);
});
},
saveInfo(){
uni.setStorageSync('applyParam',JSON.stringify(this.applyParam))
uni.navigateTo({
url:'id-card'
if(!this.applyParam.workingCategoryId){
uni.showToast({
title: '请选择职业类型',
duration: 2000,
icon: 'none'
})
return;
}
this.applyParam = {
...this.applyParam,
applyType:2,
operatStep:2,
// userId:uni.getStorageSync('cffp_userId'),
userId:42,
id:17,
certificate:this.picList.join(',')
}
console.log(this.applyParam)
api.saveApplyInfo(this.applyParam).then((res)=>{
if(res['success']){
uni.navigateTo({
// url:`id-card?id=${res['data']['id']}`
url:`id-card`
});
}else{
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
return;
}
})
},
queryById(id){
api.queryById(id).then((res)=>{
console.log(res)
if(res['success']){
this.applyParam = res['data']['data'];
if(this.applyParam.certificate){
this.picList = this.applyParam.certificate.split(',');
console.log(this.picList)
}
console.log(this.picList)
}
})
}
},
mounted() {
if(uni.getStorageSync('applyId')){
this.queryById(uni.getStorageSync('applyId'))
}
}
}
......
......@@ -89,6 +89,7 @@
},
bindDateChange: function(e) {
this.fortuneDate = e.detail.value;
this.findByUserIdForFortuneStatistic();
},
findByUserIdForFortuneStatistic(){
// const param = {
......@@ -102,7 +103,6 @@
"userId": 1,
"fortuneDate": "2022-11-01",
"timeFlag": "D"
}
api.findByUserIdForFortuneStatistic(param).then((res)=>{
console.log(res)
......
......@@ -9,9 +9,9 @@ export const interceptor = () => {
invoke(args) {
// console.log('请求拦截器',args);
// 加载loading
uni.showLoading({
title: '加载中...'
});
// uni.showLoading({
// title: '加载中...'
// });
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token
if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
......
......@@ -4,6 +4,9 @@ import {interceptor} from "./interceptor";
export default (url:string, method:any, params?:any) => {
interceptor();
return new Promise((resolve, reject) => {
uni.showLoading({
title: '加载中...'
});
uni.request({
url: url,
method: method,
......@@ -17,7 +20,7 @@ export default (url:string, method:any, params?:any) => {
reject(err);
},
complete() {
uni.hideLoading();
uni.hideLoading();
}
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment