Commit 0dba71a6 by 王昆

法人身份证正面图+声明书

parent b6730de4
...@@ -189,6 +189,31 @@ class Dao{ ...@@ -189,6 +189,31 @@ class Dao{
} }
return this.db.query(sql,tmpParas); return this.db.query(sql,tmpParas);
} }
async customUpdate(sql, paras, t) {
var tmpParas = null;
if (t && t != 'undefined') {
if (paras == null || paras == 'undefined') {
tmpParas = {
type: this.db.QueryTypes.UPDATE
};
tmpParas.transaction = t;
} else {
tmpParas = {
replacements: paras,
type: this.db.QueryTypes.UPDATE
};
tmpParas.transaction = t;
}
} else {
tmpParas = paras == null || paras == 'undefined' ? {
type: this.db.QueryTypes.UPDATE
} : {
replacements: paras,
type: this.db.QueryTypes.UPDATE
};
}
return this.db.query(sql, tmpParas);
}
async findCount(whereObj=null){ async findCount(whereObj=null){
return this.model.count(whereObj, {logging : false}).then(c=>{ return this.model.count(whereObj, {logging : false}).then(c=>{
return c; return c;
......
...@@ -23,5 +23,12 @@ class BmuserbizDao extends Dao{ ...@@ -23,5 +23,12 @@ class BmuserbizDao extends Dao{
} }
return result; return result;
} }
async updateSupplement(params) {
let sql = `UPDATE ${this.model.tableName} SET front_half_img = :front_half_img, declaration_file = :declaration_file, updated_at = NOW() WHERE idcard = :idcard`;
let rs = await this.customUpdate(sql, params);
return rs;
}
} }
module.exports=BmuserbizDao; module.exports=BmuserbizDao;
...@@ -61,5 +61,10 @@ class BmuserbizService extends ServiceBase{ ...@@ -61,5 +61,10 @@ class BmuserbizService extends ServiceBase{
var rs = await this.restClient.execPost(params, "https://bpohhr.gongsibao.com/api/econtractApi/validateUser"); var rs = await this.restClient.execPost(params, "https://bpohhr.gongsibao.com/api/econtractApi/validateUser");
return JSON.parse(rs.stdout); return JSON.parse(rs.stdout);
} }
async updateSupplement(params) {
return this.dao.updateSupplement(params);
}
} }
module.exports=BmuserbizService; module.exports=BmuserbizService;
...@@ -472,5 +472,45 @@ class xggApplet extends AppletBase { ...@@ -472,5 +472,45 @@ class xggApplet extends AppletBase {
return {code: 500}; return {code: 500};
} }
} }
async oc(gobj, pobj, req){
try {
let data = await this.uploadCtl.getOssConfig();
return {code:1, data:data};
} catch (error) {
console.log(error);
return {code: 500};
}
}
async supplement(gobj, pobj, req){
try {
let params = {};
params.idcard = this.trim(pobj.id_no);
let biz = await this.bmuserbizSve.findOne({
idcard: params.idcard
});
if(!biz) {
return {code: 0, msg: `身份证号码${params.idcard}不存在, 请先到小程序中注册`};
}
params.front_half_img = this.trim(pobj.front_half_img);
params.declaration_file = this.trim(pobj.declaration_file);
if (!params.idcard) {
return {code: 0, msg: "身份证号码错误"};
}
if(!params.front_half_img) {
return {code: 0, msg: "请上传半身照"};
}
if(!params.declaration_file) {
return {code: 0, msg: "请上传声明书"};
}
let data = await this.bmuserbizSve.updateSupplement(params);
return {code:1, data:data};
} catch (error) {
console.log(error);
return {code: 500};
}
}
} }
module.exports = xggApplet; module.exports = xggApplet;
\ No newline at end of file
...@@ -111,4 +111,8 @@ module.exports = function (app) { ...@@ -111,4 +111,8 @@ module.exports = function (app) {
}); });
}); });
app.get('/supplement_hc', function (req, res) {
res.render("supplement_hc", {});
});
}; };
var app = new Vue({
el: "#app",
data: function () {
var validmethod = (rule, value, callback) => {
if (rule.field == "id_no") {
if (!value || !value.trim()) {
return callback(new Error('请输入身份证号'));
}
}
if (rule.field == "front_half_img") {
if (!value || !value.trim()) {
return callback(new Error('请上传法人半身照'));
}
}
if (rule.field == "declaration_file") {
if (!value || !value.trim()) {
return callback(new Error('请上传声明书'));
}
}
return callback();
};
return {
btnloading: false,
action: "",
d:{},
supportInfo: {
id_no: "",
front_half_img: "",
declaration_file: ""
},
rules: {
id_no: [
{ validator: validmethod, trigger: 'blur' }
],
front_half_img: [
{ validator: validmethod, trigger: 'blur' }
],
declaration_file: [
{ validator: validmethod, trigger: 'blur' }
],
},
}
},
created: function () {
},
mounted: function () {
this.getOC();
$("#loading").fadeOut();
},
methods: {
postReq(path, data) {
return axios.post(path, data).then(function (r) {
return r.data ? r.data : null;
})
},
getOC() {
let self = this;
this.$root.postReq("/applet/xggApplet/oc", "").then(function (d) {
d = d.data;
self.d["key"] = "key";
self.d["Bucket"] = d.Bucket;
self.d["OSSAccessKeyId"] = d.OSSAccessKeyId;
self.d["Signature"] = d.Signature;
self.d["policy"] = d.policy;
self.d["success_action_status"] = d.success_action_status;
self.action = d.url;
console.log('---------------------------', self.action);
});
},
getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
return r ? unescape(r[2]) : null;
},
btnclick: function (pfm, code) {
},
frontHalfImgSuccess(res, file) {
console.log(res)
let xml = this.loadXML(res);
let ossUrl = xml.documentElement.getElementsByTagName("Location")[0].textContent;
this.supportInfo.front_half_img = ossUrl || "";
console.log(xml, ossUrl);
},
declarationFileSuccess(res, file) {
console.log(res)
let xml = this.loadXML(res);
let ossUrl = xml.documentElement.getElementsByTagName("Location")[0].textContent;
this.supportInfo.declaration_file = ossUrl || "";
console.log(xml, ossUrl);
},
beforeAvatarUpload(file) {
console.log(file);
let ext = ".png";
let fileNameArr = (file.name || "").split(".");
if (fileNameArr.length > 1) {
let fext = fileNameArr.pop().toLowerCase();
ext = !fext ? ext : `.${fext}`;
}
console.log(ext);
var key = "zc_gth_hc_" + new Date().getTime() + this.randomString(8) + ext;
this.d.key = key;
return true;
},
randomString(len) {
len = len || 32;
let chars = '0123456789abcdefghijklmnopqrstuvwxyz_';
let maxPos = chars.length;
let arr = [];
for (i = 0; i < len; i++) {
arr.push(chars.charAt(Math.floor(Math.random() * maxPos)));
}
return arr.join("");
},
save() {
var self = this;
self.btnloading = true;
self.$refs['supportForm'].validate((valid) => {
console.log(valid);
if (valid) {
console.log(self.supportInfo);
//处理登录逻辑
self.$root.postReq("/applet/xggApplet/supplement", self.supportInfo).then(function(d){
console.log(d);
if (d.code == 1) {
self.$message.success("保存成功");
} else {
self.$message.warning(d.msg || "保存失败, 请稍候重试");
}
self.btnloading = false;
});
} else {
self.btnloading = false;
return false;
}
});
},
loadXML(xmlString){
var xmlDoc=null;
if(!window.DOMParser && window.ActiveXObject){
var xmlDomVersions = ['MSXML.2.DOMDocument.6.0','MSXML.2.DOMDocument.3.0','Microsoft.XMLDOM'];
for(var i=0;i<xmlDomVersions.length;i++){
try{
xmlDoc = new ActiveXObject(xmlDomVersions[i]);
xmlDoc.async = false;
xmlDoc.loadXML(xmlString);
break;
}catch(e){
}
}
}
else if(window.DOMParser && document.implementation && document.implementation.createDocument){
try{
domParser = new DOMParser();
xmlDoc = domParser.parseFromString(xmlString, 'text/xml');
}catch(e){
}
}
else{
return null;
}
return xmlDoc;
},
patnerValid() {
},
},
});
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" ">
<title id=" idtitle"> 恒昌补充材料 </title>
<link rel="stylesheet" href="/css/ele/chalk.css">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/css/fontawesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/autocomplete.css">
<script src="/js/vue/vue.min.js"></script>
<script src="/js/vue/vue-router.min.js"></script>
<script src="/js/vue/vuex.min.js"></script>
<script src="/js/ele/index.js"></script>
<style>
body {
padding: 0px;
margin: 0px;
}
#loading {
background-color: #2c3e50;
height: 100%;
width: 100%;
position: fixed;
z-index: 9999;
margin-top: 0px;
top: 0px;
}
#loading-center {
width: 100%;
height: 100%;
position: relative;
}
#loading-center-absolute {
position: absolute;
left: 50%;
top: 50%;
height: 50px;
width: 50px;
margin-top: -25px;
margin-left: -25px;
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-animation: loading-center-absolute 1.5s infinite;
animation: loading-center-absolute 1.5s infinite;
}
.object {
width: 25px;
height: 25px;
background-color: #FFF;
float: left;
}
#object_one {
-webkit-animation: object_one 1.5s infinite;
animation: object_one 1.5s infinite;
}
#object_two {
-webkit-animation: object_two 1.5s infinite;
animation: object_two 1.5s infinite;
}
#object_three {
-webkit-animation: object_three 1.5s infinite;
animation: object_three 1.5s infinite;
}
#object_four {
-webkit-animation: object_four 1.5s infinite;
animation: object_four 1.5s infinite;
}
@-webkit-keyframes loading-center-absolute {
100% {
-webkit-transform: rotate(-45deg);
}
}
@keyframes loading-center-absolute {
100% {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
}
@-webkit-keyframes object_one {
25% {
-webkit-transform: translate(0, -50px) rotate(-180deg);
}
100% {
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@keyframes object_one {
25% {
transform: translate(0, -50px) rotate(-180deg);
-webkit-transform: translate(0, -50px) rotate(-180deg);
}
100% {
transform: translate(0, 0) rotate(-180deg);
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@-webkit-keyframes object_two {
25% {
-webkit-transform: translate(50px, 0) rotate(-180deg);
}
100% {
-webkit-transform: translate(0, 0) rotate(-180deg);
}
},
@keyframes object_two {
25% {
transform: translate(50px, 0) rotate(-180deg);
-webkit-transform: translate(50px, 0) rotate(-180deg);
}
100% {
transform: translate(0, 0) rotate(-180deg);
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@-webkit-keyframes object_three {
25% {
-webkit-transform: translate(-50px, 0) rotate(-180deg);
}
100% {
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@keyframes object_three {
25% {
transform: translate(-50px, 0) rotate(-180deg);
-webkit-transform: translate(-50px, 0) rotate(-180deg);
}
100% {
transform: translate(0, 0) rotate(-180deg);
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@-webkit-keyframes object_four {
25% {
-webkit-transform: translate(0, 50px) rotate(-180deg);
}
100% {
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
@keyframes object_four {
25% {
transform: translate(0, 50px) rotate(-180deg);
-webkit-transform: translate(0, 50px) rotate(-180deg);
}
100% {
transform: translate(0, 0) rotate(-180deg);
-webkit-transform: translate(0, 0) rotate(-180deg);
}
}
.el-input__inner {
border: none;
border-radius: 0px;
padding: 0px;
color: #ddd
}
.el-input__inner {
color: #2F2F2F;
}
.page_header {
width:100%;
text-align: center;
}
.modifybtn {
margin: 20px auto;
width:300px;
height:40px;
text-align: center;
background:#2b85e4;
border-radius:20px;
font-size:16px;
font-family:HiraginoSansGB-W3;
font-weight:normal;
color: #fff;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>
</head>
<body style="overflow: auto;">
<div id="loading">
<div id="loading-center">
<div id="loading-center-absolute">
<div class="object" id="object_one"></div>
<div class="object" id="object_two"></div>
<div class="object" id="object_three"></div>
<div class="object" id="object_four"></div>
</div>
</div>
</div>
<div id="app">
<el-container>
<div style="margin-top:10px;text-align: center;width: 100%;line-height: 40px;">
<div style="width:100%;border-bottom:solid 1px #eee;padding-bottom: 5px;">
<span style="width:300px;color: #000000;font-size: 18px;font-weight: 700;text-align: center;"> 恒昌补充材料 </span>
</div>
<div style="margin-top:15px;width:100%;text-align: center;">
<div style="width: 300px;text-align: center;margin: 0 auto">
<span id="companyTitle" style="padding-left:5px;color:#222222;font-size: 15px;float:left;"></span>
</div>
<div style="clear:both;"></div>
<el-form :model="supportInfo" label-position="left" status-icon :rules="rules" ref="supportForm" style="width: 300px;text-align: center;margin: 0 auto;">
<el-form-item label="身份证号码" prop="id_no" >
<el-input v-model="supportInfo.id_no" maxlength="18" placeHolder="请输入身份证号码" autocomplete="off" style="padding-left:5px;"></el-input>
</el-form-item>
<el-form-item label="法人半身照" prop="front_half_img" >
<br/>
<el-upload
class="avatar-uploader"
:action="action"
:data="d"
:show-file-list="false"
:on-success="frontHalfImgSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="supportInfo.front_half_img" :src="supportInfo.front_half_img" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="声明书附件" prop="declaration_file" >
<br/>
<el-upload
class="avatar-uploader"
:action="action"
:data="d"
:show-file-list="false"
:on-success="declarationFileSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="supportInfo.declaration_file" :src="supportInfo.declaration_file" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-button class="modifybtn" :loading="btnloading" @click="save" type="primary">提交信息</el-button>
</el-form>
</div>
</div>
</el-container>
</div>
<script src="/js/vue/jquery.min.js"></script>
<script src="/js/vue/base64.js"></script>
<script src="/js/vue/axios.min.js"></script>
<script src="/js/supplement_hc.js"></script>
</html>
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