|
@@ -33,7 +33,7 @@ class Cities extends Component {
|
|
|
PublicView: null,
|
|
|
contentView: "",
|
|
|
remarksView: "",
|
|
|
- hid:'none',
|
|
|
+ hid: 'none',
|
|
|
contentViewLength: 0,
|
|
|
contentViewLength1: 0,
|
|
|
pagination: {
|
|
@@ -41,13 +41,13 @@ class Cities extends Component {
|
|
|
defaultPageSize: 10,
|
|
|
showQuickJumper: true,
|
|
|
pageSize: 10,
|
|
|
- onChange: function(page) {
|
|
|
+ onChange: function (page) {
|
|
|
this.linkList(page);
|
|
|
this.setState({
|
|
|
selectedRowKeys: []
|
|
|
});
|
|
|
}.bind(this),
|
|
|
- showTotal: function(total) {
|
|
|
+ showTotal: function (total) {
|
|
|
return "共" + total + "条数据";
|
|
|
}
|
|
|
},
|
|
@@ -105,9 +105,9 @@ class Cities extends Component {
|
|
|
render: (text, record) => {
|
|
|
return (
|
|
|
<div>
|
|
|
- {
|
|
|
- text == 0 ? '正常': '冻结'
|
|
|
- }
|
|
|
+ {
|
|
|
+ text == 0 ? '正常' : '冻结'
|
|
|
+ }
|
|
|
</div>
|
|
|
);
|
|
|
},
|
|
@@ -122,16 +122,16 @@ class Cities extends Component {
|
|
|
<div>
|
|
|
<Popconfirm
|
|
|
title={record.status == 0 ? "确认冻结?" : "确认恢复?"}
|
|
|
- onConfirm={()=>this.linksUpdate(record)}
|
|
|
+ onConfirm={() => this.linksUpdate(record)}
|
|
|
okText="确定"
|
|
|
cancelText="取消"
|
|
|
>
|
|
|
<Button
|
|
|
- style={{background:record.status ?'#009966':''}}
|
|
|
- type={record.status == 0 ? 'primary' :'primary'}
|
|
|
+ style={{ background: record.status ? '#009966' : '' }}
|
|
|
+ type={record.status == 0 ? 'primary' : 'primary'}
|
|
|
onClick={(e) => {
|
|
|
e.stopPropagation();
|
|
|
-
|
|
|
+
|
|
|
// this.setState({
|
|
|
// addFlag: false,
|
|
|
// });
|
|
@@ -159,10 +159,10 @@ class Cities extends Component {
|
|
|
this.formRef = {};
|
|
|
this.submitOrder = this.submitOrder.bind(this);
|
|
|
this.linkList = this.linkList.bind(this);
|
|
|
- this.linksUpdate = this.linksUpdate.bind(this)
|
|
|
- this.reset = this.reset.bind(this)
|
|
|
+ this.linksUpdate = this.linksUpdate.bind(this)
|
|
|
+ this.reset = this.reset.bind(this)
|
|
|
this.tableRowClick = this.tableRowClick.bind(this)
|
|
|
- this.cleanAllpopularCities= this.cleanAllpopularCities.bind(this)
|
|
|
+ this.cleanAllpopularCities = this.cleanAllpopularCities.bind(this)
|
|
|
}
|
|
|
componentDidMount() {
|
|
|
this.linkList(1)
|
|
@@ -192,14 +192,17 @@ class Cities extends Component {
|
|
|
);
|
|
|
}
|
|
|
// 修改链接状态
|
|
|
- linksUpdate(record){
|
|
|
+ linksUpdate(record) {
|
|
|
if (!this.state.sort && !record.sort) {
|
|
|
message.warning("请填写排序");
|
|
|
return;
|
|
|
- }else if(!this.state.name && !record.name) {
|
|
|
+ } else if (!this.state.name && !record.name) {
|
|
|
message.warning("请输入城市名");
|
|
|
return;
|
|
|
}
|
|
|
+ this.setState({
|
|
|
+ loading: true,
|
|
|
+ });
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
@@ -207,7 +210,7 @@ class Cities extends Component {
|
|
|
url: globalConfig.context + "/api/admin/popularCities/update",
|
|
|
data: {
|
|
|
sort: record.sort || this.state.sort,
|
|
|
- status: record.status == 0 ? '1' :'0' || this.state.status,
|
|
|
+ status: record.status == 0 ? '1' : '0' || this.state.status,
|
|
|
// mutualChain: record.mutualChain || this.state.mutualChain,
|
|
|
name: record.name || this.state.name,
|
|
|
url: record.url || this.state.url,
|
|
@@ -215,6 +218,9 @@ class Cities extends Component {
|
|
|
id: record.id || this.state.id,
|
|
|
},
|
|
|
success: function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false,
|
|
|
+ });
|
|
|
if (data.error.length) {
|
|
|
this.setState({
|
|
|
loading: false,
|
|
@@ -222,8 +228,8 @@ class Cities extends Component {
|
|
|
message.warning(data.error[0].message);
|
|
|
} else {
|
|
|
this.setState({
|
|
|
- visible:false,
|
|
|
- hid:'none'
|
|
|
+ visible: false,
|
|
|
+ hid: 'none'
|
|
|
})
|
|
|
this.linkList(1)
|
|
|
message.success("修改成功");
|
|
@@ -239,11 +245,11 @@ class Cities extends Component {
|
|
|
}
|
|
|
reset() {
|
|
|
this.setState({
|
|
|
- sortType1:undefined,
|
|
|
- name1:undefined,
|
|
|
- mutualChain1:undefined,
|
|
|
- status1:undefined
|
|
|
- },()=>{
|
|
|
+ sortType1: undefined,
|
|
|
+ name1: undefined,
|
|
|
+ mutualChain1: undefined,
|
|
|
+ status1: undefined
|
|
|
+ }, () => {
|
|
|
this.linkList();
|
|
|
});
|
|
|
}
|
|
@@ -252,7 +258,7 @@ class Cities extends Component {
|
|
|
if (!this.state.sort) {
|
|
|
message.warning("请填写排序");
|
|
|
return;
|
|
|
- } else if(!this.state.name) {
|
|
|
+ } else if (!this.state.name) {
|
|
|
message.warning("请输入城市名");
|
|
|
return;
|
|
|
}
|
|
@@ -268,9 +274,9 @@ class Cities extends Component {
|
|
|
sort: this.state.sort,
|
|
|
status: 0,
|
|
|
// mutualChain:this.state.mutualChain,
|
|
|
- name:this.state.name,
|
|
|
- url:this.state.url,
|
|
|
- remarks:this.state.remarks
|
|
|
+ name: this.state.name,
|
|
|
+ url: this.state.url,
|
|
|
+ remarks: this.state.remarks
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data.error.length) {
|
|
@@ -281,13 +287,13 @@ class Cities extends Component {
|
|
|
} else {
|
|
|
this.setState({
|
|
|
loading: false,
|
|
|
- visible:false,
|
|
|
+ visible: false,
|
|
|
viewKey: this.state.viewKey + 1,
|
|
|
sort: "",
|
|
|
// mutualChain: "",
|
|
|
name: '',
|
|
|
url: '',
|
|
|
- remarks:''
|
|
|
+ remarks: ''
|
|
|
});
|
|
|
this.linkList(1)
|
|
|
// this.assistList();
|
|
@@ -302,19 +308,19 @@ class Cities extends Component {
|
|
|
}.bind(this)
|
|
|
);
|
|
|
}
|
|
|
- linkList(page){
|
|
|
+ linkList(page) {
|
|
|
$.ajax({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + "/api/admin/popularCities/list",
|
|
|
data: {
|
|
|
- sortType:this.state.sortType1 || undefined,
|
|
|
+ sortType: this.state.sortType1 || undefined,
|
|
|
name: this.state.name1 || undefined,
|
|
|
// mutualChain:this.state.mutualChain || undefined,
|
|
|
- status:this.state.status1 || undefined,
|
|
|
- pageNo:page || 1,
|
|
|
- pageSize:10
|
|
|
+ status: this.state.status1 || undefined,
|
|
|
+ pageNo: page || 1,
|
|
|
+ pageSize: 10
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data.error.length) {
|
|
@@ -329,10 +335,10 @@ class Cities extends Component {
|
|
|
});
|
|
|
this.state.pagination.total = data.data.totalCount;
|
|
|
this.state.pagination.current = data.data.pageNo;
|
|
|
- }
|
|
|
- if (data.data && data.data.list && !data.data.list.length) {
|
|
|
- this.state.pagination.total = 0;
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (data.data && data.data.list && !data.data.list.length) {
|
|
|
+ this.state.pagination.total = 0;
|
|
|
+ }
|
|
|
}.bind(this),
|
|
|
}).always(
|
|
|
function () {
|
|
@@ -342,20 +348,20 @@ class Cities extends Component {
|
|
|
}.bind(this)
|
|
|
);
|
|
|
}
|
|
|
- // 双击表格弹出修改
|
|
|
+ // 双击表格弹出修改
|
|
|
tableRowClick(record) {
|
|
|
- this.setState({
|
|
|
- visible:true,
|
|
|
- sort: record.sort,
|
|
|
- status: record.status,
|
|
|
- // mutualChain: record.mutualChain,
|
|
|
- name: record.name,
|
|
|
- url: record.url,
|
|
|
- remarks: record.remarks,
|
|
|
- id:record.id,
|
|
|
- hid:'block'
|
|
|
- })
|
|
|
- }
|
|
|
+ this.setState({
|
|
|
+ visible: true,
|
|
|
+ sort: record.sort,
|
|
|
+ status: record.status,
|
|
|
+ // mutualChain: record.mutualChain,
|
|
|
+ name: record.name,
|
|
|
+ url: record.url,
|
|
|
+ remarks: record.remarks,
|
|
|
+ id: record.id,
|
|
|
+ hid: 'block'
|
|
|
+ })
|
|
|
+ }
|
|
|
render() {
|
|
|
const formItemLayout = {
|
|
|
labelCol: { span: 8 },
|
|
@@ -385,7 +391,7 @@ class Cities extends Component {
|
|
|
</Select>
|
|
|
{/* 显示名称关键字 */}
|
|
|
<Input
|
|
|
- style={{bottom:'6px'}}
|
|
|
+ style={{ bottom: '6px' }}
|
|
|
placeholder="请输入显示名称关键字"
|
|
|
value={this.state.name1}
|
|
|
onChange={(e) => {
|
|
@@ -426,7 +432,7 @@ class Cities extends Component {
|
|
|
</Select>
|
|
|
<Button
|
|
|
type="primary"
|
|
|
- onClick={()=>this.linkList(1)}
|
|
|
+ onClick={() => this.linkList(1)}
|
|
|
style={{ marginLeft: "10px" }}
|
|
|
>
|
|
|
搜索
|
|
@@ -435,13 +441,13 @@ class Cities extends Component {
|
|
|
<Button
|
|
|
type="primary"
|
|
|
onClick={() => {
|
|
|
- this.setState({
|
|
|
- visible: true ,
|
|
|
+ this.setState({
|
|
|
+ visible: true,
|
|
|
sort: "",
|
|
|
mutualChain: "",
|
|
|
name: '',
|
|
|
url: '',
|
|
|
- remarks:''
|
|
|
+ remarks: ''
|
|
|
});
|
|
|
}}
|
|
|
style={{ marginLeft: "100px" }}
|
|
@@ -467,17 +473,17 @@ class Cities extends Component {
|
|
|
</SpinContainer>
|
|
|
</div>
|
|
|
<Modal
|
|
|
- width={'600px'}
|
|
|
+ width={'600px'}
|
|
|
visible={this.state.visible}
|
|
|
key={this.state.viewKey}
|
|
|
title="新增/编辑热门"
|
|
|
onCancel={() => {
|
|
|
this.setState({
|
|
|
visible: false,
|
|
|
- viewKey:this.state.viewKey+1
|
|
|
+ viewKey: this.state.viewKey + 1
|
|
|
});
|
|
|
}}
|
|
|
- onOk={() => {}}
|
|
|
+ onOk={() => { }}
|
|
|
footer={false}
|
|
|
>
|
|
|
<Form
|
|
@@ -495,7 +501,7 @@ class Cities extends Component {
|
|
|
value={this.state.sort}
|
|
|
min={1}
|
|
|
onChange={(e) => {
|
|
|
- if(isNaN(e)) {
|
|
|
+ if (isNaN(e)) {
|
|
|
message.info("请输入数字")
|
|
|
}
|
|
|
this.setState({ sort: e });
|
|
@@ -510,14 +516,14 @@ class Cities extends Component {
|
|
|
hasFeedback
|
|
|
>
|
|
|
<Input
|
|
|
- style={{width:'140px'}}
|
|
|
- value={this.state.url}
|
|
|
+ style={{ width: '140px' }}
|
|
|
+ value={this.state.url}
|
|
|
placeholder="请输入http://地址"
|
|
|
onChange={(e) => {
|
|
|
this.setState({ url: e.target.value });
|
|
|
}}
|
|
|
/>
|
|
|
- <span style={{ color: "red",marginLeft:'10px' }}>请输入http://地址</span>
|
|
|
+ <span style={{ color: "red", marginLeft: '10px' }}>请输入http://地址</span>
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
{...formItemLayout}
|
|
@@ -526,7 +532,7 @@ class Cities extends Component {
|
|
|
hasFeedback
|
|
|
>
|
|
|
<Input
|
|
|
- value={this.state.name}
|
|
|
+ value={this.state.name}
|
|
|
placeholder="请输入显示在页面的热门城市"
|
|
|
onChange={(e) => {
|
|
|
this.setState({ name: e.target.value });
|
|
@@ -552,17 +558,17 @@ class Cities extends Component {
|
|
|
name="remarks"
|
|
|
hasFeedback
|
|
|
>
|
|
|
- <TextArea
|
|
|
- value={this.state.remarks}
|
|
|
- maxLength={500}
|
|
|
- placeholder="请输入备注..."
|
|
|
- rows={4}
|
|
|
- onChange={(e) => {
|
|
|
+ <TextArea
|
|
|
+ value={this.state.remarks}
|
|
|
+ maxLength={500}
|
|
|
+ placeholder="请输入备注..."
|
|
|
+ rows={4}
|
|
|
+ onChange={(e) => {
|
|
|
this.setState({
|
|
|
remarks: e.target.value,
|
|
|
})
|
|
|
}}
|
|
|
- />
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
<div
|
|
@@ -572,7 +578,7 @@ class Cities extends Component {
|
|
|
}}
|
|
|
>
|
|
|
<Button
|
|
|
- style={{display:this.state.hid == 'none' ? 'block' :'none'}}
|
|
|
+ style={{ display: this.state.hid == 'none' ? 'block' : 'none' }}
|
|
|
onClick={this.submitOrder}
|
|
|
type="primary"
|
|
|
loading={this.state.loading}
|
|
@@ -580,7 +586,7 @@ class Cities extends Component {
|
|
|
保存并发布
|
|
|
</Button>
|
|
|
<Button
|
|
|
- style={{display:this.state.hid}}
|
|
|
+ style={{ display: this.state.hid }}
|
|
|
onClick={this.linksUpdate}
|
|
|
type="primary"
|
|
|
loading={this.state.loading}
|
|
@@ -598,7 +604,7 @@ class Cities extends Component {
|
|
|
// mutualChain: "",
|
|
|
name: '',
|
|
|
url: '',
|
|
|
- remarks:''
|
|
|
+ remarks: ''
|
|
|
});
|
|
|
}}
|
|
|
>
|