Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
TaoHuang
6 years ago
Commit
42f07e4b4f341bb02b745e0ef1c946c80a542219
1 parent
26af7905
update app grass share picture
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
apps/utils/share-handler.js
package.json
apps/utils/share-handler.js
View file @
42f07e4
import
{
get
,
first
}
from
'lodash'
;
const
qs
=
require
(
'yoho-qs'
);
const
cookie
=
require
(
'yoho-cookie'
);
let
app_version
=
cookie
.
get
(
'app_version'
)
||
qs
.
app_version
||
''
;
function
_version2num
(
version
)
{
if
(
!
version
)
{
return
0
;
}
let
[
m
,
j
,
b
]
=
version
.
split
(
','
);
return
(
+
m
)
*
10000
+
(
+
j
)
*
100
+
(
+
b
);
}
function
versionCompare
(
left
,
right
)
{
let
leftNum
=
_version2num
(
left
);
let
rightNum
=
_version2num
(
right
);
if
(
leftNum
===
rightNum
)
{
return
0
;
}
else
if
(
leftNum
>
rightNum
)
{
return
1
;
}
else
{
return
-
1
;
}
}
const
DEFAULT_SHARE_IMAGE
=
'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png'
;
...
...
@@ -35,12 +62,19 @@ const getDetailShareData = (article) => {
shareImage
=
`
$
{
window
?
window
.
location
.
protocol
:
''
}
//${shareImage.split('//')[1]}`;
}
const
requiredVersion
=
'6.9.11'
;
let
hideType
=
[
'7'
,
'8'
,
'9'
];
if
(
versionCompare
(
app_version
,
requiredVersion
)
>=
0
)
{
hideType
=
[
'8'
,
'9'
];
}
return
{
title
:
`@
$
{
article
.
authorName
}
在有货社区上发了一篇内容,快点开看看!`
,
imgUrl
:
handleProtocol
(
get
(
shareImage
.
split
(
'?'
),
'[0]'
)
||
DEFAULT_SHARE_IMAGE
),
link
:
handleProtocol
(
`
$
{
window
?
window
.
location
.
origin
:
''
}
/grass/
article
/
$
{
article
.
articleId
}?
share
=
true
`
),
desc
,
hideType
:
[
'8'
,
'9'
]
,
hideType
,
shareType
:
'grassDetail'
,
userName
:
article
.
authorName
,
userIcon
:
article
.
authorHeadIco
,
...
...
package.json
View file @
42f07e4
{
"name"
:
"yoho-community-web"
,
"version"
:
"6.9.11-beta
2
"
,
"version"
:
"6.9.11-beta
3
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
Please
register
or
login
to post a comment