@@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
SOFTWARE.
23
23
芋道源码:
24
24
① 优化代码,和项目的代码保持一致
25
+ ② 清理冗余代码,保证代码整洁
26
+ ③ 增加注释,提升可读性
25
27
-->
26
28
<template >
27
29
<div class =" app-container" >
@@ -53,11 +55,11 @@ SOFTWARE.
53
55
<div v-if =" item.content && item.content.newsItem" class =" waterfall-item" v-for =" item in list"
54
56
:key =' item.articleId' >
55
57
<wx-news :articles =" item.content.newsItem" />
56
- <!-- TODO 芋艿:权限、样式(搜索框之类的) -->
58
+ <!-- 操作按钮 -->
57
59
<el-row class =" ope-row" >
58
- <el-button type =" success" circle @click =" handlePublishNews (item)" >发布</el-button >
59
- <el-button type =" primary" icon =" el-icon-edit" circle @click =" handleUpdate(item)" ></ el-button >
60
- <el-button type =" danger" icon =" el-icon-delete" circle @click =" delMaterial (item)" ></ el-button >
60
+ <el-button type =" success" circle @click =" handlePublish (item)" v-hasPermi = " ['mp:free-publish:submit'] " >发布</el-button >
61
+ <el-button type =" primary" icon =" el-icon-edit" circle @click =" handleUpdate(item)" v-hasPermi = " ['mp:draft:update'] " / >
62
+ <el-button type =" danger" icon =" el-icon-delete" circle @click =" handleDelete (item)" v-hasPermi = " ['mp:draft:delete'] " / >
61
63
</el-row >
62
64
</div >
63
65
</div >
@@ -147,7 +149,6 @@ SOFTWARE.
147
149
<wx-editor v-model =" articlesAdd[isActiveAddNews].content" :account-id =" this.uploadData.accountId"
148
150
v-if =" hackResetEditor" />
149
151
</el-row >
150
- <!-- 原文地址 -->
151
152
</div >
152
153
<div slot =" footer" class =" dialog-footer" >
153
154
<el-button @click =" dialogNewsVisible = false" >取 消</el-button >
@@ -158,13 +159,13 @@ SOFTWARE.
158
159
</template >
159
160
160
161
<script >
161
- // import { getPage as getPage1 } from '@/api/wxmp/wxmaterial'
162
162
import WxEditor from ' @/views/mp/components/wx-editor/WxEditor.vue' ;
163
163
import WxNews from ' @/views/mp/components/wx-news/main.vue' ;
164
164
import WxMaterialSelect from ' @/views/mp/components/wx-material-select/main.vue'
165
165
import { getAccessToken } from ' @/utils/auth'
166
- import {createDraft , getDraftPage , updateDraft } from " @/api/mp/draft" ;
166
+ import {createDraft , deleteDraft , getDraftPage , updateDraft } from " @/api/mp/draft" ;
167
167
import { getSimpleAccounts } from " @/api/mp/account" ;
168
+ import {deleteFreePublish , submitFreePublish } from " @/api/mp/freePublish" ;
168
169
169
170
export default {
170
171
name: ' mpDraft' ,
@@ -221,7 +222,7 @@ export default {
221
222
this .setAccountId (this .accounts [0 ].id );
222
223
}
223
224
// 加载数据
224
- // this.getList(); // TODO 芋艿:开发完,放出来
225
+ this .getList ();
225
226
})
226
227
},
227
228
methods: {
@@ -434,44 +435,26 @@ export default {
434
435
},
435
436
436
437
// ======================== 草稿箱发布 ========================
437
- handlePublishNews (item ){
438
- this .$confirm (' 你正在通过发布的方式发表内容。 发布不占用群发次数,一天可多次发布。已发布内容不会推送给用户,也不会展示在公众号主页中。 发布后,你可以前往发表记录获取链接,也可以将发布内容添加到自定义菜单、自动回复、话题和页面模板中。' , ' 提示' , {
439
- confirmButtonText: ' 确定' ,
440
- cancelButtonText: ' 取消' ,
441
- type: ' warning'
438
+ handlePublish (item ) {
439
+ const accountId = this .queryParams .accountId ;
440
+ const mediaId = item .mediaId ;
441
+ const content = ' 你正在通过发布的方式发表内容。 发布不占用群发次数,一天可多次发布。已发布内容不会推送给用户,也不会展示在公众号主页中。 发布后,你可以前往发表记录获取链接,也可以将发布内容添加到自定义菜单、自动回复、话题和页面模板中。' ;
442
+ this .$modal .confirm (content).then (function () {
443
+ return submitFreePublish (accountId, mediaId);
442
444
}).then (() => {
443
- this .loading = true
444
- publish (item .mediaId ).then (response => {
445
- this .loading = false
446
- this .$message .success (' 发布任务提交成功' )
447
- this .getList (this .queryParams )
448
- }).catch (() => {
449
- this .loading = false
450
- })
451
- }).catch (() => {
452
- })
445
+ this .getList ();
446
+ this .$modal .msgSuccess (" 发布成功" );
447
+ }).catch (() => {});
453
448
},
454
- delMaterial (item ){
455
- this . $confirm ( ' 此操作将永久删除该草稿, 是否继续? ' , ' 提示 ' , {
456
- confirmButtonText : ' 确定 ' ,
457
- cancelButtonText : ' 取消 ' ,
458
- type : ' warning '
449
+ handleDelete (item ) {
450
+ const accountId = this . queryParams . accountId ;
451
+ const mediaId = item . mediaId ;
452
+ this . $modal . confirm ( ' 此操作将永久删除该草稿, 是否继续? ' ). then ( function () {
453
+ return deleteDraft (accountId, mediaId);
459
454
}).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
- })
455
+ this .getList ();
456
+ this .$modal .msgSuccess (" 删除成功" );
457
+ }).catch (() => {});
475
458
},
476
459
}
477
460
}
0 commit comments