Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
2d314bb2
Commit
2d314bb2
authored
Sep 18, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull
parent
84bcf595
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
153 additions
and
57 deletions
+153
-57
src/components/detail/index.js
+1
-0
src/components/detail/redPacket/index.js
+139
-46
src/components/passport/bindingTel/index.js
+2
-2
src/components/passport/index.js
+4
-2
src/components/passport/setPassword/index.js
+2
-7
yarn.lock
+5
-0
No files found.
src/components/detail/index.js
View file @
2d314bb2
...
...
@@ -570,6 +570,7 @@ class Detail extends Component {
history
=
{
this
.
props
.
history
}
country
=
{
this
.
props
.
country
}
delCountryNum
=
{
this
.
props
.
delCountryNum
}
userInfo
=
{
this
.
props
.
user
.
data
}
/
>
}
...
...
src/components/detail/redPacket/index.js
View file @
2d314bb2
import
React
,
{
PureComponent
}
from
'react'
;
import
CopyToClipboard
from
'react-copy-to-clipboard'
;
import
{
CopyToClipboard
}
from
'react-copy-to-clipboard'
;
import
classnames
from
'classnames'
;
import
{
isEmpty
}
from
'lodash'
;
import
{
browser
}
from
'@/utils'
;
...
...
@@ -28,13 +28,11 @@ class RedPacket extends PureComponent {
shareInfo
:
{
url
:
''
,
share_code
:
''
,
command
:
''
command
:
'
【七月在线送你一个红包】https://www.julyedu.com/
'
},
doneInfo
:
{
//领取后的状态,1:领取成功,2:领取超时
status
:
2
,
txt
:
'手机号绑定超时,红包已失效!'
,
// txt: '今日已领取5.6元代金券碎片!',
// txt: '今日已领取5.6元现金!',
desc
:
''
},
money
:
''
,
// 红包金额,
...
...
@@ -51,29 +49,33 @@ class RedPacket extends PureComponent {
componentDidMount
()
{
// console.log(this.props);
const
share_code
=
getParam
(
'share_code'
);
const
{
country
}
=
this
.
props
;
const
{
shareInfo
}
=
this
.
state
;
if
(
country
.
code
)
{
this
.
setState
({
country
,
shareInfo
:
{
...
shareInfo
,
share_code
:
country
.
code
}
});
this
.
judgePopupTypeFromCountry
();
// 分享链接进入
this
.
judgePopupType
();
// 微信进入
const
isWechat
=
getParam
(
'wechat'
);
const
{
userInfo
}
=
this
.
props
;
if
(
isWechat
===
'1'
&&
!
browser
.
isWeixin
)
{
if
(
userInfo
&&
userInfo
.
uid
)
{
const
type
=
window
.
localStorage
.
getItem
(
'redpacket-click'
);
if
(
type
===
'split'
)
{
http
.
get
(
`
${
API
.
home
}
/sys/redPacket/shareUrl/
${
getParam
(
'id'
)}
`
).
then
(
res
=>
{
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
// 检查收否领取过
http
.
post
(
`
${
API
.
home
}
/sys/redPacket/split`
,
{
action
:
'check'
,
share_code
:
country
.
code
share_code
:
data
.
share_
code
}
).
then
(
res
=>
{
console
.
log
(
res
);
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
window
.
localStorage
.
removeItem
(
'redpacket-click'
);
// is_receive 是否领取过 0-否 1-是
if
(
data
.
is_receive
)
{
this
.
judgeReceiveStatus
(
data
,
8
);
...
...
@@ -82,18 +84,47 @@ class RedPacket extends PureComponent {
type
:
3
});
}
// 清除
this
.
props
.
delCountryNum
();
}
})
}
// 分享链接进入
if
(
share_code
)
{
});
}
else
{
this
.
setState
({
shareInfo
:
{
...
shareInfo
,
share_code
type
:
1
});
window
.
localStorage
.
removeItem
(
'redpacket-click'
);
}
}
else
{
this
.
setState
({
type
:
1
});
}
}
this
.
fetchShareInfo
();
}
// 获取分享信息
fetchShareInfo
=
()
=>
{
http
.
get
(
`
${
API
.
home
}
/sys/redPacket/shareUrl/
${
getParam
(
'id'
)}
`
).
then
(
res
=>
{
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
this
.
setState
({
shareInfo
:
data
});
}
});
}
// 分享后进入,链接中带 share_code 字段
judgePopupType
=
()
=>
{
const
share_code
=
getParam
(
'share_code'
);
const
{
shareInfo
}
=
this
.
state
;
if
(
share_code
&&
share_code
!==
'null'
)
{
this
.
setState
({
shareInfo
:
Object
.
assign
({},
shareInfo
,
{
share_code
})
});
// 检查收否领取过
...
...
@@ -133,6 +164,47 @@ class RedPacket extends PureComponent {
}
}
// 选择区号后进入
judgePopupTypeFromCountry
=
()
=>
{
const
{
country
}
=
this
.
props
;
const
{
shareInfo
}
=
this
.
state
;
if
(
country
.
code
)
{
this
.
setState
({
country
,
shareInfo
:
Object
.
assign
({},
shareInfo
,
{
share_code
:
country
.
code
})
});
// 检查收否领取过
http
.
post
(
`
${
API
.
home
}
/sys/redPacket/split`
,
{
action
:
'check'
,
share_code
:
country
.
code
}
).
then
(
res
=>
{
console
.
log
(
res
);
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
// is_receive 是否领取过 0-否 1-是
if
(
data
.
is_receive
)
{
this
.
judgeReceiveStatus
(
data
,
8
);
}
else
{
this
.
setState
({
type
:
3
});
}
// 清除
this
.
props
.
delCountryNum
();
}
})
}
}
// 判断领取状态--领取后
judgeReceiveStatus
=
(
data
,
bindType
=
4
)
=>
{
let
txt
=
''
;
...
...
@@ -209,25 +281,21 @@ class RedPacket extends PureComponent {
// 获取分享信息
handleToShare
=
()
=>
{
const
{
history
}
=
this
.
props
;
http
.
get
(
`
${
API
.
home
}
/sys/redPacket/shareUrl/
${
getParam
(
'id'
)}
`
).
then
(
res
=>
{
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
4030
||
code
===
4040
)
{
const
{
history
,
userInfo
}
=
this
.
props
;
if
(
browser
.
isWeixin
)
{
this
.
setState
({
type
:
2
});
history
.
push
(
`/detail?id=
${
getParam
(
'id'
)}
&wechat=1`
);
}
else
{
history
.
push
(
'/passport/login'
);
}
}
if
(
code
===
200
)
{
if
(
userInfo
&&
userInfo
.
uid
)
{
this
.
setState
({
shareInfo
:
data
,
type
:
browser
.
isWeixin
?
2
:
1
type
:
1
});
}
else
{
history
.
push
(
'/passport/login'
);
}
}
});
}
// 提示关注公众号
...
...
@@ -354,13 +422,6 @@ class RedPacket extends PureComponent {
}
}
// 复制口令
handleToCopy
=
()
=>
{
this
.
setState
({
isCopy
:
true
});
}
getCaptchaInstance
=
instance
=>
{
this
.
setState
({
captchaInstance
:
instance
...
...
@@ -515,7 +576,7 @@ class RedPacket extends PureComponent {
render
()
{
// console.log(this.props);
const
{
history
}
=
this
.
props
;
const
{
history
,
userInfo
}
=
this
.
props
;
const
{
type
,
isCopy
,
...
...
@@ -570,11 +631,26 @@ class RedPacket extends PureComponent {
{
command
.
length
>
16
?
`
${
command
.
substr
(
0
,
16
)}
...`
:
command
}
<
/p
>
{
!
isCopy
?
userInfo
&&
userInfo
.
uid
?
(
<
CopyToClipboard
text
=
{
command
}
onCopy
=
{
this
.
handleToCopy
}
>
<
CopyToClipboard
text
=
{
command
}
onCopy
=
{()
=>
this
.
setState
({
isCopy
:
true
})}
>
<
button
className
=
"popup-password__button--copy"
>
复制口令
<
/button
>
<
/CopyToClipboard
>
)
:
(
<
button
className
=
"popup-password__button--copy"
onClick
=
{()
=>
{
window
.
localStorage
.
setItem
(
'redpacket-click'
,
'copy'
);
history
.
push
(
'/passport/login'
);
}}
>
复制口令
<
/button
>
)
:
<
p
className
=
"popup-password__success"
>
复制成功,快发送给好友吧
~<
/p
>
}
<
/div
>
...
...
@@ -585,7 +661,24 @@ class RedPacket extends PureComponent {
<
/div
>
<
i
className
=
"popup-password__button--close iconfont iconiconfront-2"
onClick
=
{()
=>
this
.
handleToClose
(
true
)}
onClick
=
{()
=>
{
if
(
getParam
(
'wechat'
)
===
'1'
)
{
if
(
userInfo
&&
userInfo
.
uid
)
{
this
.
handleToClose
(
true
);
history
.
push
(
`/detail?id=
${
getParam
(
'id'
)}
`
);
}
else
{
this
.
setState
({
type
:
3
});
window
.
localStorage
.
setItem
(
'redpacket-click'
,
'split'
);
}
}
else
{
this
.
handleToClose
(
true
);
}
this
.
setState
({
isCopy
:
false
});
}}
/
>
<
/div
>
}
...
...
src/components/passport/bindingTel/index.js
View file @
2d314bb2
...
...
@@ -123,7 +123,6 @@ const formikConfig = {
plat
:
5
}).
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
==
200
)
{
if
(
data
.
data
[
'is_set_pwd'
])
{
...
...
@@ -132,7 +131,8 @@ const formikConfig = {
data
:
{
uid
:
data
.
data
.
uid
},
msg
:
data
.
data
.
msg
msg
:
data
.
data
.
msg
,
stage
:
'binding'
})
props
.
history
.
replace
(
`/passport/set-password`
)
}
else
{
...
...
src/components/passport/index.js
View file @
2d314bb2
...
...
@@ -67,15 +67,17 @@ class Passport extends Component {
let
{
history
,
location
}
=
this
.
props
let
{
data
}
=
this
.
props
.
user
if
(
data
&&
Object
.
values
(
data
).
filter
(
item
=>
!!
item
).
length
)
{
if
(
history
.
action
===
'POP'
&&
history
.
length
<=
3
)
{
if
(
history
.
action
===
'POP'
&&
history
.
length
<=
3
)
{
history
.
push
(
'/'
)
}
else
{
const
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
,
search
:
''
}};
if
(
!
(
this
.
props
.
user
&&
this
.
props
.
user
.
stage
))
{
const
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
'/'
,
search
:
''
};
const
redirectURI
=
getParam
(
'redirect'
)
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
history
.
replace
(
from
);
}
}
}
}
render
()
{
...
...
src/components/passport/setPassword/index.js
View file @
2d314bb2
...
...
@@ -16,11 +16,6 @@ import { connect } from "react-redux";
class
SetPassword
extends
Component
{
componentDidMount
()
{
// console.log(this.props.location);
}
render
()
{
let
{
values
,
errors
,
location
}
=
this
.
props
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
...
...
@@ -75,7 +70,7 @@ const formikConfig = {
},
handleSubmit
:
(
values
,
{
props
})
=>
{
let
{
from
}
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}
}
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
if
(
from
.
pathname
.
includes
(
'forgot-password'
))
{
forgotPasswordReset
(
values
,
props
);
}
else
{
...
...
@@ -129,7 +124,7 @@ function bindMobileSetPassword(values, props) {
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
Toast
.
info
(
'密码设置成功'
)
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}
}
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
setTimeout
(
function
()
{
props
.
history
.
replace
(
from
.
pathname
)
},
1000
)
...
...
yarn.lock
View file @
2d314bb2
...
...
@@ -2772,6 +2772,11 @@ cli-width@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=
clipboard-copy@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/clipboard-copy/download/clipboard-copy-3.1.0.tgz#4c59030a43d4988990564a664baeafba99f78ca4"
integrity sha1-TFkDCkPUmImQVkpmS66vupn3jKQ=
cliui@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment