魏超 5 年之前
父節點
當前提交
80e2721666
共有 2 個檔案被更改,包括 21 行新增0 行删除
  1. 16
    0
      src/pages/news/list/NewsList.jsx
  2. 5
    0
      src/services/apis.js

+ 16
- 0
src/pages/news/list/NewsList.jsx 查看文件

5
 import request from '../../../utils/request';
5
 import request from '../../../utils/request';
6
 import apis from '../../../services/apis';
6
 import apis from '../../../services/apis';
7
 import Styles from './style.less';
7
 import Styles from './style.less';
8
+import styles from '../../style/GoodsList.less';
8
 import NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect'
9
 import NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect'
9
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10
 import SelectCity from '../../../components/SelectButton/CitySelect'
11
 import SelectCity from '../../../components/SelectButton/CitySelect'
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
     function cancelRelease(newsId, newsStatus, buildingId, newsTypeId) {
135
     function cancelRelease(newsId, newsStatus, buildingId, newsTypeId) {
122
       console.log("newsId" + newsId + "status" + newsStatus);
136
       console.log("newsId" + newsId + "status" + newsStatus);
123
       if (newsStatus === 1) {
137
       if (newsStatus === 1) {
167
         bodyStyle={{ padding: '10px 20px' }}
181
         bodyStyle={{ padding: '10px 20px' }}
168
       >
182
       >
169
         <AuthButton name="admin.taNews.id.put" noRight={null}>
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
           <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: ' 0.106rem',zIndex:1, color: '#FF7E48', cursor: 'pointer' }} onClick={toEditList(data.newsId)}>
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
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
188
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />

+ 5
- 0
src/services/apis.js 查看文件

156
       method: 'PUT',
156
       method: 'PUT',
157
       url: `${prefix}/taNews/:id`,
157
       url: `${prefix}/taNews/:id`,
158
       action: 'admin.taNews.id.put',
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
   newsType: {
166
   newsType: {