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
674576ef
Commit
674576ef
authored
Aug 26, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'share-url-ios'
parents
99d2686f
ec78b36f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
14 deletions
+25
-14
src/App.js
+12
-3
src/components/detail/index.js
+8
-6
src/utils/wechat/base.js
+2
-2
src/utils/wechat/share.js
+3
-3
No files found.
src/App.js
View file @
674576ef
...
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
...
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
;
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
;
import
{
withRouter
}
from
'react-router-dom'
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
}
from
"@/utils"
;
import
{
getParam
,
http
,
browser
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
addDays
}
from
'date-fns'
import
{
addDays
}
from
'date-fns'
...
@@ -41,6 +41,10 @@ class App extends Component {
...
@@ -41,6 +41,10 @@ class App extends Component {
//平台信息
//平台信息
cookie
.
set
(
'plat'
,
'5'
,
{
domain
:
'.julyedu.com'
})
cookie
.
set
(
'plat'
,
'5'
,
{
domain
:
'.julyedu.com'
})
if
(
browser
.
isWeixin
&&
browser
.
isIOS
){
sessionStorage
.
setItem
(
'enter_url'
,
window
.
location
.
href
)
}
this
.
props
.
startFetchUser
()
this
.
props
.
startFetchUser
()
http
.
get
(
`
${
API
.
home
}
/m/user_info`
).
then
(
res
=>
{
http
.
get
(
`
${
API
.
home
}
/m/user_info`
).
then
(
res
=>
{
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
res
))
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
res
))
...
@@ -51,7 +55,7 @@ class App extends Component {
...
@@ -51,7 +55,7 @@ class App extends Component {
history
.
listen
(
location
=>
{
history
.
listen
(
location
=>
{
const
{
pathname
}
=
location
const
{
pathname
}
=
location
if
(
pathname
.
startsWith
(
'/passport'
))
{
if
(
pathname
.
startsWith
(
'/passport'
))
{
if
(
routeMatchRule
.
test
(
pathname
))
{
if
(
routeMatchRule
.
test
(
pathname
))
{
return
return
}
}
location
.
state
=
{
from
:
this
.
previousLocation
};
location
.
state
=
{
from
:
this
.
previousLocation
};
...
@@ -159,7 +163,12 @@ class App extends Component {
...
@@ -159,7 +163,12 @@ class App extends Component {
}
}
render
()
{
render
()
{
return
<
Routes
/>
return
(
<>
<
div
style
=
{{
position
:
'fixed'
,
bottom
:
'0'
,
right
:
'0'
,
fontSize
:
'20px'
,
color
:
'red'
,
zIndex
:
'1000'
}}
onClick
=
{
e
=>
{
alert
(
location
.
href
)}}
>
url
<
/div
>
<
Routes
/>
<
/
>
)
}
}
}
}
...
...
src/components/detail/index.js
View file @
674576ef
...
@@ -46,12 +46,14 @@ class Detail extends Component {
...
@@ -46,12 +46,14 @@ class Detail extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
wxShare
({
if
(
browser
.
isWeixin
){
title
:
`课程详情页`
,
wxShare
({
desc
:
`课程详情页`
,
title
:
`课程详情页`
,
link
:
encodeURI
(
location
.
origin
+
'/detail?id='
+
getParam
(
'id'
)),
desc
:
`课程详情页`
,
imgUrl
:
''
link
:
location
.
href
,
});
imgUrl
:
`
${
location
.
origin
}
/favicon.ico`
})
}
this
.
fetchCourseInfo
();
this
.
fetchCourseInfo
();
const
{
location
:
{
state
=
{}
}
}
=
this
.
props
;
const
{
location
:
{
state
=
{}
}
}
=
this
.
props
;
...
...
src/utils/wechat/base.js
View file @
674576ef
import
{
http
}
from
"@/utils/index
"
import
{
http
,
browser
}
from
"@/utils
"
const
url
=
`https://res.wx.qq.com/open/js/jweixin-1.4.0.js`
const
url
=
`https://res.wx.qq.com/open/js/jweixin-1.4.0.js`
...
@@ -7,7 +7,7 @@ const jsApiList = ['updateAppMessageShareData','updateTimelineShareData','onMenu
...
@@ -7,7 +7,7 @@ const jsApiList = ['updateAppMessageShareData','updateTimelineShareData','onMenu
export
const
getSignature
=
async
(
config
=
{})
=>
{
export
const
getSignature
=
async
(
config
=
{})
=>
{
let
res
=
await
http
.
post
(
`
${
API
[
'base-api'
]}
/m/sale/signature`
,
{
let
res
=
await
http
.
post
(
`
${
API
[
'base-api'
]}
/m/sale/signature`
,
{
url
:
window
.
location
.
href
.
split
(
'#'
)[
0
]
url
:
browser
.
isWeixin
&&
browser
.
isIOS
?
sessionStorage
.
getItem
(
'enter_url'
)
:
window
.
location
.
href
.
split
(
'#'
)[
0
],
})
})
return
wx
.
config
({
return
wx
.
config
({
debug
:
false
,
// 开启调试模式,
debug
:
false
,
// 开启调试模式,
...
...
src/utils/wechat/share.js
View file @
674576ef
import
{
getWXObject
,
getSignature
}
from
'./base'
import
{
getWXObject
,
getSignature
}
from
'./base'
const
shareApiList
=
[
'updateAppMessageShareData'
,
'updateTimelineShareData'
,
'onMenuShareAppMessage'
,
'onMenuShareTimeline'
]
const
shareApiList
=
[
'updateAppMessageShareData'
,
'updateTimelineShareData'
,
'onMenuShareAppMessage'
,
'onMenuShareTimeline'
]
export
default
async
function
(
data
=
{
title
:
''
,
desc
:
''
,
link
:
''
,
imgUrl
:
''
})
{
export
default
async
function
(
data
=
{
title
:
''
,
desc
:
''
,
link
:
''
,
imgUrl
:
''
},
config
=
{
})
{
await
getWXObject
()
await
getWXObject
()
await
getSignature
()
await
getSignature
(
config
)
wx
.
ready
(
function
()
{
wx
.
ready
(
function
()
{
console
.
log
(
'ready'
);
console
.
log
(
'ready'
);
...
...
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