|
@@ -145,7 +145,10 @@ export default class extends Page {
|
|
|
isFaq: true,
|
|
|
});
|
|
|
this.categoryMap = getMap(result.category, 'id');
|
|
|
- const list = formatTreeData(result.category, 'id', 'title', 'parentId');
|
|
|
+ const list = formatTreeData(result.category, 'id', 'title', 'parentId').map((row) => {
|
|
|
+ if (row.isRoom) row.children = [];
|
|
|
+ return row;
|
|
|
+ });
|
|
|
const readPlates = ((result.read || {}).plates || []).map((row, index) => {
|
|
|
row.title = row.plate;
|
|
|
row.key = `${index + 1}`;
|
|
@@ -290,7 +293,7 @@ export default class extends Page {
|
|
|
} else {
|
|
|
this.refreshList(item);
|
|
|
}
|
|
|
- this.setState({ current: key });
|
|
|
+ this.setState({ current: key, open: true });
|
|
|
}
|
|
|
|
|
|
refreshRead() {
|
|
@@ -315,7 +318,7 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderView() {
|
|
|
- const { list, current, scrollCurrent } = this.state;
|
|
|
+ const { list, current, scrollCurrent, open } = this.state;
|
|
|
let detail = {};
|
|
|
return (
|
|
|
<div>
|
|
@@ -327,13 +330,19 @@ export default class extends Page {
|
|
|
return (
|
|
|
<div
|
|
|
className={`page-item ${item.key === current ? 'active' : ''}`}
|
|
|
- onClick={() => this.changePage(item.key)}
|
|
|
+ onClick={() => {
|
|
|
+ if (item.key === current) {
|
|
|
+ this.setState({ open: !open });
|
|
|
+ } else {
|
|
|
+ this.changePage(item.key);
|
|
|
+ }
|
|
|
+ }}
|
|
|
>
|
|
|
{item.children && item.children.length > 0 && <Assets name="dropdown_hover" className="up" />}
|
|
|
{<Assets name="dropdown_normal" className="down" />}
|
|
|
{(!item.children || item.children.length === 0) && <Assets name="dropdown_hover" className="change" />}
|
|
|
<div className="page-item-title">{item.title}</div>
|
|
|
- {current === item.key &&
|
|
|
+ {current === item.key && open &&
|
|
|
item.children &&
|
|
|
item.children.map(child => {
|
|
|
return (
|
|
@@ -417,11 +426,11 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderList() {
|
|
|
- const { articles = [] } = this.state;
|
|
|
+ const { articles = [], scrollCurrent } = this.state;
|
|
|
return articles.map(item => {
|
|
|
return (
|
|
|
<div className="p-t-1 m-b-2" id={item.categoryId}>
|
|
|
- <div className="t-1 t-s-18 m-b-1">{item.title}</div>
|
|
|
+ <div className="t-1 t-s-18 m-b-1">{scrollCurrent === item.categoryId ? <span className="t-4">{item.title}</span> : item.title}</div>
|
|
|
<div className="t-2" dangerouslySetInnerHTML={{ __html: item.content }} />
|
|
|
</div>
|
|
|
);
|