Commit 90ffe5adb769fd1dc3e954fdb485107476838a12

Authored by YunaiV
1 parent 28884ee6

mp:增加图文草稿箱的修改;优化前端代码

yudao-module-mp/yudao-module-mp-api/src/main/java/cn/iocoder/yudao/module/mp/enums/ErrorCodeConstants.java
... ... @@ -46,6 +46,7 @@ public interface ErrorCodeConstants {
46 46 // ========== 公众号草稿 1006007000============
47 47 ErrorCode DRAFT_LIST_FAIL = new ErrorCode(1006007000, "获得草稿列表失败,原因:{}");
48 48 ErrorCode DRAFT_CREATE_FAIL = new ErrorCode(1006007001, "创建草稿失败,原因:{}");
  49 + ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1006007002, "更新草稿失败,原因:{}");
49 50  
50 51 // TODO 要处理下
51 52 ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006001002, "菜单不存在");
... ...
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/vo/MpMaterialPageReqVO.java
... ... @@ -7,12 +7,18 @@ import lombok.Data;
7 7 import lombok.EqualsAndHashCode;
8 8 import lombok.ToString;
9 9  
  10 +import javax.validation.constraints.NotNull;
  11 +
10 12 @ApiModel("管理后台 - 公众号素材的分页 Request VO")
11 13 @Data
12 14 @EqualsAndHashCode(callSuper = true)
13 15 @ToString(callSuper = true)
14 16 public class MpMaterialPageReqVO extends PageParam {
15 17  
  18 + @ApiModelProperty(value = "公众号账号的编号", required = true, example = "2048")
  19 + @NotNull(message = "公众号账号的编号不能为空")
  20 + private Long accountId;
  21 +
16 22 @ApiModelProperty(value = "是否永久", example = "true")
17 23 private Boolean permanent;
18 24  
... ...
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/news/MpDraftController.http
... ... @@ -30,3 +30,25 @@ tenant-id: {{adminTenentId}}
30 30 }
31 31 ]
32 32 }
  33 +
  34 +### 请求 /mp/draft/create 接口 => 成功
  35 +PUT {{baseUrl}}/mp/draft/update?accountId=1&mediaId=r6ryvl6LrxBU0miaST4Y-q-G9pdsmZw0OYG4FzHQkKfpLfEwIH51wy2bxisx8PvW
  36 +Content-Type: application/json
  37 +Authorization: Bearer {{token}}
  38 +tenant-id: {{adminTenentId}}
  39 +
  40 +[{
  41 + "title": "我是标题(OOO)",
  42 + "author": "我是作者",
  43 + "digest": "我是摘要",
  44 + "content": "我是内容",
  45 + "contentSourceUrl": "https://www.iocoder.cn",
  46 + "thumbMediaId": "r6ryvl6LrxBU0miaST4Y-pIcmK-zAAId-9TGgy-DrSLhjVuWbuT3ZBjk9K1yQ0Dn"
  47 +}, {
  48 + "title": "我是标题(XXX)",
  49 + "author": "我是作者",
  50 + "digest": "我是摘要",
  51 + "content": "我是内容",
  52 + "contentSourceUrl": "https://www.iocoder.cn",
  53 + "thumbMediaId": "r6ryvl6LrxBU0miaST4Y-pIcmK-zAAId-9TGgy-DrSLhjVuWbuT3ZBjk9K1yQ0Dn"
  54 +}]
... ...
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/news/MpDraftController.java
... ... @@ -7,21 +7,20 @@ import cn.iocoder.yudao.module.mp.controller.admin.news.vo.MpDraftPageReqVO;
7 7 import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
8 8 import io.swagger.annotations.Api;
9 9 import io.swagger.annotations.ApiImplicitParam;
  10 +import io.swagger.annotations.ApiImplicitParams;
10 11 import io.swagger.annotations.ApiOperation;
11 12 import me.chanjar.weixin.common.error.WxErrorException;
12 13 import me.chanjar.weixin.mp.api.WxMpService;
13   -import me.chanjar.weixin.mp.bean.draft.WxMpAddDraft;
14   -import me.chanjar.weixin.mp.bean.draft.WxMpDraftItem;
15   -import me.chanjar.weixin.mp.bean.draft.WxMpDraftList;
  14 +import me.chanjar.weixin.mp.bean.draft.*;
16 15 import org.springframework.validation.annotation.Validated;
17 16 import org.springframework.web.bind.annotation.*;
18 17  
19 18 import javax.annotation.Resource;
  19 +import java.util.List;
20 20  
21 21 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
22 22 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
23   -import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.DRAFT_CREATE_FAIL;
24   -import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.DRAFT_LIST_FAIL;
  23 +import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*;
25 24  
26 25 // TODO 芋艿:权限
27 26 @Api(tags = "管理后台 - 公众号草稿")
... ... @@ -54,14 +53,37 @@ public class MpDraftController {
54 53 @ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true,
55 54 example = "1024", dataTypeClass = Long.class)
56 55 public CommonResult<String> createDraft(@RequestParam("accountId") Long accountId,
57   - @RequestBody WxMpAddDraft reqVO) {
  56 + @RequestBody WxMpAddDraft draft) {
58 57 WxMpService mpService = mpServiceFactory.getRequiredMpService(accountId);
59 58 try {
60   - String mediaId = mpService.getDraftService().addDraft(reqVO);
  59 + String mediaId = mpService.getDraftService().addDraft(draft);
61 60 return success(mediaId);
62 61 } catch (WxErrorException e) {
63 62 throw exception(DRAFT_CREATE_FAIL, e.getError().getErrorMsg());
64 63 }
65 64 }
66 65  
  66 + @PutMapping("/update")
  67 + @ApiOperation("更新草稿")
  68 + @ApiImplicitParams({
  69 + @ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true,
  70 + example = "1024", dataTypeClass = Long.class),
  71 + @ApiImplicitParam(name = "mediaId", value = "草稿素材的编号", required = true,
  72 + example = "xxx", dataTypeClass = String.class),
  73 + })
  74 + public CommonResult<Boolean> createDraft(@RequestParam("accountId") Long accountId,
  75 + @RequestParam("mediaId") String mediaId,
  76 + @RequestBody List<WxMpDraftArticles> articles) {
  77 + WxMpService mpService = mpServiceFactory.getRequiredMpService(accountId);
  78 + try {
  79 + for (int i = 0; i < articles.size(); i++) {
  80 + WxMpDraftArticles article = articles.get(i);
  81 + mpService.getDraftService().updateDraft(new WxMpUpdateDraft(mediaId, i, article));
  82 + }
  83 + return success(true);
  84 + } catch (WxErrorException e) {
  85 + throw exception(DRAFT_UPDATE_FAIL, e.getError().getErrorMsg());
  86 + }
  87 + }
  88 +
67 89 }
... ...
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/material/MpMaterialMapper.java
... ... @@ -20,6 +20,7 @@ public interface MpMaterialMapper extends BaseMapperX&lt;MpMaterialDO&gt; {
20 20  
21 21 default PageResult<MpMaterialDO> selectPage(MpMaterialPageReqVO pageReqVO) {
22 22 return selectPage(pageReqVO, new LambdaQueryWrapperX<MpMaterialDO>()
  23 + .eq(MpMaterialDO::getAccountId, pageReqVO.getAccountId())
23 24 .eqIfPresent(MpMaterialDO::getPermanent, pageReqVO.getPermanent())
24 25 .eqIfPresent(MpMaterialDO::getType, pageReqVO.getType()));
25 26 }
... ...
yudao-ui-admin/src/api/mp/draft.js
... ... @@ -19,3 +19,12 @@ export function createDraft(accountId, articles) {
19 19 }
20 20 })
21 21 }
  22 +
  23 +// 更新草稿
  24 +export function updateDraft(accountId, mediaId, articles) {
  25 + return request({
  26 + url: '/mp/draft/update?accountId=' + accountId + '&mediaId=' + mediaId,
  27 + method: 'put',
  28 + data: articles
  29 + })
  30 +}
... ...
yudao-ui-admin/src/views/mp/components/wx-material-select/main.vue
... ... @@ -117,7 +117,7 @@
117 117 },
118 118 props: {
119 119 objData: {
120   - type: Object,
  120 + type: Object, // type - 类型;accountId - 公众号账号编号
121 121 required: true
122 122 },
123 123 newsType:{ // 图文类型:1、已发布图文;2、草稿箱图文
... ... @@ -148,6 +148,11 @@
148 148 selectMaterial(item) {
149 149 this.$emit('selectMaterial', item)
150 150 },
  151 + /** 搜索按钮操作 */
  152 + handleQuery() {
  153 + this.queryParams.pageNo = 1
  154 + this.getPage()
  155 + },
151 156 getPage() {
152 157 this.loading = true
153 158 if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】
... ...
yudao-ui-admin/src/views/mp/draft/index.vue
... ... @@ -20,6 +20,8 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 22 SOFTWARE.
  23 + 芋道源码:
  24 + ① 优化代码,和项目的代码保持一致
23 25 -->
24 26 <template>
25 27 <div class="app-container">
... ... @@ -54,7 +56,7 @@ SOFTWARE.
54 56 <!-- TODO 芋艿:权限、样式(搜索框之类的) -->
55 57 <el-row class="ope-row">
56 58 <el-button type="success" circle @click="handlePublishNews(item)">发布</el-button>
57   - <el-button type="primary" icon="el-icon-edit" circle @click="handleEditNews(item)"></el-button>
  59 + <el-button type="primary" icon="el-icon-edit" circle @click="handleUpdate(item)"></el-button>
58 60 <el-button type="danger" icon="el-icon-delete" circle @click="delMaterial(item)"></el-button>
59 61 </el-row>
60 62 </div>
... ... @@ -66,14 +68,10 @@ SOFTWARE.
66 68 <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
67 69 @pagination="getList"/>
68 70  
69   - <!-- TODO 芋艿:位置调整 -->
  71 + <!-- 添加或修改草稿对话框 -->
70 72 <el-dialog :title="operateMaterial === 'add' ? '新建图文' : '修改图文'"
71   - append-to-body
72   - :before-close="dialogNewsClose"
73   - :close-on-click-modal="false"
74   - :visible.sync="dialogNewsVisible"
75   - width="80%"
76   - top="20px">
  73 + append-to-body width="80%" top="20px" :visible.sync="dialogNewsVisible"
  74 + :before-close="dialogNewsClose" :close-on-click-modal="false">
77 75 <div class="left">
78 76 <div class="select-item">
79 77 <div v-for="(news, index) in articlesAdd" :key='news.id'>
... ... @@ -115,12 +113,11 @@ SOFTWARE.
115 113 </div>
116 114 </div>
117 115 <div class="right" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0">
118   - <!--富文本编辑器组件-->
119   - <el-row>
120   - <wx-editor v-model="articlesAdd[isActiveAddNews].content" :account-id="this.uploadData.accountId"
121   - v-if="hackResetEditor"/>
122   - </el-row>
123   - <br><br><br><br>
  116 + <br /> <br /> <br /> <br />
  117 + <!-- 标题、作者、原文地址 -->
  118 + <el-input v-model="articlesAdd[isActiveAddNews].title" placeholder="请输入标题(必填)" />
  119 + <el-input v-model="articlesAdd[isActiveAddNews].author" placeholder="请输入作者" style="margin-top: 5px;" />
  120 + <el-input v-model="articlesAdd[isActiveAddNews].contentSourceUrl" placeholder="请输入原文地址" style="margin-top: 5px;" />
124 121 <!-- 封面和摘要 -->
125 122 <div class="input-tt">封面和摘要:</div>
126 123 <div>
... ... @@ -137,20 +134,20 @@ SOFTWARE.
137 134 <div slot="tip" class="el-upload__tip">支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M</div>
138 135 </el-upload>
139 136 </div>
  137 + <el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="80%" append-to-body>
  138 + <wx-material-select ref="materialSelect" :objData="{type: 'image', accountId: this.queryParams.accountId}"
  139 + @selectMaterial="selectMaterial" />
  140 + </el-dialog>
140 141 </div>
141   - <el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="80%" append-to-body>
142   - <WxMaterialSelect :objData="{repType:'image'}" @selectMaterial="selectMaterial" />
143   - </el-dialog>
144 142 <el-input :rows="8" type="textarea" v-model="articlesAdd[isActiveAddNews].digest" placeholder="请输入摘要"
145   - class="digest" maxlength="120"></el-input>
  143 + class="digest" maxlength="120" style="float: right" />
146 144 </div>
147   - <!-- 标题、作者、原文地址 -->
148   - <div class="input-tt">标题:</div>
149   - <el-input v-model="articlesAdd[isActiveAddNews].title" placeholder="请输入标题"></el-input>
150   - <div class="input-tt">作者:</div>
151   - <el-input v-model="articlesAdd[isActiveAddNews].author" placeholder="请输入作者"></el-input>
152   - <div class="input-tt">原文地址:</div>
153   - <el-input v-model="articlesAdd[isActiveAddNews].contentSourceUrl" placeholder="请输入原文地址"></el-input>
  145 + <!--富文本编辑器组件-->
  146 + <el-row>
  147 + <wx-editor v-model="articlesAdd[isActiveAddNews].content" :account-id="this.uploadData.accountId"
  148 + v-if="hackResetEditor"/>
  149 + </el-row>
  150 + <!-- 原文地址 -->
154 151 </div>
155 152 <div slot="footer" class="dialog-footer">
156 153 <el-button @click="dialogNewsVisible = false">取 消</el-button>
... ... @@ -166,7 +163,7 @@ import WxEditor from &#39;@/views/mp/components/wx-editor/WxEditor.vue&#39;;
166 163 import WxNews from '@/views/mp/components/wx-news/main.vue';
167 164 import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
168 165 import { getAccessToken } from '@/utils/auth'
169   -import { createDraft, getDraftPage } from "@/api/mp/draft";
  166 +import {createDraft, getDraftPage, updateDraft} from "@/api/mp/draft";
170 167 import { getSimpleAccounts } from "@/api/mp/account";
171 168  
172 169 export default {
... ... @@ -192,18 +189,12 @@ export default {
192 189 accountId: undefined,
193 190 },
194 191  
195   - page1: {
196   - total: 0, // 总页数
197   - currentPage: 1, // 当前页数
198   - pageSize: 10 // 每页显示多少条
199   - },
200   -
201 192 // ========== 文件上传 ==========
202 193 actionUrl: process.env.VUE_APP_BASE_API + "/admin-api/mp/material/upload-permanent", // 上传永久素材的地址
203 194 headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
204 195 fileList: [],
205 196 uploadData: {
206   - "type": 'image', // TODO 芋艿:试试要不要换成 thumb
  197 + "type": 'image',
207 198 // "accountId": 1,
208 199 },
209 200  
... ... @@ -213,8 +204,6 @@ export default {
213 204 articlesAdd: [],
214 205 isActiveAddNews: 0,
215 206 dialogImageVisible: false,
216   - imageListData: [],
217   - tableLoading1: false,
218 207 operateMaterial: 'add',
219 208 articlesMediaId: '',
220 209 hackResetEditor: false,
... ... @@ -236,6 +225,7 @@ export default {
236 225 })
237 226 },
238 227 methods: {
  228 + // ======================== 列表查询 ========================
239 229 /** 设置账号编号 */
240 230 setAccountId(accountId) {
241 231 this.queryParams.accountId = accountId;
... ... @@ -267,6 +257,10 @@ export default {
267 257 /** 搜索按钮操作 */
268 258 handleQuery() {
269 259 this.queryParams.pageNo = 1
  260 + // 默认选中第一个
  261 + if (this.queryParams.accountId) {
  262 + this.setAccountId(this.queryParams.accountId)
  263 + }
270 264 this.getList()
271 265 },
272 266 /** 重置按钮操作 */
... ... @@ -279,62 +273,24 @@ export default {
279 273 this.handleQuery()
280 274 },
281 275  
282   - delMaterial(item){
283   - this.$confirm('此操作将永久删除该草稿, 是否继续?', '提示', {
284   - confirmButtonText: '确定',
285   - cancelButtonText: '取消',
286   - type: 'warning'
287   - }).then(() => {
288   - this.loading = true
289   - delObj({
290   - id:item.mediaId
291   - }).then(response => {
292   - this.loading = false
293   - if(response.code == 200){
294   - this.getList(this.queryParams)
295   - }else{
296   - this.loading = false
297   - this.$message.error('删除出错:' + response.msg)
298   - }
299   - }).catch(() => {
300   - this.loading = false
301   - })
302   - })
303   - },
304   - getPage1(){
305   - this.tableLoading1 = true
306   - getPage1({
307   - current: this.page1.currentPage,
308   - size: this.page1.pageSize,
309   - type:'image'
310   - }).then(response => {
311   - this.tableLoading1 = false
312   - this.imageListData = response.data.items
313   - this.page1.total = response.data.totalCount
314   - }).catch(() => {
315   - this.tableLoading1 = false
316   - })
317   - },
318   - openMaterial(){
319   - this.imageListData = null
320   - this.page1.currentPage = 1
321   - this.getPage1()
322   - this.dialogImageVisible = true
  276 + // ======================== 新增/修改草稿 ========================
  277 + /** 新增按钮操作 */
  278 + handleAdd() {
  279 + this.resetEditor();
  280 + this.reset();
  281 + // 打开表单,并设置初始化
  282 + this.operateMaterial = 'add'
  283 + this.dialogNewsVisible = true
323 284 },
324   - dialogNewsClose(done){
325   - this.$confirm('修改内容可能还未保存,确定关闭吗?', '提示', {
326   - confirmButtonText: '确定',
327   - cancelButtonText: '取消',
328   - type: 'warning'
329   - }).then(() => {
330   - this.hackResetEditor = false//销毁组件
331   - this.$nextTick(() => {
332   - this.hackResetEditor = true//重建组件
333   - })
334   - this.isActiveAddNews = 0
335   - done()
336   - }).catch(() => {
337   - })
  285 + /** 更新按钮操作 */
  286 + handleUpdate(item){
  287 + this.resetEditor();
  288 + this.reset();
  289 + this.articlesMediaId = item.mediaId
  290 + this.articlesAdd = JSON.parse(JSON.stringify(item.content.newsItem))
  291 + // 打开表单,并设置初始化
  292 + this.operateMaterial = 'edit'
  293 + this.dialogNewsVisible = true
338 294 },
339 295 /** 提交按钮 */
340 296 submitForm() {
... ... @@ -347,59 +303,23 @@ export default {
347 303 }).finally(() => {
348 304 this.addMaterialLoading = false
349 305 })
350   - }
351   - if(this.operateMaterial == 'edit'){
352   - putObj({
353   - articles:this.articlesAdd,
354   - mediaId:this.articlesMediaId
355   - }).then(response => {
356   - this.addMaterialLoading = false
357   - this.dialogNewsVisible = false
358   - if(response.code == 200){
359   - this.isActiveAddNews = 0
360   - this.articlesAdd = [
361   - {
362   - "title": '',
363   - "thumbMediaId": '',
364   - "author": '',
365   - "digest": '',
366   - "showCoverPic": '',
367   - "content": '',
368   - "contentSourceUrl": '',
369   - "needOpenComment":'',
370   - "onlyFansCanComment":'',
371   - "thumbUrl":''
372   - }
373   - ]
374   - this.getList(this.queryParams)
375   - }else{
376   - this.$message.error('修改图文出错:' + response.msg)
377   - }
378   - }).catch(() => {
  306 + } else {
  307 + updateDraft(this.queryParams.accountId, this.articlesMediaId, this.articlesAdd).then(response => {
  308 + this.$modal.msgSuccess("更新成功");
  309 + this.dialogNewsVisible = false;
  310 + this.getList()
  311 + }).finally(() => {
379 312 this.addMaterialLoading = false
380 313 })
381 314 }
382 315 },
383   - handleEditNews(item){
384   - this.hackResetEditor = false // 销毁组件
385   - this.$nextTick(() => {
386   - this.hackResetEditor = true // 重建组件
387   - })
388   - if (this.operateMaterial == 'add') {
389   - this.isActiveAddNews = 0
390   - }
391   - this.operateMaterial = 'edit'
392   - this.articlesAdd = JSON.parse(JSON.stringify(item.content.newsItem))
393   - this.articlesMediaId = item.mediaId
394   - this.dialogNewsVisible = true
395   - },
396   - /** 新增按钮操作 */
397   - handleAdd() {
398   - this.resetEditor();
399   - this.reset();
400   - // 打开表单,并设置初始化
401   - this.operateMaterial = 'add'
402   - this.dialogNewsVisible = true
  316 + // 关闭弹窗
  317 + dialogNewsClose(done) {
  318 + this.$modal.confirm('修改内容可能还未保存,确定关闭吗?').then(() => {
  319 + this.reset()
  320 + this.resetEditor()
  321 + done()
  322 + }).catch(() => {})
403 323 },
404 324 // 表单重置
405 325 reset() {
... ... @@ -498,11 +418,20 @@ export default {
498 418 this.articlesAdd[this.isActiveAddNews].thumbMediaId = response.data.mediaId
499 419 this.articlesAdd[this.isActiveAddNews].thumbUrl = response.data.url
500 420 },
501   - selectMaterial(item){
  421 + // 选择 or 上传完素材,设置回草稿
  422 + selectMaterial(item) {
502 423 this.dialogImageVisible = false
503 424 this.articlesAdd[this.isActiveAddNews].thumbMediaId = item.mediaId
504 425 this.articlesAdd[this.isActiveAddNews].thumbUrl = item.url
505 426 },
  427 + // 打开素材选择
  428 + openMaterial() {
  429 + this.dialogImageVisible = true
  430 + try {
  431 + this.$refs['materialSelect'].queryParams.accountId = this.queryParams.accountId // 强制设置下 accountId,避免二次查询不对
  432 + this.$refs['materialSelect'].handleQuery(); // 刷新列表,失败也无所谓
  433 + } catch (e) {}
  434 + },
506 435  
507 436 // ======================== 草稿箱发布 ========================
508 437 handlePublishNews(item){
... ... @@ -521,248 +450,270 @@ export default {
521 450 })
522 451 }).catch(() => {
523 452 })
524   - }
  453 + },
  454 + delMaterial(item){
  455 + this.$confirm('此操作将永久删除该草稿, 是否继续?', '提示', {
  456 + confirmButtonText: '确定',
  457 + cancelButtonText: '取消',
  458 + type: 'warning'
  459 + }).then(() => {
  460 + this.loading = true
  461 + delObj({
  462 + id:item.mediaId
  463 + }).then(response => {
  464 + this.loading = false
  465 + if(response.code == 200){
  466 + this.getList(this.queryParams)
  467 + }else{
  468 + this.loading = false
  469 + this.$message.error('删除出错:' + response.msg)
  470 + }
  471 + }).catch(() => {
  472 + this.loading = false
  473 + })
  474 + })
  475 + },
525 476 }
526 477 }
527 478 </script>
528 479  
529 480 <style lang="scss" scoped>
530   - .pagination {
531   - float: right;
532   - margin-right: 25px;
533   - }
  481 +.pagination {
  482 + float: right;
  483 + margin-right: 25px;
  484 +}
534 485  
535   - .add_but {
536   - padding: 10px;
537   - }
  486 +.add_but {
  487 + padding: 10px;
  488 +}
538 489  
539   - .ope-row {
540   - margin-top: 5px;
541   - text-align: center;
542   - border-top: 1px solid #eaeaea;
543   - padding-top: 5px;
544   - }
  490 +.ope-row {
  491 + margin-top: 5px;
  492 + text-align: center;
  493 + border-top: 1px solid #eaeaea;
  494 + padding-top: 5px;
  495 +}
545 496  
546   - .item-name {
547   - font-size: 12px;
548   - overflow: hidden;
549   - text-overflow: ellipsis;
550   - white-space: nowrap;
551   - text-align: center;
552   - }
  497 +.item-name {
  498 + font-size: 12px;
  499 + overflow: hidden;
  500 + text-overflow: ellipsis;
  501 + white-space: nowrap;
  502 + text-align: center;
  503 +}
553 504  
554   - .el-upload__tip {
555   - margin-left: 5px;
556   - }
  505 +.el-upload__tip {
  506 + margin-left: 5px;
  507 +}
557 508  
558   - /*新增图文*/
559   - .left {
560   - display: inline-block;
561   - width: 35%;
562   - vertical-align: top;
563   - margin-top: 200px;
564   - }
  509 +/*新增图文*/
  510 +.left {
  511 + display: inline-block;
  512 + width: 35%;
  513 + vertical-align: top;
  514 + margin-top: 200px;
  515 +}
565 516  
566   - .right {
567   - display: inline-block;
568   - width: 60%;
569   - margin-top: -40px;
570   - }
  517 +.right {
  518 + display: inline-block;
  519 + width: 60%;
  520 + margin-top: -40px;
  521 +}
571 522  
572   - .avatar-uploader {
573   - width: 20%;
574   - display: inline-block;
575   - }
  523 +.avatar-uploader {
  524 + width: 20%;
  525 + display: inline-block;
  526 +}
576 527  
577   - .avatar-uploader .el-upload {
578   - border-radius: 6px;
579   - cursor: pointer;
580   - position: relative;
581   - overflow: hidden;
582   - text-align: unset !important;
583   - }
  528 +.avatar-uploader .el-upload {
  529 + border-radius: 6px;
  530 + cursor: pointer;
  531 + position: relative;
  532 + overflow: hidden;
  533 + text-align: unset !important;
  534 +}
584 535  
585   - .avatar-uploader .el-upload:hover {
586   - border-color: #165dff;
587   - }
  536 +.avatar-uploader .el-upload:hover {
  537 + border-color: #165dff;
  538 +}
588 539  
589   - .avatar-uploader-icon {
590   - border: 1px solid #d9d9d9;
591   - font-size: 28px;
592   - color: #8c939d;
593   - width: 120px;
594   - height: 120px;
595   - line-height: 120px;
596   - text-align: center;
597   - }
  540 +.avatar-uploader-icon {
  541 + border: 1px solid #d9d9d9;
  542 + font-size: 28px;
  543 + color: #8c939d;
  544 + width: 120px;
  545 + height: 120px;
  546 + line-height: 120px;
  547 + text-align: center;
  548 +}
598 549  
599   - .avatar {
600   - width: 230px;
601   - height: 120px;
602   - }
  550 +.avatar {
  551 + width: 230px;
  552 + height: 120px;
  553 +}
603 554  
604   - .avatar1 {
605   - width: 120px;
606   - height: 120px;
607   - }
  555 +.avatar1 {
  556 + width: 120px;
  557 + height: 120px;
  558 +}
608 559  
609   - .digest {
610   - width: 60%;
611   - display: inline-block;
612   - vertical-align: top;
613   - }
  560 +.digest {
  561 + width: 60%;
  562 + display: inline-block;
  563 + vertical-align: top;
  564 +}
614 565  
615   - /*新增图文*/
616   - /*瀑布流样式*/
617   - .waterfall {
618   - width: 100%;
619   - column-gap: 10px;
620   - column-count: 5;
621   - margin: 0 auto;
622   - }
  566 +/*新增图文*/
  567 +/*瀑布流样式*/
  568 +.waterfall {
  569 + width: 100%;
  570 + column-gap: 10px;
  571 + column-count: 5;
  572 + margin: 0 auto;
  573 +}
623 574  
624   - .waterfall-item {
625   - padding: 10px;
626   - margin-bottom: 10px;
627   - break-inside: avoid;
628   - border: 1px solid #eaeaea;
629   - }
  575 +.waterfall-item {
  576 + padding: 10px;
  577 + margin-bottom: 10px;
  578 + break-inside: avoid;
  579 + border: 1px solid #eaeaea;
  580 +}
630 581  
  582 +p {
  583 + line-height: 30px;
  584 +}
  585 +
  586 +@media (min-width: 992px) and (max-width: 1300px) {
  587 + .waterfall {
  588 + column-count: 3;
  589 + }
631 590 p {
632   - line-height: 30px;
  591 + color: red;
633 592 }
  593 +}
634 594  
635   - @media (min-width: 992px) and (max-width: 1300px) {
636   - .waterfall {
637   - column-count: 3;
638   - }
639   - p {
640   - color: red;
641   - }
  595 +@media (min-width: 768px) and (max-width: 991px) {
  596 + .waterfall {
  597 + column-count: 2;
642 598 }
643   -
644   - @media (min-width: 768px) and (max-width: 991px) {
645   - .waterfall {
646   - column-count: 2;
647   - }
648   - p {
649   - color: orange;
650   - }
  599 + p {
  600 + color: orange;
651 601 }
  602 +}
652 603  
653   - @media (max-width: 767px) {
654   - .waterfall {
655   - column-count: 1;
656   - }
  604 +@media (max-width: 767px) {
  605 + .waterfall {
  606 + column-count: 1;
657 607 }
  608 +}
658 609  
659   - /*瀑布流样式*/
660   - .news-main {
661   - background-color: #FFFFFF;
662   - width: 100%;
663   - margin: auto;
664   - height: 120px;
665   - }
  610 +/*瀑布流样式*/
  611 +.news-main {
  612 + background-color: #FFFFFF;
  613 + width: 100%;
  614 + margin: auto;
  615 + height: 120px;
  616 +}
666 617  
667   - .news-content {
668   - background-color: #acadae;
669   - width: 100%;
670   - height: 120px;
671   - position: relative;
672   - }
  618 +.news-content {
  619 + background-color: #acadae;
  620 + width: 100%;
  621 + height: 120px;
  622 + position: relative;
  623 +}
673 624  
674   - .news-content-title {
675   - display: inline-block;
676   - font-size: 15px;
677   - color: #FFFFFF;
678   - position: absolute;
679   - left: 0px;
680   - bottom: 0px;
681   - background-color: black;
682   - width: 98%;
683   - padding: 1%;
684   - opacity: 0.65;
685   - overflow: hidden;
686   - text-overflow: ellipsis;
687   - white-space: nowrap;
688   - height: 25px;
689   - }
  625 +.news-content-title {
  626 + display: inline-block;
  627 + font-size: 15px;
  628 + color: #FFFFFF;
  629 + position: absolute;
  630 + left: 0px;
  631 + bottom: 0px;
  632 + background-color: black;
  633 + width: 98%;
  634 + padding: 1%;
  635 + opacity: 0.65;
  636 + overflow: hidden;
  637 + text-overflow: ellipsis;
  638 + white-space: nowrap;
  639 + height: 25px;
  640 +}
690 641  
691   - .news-main-item {
692   - background-color: #FFFFFF;
693   - padding: 5px 0px;
694   - border-top: 1px solid #eaeaea;
695   - width: 100%;
696   - margin: auto;
697   - }
  642 +.news-main-item {
  643 + background-color: #FFFFFF;
  644 + padding: 5px 0px;
  645 + border-top: 1px solid #eaeaea;
  646 + width: 100%;
  647 + margin: auto;
  648 +}
698 649  
699   - .news-content-item {
700   - position: relative;
701   - margin-left: -3px
702   - }
  650 +.news-content-item {
  651 + position: relative;
  652 + margin-left: -3px
  653 +}
703 654  
704   - .news-content-item-title {
705   - display: inline-block;
706   - font-size: 12px;
707   - width: 70%;
708   - }
  655 +.news-content-item-title {
  656 + display: inline-block;
  657 + font-size: 12px;
  658 + width: 70%;
  659 +}
709 660  
710   - .news-content-item-img {
711   - display: inline-block;
712   - width: 25%;
713   - background-color: #acadae
714   - }
  661 +.news-content-item-img {
  662 + display: inline-block;
  663 + width: 25%;
  664 + background-color: #acadae
  665 +}
715 666  
716   - .input-tt {
717   - padding: 5px;
718   - }
  667 +.input-tt {
  668 + padding: 5px;
  669 +}
719 670  
720   - .activeAddNews {
721   - border: 5px solid #2bb673;
722   - }
  671 +.activeAddNews {
  672 + border: 5px solid #2bb673;
  673 +}
723 674  
724   - .news-main-plus {
725   - width: 280px;
726   - text-align: center;
727   - margin: auto;
728   - height: 50px;
729   - }
  675 +.news-main-plus {
  676 + width: 280px;
  677 + text-align: center;
  678 + margin: auto;
  679 + height: 50px;
  680 +}
730 681  
731   - .icon-plus {
732   - margin: 10px;
733   - font-size: 25px;
734   - }
  682 +.icon-plus {
  683 + margin: 10px;
  684 + font-size: 25px;
  685 +}
735 686  
736   - .select-item {
737   - width: 60%;
738   - padding: 10px;
739   - margin: 0 auto 10px auto;
740   - border: 1px solid #eaeaea;
741   - }
  687 +.select-item {
  688 + width: 60%;
  689 + padding: 10px;
  690 + margin: 0 auto 10px auto;
  691 + border: 1px solid #eaeaea;
  692 +}
742 693  
743   - .father .child {
744   - display: none;
745   - text-align: center;
746   - position: relative;
747   - bottom: 25px;
748   - }
  694 +.father .child {
  695 + display: none;
  696 + text-align: center;
  697 + position: relative;
  698 + bottom: 25px;
  699 +}
749 700  
750   - .father:hover .child {
751   - display: block;
752   - }
  701 +.father:hover .child {
  702 + display: block;
  703 +}
753 704  
754   - .thumb-div {
755   - display: inline-block;
756   - width: 30%;
757   - text-align: center;
758   - }
  705 +.thumb-div {
  706 + display: inline-block;
  707 + width: 30%;
  708 + text-align: center;
  709 +}
759 710  
760   - .thumb-but {
761   - margin: 5px;
762   - }
  711 +.thumb-but {
  712 + margin: 5px;
  713 +}
763 714  
764   - .material-img {
765   - width: 100%;
766   - height: 100%;
767   - }
  715 +.material-img {
  716 + width: 100%;
  717 + height: 100%;
  718 +}
768 719 </style>
... ...