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
Email Patches
Plain Diff
Browse Files
Authored by
盖剑秋
9 years ago
Commit
96012f0a6009740f1d0eeac51ad25d04fd8361b3
1 parent
9840c323
Store posting reviewed by redding.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
69 deletions
js/community/Community.js
js/community/reducers/posting/postingActions.js
js/community/Community.js
View file @
96012f0
...
...
@@ -59,6 +59,7 @@ import {
startPosting
,
mergeCachedPosting
,
getPostUser
,
startEditPost
,
}
from
'./reducers/posting/postingActions'
;
import
PostingService
from
'./services/PostingService'
;
...
...
@@ -101,6 +102,7 @@ export default function community(platform) {
store
.
dispatch
(
setPlatform
(
platform
));
store
.
dispatch
(
setContianer
(
contaner
));
store
.
dispatch
(
setChannel
(
this
.
props
.
channel
));
store
.
dispatch
(
mergeCachedPosting
());
let
navBarStyle
=
contaner
===
2
?
{
backgroundColor
:
'gray'
,}
:
null
;
let
extraTitleStyle
=
contaner
===
2
?
{
color
:
'black'
,}
:
null
;
...
...
@@ -276,34 +278,9 @@ export default function community(platform) {
},
homeOnRight
(
state
)
{
if
(
state
.
getPostingState
())
{
Alert
.
alert
(
'抱歉'
,
'您有正在发送的帖子,请耐心等待~'
);
}
else
{
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
uid
()
.
then
(
uid
=>
{
this
.
pushPostingWithUID
(
uid
);
})
.
catch
(
error
=>
{
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
login
()
.
then
(
uid
=>
{
this
.
pushPostingWithUID
(
uid
);
});
});
}
console
.
log
(
state
);
state
.
dispatch
(
startEditPost
(
state
.
getPostingState
()));
},
pushPostingWithUID
(
uid
)
{
new
PostingService
().
getPostUser
(
uid
).
then
(
json
=>
{
if
(
json
.
forbidSpeaking
===
'Y'
)
{
Alert
.
alert
(
'抱歉'
,
'您暂时被禁言,请等待禁言解除哦~'
);
}
else
{
Actions
.
Posting
();
}
}).
catch
(
error
=>
{
Actions
.
Posting
();
})
},
/*
* 自定义导航push动画
*
...
...
js/community/reducers/posting/postingActions.js
View file @
96012f0
...
...
@@ -34,6 +34,51 @@ const {
let
POSTING_CACHE_KEY
=
'cachedPosting'
;
export
function
voidImplementationFunc
()
{
return
{
type
:
'null'
,
}
}
export
function
startEditPost
(
postingState
)
{
return
dispatch
=>
{
console
.
log
(
'lalala'
);
dispatch
(
voidImplementationFunc
());
dispatch
(()
=>
{
console
.
log
(
'nononononon'
);
if
(
postingState
)
{
Alert
.
alert
(
'抱歉'
,
'您有正在发送的帖子,请耐心等待~'
);
}
else
{
NativeModules
.
YH_CommunityHelper
.
uid
()
.
then
(
uid
=>
{
drillToEditPostPage
(
uid
);
})
.
catch
(
error
=>
{
ReactNative
.
NativeModules
.
YH_CommunityHelper
.
login
()
.
then
(
uid
=>
{
drillToEditPostPage
(
uid
);
});
});
}
})
}
}
function
drillToEditPostPage
(
uid
,
postingPageFunc
)
{
new
PostingService
().
getPostUser
(
uid
).
then
(
json
=>
{
if
(
json
.
forbidSpeaking
===
'Y'
)
{
Alert
.
alert
(
'抱歉'
,
'您暂时被禁言,请等待禁言解除哦~'
);
}
else
{
Actions
.
Posting
();
}
}).
catch
(
error
=>
{
Actions
.
Posting
();
})
}
export
function
commitMerge
(
cachedObj
)
{
return
{
type
:
POSTING_STATE_MERGE
,
...
...
@@ -42,12 +87,17 @@ export function commitMerge(cachedObj) {
}
export
function
mergeCachedPosting
()
{
return
dispatch
=>
store
.
get
(
POSTING_CACHE_KEY
).
then
(
cachedObj
=>
{
if
(
cachedObj
)
{
dispatch
(
commitMerge
(
cachedObj
));
dispatch
(
startPosting
(
cachedObj
.
assets
));
}
})
return
dispatch
=>
{
store
.
get
(
POSTING_CACHE_KEY
)
.
then
((
cachedObj
)
=>
{
console
.
log
(
'2222222222222222222222222'
);
console
.
log
(
cachedObj
);
if
(
cachedObj
)
{
dispatch
(
commitMerge
(
cachedObj
));
dispatch
(
startPosting
(
cachedObj
.
assets
));
}
})
}
}
...
...
@@ -147,7 +197,7 @@ export function updateUploadState(url,fileName) {
contentData
:
encodeURI
(
posting
.
content
),
images
:
imageStr
,
}
return
new
PostingService
().
commitPost
(
param
).
then
(
json
=>
{
return
new
PostingService
().
commitPost
(
param
).
then
(
(
json
)
=>
{
store
.
delete
(
POSTING_CACHE_KEY
);
dispatch
(
postFinished
(
true
));
}).
catch
(
error
=>
{
...
...
@@ -178,41 +228,15 @@ export function startPosting(assets) {
dispatch
(
postStart
());
let
storedState
=
getState
().
posting
.
toJS
();
let
assetsArray
=
storedState
.
assets
;
let
temp
=
[];
for
(
var
i
=
0
;
i
<
assetsArray
.
length
;
i
++
)
{
let
{
uri
,
height
,
width
,
isStored
,
url
,
uti
,
size
,
finished
,
name
,
webURL
,
}
=
assetsArray
[
i
];
let
newAsset
=
{
uri
,
height
,
width
,
isStored
,
url
,
uti
,
size
,
finished
,
name
,
webURL
,
}
temp
.
push
(
newAsset
);
}
storedState
.
assets
=
temp
;
storedState
.
boards
=
[];
storedState
.
postingBannerShow
=
true
;
store
.
save
(
POSTING_CACHE_KEY
,
storedState
).
then
(()
=>
{
console
.
log
(
'00000000000000000000000000'
);
console
.
log
(
storedState
);
store
.
get
(
POSTING_CACHE_KEY
).
then
((
data
)
=>
{
console
.
log
(
'11111111111111111111'
);
console
.
log
(
data
);
})
if
(
assets
.
length
)
{
for
(
let
i
=
0
;
i
<
assets
.
length
;
i
++
)
{
let
asset
=
assets
[
i
]
...
...
@@ -239,11 +263,9 @@ export function startPosting(assets) {
contentData
:
posting
.
content
,
}
return
new
PostingService
().
commitPost
(
param
).
then
(
json
=>
{
console
.
log
(
json
);
store
.
delete
(
POSTING_CACHE_KEY
);
dispatch
(
postFinished
(
true
));
}).
catch
(
error
=>
{
console
.
log
(
'download error.....'
);
dispatch
(
postFinished
(
false
));
});
});
...
...
Please
register
or
login
to post a comment