|
@@ -489,7 +489,10 @@ var logic = function(data,num){
|
|
|
$("#bidcommunity").modal("hide")
|
|
|
clearInterval(loginfg);
|
|
|
loginflag = true;
|
|
|
- processpage(data.shareid,num);
|
|
|
+ if(!data.phone && data.openid) {
|
|
|
+ window.location.href = '/swordfish/frontPage/userMerge/sess/bind'
|
|
|
+ }
|
|
|
+ processpage(data,num);
|
|
|
//登录成功,停止轮询
|
|
|
LoginPolling.stop();
|
|
|
//登录成功,停止心跳监测
|
|
@@ -529,7 +532,7 @@ var logic = function(data,num){
|
|
|
}
|
|
|
|
|
|
//登录后处理页面逻辑
|
|
|
-var processpage = function(shareid,num){
|
|
|
+var processpage = function(item,num){
|
|
|
var backToUrl = getParam('backTo')
|
|
|
if (backToUrl) {
|
|
|
return location.replace(decodeURIComponent(backToUrl))
|
|
@@ -877,6 +880,7 @@ $(function(){
|
|
|
var Direct = {
|
|
|
verify: {},
|
|
|
forge: {},
|
|
|
+ loginInfo: {},
|
|
|
instance: {},
|
|
|
ajaxSms: function (e, type) {
|
|
|
var _this = this;
|
|
@@ -1006,6 +1010,27 @@ $(function(){
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 设置密码
|
|
|
+ ajaxSetPassword: function (e, arr) {
|
|
|
+ var payload = {
|
|
|
+ password: arr[0].value
|
|
|
+ };
|
|
|
+ $.ajax({
|
|
|
+ url: "/publicapply/password/update",
|
|
|
+ type: "POST",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(payload),
|
|
|
+ success: function(r) {
|
|
|
+ e.setAttribute('data-loading', 'false');
|
|
|
+ if (r) {
|
|
|
+ // 密码保存成功,走登录成功步骤
|
|
|
+ logic(Direct.loginInfo.userInfo, mynum);
|
|
|
+ } else {
|
|
|
+ arr[1].showError('密码保存失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 手机号+密码登录
|
|
|
ajaxLoginPass: function (e, arr) {
|
|
|
var payload = {
|
|
@@ -1049,6 +1074,7 @@ $(function(){
|
|
|
location.href = '/'
|
|
|
})
|
|
|
} else {
|
|
|
+ checkNeedGoNewUserSettingPage()
|
|
|
history.back()
|
|
|
}
|
|
|
}
|
|
@@ -1058,6 +1084,7 @@ $(function(){
|
|
|
location.href = '/swordfish/frontPage/userMerge/sess/merge?token=' + r.data.mergeToken
|
|
|
return
|
|
|
} else {
|
|
|
+ checkNeedGoNewUserSettingPage()
|
|
|
$("#bidLogin").modal("hide")
|
|
|
sessionStorage.setItem('bind-phone', arr[0].value.trim())
|
|
|
typeof window.callBindPhoneSuccess === 'function' && window.callBindPhoneSuccess(true)
|
|
@@ -1070,19 +1097,19 @@ $(function(){
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- var source = getParam("source");//百度SEM
|
|
|
- if (source!=null){
|
|
|
- var pathname = window.location.pathname;
|
|
|
- if (pathname=="/front/structed/pc_index.html"){//结构化数据
|
|
|
- source+="_structed";
|
|
|
- }else if (pathname=="/bid/pc/page/bidfile_landpage"){//招标文件解读
|
|
|
- source+="_bidfile";
|
|
|
- }else if (pathname=="/big/page/index"){//大会员
|
|
|
- source+="_member";
|
|
|
- }
|
|
|
- }else{
|
|
|
- source="";
|
|
|
- }
|
|
|
+ var source = getParam("source");//百度SEM
|
|
|
+ if (source!=null){
|
|
|
+ var pathname = window.location.pathname;
|
|
|
+ if (pathname=="/front/structed/pc_index.html"){//结构化数据
|
|
|
+ source+="_structed";
|
|
|
+ }else if (pathname=="/bid/pc/page/bidfile_landpage"){//招标文件解读
|
|
|
+ source+="_bidfile";
|
|
|
+ }else if (pathname=="/big/page/index"){//大会员
|
|
|
+ source+="_member";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ source="";
|
|
|
+ }
|
|
|
var payload = {
|
|
|
reqType:"identCodeLogin",
|
|
|
identCode:arr[2].value,
|
|
@@ -1093,13 +1120,30 @@ $(function(){
|
|
|
$.post("/phone/login",payload,function(r){
|
|
|
e.setAttribute('data-loading', 'false')
|
|
|
if(r.status==1){
|
|
|
+ if (r.userInfo.isNewUser) {
|
|
|
+ trackClick('注册行为-打开设置密码弹窗')
|
|
|
+ Direct.showSetPassModule(true)
|
|
|
+ Direct.loginInfo = r
|
|
|
+ } else {
|
|
|
logic(r.userInfo,mynum);
|
|
|
+ }
|
|
|
}else if(r.status==-1){
|
|
|
arr[2].showError('短信验证码输入错误')
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // 新用户设置密码
|
|
|
+ showSetPassModule: function (type) {
|
|
|
+ var otherArr = ['.login-dig-footer-box .wx-logo-box', '.login-dig-footer-box .login-dig-text-split' ,'.login-dig-tabbar-navbar', '.login-dig-tabbar-content', '.login-dig-tabbar-content.is-active', '.pass-bottom', '.login-dig-wx-qrcode-box', '.login-dig-top-back-box', '.code-bottom']
|
|
|
+ var setPassArr = ['.login-dig-tabbar-content.set-password', '.login-dig-tabbar-navbar.set-pass-module', '.set-pass-bottom']
|
|
|
+ for(var i=0;i<otherArr.length;i++){
|
|
|
+ document.querySelector(otherArr[i]).style.display = (type ? 'none' : '')
|
|
|
+ }
|
|
|
+ for(var i=0;i<setPassArr.length;i++){
|
|
|
+ document.querySelector(setPassArr[i]).style.display = (type ? 'block' : 'none')
|
|
|
+ }
|
|
|
+ },
|
|
|
ajaxRegister: function (e, arr) {
|
|
|
var source = getParam("source");//百度SEM
|
|
|
if (source!=null){
|
|
@@ -1205,6 +1249,9 @@ $(function(){
|
|
|
if($("#bidLogin").attr("data-rec")){
|
|
|
$("#bidLogin").removeAttr("data-rec");
|
|
|
}
|
|
|
+ if(Direct.loginInfo.userInfo.result === 'ok') {
|
|
|
+ location.reload()
|
|
|
+ }
|
|
|
});
|
|
|
function startTimeDown (type) {
|
|
|
var nowCount = 60
|
|
@@ -1261,9 +1308,9 @@ $(function(){
|
|
|
nowQ = 'bind-phone'
|
|
|
// getNewVerify()
|
|
|
}
|
|
|
- if (e.getAttribute('data-name') === 'register_get_sms') {
|
|
|
- nowQ = 'register'
|
|
|
- trackClick('注册行为-发送验证码')
|
|
|
+ if (e.getAttribute('data-name') === 'verify_get_sms' && !isBindPage) {
|
|
|
+ nowQ = 'verify'
|
|
|
+ trackClick('注册行为-验证码登录/注册-获取验证码')
|
|
|
}
|
|
|
if(isBindPage) {
|
|
|
trackClick('绑定-发送验证码')
|
|
@@ -1465,6 +1512,15 @@ $(function(){
|
|
|
if (e.target.classList.contains('is-active')) {
|
|
|
return
|
|
|
}
|
|
|
+ if(e.target.innerText === '密码登录') {
|
|
|
+ $('.code-bottom').hide()
|
|
|
+ $('.pass-bottom').show()
|
|
|
+ $('.line-box').addClass('pass-line-box')
|
|
|
+ } else {
|
|
|
+ $('.pass-bottom').hide()
|
|
|
+ $('.code-bottom').show()
|
|
|
+ $('.line-box').removeClass('pass-line-box')
|
|
|
+ }
|
|
|
var SelectName = e.target.getAttribute('name')
|
|
|
document.querySelector('.login-dig-tabbar-navbar span.is-active').classList.toggle('is-active')
|
|
|
e.target.classList.toggle('is-active')
|
|
@@ -1511,6 +1567,8 @@ $(function(){
|
|
|
e.setAttribute('data-loading', 'true')
|
|
|
if(isBindPage){
|
|
|
trackClick('绑定-立即绑定')
|
|
|
+ } else {
|
|
|
+ trackClick('注册行为-登录/注册')
|
|
|
}
|
|
|
Direct.ajaxLoginSms(e, verifySubmit.arr)
|
|
|
},
|
|
@@ -1536,7 +1594,11 @@ $(function(){
|
|
|
if (type) {
|
|
|
Ele.classList.remove('is-stop')
|
|
|
} else {
|
|
|
- Ele.classList.add('is-stop')
|
|
|
+ if(isBindPage) {
|
|
|
+ Ele.classList.remove('is-stop')
|
|
|
+ } else {
|
|
|
+ Ele.classList.add('is-stop')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1594,11 +1656,11 @@ $(function(){
|
|
|
check: function () {
|
|
|
var submitEle = document.querySelector(this.el)
|
|
|
var checkStauts = false
|
|
|
- for(var i=0;i<this.arr.length;i++){
|
|
|
- if (!this.arr[i].next) {
|
|
|
- checkStauts = true
|
|
|
- }
|
|
|
- }
|
|
|
+ for(var i=0;i<this.arr.length;i++){
|
|
|
+ if (!this.arr[i].next) {
|
|
|
+ checkStauts = true
|
|
|
+ }
|
|
|
+ }
|
|
|
if (checkStauts) {
|
|
|
submitEle.setAttribute('disabled', checkStauts)
|
|
|
} else {
|
|
@@ -1624,6 +1686,75 @@ $(function(){
|
|
|
})
|
|
|
passSubmit.init([passPhone, passPass])
|
|
|
Direct.instance.password = passSubmit
|
|
|
+
|
|
|
+ // 设置密码
|
|
|
+ var setPassSubmit = {
|
|
|
+ el: 'button[name="set_pass_submit"]',
|
|
|
+ init: function (arr) {
|
|
|
+ this.arr = arr
|
|
|
+ this.check()
|
|
|
+ var submitEle = document.querySelector(this.el)
|
|
|
+ submitEle.addEventListener('click', this.submit)
|
|
|
+ },
|
|
|
+ submit: function (e) {
|
|
|
+ var e = e.target
|
|
|
+ if (e.getAttribute('data-loading') === 'true') return
|
|
|
+ trackClick('注册行为-设置密码-确定')
|
|
|
+ Direct.ajaxSetPassword(e, setPassSubmit.arr)
|
|
|
+ // e.setAttribute('data-loading', 'true')
|
|
|
+ // Direct.ajaxLoginPass(e, passSubmit.arr)
|
|
|
+ },
|
|
|
+ check: function () {
|
|
|
+ var submitEle = document.querySelector(this.el)
|
|
|
+ var checkStauts = false
|
|
|
+ for(var i=0;i<this.arr.length;i++){
|
|
|
+ if (!this.arr[i].next) {
|
|
|
+ checkStauts = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (checkStauts) {
|
|
|
+ submitEle.setAttribute('disabled', checkStauts)
|
|
|
+ } else {
|
|
|
+ if (this.arr[0].value !== this.arr[1].value) {
|
|
|
+ this.arr[1].showError('两次密码输入不一致')
|
|
|
+ } else {
|
|
|
+ submitEle.removeAttribute('disabled')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 暂不设置密码,走登录成功步骤
|
|
|
+ var setPassCancel = {
|
|
|
+ el: 'button[name="set_pass_cancel"]',
|
|
|
+ init: function () {
|
|
|
+ var submitEle = document.querySelector(this.el)
|
|
|
+ submitEle.addEventListener('click', this.submit)
|
|
|
+ },
|
|
|
+ submit: function (e) {
|
|
|
+ trackClick('注册行为-设置密码-暂不订阅')
|
|
|
+ logic(Direct.loginInfo.userInfo,mynum);
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ var setInitPass = createFormStauts({
|
|
|
+ el: '.login-dig-input-box input[name="init_pass"]',
|
|
|
+ rule: ruleForPass,
|
|
|
+ event: ['input', 'blur'],
|
|
|
+ upStatus: function () {
|
|
|
+ setPassSubmit.check()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var setCheckPass = createFormStauts({
|
|
|
+ el: '.login-dig-input-box input[name="check_pass"]',
|
|
|
+ rule: ruleForPass,
|
|
|
+ event: ['input', 'blur'],
|
|
|
+ upStatus: function () {
|
|
|
+ setPassSubmit.check()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setPassSubmit.init([setInitPass, setCheckPass])
|
|
|
+ setPassCancel.init()
|
|
|
}
|
|
|
function initForgetDirect () {
|
|
|
// 判断是否需要初始化
|
|
@@ -1909,14 +2040,17 @@ function openLoginDig(type, redirectUrl) {
|
|
|
try {
|
|
|
var injectLogic = logic
|
|
|
logic = function (data, num) {
|
|
|
- if (type) {
|
|
|
- window.needToWork = true
|
|
|
- }
|
|
|
+ window.needToWork = Boolean(type)
|
|
|
if (data.result === 'ok') {
|
|
|
//判断是否需要设置cookie
|
|
|
if(data.cValue){
|
|
|
afterLoginSetCookit(data.cName,data.cValue,data.expires)
|
|
|
}
|
|
|
+ // 判断是否绑定手机号
|
|
|
+ if(!data.phone && data.openid) {
|
|
|
+ window.location.href = '/swordfish/frontPage/userMerge/sess/bind'
|
|
|
+ return
|
|
|
+ }
|
|
|
// 检查是否需要新窗口打开<新用户兴趣偏好设置页面>
|
|
|
checkNeedGoNewUserSettingPage()
|
|
|
if (redirectUrl === 'reload') {
|
|
@@ -1935,6 +2069,8 @@ function openLoginDig(type, redirectUrl) {
|
|
|
injectLogic(data, num)
|
|
|
}
|
|
|
} catch (e) {}
|
|
|
+ // 埋点
|
|
|
+ trackClick('注册行为-登录或注册弹窗')
|
|
|
}
|
|
|
function openBindPhoneDig() {
|
|
|
openLoginDigForWx(false);
|
|
@@ -1951,12 +2087,23 @@ function openBindPhoneDig() {
|
|
|
}
|
|
|
$("#bidLogin").modal("show");
|
|
|
}
|
|
|
+// 密码切换显示/隐藏
|
|
|
+function switchPassShow (e, str) {
|
|
|
+ e.preventDefault()
|
|
|
+ const type = $(str).attr('type')
|
|
|
+ if(type === 'password') {
|
|
|
+ $(str).attr('type', 'text')
|
|
|
+ } else {
|
|
|
+ $(str).attr('type', 'password')
|
|
|
+ }
|
|
|
+}
|
|
|
function closeLoginDig() {
|
|
|
$("#bidLogin").modal("hide");
|
|
|
+ window.location.reload()
|
|
|
}
|
|
|
function openLoginDigForWx (type) {
|
|
|
- var otherArr = ['.login-dig-footer-box .wx-logo-box', '.login-dig-footer-box .login-dig-text-split' ,'.login-dig-tabbar-navbar', '.login-dig-tabbar-content', '.login-dig-tabbar-content.is-active']
|
|
|
- var wxArr = ['.login-dig-wx-qrcode-box', '.login-dig-top-back-box']
|
|
|
+ var otherArr = ['.login-dig-footer-box .wx-logo-box', '.login-dig-footer-box .login-dig-text-split' ,'.login-dig-tabbar-navbar', '.login-dig-tabbar-content', '.login-dig-tabbar-content.is-active', '.pass-bottom']
|
|
|
+ var wxArr = ['.login-dig-wx-qrcode-box', '.login-dig-top-back-box', '.code-bottom']
|
|
|
for(var i=0;i<otherArr.length;i++){
|
|
|
document.querySelector(otherArr[i]).style.display = (type ? 'none' : '')
|
|
|
}
|
|
@@ -1974,7 +2121,7 @@ function openLoginDigForReg (type) {
|
|
|
$('.login-dig-reg').show()
|
|
|
$('.login-dig-footer-box').hide()
|
|
|
// 埋点
|
|
|
- trackClick('注册行为-打开注册页面')
|
|
|
+ trackClick('注册行为-登录或注册弹窗')
|
|
|
}
|
|
|
|
|
|
function backLogin (type) {
|