Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
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
于良
9 years ago
Commit
1cb2d8dbe0eee431b6075766184281ee8d097c33
2 parents
a31b9a81
13398668
master
...
6.7.0_0.49
6.7.1_0.49
6.7.4_0.49
6.7.5_0.49
6.8.7_message
6.9.5_msg
6.9.9_invite
V0125_Date
V1115_Date
V1130_Date
V1217_Date
V1230_Date
V6.10.1
V6.10.2
V6.7.9_dev
V6.8.6
V6.8.7
V6.8.7_upgrades
V6.8.9
V6.9.1
V6.9.2
V6.9.3
V6.9.5
V6.9.6
V6.9.6_Alliance
V6.9.7
V6.9.8
V6.9.8_shoudan
V6.9.9
V9.30_Date
exception
feature/rn_update61
gerry/v6.9.14_panicBuying
gerry/v6.9.16_bugfixed
v6.10.0
v6.9.10
v6.9.11
v6.9.12
v6.9.13
v6.9.14
v6.9.16
v6.9.17
v6.9.19
v6.9.20
v6.9.21
v6.9.22
v6.9.24
6.9.8
6.9.7
6.9.6
6.9.4
6.9.2
6.9.1
6.8.9
6.8.8
6.8.4
6.8.3
6.8.2
6.7.9
6.7.8
6.7.7
6.6.4
5.5.1
5.4.1
5.4
v6.7.5
v6.7.1
v6.2.0
v6.1.0
v5.6.2
v5.6.0
v5.5.2
v5.5.0
v5.4.1
v5.4.0
lqzx-5.1.0
lqzx-5.0.0
ios-qrcode-5.3.1-20161230
ios-dp-5.2.0-20161129
ios-dp-5.2.0-20161128
ios-classify-5.3.0-2016122101
ios-5.4.0
iOS-dp-5.2.0
android-dp-5.2.0-20161201
android-dp-5.2.0-20161128
android-classify-5.3.0-2016122801
V6.8.6
V6.8.5
V6.8.1
Merge branch 'local' into develop
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
139 additions
and
33 deletions
js/common/components/SlicedImage.js
js/community/Community.js
js/community/components/home/Home.js
js/community/components/home/NumberButton.js
js/community/components/home/SuperMan.js
js/community/components/section/Section.js
js/community/components/section/SectionHeader.js
js/community/constants/actionTypes.js
js/community/containers/HomeContainer.js
js/community/containers/SectionContainer.js
js/community/reducers/app/appActions.js
js/community/reducers/home/homeActions.js
js/community/reducers/section/sectionActions.js
js/community/reducers/section/sectionInitialState.js
js/community/reducers/section/sectionReducer.js
js/community/reducers/subject/subjectPostReducer.js
js/community/services/RouterService.js
js/common/components/SlicedImage.js
View file @
1cb2d8d
...
...
@@ -28,7 +28,7 @@ export default class SlicedImage extends React.Component {
width
=
PixelRatio
.
getPixelSizeForLayoutSize
(
width
);
height
=
PixelRatio
.
getPixelSizeForLayoutSize
(
height
);
let
newSrc
=
src
;
if
(
src
.
indexOf
(
'imageView
2
'
)
===
-
1
)
{
if
(
src
.
indexOf
(
'imageView'
)
===
-
1
)
{
newSrc
=
src
+
'?imageView2/'
+
this
.
mode
+
'/w/'
+
width
+
'/h/'
+
height
;
}
else
{
newSrc
=
src
.
replace
(
'{mode}'
,
this
.
mode
)
...
...
js/community/Community.js
View file @
1cb2d8d
...
...
@@ -317,8 +317,7 @@ export default function community(platform) {
},
homeOnRight
(
state
)
{
Actions
.
SubjectPost
();
// state.dispatch(startEditPost(state.getPostingState()));
state
.
dispatch
(
startEditPost
(
state
.
getPostingState
()));
},
pushPostingWithUID
(
uid
)
{
...
...
js/community/components/home/Home.js
View file @
1cb2d8d
...
...
@@ -307,7 +307,7 @@ export default class Home extends React.Component {
isVisible
=
{
isSyncFetching
}
/
>
<
SuperMan
fly
=
{
styles
.
fly
}
uid
=
{
user
.
uid
}
avatar
=
{
user
.
avatar
}
msgCount
=
{
user
.
msgCount
}
onSaveingTheWorld
=
{
this
.
props
.
onSaveingTheWorld
}
...
...
@@ -355,9 +355,4 @@ let styles = StyleSheet.create({
height
:
0.5
,
backgroundColor
:
'#e0e0e0'
,
},
fly
:
{
position
:
'absolute'
,
right
:
20
,
bottom
:
20
,
},
});
...
...
js/community/components/home/NumberButton.js
View file @
1cb2d8d
...
...
@@ -51,6 +51,7 @@ let styles = StyleSheet.create({
height
:
18
,
},
number
:
{
color
:
'#b0b0b0'
,
fontSize
:
14
,
marginLeft
:
5
,
},
...
...
js/community/components/home/SuperMan.js
View file @
1cb2d8d
...
...
@@ -17,6 +17,7 @@ const {
export
default
class
SuperMan
extends
React
.
Component
{
static
propTypes
=
{
uid
:
React
.
PropTypes
.
number
,
avatar
:
React
.
PropTypes
.
string
,
msgCount
:
React
.
PropTypes
.
string
,
onSaveingTheWorld
:
React
.
PropTypes
.
func
,
...
...
@@ -28,8 +29,18 @@ export default class SuperMan extends React.Component {
}
renderText
()
{
if
(
this
.
props
.
uid
==
0
)
{
return
(
<
Text
style
=
{
styles
.
loginText
}
>
请登录
<
/Text
>
);
}
else
{
return
null
;
}
}
renderMsgCount
()
{
if
(
parseInt
(
this
.
props
.
msgCount
)
!==
0
)
{
if
(
this
.
props
.
uid
>
0
&&
parseInt
(
this
.
props
.
msgCount
)
!==
0
)
{
return
(
<
View
style
=
{
styles
.
textContainer
}
>
<
Text
style
=
{
styles
.
text
}
>
{
this
.
props
.
msgCount
}
<
/Text
>
...
...
@@ -41,15 +52,17 @@ export default class SuperMan extends React.Component {
}
render
()
{
let
avtatStyle
=
this
.
props
.
avatar
?
styles
.
avatarContainer
:
null
;
let
avatarContainerStyle
=
this
.
props
.
uid
>
0
?
styles
.
avatarContainer
:
null
;
let
avatarStyle
=
this
.
props
.
uid
>
0
?
styles
.
avatarBorder
:
null
;
return
(
<
View
style
=
{[
styles
.
container
,
this
.
props
.
fly
]}
>
<
TouchableOpacity
activeOpacity
=
{
0.8
}
onPress
=
{()
=>
{
this
.
props
.
onSaveingTheWorld
&&
this
.
props
.
onSaveingTheWorld
();
}}
>
<
View
style
=
{
avtatStyle
}
>
<
SlicedImage
style
=
{
styles
.
avatar
}
source
=
{{
uri
:
this
.
props
.
avatar
}}
resizeMode
=
{
'cover'
}
defaultSource
=
{
require
(
'../../images/home/superman.png'
)}
/
>
<
View
style
=
{
avatarContainerStyle
}
>
<
SlicedImage
style
=
{[
styles
.
avatar
,
avatarStyle
]}
source
=
{{
uri
:
this
.
props
.
avatar
}}
resizeMode
=
{
'cover'
}
defaultSource
=
{
require
(
'../../images/home/superman.png'
)}
/
>
<
/View
>
{
this
.
renderText
()}
{
this
.
renderMsgCount
()}
<
/TouchableOpacity
>
<
/View
>
...
...
@@ -59,7 +72,10 @@ export default class SuperMan extends React.Component {
let
styles
=
StyleSheet
.
create
({
container
:
{
flexDirection
:
'row'
,
position
:
'absolute'
,
right
:
20
,
bottom
:
20
,
flexDirection
:
'column'
,
alignItems
:
'center'
,
backgroundColor
:
'transparent'
,
width
:
45
,
...
...
@@ -79,12 +95,15 @@ let styles = StyleSheet.create({
width
:
44
,
height
:
44
,
borderRadius
:
22
,
},
avatarBorder
:
{
borderColor
:
'white'
,
borderWidth
:
1
,
// shadowColor: 'red',
// shadowOpacity: 1,
// // shadowRadius: 20,
// shadowOffset: {width: 0, height: 0},
},
loginText
:
{
marginTop
:
2
,
fontSize
:
10
,
textAlign
:
'center'
,
},
textContainer
:
{
position
:
'absolute'
,
...
...
js/community/components/section/Section.js
View file @
1cb2d8d
...
...
@@ -290,7 +290,7 @@ export default class Section extends React.Component {
}}
/
>
<
SuperMan
fly
=
{
styles
.
fly
}
uid
=
{
user
.
uid
}
avatar
=
{
user
.
avatar
}
msgCount
=
{
user
.
msgCount
}
onSaveingTheWorld
=
{
this
.
props
.
onSaveingTheWorld
}
...
...
js/community/components/section/SectionHeader.js
View file @
1cb2d8d
...
...
@@ -22,7 +22,8 @@ export default class SectionHeader extends React.Component {
static
propTypes
=
{
data
:
ImmutablePropTypes
.
contains
({
uri
:
React
.
PropTypes
.
string
.
isRequired
,
title
:
React
.
PropTypes
.
string
.
isRequired
,
title
:
React
.
PropTypes
.
string
,
desc
:
React
.
PropTypes
.
string
.
isRequired
,
post
:
React
.
PropTypes
.
string
.
isRequired
,
comment
:
React
.
PropTypes
.
string
.
isRequired
,
like
:
React
.
PropTypes
.
string
.
isRequired
,
...
...
@@ -35,11 +36,11 @@ export default class SectionHeader extends React.Component {
}
render
()
{
let
{
uri
,
title
,
post
,
comment
,
like
}
=
this
.
props
.
data
.
toJS
();
let
{
uri
,
desc
,
post
,
comment
,
like
}
=
this
.
props
.
data
.
toJS
();
return
(
<
Image
style
=
{[
styles
.
container
,
this
.
props
.
style
]}
source
=
{{
uri
}}
resizeMode
=
{
'cover'
}
>
<
Text
style
=
{
styles
.
title
}
>
{
title
}
<
/Text
>
<
View
style
=
{
styles
.
desc
}
>
<
Text
style
=
{
styles
.
desc
}
>
{
desc
}
<
/Text
>
<
View
style
=
{
styles
.
stats
}
>
<
Text
style
=
{[
styles
.
content
,
{
flex
:
0.3
}]}
numberOfLines
=
{
1
}
>
{
post
}
<
/Text
>
<
Text
style
=
{
styles
.
content
}
>|<
/Text
>
<
Text
style
=
{[
styles
.
content
,
{
flex
:
0.3
}]}
numberOfLines
=
{
1
}
>
{
comment
}
<
/Text
>
...
...
@@ -58,7 +59,7 @@ let styles = StyleSheet.create({
// alignItems: 'center',
backgroundColor
:
'#b0b0b0'
,
},
title
:
{
desc
:
{
color
:
'white'
,
// fontFamily: 'SourceHanSansCN Normal',
fontSize
:
24
,
...
...
@@ -66,7 +67,7 @@ let styles = StyleSheet.create({
textAlign
:
'center'
,
backgroundColor
:
'transparent'
,
},
desc
:
{
stats
:
{
flex
:
1
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
...
...
js/community/constants/actionTypes.js
View file @
1cb2d8d
...
...
@@ -5,6 +5,7 @@ export default keyMirror({
SET_PLATFORM
:
null
,
SET_CONTAINER
:
null
,
SET_CHANNEL
:
null
,
GO_ACTION
:
null
,
SET_UID
:
null
,
SYNC_USER_REQUEST
:
null
,
...
...
@@ -52,7 +53,7 @@ export default keyMirror({
/*用户中心*/
USER_BACKGROUND_TAP
:
null
,
USER_AVATAR_TAP
:
null
,
USER_AVATAR_TAP
:
null
,
USER_POSTS_REQUEST
:
null
,
//我的帖子
USER_POSTS_SUCCESS
:
null
,
...
...
js/community/containers/HomeContainer.js
View file @
1cb2d8d
...
...
@@ -117,11 +117,12 @@ class HomeContainer extends React.Component {
}
_onPressBanner
(
url
)
{
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
jumpWithUrl
(
url
,
{}
);
this
.
props
.
actions
.
goAction
(
url
);
}
_onPressNotice
(
url
)
{
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
jumpWithUrl
(
url
,
{});
// url = `http://feature.yoho.cn/0714/0714ITEMBOY/index.html?title=男生分会场&share_id=814&openby:yohobuy={"action":"go.comm.h5","params":{"product_skn":51285070,"forumid":10003,"param":{"share_id":"814","title":"男生分会场"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"814"},"title":"男生分会场","url":"http://feature.yoho.cn/0714/0714ITEMBOY/index.html"}}`;
this
.
props
.
actions
.
goAction
(
url
);
}
_onPressSection
(
section
)
{
...
...
js/community/containers/SectionContainer.js
View file @
1cb2d8d
...
...
@@ -13,6 +13,7 @@ import Section from '../components/section/Section';
import
*
as
sectionActions
from
'../reducers/section/sectionActions'
;
import
*
as
postingActions
from
'../reducers/posting/postingActions'
;
import
*
as
homeActions
from
'../reducers/home/homeActions'
;
import
*
as
appActions
from
'../reducers/app/appActions'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
{
shouldShowTabBar
,
shouldHideTabBar
}
from
'../utils/tabBar'
;
...
...
@@ -32,7 +33,8 @@ const {
const
actions
=
[
sectionActions
,
postingActions
,
homeActions
homeActions
,
appActions
];
/**
...
...
@@ -98,12 +100,11 @@ class SectionContainer extends React.Component {
}
_onPressBanner
(
url
)
{
console
.
log
(
'banner'
);
this
.
props
.
actions
.
goAction
(
url
);
}
_onPressNotice
(
url
)
{
console
.
log
(
'notice'
);
this
.
props
.
actions
.
goAction
(
url
);
}
_onPressPost
(
id
)
{
...
...
js/community/reducers/app/appActions.js
View file @
1cb2d8d
...
...
@@ -6,13 +6,17 @@
*/
'use strict'
;
import
ReactNative
from
'react-native'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
AppService
from
'../../services/AppService'
;
import
RouterService
from
'../../services/RouterService'
;
import
{
goToSection
,
goToPost
}
from
'../home/homeActions'
;
const
{
SET_PLATFORM
,
SET_CONTAINER
,
SET_CHANNEL
,
GO_ACTION
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
export
function
setPlatform
(
platform
)
{
...
...
@@ -35,3 +39,46 @@ export function setChannel(channel) {
payload
:
channel
};
}
export
function
goAction
(
inputUrl
)
{
return
(
dispatch
,
getState
)
=>
{
return
new
RouterService
().
parseUrl
(
inputUrl
)
.
then
((
json
)
=>
{
let
{
action
,
params
}
=
json
;
let
{
param
,
share
,
shareparam
,
title
,
url
}
=
params
;
if
(
action
==
'go.comm.forum'
)
{
let
id
=
params
&&
params
.
forumid
?
params
.
forumid
:
0
;
let
name
=
''
;
if
(
id
!=
0
)
{
dispatch
(
goToSection
({
id
,
name
}));
}
}
else
if
(
action
==
'go.comm.postdetail'
)
{
let
id
=
params
&&
params
.
postid
?
params
.
postid
:
0
;
if
(
id
!=
0
)
{
dispatch
(
goToPost
(
id
));
}
}
else
if
(
action
==
'go.comm.h5'
)
{
let
title
=
params
.
title
?
params
.
title
:
''
;
let
url
=
params
.
url
?
params
.
url
:
''
;
if
(
!
url
||
url
.
length
==
0
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
displayH5
({
url
,
title
});
}
else
if
(
action
==
'go.comm.productDetail'
)
{
let
productSkn
=
params
.
product_skn
?
params
.
product_skn
:
''
;
productSkn
=
productSkn
+
''
;
let
tag
=
params
.
tag
?
params
.
tag
:
''
;
if
(
!
productSkn
||
productSkn
.
length
==
0
)
{
return
;
}
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
displayProductDetail
({
productSkn
,
tag
});
}
})
.
catch
(
error
=>
{
__DEV__
&&
console
.
log
(
error
);
});
};
}
...
...
js/community/reducers/home/homeActions.js
View file @
1cb2d8d
...
...
@@ -69,7 +69,7 @@ export function goToUserOrMe(uid) {
}
export
function
goToPost
(
id
)
{
// Actions.
Post();
Actions
.
Subject
Post
();
return
{
type
:
GO_TO_POST
,
payload
:
id
,
...
...
@@ -322,6 +322,7 @@ function parseBNS(json) {
id
:
item
.
forumCode
?
item
.
forumCode
:
0
,
logo
:
item
.
forumPic
?
item
.
forumPic
:
''
,
title
:
item
.
forumName
?
item
.
forumName
:
''
,
desc
:
item
.
forumDesc
?
item
.
forumDesc
:
''
,
post
:
number10KFormater
(
item
.
postsNum
),
comment
:
number10KFormater
(
item
.
commentsNum
),
like
:
number10KFormater
(
item
.
praiseNum
),
...
...
js/community/reducers/section/sectionActions.js
View file @
1cb2d8d
...
...
@@ -232,6 +232,7 @@ function parseHeader(json) {
let
uri
=
json
.
forumPic
?
json
.
forumPic
:
''
;
let
title
=
json
.
forumName
?
json
.
forumName
:
''
;
let
desc
=
json
.
forumDesc
?
json
.
forumDesc
:
''
;
let
post
=
number10KFormater
(
json
.
postsNum
);
let
comment
=
number10KFormater
(
json
.
commentsNum
);
let
like
=
number10KFormater
(
json
.
praiseNum
);
...
...
@@ -239,6 +240,7 @@ function parseHeader(json) {
let
header
=
{
uri
,
title
,
desc
,
post
,
comment
,
like
,
...
...
js/community/reducers/section/sectionInitialState.js
View file @
1cb2d8d
...
...
@@ -29,6 +29,7 @@ let item = new (Record({
header
:
new
(
Record
({
uri
:
''
,
title
:
''
,
desc
:
''
,
post
:
''
,
comment
:
''
,
like
:
''
,
...
...
js/community/reducers/section/sectionReducer.js
View file @
1cb2d8d
...
...
@@ -76,6 +76,7 @@ export default function sectionReducer(state = initialState, action) {
.
set
(
'ptr'
,
false
)
.
setIn
([
'header'
,
'uri'
],
header
.
uri
)
.
setIn
([
'header'
,
'title'
],
header
.
title
)
.
setIn
([
'header'
,
'desc'
],
header
.
desc
)
.
setIn
([
'header'
,
'post'
],
header
.
post
)
.
setIn
([
'header'
,
'comment'
],
header
.
comment
)
.
setIn
([
'header'
,
'like'
],
header
.
like
)
...
...
js/community/reducers/subject/subjectPostReducer.js
View file @
1cb2d8d
...
...
@@ -13,6 +13,8 @@ import InitialState from './subjectPostInitialState';
import
Immutable
,
{
List
,
Record
}
from
'immutable'
;
const
{
GO_TO_POST
,
SUBJECT_CONTENT_REQUEST
,
SUBJECT_CONTENT_SUCCESS
,
SUBJECT_CONTENT_FAILURE
,
...
...
@@ -34,6 +36,10 @@ export default function postingReducer(state = initialState, action) {
if
(
!
(
state
instanceof
InitialState
))
return
initialState
.
merge
(
state
);
switch
(
action
.
type
)
{
case
GO_TO_POST
:
{
return
state
.
set
(
'id'
,
action
.
payload
);
}
case
SUBJECT_CONTENT_REQUEST
:
{
let
nextState
=
state
.
set
(
'isContentFetching'
,
true
).
set
(
'contentError'
,
null
);
return
nextState
;
...
...
js/community/services/RouterService.js
View file @
1cb2d8d
...
...
@@ -8,5 +8,35 @@ export default class RouterService {
this
.
api
=
new
Request
();
}
parseUrl
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
url
)
{
reject
(
'Illegal url: '
+
url
);
}
// url解码
url
=
decodeURI
(
url
);
// 处理半角等号和全角等号
let
mark
=
'yohobuy='
;
let
markIndex
=
url
.
indexOf
(
mark
);
if
(
markIndex
==
-
1
)
{
mark
=
'yohobuy='
;
markIndex
=
url
.
indexOf
(
mark
);
}
if
(
markIndex
==
-
1
)
{
reject
(
'Can not find url rule: '
+
url
);
}
let
rule
=
url
.
substring
(
markIndex
+
mark
.
length
);
let
json
;
try
{
json
=
JSON
.
parse
(
rule
);
resolve
(
json
);
}
catch
(
e
)
{
reject
(
'Parse json string fail: '
+
e
);
}
});
}
}
...
...
Please
register
or
login
to post a comment