Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commite333a4e

Browse files
committed
category setter enhance
1 parent69d2ff4 commite333a4e

File tree

12 files changed

+62
-23
lines changed

12 files changed

+62
-23
lines changed

‎containers/Banner/index.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import { inject, observer } from 'mobx-react'
99

1010
// import Link from 'next/link'
1111

12-
import{CommunityBanner,CommunitiesBanner}from'../../containers'
12+
import{
13+
CommunityBanner,
14+
CommunitiesBanner,
15+
UsersBanner,
16+
}from'../../containers'
1317
import{makeDebugger,storePlug,ROUTE}from'../../utils'
1418
import*aslogicfrom'./logic'
1519

@@ -22,6 +26,9 @@ const DomainBanner = ({ curRoute }) => {
2226
caseROUTE.COMMUNITIES:{
2327
return<CommunitiesBanner/>
2428
}
29+
caseROUTE.USERS:{
30+
return<UsersBanner/>
31+
}
2532
default:{
2633
return<CommunityBanner/>
2734
}

‎containers/CategoryEditor/index.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class CategoryEditorContainer extends React.Component {
5656
onChange={logic.profileChange('title')}
5757
note="一个分类可包含多个社区,同时,一个社区可属于多个分类"
5858
/>
59+
<FormInputer
60+
label="raw:"
61+
value={categoryData.raw}
62+
onChange={logic.profileChange('raw')}
63+
note="必须是英文,用于 route 以及国际化"
64+
/>
5965
<Divider/>
6066
<ActionBtns>
6167
<Buttontype="primary"ghostonClick={logic.cancleMutate}>

‎containers/CategoryEditor/logic.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ export const profileChange = R.curry((thread, e) =>
2727
)
2828

2929
exportconstmutateConfirm=()=>{
30-
constrequiredArgs=['title']
30+
constrequiredArgs=['title','raw']
3131
constargs={ ...categoryEditor.categoryData}
3232

33-
categoryEditor.markState({
34-
mutating:true,
35-
})
33+
categoryEditor.markState({mutating:true})
3634
constfargs=castArgs(args,requiredArgs)
3735

3836
if(categoryEditor.isEdit){
@@ -41,6 +39,7 @@ export const mutateConfirm = () => {
4139
castArgs(args,['id', ...requiredArgs])
4240
)
4341
}
42+
console.log('fargs --- xxx ',fargs)
4443
returnsr71$.mutate(S.createCategory,fargs)
4544
}
4645

‎containers/CategoryEditor/schema.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
importgqlfrom'graphql-tag'
22

33
constcreateCategory=gql`
4-
mutation($title: String!) {
5-
createCategory(title: $title) {
4+
mutation($title: String!, $raw: String!) {
5+
createCategory(title: $title, raw: $raw) {
66
id
77
}
88
}

‎containers/CommunitiesContent/CategoriesContent.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,22 @@ const columns = [
2626
},
2727
{
2828
title:'标题',
29-
width:200,
29+
width:150,
3030
dataIndex:'title',
3131
align:'center',
3232
render:text=>{
3333
return<div>{cutFrom(text,15)}</div>
3434
},
3535
},
36+
{
37+
title:'raw',
38+
width:150,
39+
dataIndex:'raw',
40+
align:'center',
41+
render:text=>{
42+
return<div>{cutFrom(text,15)}</div>
43+
},
44+
},
3645
{
3746
title:'社区',
3847
width:260,
@@ -90,7 +99,7 @@ const columns = [
9099
size="small"
91100
type="red"
92101
ghost
93-
onClick={logic.onDelete.bind(this,record)}
102+
onClick={logic.onDeleteCagegory.bind(this,record)}
94103
>
95104
删除
96105
</Button>

‎containers/CommunitiesContent/logic.js‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ export function loadCommunities(page = 1) {
4949
communitiesContent.markState({communitiesLoading:true})
5050

5151
communitiesContent.markRoute({ page})
52-
communitiesContent.markRoute({ page})
53-
const{ route}=communitiesContent
52+
/* const { route } = communitiesContent */
5453

55-
args.filter=R.merge(args.filter,route.query)
54+
/*args.filter = R.merge(args.filter, route.query) */
5655
sr71$.query(S.pagedCommunities,args)
5756
}
5857

@@ -154,6 +153,11 @@ export function onDeleteTag(record) {
154153
sr71$.mutate(S.deleteTag,args)
155154
}
156155

156+
exportfunctiononDeleteCagegory(record){
157+
constargs={id:record.id}
158+
sr71$.mutate(S.deleteCategory,args)
159+
}
160+
157161
exportfunctionsetCommunity(thread,source){
158162
dispatchEvent(EVENT.NAV_SET_COMMUNITY,{
159163
type:TYPE.PREVIEW_SET_COMMUNITY,
@@ -330,6 +334,10 @@ const DataSolver = [
330334
match:asyncRes('deleteTag'),
331335
action:()=>loadTags(),
332336
},
337+
{
338+
match:asyncRes('deleteCategory'),
339+
action:()=>loadCategories(),
340+
},
333341
{
334342
match:asyncRes(EVENT.LOGOUT),
335343
action:()=>loadCommunities(),

‎containers/CommunitiesContent/schema.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const pagedCategories = gql`
3939
entries {
4040
id
4141
title
42+
raw
4243
communities {
4344
id
4445
logo
@@ -250,6 +251,14 @@ const deleteTag = gql`
250251
}
251252
`
252253

254+
constdeleteCategory=gql`
255+
mutation($id: ID!) {
256+
deleteCategory(id: $id) {
257+
id
258+
}
259+
}
260+
`
261+
253262
constschema={
254263
pagedCommunities,
255264
pagedCommunitiesRaw,
@@ -267,6 +276,7 @@ const schema = {
267276
setTag,
268277
unsetTag,
269278
deleteTag,
279+
deleteCategory,
270280
}
271281

272282
exportdefaultschema

‎containers/UsersBanner/index.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import { BannerContainer } from './styles'
2323
constdebug=makeDebugger('C:UsersBanner')
2424
/* eslint-enable no-unused-vars */
2525

26-
constrenderChildBanner=(route,store)=>{
26+
constrenderChildBanner=(curRoute,store)=>{
2727
const{ usersTotalCount, filteredCount}=store
2828

29-
switch(route.subPath){
29+
switch(curRoute.subPath){
3030
caseROUTE.PAYS:{
3131
return<PaysBannertotalCount={200}filteredCount={100}/>
3232
}
@@ -54,10 +54,12 @@ class UsersBannerContainer extends React.Component {
5454

5555
render(){
5656
const{ usersBanner}=this.props
57-
const{route}=usersBanner
57+
const{curRoute}=usersBanner
5858

5959
return(
60-
<BannerContainer>{renderChildBanner(route,usersBanner)}</BannerContainer>
60+
<BannerContainer>
61+
{renderChildBanner(curRoute,usersBanner)}
62+
</BannerContainer>
6163
)
6264
}
6365
}

‎containers/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
export{defaultasBanner}from'./Banner'
66
export{defaultasCommunityBanner}from'./CommunityBanner'
77
export{defaultasCommunitiesBanner}from'./CommunitiesBanner'
8+
export{defaultasUsersBanner}from'./UsersBanner'
89

910
// content
1011
export{defaultasContent}from'./Content'

‎stores/RouteStore/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const RouteStore = t
5959

6060
consturl=`/${allQueryString}`
6161
letasPath=`/${self.mainPath}/${self.subPath}${queryString}`
62-
if(self.subPath==='index'){
62+
if(self.subPath==='index'||self.mainPath===self.subPath){
6363
asPath=`/${self.mainPath}${queryString}`
6464
}
6565

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp