魏超 5 år sedan
förälder
incheckning
80e2721666
2 ändrade filer med 21 tillägg och 0 borttagningar
  1. 16
    0
      src/pages/news/list/NewsList.jsx
  2. 5
    0
      src/services/apis.js

+ 16
- 0
src/pages/news/list/NewsList.jsx Visa fil

@@ -5,6 +5,7 @@ import router from 'umi/router';
5 5
 import request from '../../../utils/request';
6 6
 import apis from '../../../services/apis';
7 7
 import Styles from './style.less';
8
+import styles from '../../style/GoodsList.less';
8 9
 import NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect'
9 10
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10 11
 import SelectCity from '../../../components/SelectButton/CitySelect'
@@ -118,6 +119,19 @@ function body(props) {
118 119
       });
119 120
     }
120 121
 
122
+    //   置顶
123
+    const topNews = (weightParam, newsId) => () => {
124
+      const weight = Math.abs(weightParam - 1)
125
+      request({ ...apis.news.weight, params: {newsId: newsId, weight} }).then((data) => {
126
+          console.log(data)
127
+          message.info('操作成功!')
128
+          getList({ pageNum: 1, pageSize: 10 })
129
+      }).catch((err) => {
130
+          console.log(err)
131
+          message.info(err.msg || err.message)
132
+      })
133
+    }
134
+
121 135
     function cancelRelease(newsId, newsStatus, buildingId, newsTypeId) {
122 136
       console.log("newsId" + newsId + "status" + newsStatus);
123 137
       if (newsStatus === 1) {
@@ -167,6 +181,8 @@ function body(props) {
167 181
         bodyStyle={{ padding: '10px 20px' }}
168 182
       >
169 183
         <AuthButton name="admin.taNews.id.put" noRight={null}>
184
+          <span style={{ position: 'absolute', right: '100px', top: '19px', fontSize: ' 0.106rem',zIndex:1, color: '#FF7E48', cursor: 'pointer' }} onClick={topNews(data.weight, data.newsId)}>{ data.weight === 1 ? '取消置顶' : '置顶' }</span>
185
+
170 186
           <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: ' 0.106rem',zIndex:1, color: '#FF7E48', cursor: 'pointer' }} onClick={toEditList(data.newsId)}>
171 187
             编辑
172 188
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />

+ 5
- 0
src/services/apis.js Visa fil

@@ -156,6 +156,11 @@ export default {
156 156
       method: 'PUT',
157 157
       url: `${prefix}/taNews/:id`,
158 158
       action: 'admin.taNews.id.put',
159
+    },
160
+    weight: {
161
+      method: 'PUT',
162
+      url: `${prefix}/taNews/weight`,
163
+      action: 'admin.taNews.weight.put',
159 164
     }
160 165
   },
161 166
   newsType: {