Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
6ec4e7a1d8fa787fbc20ed0b944f0920fb812a82
2 parents
200b3884
ac256c34
Merge branch 'gray'
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
430 additions
and
286 deletions
apps/cart/models/cart.js
apps/home/models/orderDetail.js
apps/passport/controllers/back.js
apps/passport/controllers/bind.js
apps/passport/controllers/geetest.js
apps/passport/controllers/login.js
apps/passport/controllers/reg.js
apps/passport/controllers/sms.js
apps/passport/router.js
apps/passport/views/action/international.hbs
apps/passport/views/action/login.hbs
apps/passport/views/action/sms/login.hbs
apps/product/views/action/newshop/brand.hbs
apps/product/views/partial/search/list.hbs
apps/service/controllers/chat.js
apps/service/models/im-api.js
config/common.js
doraemon/views/layout.hbs
package.json
public/js/passport/login/international.js
public/js/passport/login/login.js
public/js/passport/sms-login.page.js
public/js/plugin/validata.js
public/js/service/chat/view.js
public/scss/home/order-address-modify.page.css
public/scss/layout/_img-check.css
public/scss/passport/_login.css
public/scss/passport/_sms-login.css
public/scss/product/search/_list.css
apps/cart/models/cart.js
View file @
6ec4e7a
...
...
@@ -5,6 +5,7 @@ const helpers = global.yoho.helpers;
const
paymentProcess
=
require
(
global
.
utils
+
'/payment-process'
);
const
shoppingAPI
=
require
(
'./shopping'
);
const
logger
=
global
.
yoho
.
logger
;
const
payModel
=
require
(
'../models/pay'
);
/**
* 转换价格
...
...
@@ -326,6 +327,19 @@ exports.searchCoupon = (uid, couponCode) => {
*/
exports
.
jitDetailData
=
(
uid
,
cartType
,
skuList
,
orderCode
,
sessionKey
,
deliveryId
,
paymentType
,
couponCode
,
yohoCoin
)
=>
{
// 订单详情页拆单
if
(
orderCode
)
{
return
payModel
.
getOtherDetail
({
uid
:
uid
,
orderCode
:
orderCode
,
sessionKey
:
sessionKey
}).
then
(
result
=>
{
return
paymentProcess
.
transformJit
(
_
.
get
(
result
,
'data.package_list'
,
[]));
});
}
// 购物车拆单
if
(
deliveryId
)
{
// 购物车选择改变字段,重新运算订单数据
...
...
apps/home/models/orderDetail.js
View file @
6ec4e7a
...
...
@@ -312,17 +312,9 @@ const orderDetailData = (uid, orderCode) => {
// 为支付的拆单配送信息
if
(
orderDetail
.
isMultiPackage
&&
orderDetail
.
isMultiPackage
===
'Y'
)
{
let
jitInfo
=
{
deliveryId
:
orderDetail
.
deliveryId
,
paymentType
:
orderDetail
.
paymentType
,
couponCode
:
orderDetail
.
couponCode
,
yohoCoin
:
orderDetail
.
yohoCoin
,
cartType
:
'ordinary'
};
orderDetail
=
_
.
assign
(
orderDetail
,
{
isJit
:
true
,
jitDetailUrl
:
helpers
.
urlFormat
(
'/cart/index/new/jitDetail'
,
jitInfo
)
jitDetailUrl
:
helpers
.
urlFormat
(
'/cart/index/new/jitDetail'
,
{
orderCode
:
orderCode
}
)
});
}
...
...
apps/passport/controllers/back.js
View file @
6ec4e7a
...
...
@@ -13,7 +13,7 @@ const config = global.yoho.config;
const
service
=
require
(
'../models/back-service'
);
const
captchaService
=
require
(
'../models/captcha-service'
);
const
SIGN_IN
=
helpers
.
urlFormat
(
'/
passport/login
'
);
const
SIGN_IN
=
helpers
.
urlFormat
(
'/
signin.html
'
);
const
logger
=
global
.
yoho
.
logger
;
/**
...
...
@@ -211,7 +211,7 @@ const sendCodeToMobileAPI = (req, res, next) => {
if
(
verifyCode
)
{
let
captcha
=
_
.
get
(
req
,
'session.captcha'
);
logger
.
info
(
`
验证码校验结果
:
$
{
verifyCode
.
toString
()
===
captcha
},
user
:
$
{
verifyCode
};
server
:
$
{
captcha
}
`
);
logger
.
info
(
`
captcha
validate
result
:
$
{
verifyCode
.
toString
()
===
captcha
},
user
:
$
{
verifyCode
};
server
:
$
{
captcha
}
`
);
if
((
captcha
&&
verifyCode
.
toString
()
===
captcha
)
||
(
testCode
===
config
.
testCode
))
{
req
.
session
.
backupCaptch
.
verifyResult
=
true
;
}
else
{
...
...
apps/passport/controllers/bind.js
View file @
6ec4e7a
...
...
@@ -45,7 +45,7 @@ const bind = {
res
.
render
(
'bind/index'
,
{
bindIndex
:
true
,
// js标识
backUrl
:
helpers
.
urlFormat
(
'/
passport/login
'
),
// 返回的URL链接
backUrl
:
helpers
.
urlFormat
(
'/
signin.html
'
),
// 返回的URL链接
showHeaderImg
:
true
,
// 控制显示头部图片
isPassportPage
:
true
,
// 模板中模块标识
sourceType
:
sourceType
,
// 第三方登录来源
...
...
@@ -69,7 +69,7 @@ const bind = {
let
phoneNum
=
req
.
query
.
phoneNum
;
res
.
render
(
'bind/code'
,
{
backUrl
:
helpers
.
urlFormat
(
'/
passport/login
'
),
backUrl
:
helpers
.
urlFormat
(
'/
signin.html
'
),
showHeaderImg
:
true
,
isPassportPage
:
true
,
sourceType
:
sourceType
,
...
...
@@ -97,7 +97,7 @@ const bind = {
if
(
verify
)
{
let
captcha
=
_
.
get
(
req
,
'session.captcha'
);
logger
.
info
(
`
验证码校验结果
:
$
{
verify
.
toString
()
===
captcha
},
user
:
$
{
verify
};
server
:
$
{
captcha
}
`
);
logger
.
info
(
`
captcha
validate
result
:
$
{
verify
.
toString
()
===
captcha
},
user
:
$
{
verify
};
server
:
$
{
captcha
}
`
);
if
((
captcha
&&
verify
.
toString
()
===
captcha
)
||
(
testCode
===
config
.
testCode
))
{
BindService
.
bindCheck
(
phoneNum
,
openId
,
sourceType
,
areaCode
).
then
(
result
=>
{
let
data
=
{
...
...
@@ -315,7 +315,7 @@ const bind = {
module
:
'passport'
,
page
:
'bind-password'
,
bindPwd
:
true
,
// js标识
backUrl
:
helpers
.
urlFormat
(
'/
passport/login
'
),
// 返回的URL链接
backUrl
:
helpers
.
urlFormat
(
'/
signin.html
'
),
// 返回的URL链接
showHeaderImg
:
true
,
// 控制显示头部图片
isPassportPage
:
true
,
// 模板中模块标识
sourceType
:
sourceType
,
// 第三方登录来源
...
...
apps/passport/controllers/geetest.js
0 → 100644
View file @
6ec4e7a
'use strict'
;
const
_
=
require
(
'lodash'
);
const
Geetest
=
require
(
'geetest'
);
const
logger
=
global
.
yoho
.
logger
;
const
captcha
=
new
Geetest
({
geetest_id
:
'bce95d796bc3058615fdf2ec2c0aef29'
,
geetest_key
:
'124c41d3a22aa48f36ae3cd609c51db5'
});
const
geetest
=
{
register
(
req
,
res
,
next
)
{
captcha
.
register
().
then
(
function
(
data
)
{
// data 为一个对象,包含 gt, challenge, success, new_captcha 字段
// success 为 1 表示正常模式,为 0 表示宕机模式(failback, fallback)
// var body = {
// gt: data.geetest_id,
// challenge: data.challenge,
// success: data.success
// };
res
.
send
(
data
);
}).
catch
(
next
);
},
validate
(
req
,
res
,
next
)
{
let
challenge
=
req
.
body
.
geetest_challenge
,
validate
=
req
.
body
.
geetest_validate
,
seccode
=
req
.
body
.
geetest_seccode
;
let
errRes
=
{
code
:
400
,
message
:
'验证码错误'
,
captchaShow
:
true
,
changeCaptcha
:
true
};
// 使用极验证
let
useGeetest
=
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'geetest.validation'
,
false
);
if
(
!
useGeetest
)
{
return
next
();
}
if
(
!
challenge
||
!
validate
||
!
seccode
)
{
return
res
.
send
(
errRes
);
}
captcha
.
validate
({
challenge
,
validate
,
seccode
}).
then
(
function
(
success
)
{
if
(
success
)
{
logger
.
info
(
'geetest success'
);
return
next
();
}
logger
.
info
(
'geetest faild'
);
return
res
.
send
(
errRes
);
});
}
};
module
.
exports
=
geetest
;
...
...
apps/passport/controllers/login.js
View file @
6ec4e7a
...
...
@@ -19,7 +19,7 @@ const RegService = require('../models/reg-service');
const
AuthHelper
=
require
(
'../models/auth-helper'
);
const
logger
=
global
.
yoho
.
logger
;
const
loginPage
=
`
$
{
config
.
siteUrl
}
/
passport/
login
`
;
const
loginPage
=
`
$
{
config
.
siteUrl
}
/
signin.html
`
;
function
doPassportCallback
(
openId
,
nickname
,
sourceType
,
req
,
res
)
{
let
shoppingKey
=
cookie
.
getShoppingKey
(
req
);
...
...
@@ -82,6 +82,12 @@ const common = {
const
local
=
{
loginPage
:
(
req
,
res
)
=>
{
// 是否关闭账号登录
let
closePassword
=
_
.
get
(
req
.
app
.
locals
.
wap
,
'close.passwordLogin'
,
false
);
if
(
closePassword
)
{
return
res
.
redirect
(
`
/
signin
.
html
?
refer
=
$
{
req
.
query
.
refer
||
''
}
`
);
}
if
(
req
.
session
.
captchaValidCount
==
null
)
{
// eslint-disable-line
req
.
session
.
captchaValidCount
=
5
;
}
...
...
@@ -112,11 +118,8 @@ const local = {
res
.
render
(
'login'
,
{
width750
:
true
,
loginIndex
:
true
,
// 模板中使用JS的标识
// captchaShow: _.get(req.session, 'login.errorCount') <= 0,
useGeetest
:
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'geetest.validation'
,
false
),
// 使用极验证
captchaShow
:
true
,
// 170306 因为暴力破解密码问题,要求每次都展示验证码
// 返回的URL链接
backUrl
:
'javascript:history.go(-1)'
,
// eslint-disable-line
showHeaderImg
:
true
,
// 控制显示头部图片
isPassportPage
:
true
,
// 模板中模块标识
...
...
@@ -132,10 +135,25 @@ const local = {
module
:
'passport'
,
page
:
'login'
,
title
:
'登录'
,
reg
:
true
reg
:
true
,
loadJs
:
[
{
src
:
global
.
yoho
.
config
.
geetestJs
}
]
});
},
international
:
(
req
,
res
)
=>
{
// 是否关闭账号登录
let
closePassword
=
_
.
get
(
req
.
app
.
locals
.
wap
,
'close.passwordLogin'
,
false
);
if
(
closePassword
)
{
return
res
.
redirect
(
`
/
signin
.
html
?
refer
=
$
{
req
.
query
.
refer
||
''
}
`
);
}
if
(
req
.
session
.
captchaValidCount
==
null
)
{
// eslint-disable-line
req
.
session
.
captchaValidCount
=
5
;
}
// 先清除cookie
// res.clearCookie('LE' + md5('_LOGIN_EXPIRE'), {
// domain: 'yohobuy.com'
...
...
@@ -161,12 +179,9 @@ const local = {
res
.
render
(
'international'
,
{
width750
:
true
,
// 返回的URL链接
backUrl
:
'javascript:history.go(-1)'
,
// eslint-disable-line
loginInternational
:
true
,
// 模板中使用JS的标识
// captchaShow: _.get(req.session, 'login.errorCount') <= 0,
useGeetest
:
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'geetest.validation'
,
false
),
// 使用极验证
captchaShow
:
true
,
// 170306 因为暴力破解密码问题,要求每次都展示验证码
isPassportPage
:
true
,
// 模板中模块标识
headerText
:
'登录'
,
...
...
@@ -174,21 +189,30 @@ const local = {
countrys
:
RegService
.
getAreaData
(),
// 地区信息列表
module
:
'passport'
,
page
:
'international'
,
title
:
'国际账号登录'
title
:
'国际账号登录'
,
loadJs
:
[
{
src
:
global
.
yoho
.
config
.
geetestJs
}
]
});
},
login
:
(
req
,
res
,
next
)
=>
{
// 170306 因为暴力破解密码问题,要求每次都校验验证码
_
.
set
(
req
.
session
,
'login.errorCount'
,
0
);
let
count
=
_
.
get
(
req
.
session
,
'login.errorCount'
);
if
(
count
==
null
)
{
// eslint-disable-line
_
.
set
(
req
.
session
,
'login.errorCount'
,
3
);
// 是否关闭账号登录
let
closePassword
=
_
.
get
(
req
.
app
.
locals
.
wap
,
'close.passwordLogin'
,
false
);
if
(
closePassword
)
{
return
res
.
json
({
code
:
403
,
message
:
'请使用快速登录'
});
}
if
(
count
<=
0
)
{
// 使用极验证
let
useGeetest
=
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'geetest.validation'
,
false
);
// 关闭极验证的时候使用有货自有验证码
if
(
!
useGeetest
)
{
let
captchaInput
=
req
.
body
.
captcha
;
let
captchaCode
=
_
.
get
(
req
.
session
,
'captcha'
);
let
testCode
=
req
.
body
.
yohobuy
;
...
...
@@ -201,7 +225,7 @@ const local = {
captchaShow
:
true
};
logger
.
info
(
`
验证码校验结果
:
$
{
captchaInput
.
toString
()
===
captchaCode
},
user
:
$
{
captchaInput
};
server
:
$
{
captchaCode
}
`
);
logger
.
info
(
`
captcha
validate
result
:
$
{
captchaInput
.
toString
()
===
captchaCode
},
user
:
$
{
captchaInput
};
server
:
$
{
captchaCode
}
`
);
--
req
.
session
.
captchaValidCount
;
...
...
@@ -226,21 +250,14 @@ const local = {
}
passport
.
authenticate
(
'local'
,
(
err
,
user
)
=>
{
let
loginSession
=
req
.
session
.
login
;
if
(
err
||
!
user
)
{
let
obj
=
{
code
:
400
,
message
:
err
||
'登录出错请重试'
,
data
:
''
data
:
''
,
captchaShow
:
true
};
--
loginSession
.
errorCount
;
if
(
loginSession
.
errorCount
<=
0
)
{
obj
.
captchaShow
=
true
;
}
res
.
json
(
obj
);
}
else
{
let
refer
=
req
.
cookies
.
refer
;
...
...
apps/passport/controllers/reg.js
View file @
6ec4e7a
...
...
@@ -142,7 +142,7 @@ let verifyMobile = (req, res, next) => {
req
.
session
.
captcha
=
null
;
data
.
changeCaptcha
=
true
;
}
logger
.
info
(
`
验证码校验结果
:
$
{
captcha
.
toString
()
===
diffCaptcha
},
user
:
$
{
captcha
};
server
:
$
{
diffCaptcha
}
`
);
logger
.
info
(
`
captcha
validate
result
:
$
{
captcha
.
toString
()
===
diffCaptcha
},
user
:
$
{
captcha
};
server
:
$
{
diffCaptcha
}
`
);
// error case: 验证码不匹配
if
(
!
(
captcha
===
diffCaptcha
||
testCode
===
config
.
testCode
))
{
...
...
apps/passport/controllers/sms.js
View file @
6ec4e7a
...
...
@@ -44,20 +44,9 @@ const _step1 = (req, res, next) => {
req
.
session
.
captchaValidCount
=
5
;
}
// 是否打开账号登录
let
openPassword
=
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'close.passwordLogin'
,
false
);
let
template
=
'sms/login'
;
// 登陆切换到短信登陆
// let viewData = {
// width750: true,
// module: 'passport',
// page: 'sms-login',
// title: '手机短信登录',
// isPassportPage: true,
// headerText: '手机号码快捷登录',
// captchaUrl: helpers.urlFormat('/passport/sms_login/captcha.png', {t: Date.now()}),
// areaCode: '+86', // 默认的区号
// countrys: RegService.getAreaData() // 地区信息列表
// };
let
viewData
=
{
width750
:
true
,
module
:
'passport'
,
...
...
@@ -79,6 +68,7 @@ const _step1 = (req, res, next) => {
emailRetriveUrl
:
'/passport/back/email'
,
// 通过邮箱找回密码的URL链接
areaCode
:
'+86'
,
// 默认的区号
countrys
:
RegService
.
getAreaData
(),
// 地区信息列表
openPassword
,
reg
:
true
};
...
...
@@ -206,7 +196,7 @@ exports.indexCheck = (req, res, next) => {
}
logger
.
info
(
`
验证码校验结果
:
$
{
captcode
.
toString
()
===
captcodeValid
},
user
:
$
{
captcode
};
server
:
$
{
captcodeValid
}
`
);
logger
.
info
(
`
captcha
validate
result
:
$
{
captcode
.
toString
()
===
captcodeValid
},
user
:
$
{
captcode
};
server
:
$
{
captcodeValid
}
`
);
// 验证
if
([
area
,
mobile
].
some
(
val
=>
val
===
''
))
{
return
em
.
emit
(
'reject'
,
Object
.
assign
(
errorData
,
{
message
:
'请填写手机号'
}));
...
...
apps/passport/router.js
View file @
6ec4e7a
...
...
@@ -19,10 +19,14 @@ const smsLogin = require(cRoot + '/sms');
const
update
=
require
(
cRoot
+
'/update'
);
const
agreement
=
require
(
cRoot
+
'/app-agreement'
);
const
geetest
=
require
(
cRoot
+
'/geetest'
);
const
router
=
express
.
Router
();
// eslint-disable-line
// geetest
router
.
get
(
'/passport/geetest/register'
,
geetest
.
register
);
// 兼容老的路由
// router.get('/signin.html', login.common.beforeLogin, login.local.loginPage);
router
.
get
(
'/signin.html'
,
login
.
common
.
beforeLogin
,
smsLogin
.
loginPage
);
router
.
get
(
'/reg.html'
,
disableBFCahce
,
reg
.
index
);
router
.
get
(
'/login.html'
,
login
.
common
.
beforeLogin
,
login
.
local
.
international
);
...
...
@@ -33,11 +37,11 @@ router.get('/emailback.html', back.indexEmailPage);
router
.
get
(
'/passport/signout/index'
,
login
.
local
.
logout
);
// 登录页面
// router.get('/passport/login', login.local.loginPage);
// router.get('/passport/international', login.common.beforeLogin, login.local.international);
router
.
get
(
'/passport/login'
,
login
.
common
.
beforeLogin
,
login
.
local
.
loginPage
);
router
.
get
(
'/passport/international'
,
login
.
common
.
beforeLogin
,
login
.
local
.
international
);
// 本地登录
// router.post('/passport/login/auth'
, login.local.login);
router
.
post
(
'/passport/login/auth'
,
geetest
.
validate
,
login
.
local
.
login
);
// SMS 短信
router
.
use
(
'/passport/sms_login'
,
login
.
common
.
beforeLogin
,
smsLogin
.
beforeIn
);
...
...
apps/passport/views/action/international.hbs
View file @
6ec4e7a
...
...
@@ -9,8 +9,8 @@
<div
class=
"input-container row has-eye"
>
<input
id=
"pwd"
class=
"pwd input"
type=
"password"
placeholder=
"密码"
>
</div>
<div
id=
"js-img-check"
{{#
captchaShow
}}
data-init
{{/
captchaShow
}}
></div>
<div
data-geetest=
"
{{
useGeetest
}}
"
id=
"js-img-check"
{{#
captchaShow
}}
data-init
{{/
captchaShow
}}
></div>
<span
id=
"btn-login"
class=
"btn btn-login disble row"
>
登录
</span>
</div>
</div>
\ No newline at end of file
</div>
...
...
apps/passport/views/action/login.hbs
View file @
6ec4e7a
...
...
@@ -8,7 +8,7 @@
<div
class=
"input-container row has-eye"
>
<input
id=
"pwd"
class=
"pwd input"
type=
"password"
placeholder=
"密码"
>
</div>
<div
id=
"js-img-check"
{{#
captchaShow
}}
data-init
{{/
captchaShow
}}
></div>
<div
data-geetest=
"
{{
useGeetest
}}
"
id=
"js-img-check"
{{#
captchaShow
}}
data-init
{{/
captchaShow
}}
></div>
<span
id=
"btn-login"
class=
"btn btn-login disable"
>
登录
</span>
<p
class=
"op-container"
>
<a
class=
"op-item internat"
href=
{{
internationalUrl
}}
>
海外手机</a
>
...
...
apps/passport/views/action/sms/login.hbs
View file @
6ec4e7a
...
...
@@ -14,9 +14,9 @@
{{!--图片验证 end--}}
<button
id=
"btn-next"
class=
"btn btn-next disable row"
disabled
>
获取短信验证码
</button>
<p
class=
"op-container"
>
{{!--<a class="op-item internat" href={{accountUrl}}>账号密码登录</a>--}}
{{!--<a class="op-item internat" href={{internationalUrl}}>海外手机</a>--}}
{{!--<a class="op-item sms-login" href={{smsLoginUrl}}>快速登录</a>--}}
{{#if
openPassword
}}
<a
class=
"op-item internat"
href=
{{
accountUrl
}}
>
账号密码登录</a
>
{{/if}}
<span
id=
"forget-pwd"
class=
"op-item forget-pwd"
>
忘记密码
</span>
</p>
<div
class=
"third-party-login"
>
...
...
apps/product/views/action/newshop/brand.hbs
View file @
6ec4e7a
...
...
@@ -74,7 +74,7 @@
{{!--搜索列表显示过少,显示猜您喜欢--}}
{{#if
@root
.
suggestion
.
isMaybeLike
}}
<div
class=
"maybe-like-search"
>
您可能喜欢的
</div>
<div
class=
"maybe-like-search"
>
你可能喜欢
</div>
<div
class=
'maybe-like'
>
<div
id=
"goods-list"
class=
"goods-list clearfix"
></div>
</div>
...
...
apps/product/views/partial/search/list.hbs
View file @
6ec4e7a
...
...
@@ -122,7 +122,7 @@
{{!--搜索列表显示过少,显示猜您喜欢--}}
{{#if
@root
.
suggestion
.
isMaybeLike
}}
<div
class=
"maybe-like-search"
>
您可能喜欢的
</div>
<div
class=
"maybe-like-search"
>
你可能喜欢
</div>
<div
class=
'maybe-like maybe-like-word'
>
<div
id=
"goods-list"
class=
"goods-list clearfix"
></div>
</div>
...
...
apps/service/controllers/chat.js
View file @
6ec4e7a
...
...
@@ -143,13 +143,22 @@ exports.fetchOrders = (req, res) => {
};
exports
.
saveEvalute
=
(
req
,
res
)
=>
{
const
encryptedUid
=
req
.
body
.
encryptedUid
;
const
conversationId
=
req
.
body
.
conversationId
;
const
promoter
=
req
.
body
.
promoter
;
const
stars
=
req
.
body
.
stars
;
const
reasonMsg
=
req
.
body
.
reasonMsg
||
''
;
const
params
=
{};
params
.
encryptedUid
=
req
.
body
.
encryptedUid
;
params
.
conversationId
=
req
.
body
.
conversationId
;
params
.
promoter
=
req
.
body
.
promoter
;
params
.
stars
=
req
.
body
.
stars
;
if
(
req
.
body
.
reasonIds
)
{
params
.
reasonIds
=
req
.
body
.
reasonIds
;
}
if
(
req
.
body
.
reasonMsg
)
{
params
.
reasonMsg
=
req
.
body
.
reasonMsg
;
}
imApi
.
saveEvalute
(
encryptedUid
,
conversationId
,
promoter
,
stars
,
reasonMsg
)
imApi
.
saveEvalute
(
params
)
.
then
(
result
=>
{
return
res
.
json
(
result
);
}).
catch
(()
=>
{
...
...
apps/service/models/im-api.js
View file @
6ec4e7a
...
...
@@ -105,15 +105,7 @@ exports.fetchOrderList = (encryptedUid, createTimeBegin) => {
| reasonMsg | string | N | 其他原因 |
*/
exports
.
saveEvalute
=
(
encryptedUid
,
conversationId
,
promoter
,
stars
,
reasonMsg
)
=>
{
let
params
=
{
conversationId
,
encryptedUid
,
promoter
,
stars
,
reasonMsg
};
exports
.
saveEvalute
=
(
params
)
=>
{
return
ImService
.
post
(
'/api/evalute/saveEvalute'
,
params
);
};
...
...
config/common.js
View file @
6ec4e7a
...
...
@@ -10,8 +10,8 @@ const isProduction = process.env.NODE_ENV === 'production';
const
isTest
=
process
.
env
.
NODE_ENV
===
'test'
;
const
domains
=
{
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
api
:
'http://api.yoho.cn/'
,
service
:
'http://service.yoho.cn/'
,
liveApi
:
'http://testapi.live.yohops.com:9999/'
,
singleApi
:
'http://api-test3.yohops.com:9999/'
,
...
...
@@ -101,7 +101,8 @@ module.exports = {
appSecret
:
'ce21ae4a3f93852279175a167e54509b'
,
notifyUrl
:
domains
.
service
+
'payment/weixin_notify'
,
},
maxQps
:
1200
maxQps
:
1200
,
geetestJs
:
'//static.geetest.com/static/tools/gt.js'
};
if
(
isProduction
)
{
...
...
doraemon/views/layout.hbs
View file @
6ec4e7a
...
...
@@ -111,5 +111,8 @@
{{#
unless
devEnv
}}
{{>
analysis
}}
{{/
unless
}}
{{#
loadJs
}}
<script
type=
"text/javascript"
src=
"
{{
src
}}
"
></script>
{{/
loadJs
}}
</body>
</html>
...
...
package.json
View file @
6ec4e7a
{
"name"
:
"m-yohobuy-node"
,
"version"
:
"5.5.
0
"
,
"version"
:
"5.5.
1
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
@@ -31,6 +31,7 @@
"cookie-parser"
:
"^1.4.3"
,
"express"
:
"^4.14.1"
,
"feed"
:
"^0.3.1"
,
"geetest"
:
"^4.1.1"
,
"lodash"
:
"^4.17.4"
,
"md5"
:
"^2.1.0"
,
"memory-cache"
:
"^0.1.6"
,
...
...
public/js/passport/login/international.js
View file @
6ec4e7a
...
...
@@ -4,7 +4,7 @@
* @date: 2015/10/8
*/
var
$
=
require
(
'yoho-jquery'
);
var
ImgCheck
=
require
(
'plugin/img-check
'
);
var
Validate
=
require
(
'plugin/validata
'
);
var
$phoneNum
=
$
(
'#phone-num'
),
$countrySelect
=
$
(
'#country-select'
),
...
...
@@ -23,7 +23,7 @@ var tip = require('plugin/tip');
var
trim
=
$
.
trim
;
var
showErrTip
=
tip
.
show
;
var
imgCheck
=
new
ImgCheck
(
$captcha
,
{
var
validate
=
new
Validate
(
$captcha
,
{
useREM
:
{
rootFontSize
:
40
,
picWidth
:
150
...
...
@@ -31,7 +31,7 @@ var imgCheck = new ImgCheck($captcha, {
});
if
(
$captcha
.
data
(
'init'
)
!=
null
)
{
//eslint-disable-line
imgCheck
.
init
();
validate
.
init
();
}
...
...
@@ -85,82 +85,68 @@ $countrySelect.change(function() {
$loginBtn
.
on
(
'touchstart'
,
function
()
{
var
pn
=
trim
(
$phoneNum
.
val
()),
areaCode
=
$countrySelect
.
val
(),
pwd
=
trim
(
$pwd
.
val
()),
captcha
=
null
;
pwd
=
trim
(
$pwd
.
val
());
if
(
$loginBtn
.
hasClass
(
'disable'
))
{
return
;
}
if
(
imgCheck
.
atWorking
)
{
captcha
=
imgCheck
.
getResults
();
if
(
captcha
===
'0000'
)
{
return
tip
.
show
(
' 请将图片旋转到正确方向'
);
}
}
if
((
api
.
phoneRegx
[
areaCode
].
test
(
pn
)
||
areaCode
!==
'+86'
)
&&
api
.
pwdValidate
(
pwd
))
{
$loginBtn
.
text
(
'正在登录...'
).
addClass
(
'disable'
);
let
validResult
=
validate
.
getResults
(
);
if
((
api
.
phoneRegx
[
areaCode
].
test
(
pn
)
||
areaCode
!==
'+86'
)
&&
api
.
pwdValidate
(
pwd
))
{
let
data
=
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
account
:
pn
,
password
:
pwd
};
if
(
imgCheck
.
atWorking
)
{
$
.
extend
(
data
,
{
captcha
});
if
(
typeof
validResult
===
'string'
)
{
if
(
validResult
===
'0000'
)
{
return
tip
.
show
(
' 请将图片旋转到正确方向'
);
}
validResult
=
Promise
.
resolve
({
captcha
:
validResult
});
}
validResult
.
then
((
captcha
)
=>
{
$loginBtn
.
text
(
'正在登录...'
).
addClass
(
'disable'
);
let
data
=
{
areaCode
:
areaCode
.
replace
(
'+'
,
''
),
account
:
pn
,
password
:
pwd
};
if
(
validate
.
atWorking
)
{
$
.
extend
(
data
,
captcha
);
}
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/login/auth'
,
data
,
success
:
function
(
data
)
{
var
res
,
time
;
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
showErrTip
(
'登录成功'
);
$
.
ajax
({
url
:
res
.
session
,
dataType
:
'jsonp'
,
success
:
function
()
{
clearTimeout
(
time
);
// Cookie写入成功后,1s后跳转页面
setTimeout
(
function
()
{
location
.
href
=
res
.
href
;
},
1000
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/login/auth'
,
data
,
success
:
function
(
data
)
{
var
res
;
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
showErrTip
(
'登录成功'
);
// 3秒后强制跳转
setTimeout
(
function
()
{
location
.
href
=
res
.
href
;
},
1500
);
$loginBtn
.
text
(
'登录成功'
).
off
();
showErrTip
(
'登录成功'
);
}
else
{
if
(
data
.
captchaShow
)
{
validate
.
atWorking
?
((
data
.
changeCaptcha
||
validate
.
type
===
2
)
&&
validate
.
refresh
())
:
validate
.
init
();
}
});
// 3秒后强制跳转
time
=
setTimeout
(
function
()
{
location
.
href
=
res
.
href
;
},
3000
);
$loginBtn
.
text
(
'登录成功'
).
off
();
showErrTip
(
'登录成功'
);
}
else
{
if
(
data
.
captchaShow
)
{
imgCheck
.
atWorking
?
imgCheck
.
refresh
()
:
imgCheck
.
init
();
showErrTip
(
data
.
message
);
resetForm
();
}
},
error
:
function
()
{
showErrTip
(
'网络断开连接啦~'
);
$loginBtn
.
text
(
'登录'
);
showErrTip
(
data
.
message
);
resetForm
();
validate
.
atWorking
&&
validate
.
refresh
();
}
},
error
:
function
()
{
showErrTip
(
'网络断开连接啦~'
);
$loginBtn
.
text
(
'登录'
);
imgCheck
.
atWorking
&&
imgCheck
.
refresh
();
}
});
});
}
else
{
showErrTip
(
'账号或密码有错误,请重新输入'
);
...
...
public/js/passport/login/login.js
View file @
6ec4e7a
...
...
@@ -4,7 +4,7 @@
* @date: 2015/9/30
*/
var
$
=
require
(
'yoho-jquery'
);
var
ImgCheck
=
require
(
'plugin/img-check
'
);
var
Validate
=
require
(
'plugin/validata
'
);
var
$account
=
$
(
'#account'
),
$pwd
=
$
(
'#pwd'
),
...
...
@@ -25,7 +25,7 @@ var trim = $.trim;
var
showErrTip
=
tip
.
show
;
var
imgCheck
=
new
ImgCheck
(
$captcha
,
{
var
validate
=
new
Validate
(
$captcha
,
{
useREM
:
{
rootFontSize
:
40
,
picWidth
:
150
...
...
@@ -33,7 +33,7 @@ var imgCheck = new ImgCheck($captcha, {
});
if
(
$captcha
.
data
(
'init'
)
!=
null
)
{
//eslint-disable-line
imgCheck
.
init
();
validate
.
init
();
}
// 登录按钮状态切换
...
...
@@ -89,86 +89,86 @@ $pwd.bind('input', function() {
// Login
$loginBtn
.
on
(
'touchstart'
,
function
()
{
var
acc
=
trim
(
$account
.
val
()),
pwd
=
trim
(
$pwd
.
val
()),
captcha
=
null
;
if
(
$loginBtn
.
hasClass
(
'disable'
))
{
return
;
}
// if (imgCheck.atWorking) {
captcha
=
imgCheck
.
getResults
();
// if (captcha === '0000') {
// return tip.show(' 请将图片旋转到正确方向');
// }
// }
$loginBtn
.
text
(
'正在登录...'
).
addClass
(
'disable'
);
let
acc
=
trim
(
$account
.
val
()),
pwd
=
trim
(
$pwd
.
val
());
// 验证账号(数字或者邮箱)和密码合理性
if
((
/^
[
0-9
]
+$/
.
test
(
acc
)
||
api
.
emailRegx
.
test
(
acc
))
&&
api
.
pwdValidate
(
pwd
))
{
let
data
=
{
account
:
acc
,
password
:
pwd
,
yohobuy
:
$
(
'#yohobuy'
).
val
()
};
if
(
imgCheck
.
atWorking
)
{
$
.
extend
(
data
,
{
captcha
});
let
validResult
=
validate
.
getResults
();
if
(
typeof
validResult
===
'string'
)
{
if
(
validResult
===
'0000'
)
{
return
tip
.
show
(
' 请将图片旋转到正确方向'
);
}
validResult
=
Promise
.
resolve
({
captcha
:
validResult
});
}
validResult
.
then
((
captcha
)
=>
{
$loginBtn
.
text
(
'正在登录...'
).
addClass
(
'disable'
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/login/auth'
,
data
,
success
:
function
(
data
)
{
//eslint-disable-line
var
res
,
LOGI_TYPE
;
if
(
acc
.
indexOf
(
'@'
)
>
0
)
{
LOGI_TYPE
=
8
;
}
else
{
LOGI_TYPE
=
5
;
}
let
data
=
{
account
:
acc
,
password
:
pwd
,
yohobuy
:
$
(
'#yohobuy'
).
val
()
};
if
(
window
.
_yas
&&
window
.
_yas
.
sendCustomInfo
)
{
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_MY_LOGIN_C'
,
param
:
JSON
.
stringify
({
C_ID
:
window
.
_ChannelVary
[
window
.
cookie
(
'_Channel'
)],
LOGI_TYPE
:
LOGI_TYPE
})
},
true
);
}
if
(
validate
.
atWorking
)
{
$
.
extend
(
data
,
captcha
);
}
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/login/auth'
,
data
,
success
:
function
(
data
)
{
//eslint-disable-line
var
res
,
LOGI_TYPE
;
if
(
acc
.
indexOf
(
'@'
)
>
0
)
{
LOGI_TYPE
=
8
;
}
else
{
LOGI_TYPE
=
5
;
}
showErrTip
(
'登录成功'
);
location
.
href
=
res
.
href
;
$loginBtn
.
text
(
'登录成功'
).
off
();
}
else
{
if
(
data
.
captchaShow
)
{
imgCheck
.
atWorking
?
(
data
.
changeCaptcha
&&
imgCheck
.
refresh
())
:
imgCheck
.
init
();
if
(
window
.
_yas
&&
window
.
_yas
.
sendCustomInfo
)
{
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_MY_LOGIN_C'
,
param
:
JSON
.
stringify
({
C_ID
:
window
.
_ChannelVary
[
window
.
cookie
(
'_Channel'
)],
LOGI_TYPE
:
LOGI_TYPE
})
},
true
);
}
showErrTip
(
data
.
message
);
resetForm
();
}
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
return
data
;
},
error
:
function
()
{
showErrTip
(
'网络断开连接啦~'
);
showErrTip
(
'登录成功'
);
location
.
href
=
res
.
href
;
$loginBtn
.
text
(
'登录成功'
).
off
();
}
else
{
if
(
data
.
captchaShow
)
{
validate
.
atWorking
?
((
data
.
changeCaptcha
||
validate
.
type
===
2
)
&&
validate
.
refresh
())
:
validate
.
init
();
}
imgCheck
.
atWorking
&&
imgCheck
.
refresh
();
},
complete
:
function
()
{
$loginBtn
.
text
(
'登录'
).
removeClass
(
'disable'
);
}
});
showErrTip
(
data
.
message
);
resetForm
();
}
return
data
;
},
error
:
function
()
{
showErrTip
(
'网络断开连接啦~'
);
validate
.
atWorking
&&
validate
.
refresh
();
},
complete
:
function
()
{
$loginBtn
.
text
(
'登录'
).
removeClass
(
'disable'
);
}
});
},
()
=>
{});
}
else
{
showErrTip
(
'账号或密码有错误,请重新输入'
);
$loginBtn
.
text
(
'登录'
).
removeClass
(
'disable'
);
...
...
public/js/passport/sms-login.page.js
View file @
6ec4e7a
...
...
@@ -34,31 +34,7 @@ imgCheck.init();
require
(
'./login/qr-check'
);
// 显示找回密码面板
function
showRetrivePanel
()
{
$mask
.
show
();
$ways
.
show
();
}
// 隐藏找回密码面板
function
hideRetrivePanel
()
{
$mask
.
hide
();
$ways
.
hide
();
}
$
(
'#forget-pwd'
).
on
(
'touchstart'
,
function
()
{
showRetrivePanel
();
});
$mask
.
on
(
'touchstart'
,
function
()
{
hideRetrivePanel
();
});
$
(
'#cancel-retrive'
).
on
(
'touchstart'
,
function
(
e
)
{
e
.
preventDefault
();
hideRetrivePanel
();
});
page
=
{
init
:
function
()
{
this
.
domInit
();
...
...
@@ -93,8 +69,27 @@ page = {
.
toggleClass
(
'disable'
,
true
);
$resetBtn
.
hide
();
});
},
$
(
'#forget-pwd'
).
on
(
'touchstart'
,
()
=>
{
this
.
showRetrivePanel
();
});
$mask
.
on
(
'touchstart'
,
()
=>
{
this
.
hideRetrivePanel
();
});
$
(
'#cancel-retrive'
).
on
(
'touchstart'
,
(
e
)
=>
{
e
.
preventDefault
();
this
.
hideRetrivePanel
();
});
},
showRetrivePanel
:
()
=>
{
$mask
.
show
();
$ways
.
show
();
},
hideRetrivePanel
:
()
=>
{
$mask
.
hide
();
$ways
.
hide
();
},
// 切换$nextBtn disable状态
toggleNextBtn
:
function
()
{
var
bool
=
Boolean
(
$
.
trim
(
$phoneNum
.
val
()));
...
...
@@ -155,4 +150,4 @@ page = {
$
(
function
()
{
page
.
init
();
});
});
\ No newline at end of file
...
...
public/js/plugin/validata.js
0 → 100644
View file @
6ec4e7a
/**
* 验证码插件
* @author: feng.chen<feng.chen@yoho.cn>
* @date: 2017/03/13
*/
let
$
=
require
(
'yoho-jquery'
),
ImgCheck
=
require
(
'plugin/img-check'
);
const
validType
=
{
IMG_CHECK
:
1
,
GEETEST
:
2
};
class
Validate
{
constructor
(
container
,
options
)
{
this
.
$container
=
container
;
this
.
options
=
options
;
this
.
type
=
container
.
data
(
'geetest'
)
?
validType
.
GEETEST
:
validType
.
IMG_CHECK
;
if
(
this
.
type
===
validType
.
IMG_CHECK
)
{
this
.
imgCheck
=
new
ImgCheck
(
this
.
$container
,
this
.
options
);
}
else
{
$
.
ajax
({
url
:
'/passport/geetest/register?t='
+
(
new
Date
()).
getTime
(),
// 加随机数防止缓存(IE下的问题)
type
:
'get'
,
dataType
:
'json'
,
success
:
data
=>
{
window
.
initGeetest
&&
window
.
initGeetest
({
gt
:
data
.
gt
,
challenge
:
data
.
challenge
,
offline
:
!
data
.
success
},
(
captchaObj
)
=>
{
this
.
captchaObj
=
captchaObj
;
captchaObj
.
appendTo
(
$
(
'#js-img-check'
));
this
.
_atWorking
=
true
;
$
(
'#js-img-check'
).
addClass
(
'hide'
).
addClass
(
'popup'
);
});
}
});
$
(
'.yoho-page'
).
on
(
'touchstart'
,
'#js-img-check'
,
(
e
)
=>
{
if
(
$
(
e
.
target
).
attr
(
'id'
)
!==
'js-img-check'
)
{
return
;
}
$
(
'#js-img-check'
).
addClass
(
'hide'
);
});
}
}
get
atWorking
()
{
return
this
.
_atWorking
;
}
refresh
()
{
if
(
this
.
type
===
validType
.
IMG_CHECK
)
{
this
.
imgCheck
.
refresh
();
}
else
{
this
.
captchaObj
.
refresh
();
}
}
init
()
{
if
(
this
.
type
===
validType
.
IMG_CHECK
)
{
if
(
this
.
$container
.
data
(
'init'
)
!=
null
)
{
//eslint-disable-line
this
.
imgCheck
.
init
();
this
.
_atWorking
=
this
.
imgCheck
.
atWorking
;
}
}
}
getResults
()
{
if
(
this
.
type
===
validType
.
IMG_CHECK
)
{
return
this
.
imgCheck
.
getResults
();
}
else
{
return
new
Promise
((
resolve
)
=>
{
$
(
'#js-img-check'
).
removeClass
(
'hide'
);
this
.
captchaObj
.
onSuccess
(()
=>
{
resolve
(
this
.
captchaObj
.
getValidate
());
$
(
'#js-img-check'
).
addClass
(
'hide'
);
});
});
}
}
}
module
.
exports
=
Validate
;
...
...
public/js/service/chat/view.js
View file @
6ec4e7a
...
...
@@ -209,7 +209,7 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
stars
:
++
this
.
rank
,
promoter
:
1
,
reasonIds
:
''
,
reasonMsg
:
elem
.
find
(
'.words-to-say'
).
val
(),
reasonMsg
:
elem
.
find
(
'.words-to-say'
).
val
()
.
trim
()
,
};
let
temp
=
[];
...
...
public/scss/home/order-address-modify.page.css
View file @
6ec4e7a
...
...
@@ -37,11 +37,11 @@
}
label
{
width
:
20%
;
width
:
130px
;
}
input
{
width
:
77%
;
width
:
470px
;
line-height
:
60px
;
border
:
0
;
}
...
...
@@ -52,7 +52,7 @@
textarea
{
right
:
0
;
width
:
77%
;
width
:
470px
;
resize
:
none
;
padding-top
:
22px
;
height
:
120px
;
...
...
public/scss/layout/_img-check.css
View file @
6ec4e7a
...
...
@@ -34,4 +34,24 @@
width
:
150px
;
height
:
150px
;
}
}
#js-img-check
{
&.hide
{
display
:
none
!important
;
}
&
.popup
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
fixed
;
width
:
100%
;
height
:
100%
;
left
:
0
;
right
:
0
;
bottom
:
0
;
top
:
0
;
z-index
:
99
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
}
}
\ No newline at end of file
...
...
public/scss/passport/_login.css
View file @
6ec4e7a
...
...
@@ -13,28 +13,6 @@
padding-left
:
45
PX
;
}
.op-container
{
position
:
relative
;
width
:
100%
;
margin
:
20
PX
0
;
text-align
:
center
;
font-size
:
16
PX
;
display
:
flex
;
.op-item
{
flex
:
1
;
color
:
#fff
;
}
.internat
{
text-align
:
left
;
}
.forget-pwd
{
text-align
:
right
;
}
}
.third-party-login
{
text-align
:
left
;
...
...
public/scss/passport/_sms-login.css
View file @
6ec4e7a
...
...
@@ -44,25 +44,25 @@
color
:
#858585
;
}
}
.op-container
{
.op-container
{
position
:
relative
;
width
:
100%
;
margin
:
20
PX
0
;
height
:
40px
;
text-align
:
center
;
font-size
:
16
PX
;
display
:
flex
;
.op-item
{
flex
:
1
;
margin
:
0
auto
;
color
:
#fff
;
}
.internat
{
.op-item
:first-child
{
float
:
left
;
text-align
:
left
;
}
.forget-pwd
{
.op-item
:last-child
{
float
:
right
;
text-align
:
right
;
}
}
...
...
public/scss/product/search/_list.css
View file @
6ec4e7a
...
...
@@ -390,11 +390,11 @@
line-height
:
60px
;
background-color
:
#eee
;
text-align
:
center
;
font-size
:
16
px
;
font-size
:
20
px
;
}
.maybe-like-word
{
margin-top
:
none
;
margin-top
:
0
;
border-top
:
none
;
}
}
...
...
Please
register
or
login
to post a comment