Commit b087d2fb by zhaoxiqing

gsb

parent e3a2665a
var system = require("../../system")
const CtlBase = require("../ctl.base"); const CtlBase = require("../ctl.base");
const logCtl = system.getObject("web.oplogCtl");
class EntcontractCtl extends CtlBase { class EntcontractCtl extends CtlBase {
constructor() { constructor() {
super(CtlBase.getServiceName(EntcontractCtl)); super(CtlBase.getServiceName(EntcontractCtl));
...@@ -27,6 +28,19 @@ class EntcontractCtl extends CtlBase { ...@@ -27,6 +28,19 @@ class EntcontractCtl extends CtlBase {
return system.getErrResult2("网络繁忙,获取合同失败,请稍后重试"); return system.getErrResult2("网络繁忙,获取合同失败,请稍后重试");
} }
async geturl(req){
try {
var entid = req.query.entid || 0;
var data = await this.service.findById(entid);
if(data && data.eflowstatus == 1){
return {code :0,data:data.esignUrl}
}
return {code:-1,data:"已签约"};
}catch (e) {
logCtl.info({e});
}
}
} }
module.exports = EntcontractCtl; module.exports = EntcontractCtl;
\ No newline at end of file
...@@ -45,7 +45,7 @@ module.exports = function (app) { ...@@ -45,7 +45,7 @@ module.exports = function (app) {
} }
res.render("h5", {}); res.render("h5", {});
}); });
app.get('/ecyd2', async function (req, res) { app.get('/ecyd2', async function (req, res) {
try { try {
var loginCtl = System.getObject("web.userCtl"); var loginCtl = System.getObject("web.userCtl");
...@@ -102,6 +102,26 @@ module.exports = function (app) { ...@@ -102,6 +102,26 @@ module.exports = function (app) {
} }
}); });
app.get('/bpoent',async function (req, res) {
try {
var entcontractCtl = System.getObject("web.entcontractCtl");
var esign = await entcontractCtl.geturl(req);
if (esign.code ==0) {
return res.redirect(esign.data);
}
} catch (e) {
logCtl.error({
optitle: "web 根接口调用登录异常error:",
op: "userCtl/login",
content: e.stack,
clientIp: System.get_client_ip(req),
agent: req.headers["user-agent"],
});
}
});
app.all("/web/*", function (req, res, next) { app.all("/web/*", function (req, res, next) {
if (req.url.indexOf("getRouteConfigWithoutProduct") > 0 || if (req.url.indexOf("getRouteConfigWithoutProduct") > 0 ||
req.url.indexOf("getRsConfig") > 0 || req.url.indexOf("getRsConfig") > 0 ||
...@@ -126,8 +146,8 @@ module.exports = function (app) { ...@@ -126,8 +146,8 @@ module.exports = function (app) {
req.url.indexOf("ecompanywxuserCtl/validateECSign") > 0 || req.url.indexOf("ecompanywxuserCtl/validateECSign") > 0 ||
req.url.indexOf("ecompanywxuserCtl/companyByEcid") > 0 || req.url.indexOf("ecompanywxuserCtl/companyByEcid") > 0 ||
/dksignCtl\/./.test(req.url) || /dksignCtl\/./.test(req.url) ||
req.url.indexOf("econtractCtl/getPayNotify") > 0 || req.url.indexOf("econtractCtl/getPayNotify") > 0 ||
req.url.indexOf("ecompanyCtl/wxsignCompany") > 0 || req.url.indexOf("ecompanyCtl/wxsignCompany") > 0 ||
req.url.indexOf("taskCtl/restartTasks2") > 0 || req.url.indexOf("taskCtl/restartTasks2") > 0 ||
...@@ -145,8 +165,8 @@ module.exports = function (app) { ...@@ -145,8 +165,8 @@ module.exports = function (app) {
req.url.indexOf("userCtl/getCurrentUser") > 0 || req.url.indexOf("userCtl/getCurrentUser") > 0 ||
req.url.indexOf("ecompanyCtl/findOne") > 0 || req.url.indexOf("ecompanyCtl/findOne") > 0 ||
req.url.indexOf("userCtl/updateSigner") > 0 || req.url.indexOf("userCtl/updateSigner") > 0 ||
req.url.indexOf("econtractCtl/genContract") > 0 || req.url.indexOf("econtractCtl/genContract") > 0 ||
req.url.indexOf("getOssConfig") > 0) { req.url.indexOf("getOssConfig") > 0) {
// 韵达电子签免登陆, 因为它们牛逼闪闪的技术只会用iframe丢cookie // 韵达电子签免登陆, 因为它们牛逼闪闪的技术只会用iframe丢cookie
return next(); return next();
} }
...@@ -193,7 +213,7 @@ module.exports = function (app) { ...@@ -193,7 +213,7 @@ module.exports = function (app) {
agent: req.headers["user-agent"], agent: req.headers["user-agent"],
}); });
} catch (error) { } catch (error) {
} }
}).catch(e => { }).catch(e => {
console.log(e); console.log(e);
...@@ -302,7 +322,7 @@ module.exports = function (app) { ...@@ -302,7 +322,7 @@ module.exports = function (app) {
app.get('/errpage', function (req, res) { app.get('/errpage', function (req, res) {
res.render("errpage", {}); res.render("errpage", {});
}); });
app.get('/h5yd', function (req, res) { app.get('/h5yd', function (req, res) {
res.render("h5yd", {}); res.render("h5yd", {});
}); });
...@@ -312,10 +332,10 @@ module.exports = function (app) { ...@@ -312,10 +332,10 @@ module.exports = function (app) {
app.get('/paynotify', function (req, res) { app.get('/paynotify', function (req, res) {
res.render("paynotify", {}); res.render("paynotify", {});
}); });
app.get('/bpoent', function (req, res) { // app.get('/bpoent', function (req, res) {
res.render("bpoent", {}); // res.render("bpoent", {});
}); // });
app.get('/', function (req, res) { app.get('/', function (req, res) {
res.render("main", {}); res.render("main", {});
}); });
}; };
\ 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);
}
}
{
"icon": "tool-order", "title":"商标列表", "type":"default", "key":"myTmList", "isOnGrid":true
}
,
@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: rtranslate(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;
}
</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="wxuser" label-position="left" status-icon :rules="rules" ref="wxuserform" style="width: 300px;text-align: center;margin: 0 auto;">
<el-form-item label="" prop="id_name" >
<el-row gutter="1" style="border-bottom:solid 1px #eee;">
<el-col :span="2"><img src="/imgs/h5/icon_cell_ name.png" style="margin-top:5px"/></el-col>
<el-col v-if="isIdNameEdit" :span="22" style="text-align:left">
<el-input v-model="wxuser.id_name" placeHolder="请输入真实姓名" autocomplete="off" style="padding-left:5px;"></el-input>
</el-col>
<el-col v-if="!isIdNameEdit" :span="22" style="text-align:left">
<span style="padding-left:5px;">{{wxuser.id_name}}</span>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="" prop="id_no">
<el-row gutter="1" style="border-bottom:solid 1px #eee">
<el-col :span="2"><img src="/imgs/h5/icon_cell_IDnumber.png" style="margin-top:5px"/></el-col>
<el-col v-if="isIdNoEdit" :span="22" style="text-align:left">
<el-input v-model="wxuser.id_no" placeHolder="请输入您的身份证号" autocomplete="off" style="padding-left:5px;"></el-input>
</el-col>
<el-col v-if="!isIdNoEdit" :span="22" style="text-align:left">
<span style="padding-left:5px;">{{wxuser.id_no}}</span>
</el-col>
</el-row>
</el-form-item>
<div style="float:left;">
<el-checkbox style="float:left" v-model="isaggree" >我已知悉并同意</el-checkbox>
<a @click.stop="showaggreement" href="javascript:;"
style="float:left;text-decoration:none;color:blue;font-size: 13px;
padding-top: 1px;" target="_blank">《薪必果分包协议》</a>
</div>
<el-button :disabled="!isaggree" :loading="btnloading" class="modifybtn" @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/bpoent.js"></script>
</html>
var app = new Vue({
el: "#app",
data: function () {
var validmethod = (rule, value, callback) => {
if (rule.field == "id_name") {
if (!value) {
return callback(new Error('请输入真实姓名'));
} else {
callback();
}
}
if (rule.field == "id_no") {
if (!value) {
return callback(new Error('请输入身份证号'));
} else {
callback();
}
} else {
if (!value) {
return callback(new Error('请输入密码'));
}
callback();
}
};
return {
isaggree: false,
companyName: "",
btnloading: true,
appid:"wxf616c0a459d66081",
isIdNameEdit: true,
isIdNoEdit: true,
code: "",
state: "",
openId: "",
companyId:"",
wxuser: {},
rules: {
id_no: [
{ validator: validmethod, trigger: 'blur' }
],
id_name: [
{ validator: validmethod, trigger: 'blur' }
],
},
}
},
created: function () {
},
mounted: function () {
var self = this;
var url = window.location.href;
this.code = this.getUrlParam("code") || "";
this.state = this.getUrlParam("state") || "";
var nonceStr = this.getUrlParam("nonceStr") || "";
var userCode = this.getUrlParam("userCode") || "";
var sign = this.getUrlParam("sign") || "";
this.companyId = this.getUrlParam("comid") || this.state;
console.log(url, this.code, this.state, this.companyId, "------------------");
var idName = decodeURI(this.getUrlParam("idName") || "");
var idNo = this.getUrlParam("idNo") || "";
// %E5%BC%A0%E8%A1%8C%E8%89%AF
if(this.code) {
if(!idNo) {
idNo = localStorage.getItem("idNo");
if(idNo) {
this.wxuser.id_no = idNo;
this.isIdNoEdit = false;
}
}
if(!idName) {
idName = localStorage.getItem("idName");
if(idName) {
this.wxuser.id_name = idName;
this.isIdNameEdit = false;
}
}
if(!userCode) {
this.wxuser.userCode = localStorage.getItem("userCode") || "";
}
console.log(idName, idNo, "-----------------------2");
$("#loading").fadeOut();
// TODO 获取openId
this.getCompany();
this.getOpenId();
} else {
console.log(idName, idNo, "-----------------------1");
self.$root.postReq("/web/ecompanywxuserCtl/validateSign", {
companyId: self.companyId,
nonceStr: nonceStr,
userCode: userCode,
sign: sign,
}).then(rd => {
if (rd.status == 0) {
localStorage.removeItem("idName");
localStorage.removeItem("idNo");
localStorage.removeItem("userCode");
if(idName) {
localStorage.setItem("idName", idName);
}
if(idNo) {
localStorage.setItem("idNo", idNo);
}
if(userCode) {
localStorage.setItem("userCode", userCode);
}
url = url.split("?")[0];
// url = "https://bpohhr.gongsibao.com/bpoproxy"
// http://192.168.18.125:3000/wxsign?comid=10172&userCode=100018&nonceStr=nonceStrnonceStr&sign=E47D90EA49DCB7E9114A27767DCBF3C2
var redirect_uri = encodeURIComponent(url);
var appkey = this.appid;
var wxurl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appkey}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${this.companyId}#wechat_redirect`;
window.location.href = wxurl;
} else {
alert("签名失败,请关闭该页重试");
}
});
}
},
methods: {
postReq(path, data) {
return axios.post(path, data).then(function (r) {
return r.data ? r.data : null;
})
},
getCompany() {
this.$root.postReq("/web/ecompanywxuserCtl/companyName", {
companyId: this.companyId
}).then(rd => {
if (rd.status == 0) {
self.companyName = rd.data;
$("#companyTitle").text(self.companyName || "公司错误");
} else {
self.$message.error(`公司不存在`);
}
});
},
getOpenId() {
var self = this;
if(self.openId) {
return;
}
//调用接口,根据用户名判断是否协议
this.$root.postReq("/web/wxCtl/wxuseropenid", {
code: self.code
}).then(rd => {
if (rd.status == 0) {
self.openId = rd.data;
self.btnloading = false;
} else {
self.$message.error(`获取openId失败,请退出重试`);
}
});
},
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) {
},
showaggreement() {
window.location.href = "https://bpohhr.gongsibao.com/wxsignaggreement?comid=" + this.companyId;
},
save() {
var self = this;
if(!self.openId) {
self.$message.error(`获取openId失败,请刷新重试`);
return;
}
self.btnloading = true;
self.wxuser.openId = self.openId;
self.wxuser.code = self.code;
self.wxuser.ecompany_id = self.companyId;
self.$refs['wxuserform'].validate((valid) => {
console.log(valid);
if (valid) {
//处理登录逻辑
self.$root.postReq("/web/ecompanywxuserCtl/saveuser", self.wxuser).then(function(d){
console.log(d);
if(d.status==0) {
self.$message.success("保存成功");
} else {
self.$message.warning(d.msg || "登录失败, 请稍候重试");
}
self.btnloading = false;
});
} else {
self.btnloading = false;
return false;
}
});
},
patnerValid() {
// var self = this;
// //调用接口,根据用户名判断是否协议
// this.$root.postReq("/web/userCtl/patnerValid", {
// userName: self.loginForm.userName
// }).then(rd => {
// self.showAggree = false;
// if (rd.status == 0) {
// if (rd.data == "1") {
// self.showAggree = true;
// }
// }
// });
},
},
});
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