mp:增加图文草稿箱的修改;优化前端代码
This commit is contained in:
parent
28884ee638
commit
90ffe5adb7
|
@ -46,6 +46,7 @@ public interface ErrorCodeConstants {
|
||||||
// ========== 公众号草稿 1006007000============
|
// ========== 公众号草稿 1006007000============
|
||||||
ErrorCode DRAFT_LIST_FAIL = new ErrorCode(1006007000, "获得草稿列表失败,原因:{}");
|
ErrorCode DRAFT_LIST_FAIL = new ErrorCode(1006007000, "获得草稿列表失败,原因:{}");
|
||||||
ErrorCode DRAFT_CREATE_FAIL = new ErrorCode(1006007001, "创建草稿失败,原因:{}");
|
ErrorCode DRAFT_CREATE_FAIL = new ErrorCode(1006007001, "创建草稿失败,原因:{}");
|
||||||
|
ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1006007002, "更新草稿失败,原因:{}");
|
||||||
|
|
||||||
// TODO 要处理下
|
// TODO 要处理下
|
||||||
ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006001002, "菜单不存在");
|
ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006001002, "菜单不存在");
|
||||||
|
|
|
@ -7,12 +7,18 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@ApiModel("管理后台 - 公众号素材的分页 Request VO")
|
@ApiModel("管理后台 - 公众号素材的分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class MpMaterialPageReqVO extends PageParam {
|
public class MpMaterialPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "公众号账号的编号", required = true, example = "2048")
|
||||||
|
@NotNull(message = "公众号账号的编号不能为空")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否永久", example = "true")
|
@ApiModelProperty(value = "是否永久", example = "true")
|
||||||
private Boolean permanent;
|
private Boolean permanent;
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,25 @@ tenant-id: {{adminTenentId}}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### 请求 /mp/draft/create 接口 => 成功
|
||||||
|
PUT {{baseUrl}}/mp/draft/update?accountId=1&mediaId=r6ryvl6LrxBU0miaST4Y-q-G9pdsmZw0OYG4FzHQkKfpLfEwIH51wy2bxisx8PvW
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
[{
|
||||||
|
"title": "我是标题(OOO)",
|
||||||
|
"author": "我是作者",
|
||||||
|
"digest": "我是摘要",
|
||||||
|
"content": "我是内容",
|
||||||
|
"contentSourceUrl": "https://www.iocoder.cn",
|
||||||
|
"thumbMediaId": "r6ryvl6LrxBU0miaST4Y-pIcmK-zAAId-9TGgy-DrSLhjVuWbuT3ZBjk9K1yQ0Dn"
|
||||||
|
}, {
|
||||||
|
"title": "我是标题(XXX)",
|
||||||
|
"author": "我是作者",
|
||||||
|
"digest": "我是摘要",
|
||||||
|
"content": "我是内容",
|
||||||
|
"contentSourceUrl": "https://www.iocoder.cn",
|
||||||
|
"thumbMediaId": "r6ryvl6LrxBU0miaST4Y-pIcmK-zAAId-9TGgy-DrSLhjVuWbuT3ZBjk9K1yQ0Dn"
|
||||||
|
}]
|
||||||
|
|
|
@ -7,21 +7,20 @@ import cn.iocoder.yudao.module.mp.controller.admin.news.vo.MpDraftPageReqVO;
|
||||||
import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
|
import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.WxMpService;
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.draft.WxMpAddDraft;
|
import me.chanjar.weixin.mp.bean.draft.*;
|
||||||
import me.chanjar.weixin.mp.bean.draft.WxMpDraftItem;
|
|
||||||
import me.chanjar.weixin.mp.bean.draft.WxMpDraftList;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.DRAFT_CREATE_FAIL;
|
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*;
|
||||||
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.DRAFT_LIST_FAIL;
|
|
||||||
|
|
||||||
// TODO 芋艿:权限
|
// TODO 芋艿:权限
|
||||||
@Api(tags = "管理后台 - 公众号草稿")
|
@Api(tags = "管理后台 - 公众号草稿")
|
||||||
|
@ -54,14 +53,37 @@ public class MpDraftController {
|
||||||
@ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true,
|
@ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true,
|
||||||
example = "1024", dataTypeClass = Long.class)
|
example = "1024", dataTypeClass = Long.class)
|
||||||
public CommonResult<String> createDraft(@RequestParam("accountId") Long accountId,
|
public CommonResult<String> createDraft(@RequestParam("accountId") Long accountId,
|
||||||
@RequestBody WxMpAddDraft reqVO) {
|
@RequestBody WxMpAddDraft draft) {
|
||||||
WxMpService mpService = mpServiceFactory.getRequiredMpService(accountId);
|
WxMpService mpService = mpServiceFactory.getRequiredMpService(accountId);
|
||||||
try {
|
try {
|
||||||
String mediaId = mpService.getDraftService().addDraft(reqVO);
|
String mediaId = mpService.getDraftService().addDraft(draft);
|
||||||
return success(mediaId);
|
return success(mediaId);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
throw exception(DRAFT_CREATE_FAIL, e.getError().getErrorMsg());
|
throw exception(DRAFT_CREATE_FAIL, e.getError().getErrorMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("更新草稿")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true,
|
||||||
|
example = "1024", dataTypeClass = Long.class),
|
||||||
|
@ApiImplicitParam(name = "mediaId", value = "草稿素材的编号", required = true,
|
||||||
|
example = "xxx", dataTypeClass = String.class),
|
||||||
|
})
|
||||||
|
public CommonResult<Boolean> createDraft(@RequestParam("accountId") Long accountId,
|
||||||
|
@RequestParam("mediaId") String mediaId,
|
||||||
|
@RequestBody List<WxMpDraftArticles> articles) {
|
||||||
|
WxMpService mpService = mpServiceFactory.getRequiredMpService(accountId);
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < articles.size(); i++) {
|
||||||
|
WxMpDraftArticles article = articles.get(i);
|
||||||
|
mpService.getDraftService().updateDraft(new WxMpUpdateDraft(mediaId, i, article));
|
||||||
|
}
|
||||||
|
return success(true);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
throw exception(DRAFT_UPDATE_FAIL, e.getError().getErrorMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public interface MpMaterialMapper extends BaseMapperX<MpMaterialDO> {
|
||||||
|
|
||||||
default PageResult<MpMaterialDO> selectPage(MpMaterialPageReqVO pageReqVO) {
|
default PageResult<MpMaterialDO> selectPage(MpMaterialPageReqVO pageReqVO) {
|
||||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<MpMaterialDO>()
|
return selectPage(pageReqVO, new LambdaQueryWrapperX<MpMaterialDO>()
|
||||||
|
.eq(MpMaterialDO::getAccountId, pageReqVO.getAccountId())
|
||||||
.eqIfPresent(MpMaterialDO::getPermanent, pageReqVO.getPermanent())
|
.eqIfPresent(MpMaterialDO::getPermanent, pageReqVO.getPermanent())
|
||||||
.eqIfPresent(MpMaterialDO::getType, pageReqVO.getType()));
|
.eqIfPresent(MpMaterialDO::getType, pageReqVO.getType()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,12 @@ export function createDraft(accountId, articles) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新草稿
|
||||||
|
export function updateDraft(accountId, mediaId, articles) {
|
||||||
|
return request({
|
||||||
|
url: '/mp/draft/update?accountId=' + accountId + '&mediaId=' + mediaId,
|
||||||
|
method: 'put',
|
||||||
|
data: articles
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
objData: {
|
objData: {
|
||||||
type: Object,
|
type: Object, // type - 类型;accountId - 公众号账号编号
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
newsType:{ // 图文类型:1、已发布图文;2、草稿箱图文
|
newsType:{ // 图文类型:1、已发布图文;2、草稿箱图文
|
||||||
|
@ -148,6 +148,11 @@
|
||||||
selectMaterial(item) {
|
selectMaterial(item) {
|
||||||
this.$emit('selectMaterial', item)
|
this.$emit('selectMaterial', item)
|
||||||
},
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1
|
||||||
|
this.getPage()
|
||||||
|
},
|
||||||
getPage() {
|
getPage() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】
|
if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】
|
||||||
|
|
|
@ -20,6 +20,8 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
芋道源码:
|
||||||
|
① 优化代码,和项目的代码保持一致
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
@ -54,7 +56,7 @@ SOFTWARE.
|
||||||
<!-- TODO 芋艿:权限、样式(搜索框之类的) -->
|
<!-- TODO 芋艿:权限、样式(搜索框之类的) -->
|
||||||
<el-row class="ope-row">
|
<el-row class="ope-row">
|
||||||
<el-button type="success" circle @click="handlePublishNews(item)">发布</el-button>
|
<el-button type="success" circle @click="handlePublishNews(item)">发布</el-button>
|
||||||
<el-button type="primary" icon="el-icon-edit" circle @click="handleEditNews(item)"></el-button>
|
<el-button type="primary" icon="el-icon-edit" circle @click="handleUpdate(item)"></el-button>
|
||||||
<el-button type="danger" icon="el-icon-delete" circle @click="delMaterial(item)"></el-button>
|
<el-button type="danger" icon="el-icon-delete" circle @click="delMaterial(item)"></el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,14 +68,10 @@ SOFTWARE.
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"/>
|
@pagination="getList"/>
|
||||||
|
|
||||||
<!-- TODO 芋艿:位置调整 -->
|
<!-- 添加或修改草稿对话框 -->
|
||||||
<el-dialog :title="operateMaterial === 'add' ? '新建图文' : '修改图文'"
|
<el-dialog :title="operateMaterial === 'add' ? '新建图文' : '修改图文'"
|
||||||
append-to-body
|
append-to-body width="80%" top="20px" :visible.sync="dialogNewsVisible"
|
||||||
:before-close="dialogNewsClose"
|
:before-close="dialogNewsClose" :close-on-click-modal="false">
|
||||||
:close-on-click-modal="false"
|
|
||||||
:visible.sync="dialogNewsVisible"
|
|
||||||
width="80%"
|
|
||||||
top="20px">
|
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="select-item">
|
<div class="select-item">
|
||||||
<div v-for="(news, index) in articlesAdd" :key='news.id'>
|
<div v-for="(news, index) in articlesAdd" :key='news.id'>
|
||||||
|
@ -115,12 +113,11 @@ SOFTWARE.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0">
|
<div class="right" v-loading="addMaterialLoading" v-if="articlesAdd.length > 0">
|
||||||
<!--富文本编辑器组件-->
|
<br /> <br /> <br /> <br />
|
||||||
<el-row>
|
<!-- 标题、作者、原文地址 -->
|
||||||
<wx-editor v-model="articlesAdd[isActiveAddNews].content" :account-id="this.uploadData.accountId"
|
<el-input v-model="articlesAdd[isActiveAddNews].title" placeholder="请输入标题(必填)" />
|
||||||
v-if="hackResetEditor"/>
|
<el-input v-model="articlesAdd[isActiveAddNews].author" placeholder="请输入作者" style="margin-top: 5px;" />
|
||||||
</el-row>
|
<el-input v-model="articlesAdd[isActiveAddNews].contentSourceUrl" placeholder="请输入原文地址" style="margin-top: 5px;" />
|
||||||
<br><br><br><br>
|
|
||||||
<!-- 封面和摘要 -->
|
<!-- 封面和摘要 -->
|
||||||
<div class="input-tt">封面和摘要:</div>
|
<div class="input-tt">封面和摘要:</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -137,20 +134,20 @@ SOFTWARE.
|
||||||
<div slot="tip" class="el-upload__tip">支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M</div>
|
<div slot="tip" class="el-upload__tip">支持 bmp/png/jpeg/jpg/gif 格式,大小不超过 2M</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</div>
|
</div>
|
||||||
|
<el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="80%" append-to-body>
|
||||||
|
<wx-material-select ref="materialSelect" :objData="{type: 'image', accountId: this.queryParams.accountId}"
|
||||||
|
@selectMaterial="selectMaterial" />
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="80%" append-to-body>
|
|
||||||
<WxMaterialSelect :objData="{repType:'image'}" @selectMaterial="selectMaterial" />
|
|
||||||
</el-dialog>
|
|
||||||
<el-input :rows="8" type="textarea" v-model="articlesAdd[isActiveAddNews].digest" placeholder="请输入摘要"
|
<el-input :rows="8" type="textarea" v-model="articlesAdd[isActiveAddNews].digest" placeholder="请输入摘要"
|
||||||
class="digest" maxlength="120"></el-input>
|
class="digest" maxlength="120" style="float: right" />
|
||||||
</div>
|
</div>
|
||||||
<!-- 标题、作者、原文地址 -->
|
<!--富文本编辑器组件-->
|
||||||
<div class="input-tt">标题:</div>
|
<el-row>
|
||||||
<el-input v-model="articlesAdd[isActiveAddNews].title" placeholder="请输入标题"></el-input>
|
<wx-editor v-model="articlesAdd[isActiveAddNews].content" :account-id="this.uploadData.accountId"
|
||||||
<div class="input-tt">作者:</div>
|
v-if="hackResetEditor"/>
|
||||||
<el-input v-model="articlesAdd[isActiveAddNews].author" placeholder="请输入作者"></el-input>
|
</el-row>
|
||||||
<div class="input-tt">原文地址:</div>
|
<!-- 原文地址 -->
|
||||||
<el-input v-model="articlesAdd[isActiveAddNews].contentSourceUrl" placeholder="请输入原文地址"></el-input>
|
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogNewsVisible = false">取 消</el-button>
|
<el-button @click="dialogNewsVisible = false">取 消</el-button>
|
||||||
|
@ -166,7 +163,7 @@ import WxEditor from '@/views/mp/components/wx-editor/WxEditor.vue';
|
||||||
import WxNews from '@/views/mp/components/wx-news/main.vue';
|
import WxNews from '@/views/mp/components/wx-news/main.vue';
|
||||||
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
|
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
|
||||||
import { getAccessToken } from '@/utils/auth'
|
import { getAccessToken } from '@/utils/auth'
|
||||||
import { createDraft, getDraftPage } from "@/api/mp/draft";
|
import {createDraft, getDraftPage, updateDraft} from "@/api/mp/draft";
|
||||||
import { getSimpleAccounts } from "@/api/mp/account";
|
import { getSimpleAccounts } from "@/api/mp/account";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -192,18 +189,12 @@ export default {
|
||||||
accountId: undefined,
|
accountId: undefined,
|
||||||
},
|
},
|
||||||
|
|
||||||
page1: {
|
|
||||||
total: 0, // 总页数
|
|
||||||
currentPage: 1, // 当前页数
|
|
||||||
pageSize: 10 // 每页显示多少条
|
|
||||||
},
|
|
||||||
|
|
||||||
// ========== 文件上传 ==========
|
// ========== 文件上传 ==========
|
||||||
actionUrl: process.env.VUE_APP_BASE_API + "/admin-api/mp/material/upload-permanent", // 上传永久素材的地址
|
actionUrl: process.env.VUE_APP_BASE_API + "/admin-api/mp/material/upload-permanent", // 上传永久素材的地址
|
||||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||||
fileList: [],
|
fileList: [],
|
||||||
uploadData: {
|
uploadData: {
|
||||||
"type": 'image', // TODO 芋艿:试试要不要换成 thumb
|
"type": 'image',
|
||||||
// "accountId": 1,
|
// "accountId": 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -213,8 +204,6 @@ export default {
|
||||||
articlesAdd: [],
|
articlesAdd: [],
|
||||||
isActiveAddNews: 0,
|
isActiveAddNews: 0,
|
||||||
dialogImageVisible: false,
|
dialogImageVisible: false,
|
||||||
imageListData: [],
|
|
||||||
tableLoading1: false,
|
|
||||||
operateMaterial: 'add',
|
operateMaterial: 'add',
|
||||||
articlesMediaId: '',
|
articlesMediaId: '',
|
||||||
hackResetEditor: false,
|
hackResetEditor: false,
|
||||||
|
@ -236,6 +225,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// ======================== 列表查询 ========================
|
||||||
/** 设置账号编号 */
|
/** 设置账号编号 */
|
||||||
setAccountId(accountId) {
|
setAccountId(accountId) {
|
||||||
this.queryParams.accountId = accountId;
|
this.queryParams.accountId = accountId;
|
||||||
|
@ -267,6 +257,10 @@ export default {
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNo = 1
|
this.queryParams.pageNo = 1
|
||||||
|
// 默认选中第一个
|
||||||
|
if (this.queryParams.accountId) {
|
||||||
|
this.setAccountId(this.queryParams.accountId)
|
||||||
|
}
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
|
@ -279,62 +273,24 @@ export default {
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
|
|
||||||
delMaterial(item){
|
// ======================== 新增/修改草稿 ========================
|
||||||
this.$confirm('此操作将永久删除该草稿, 是否继续?', '提示', {
|
/** 新增按钮操作 */
|
||||||
confirmButtonText: '确定',
|
handleAdd() {
|
||||||
cancelButtonText: '取消',
|
this.resetEditor();
|
||||||
type: 'warning'
|
this.reset();
|
||||||
}).then(() => {
|
// 打开表单,并设置初始化
|
||||||
this.loading = true
|
this.operateMaterial = 'add'
|
||||||
delObj({
|
this.dialogNewsVisible = true
|
||||||
id:item.mediaId
|
|
||||||
}).then(response => {
|
|
||||||
this.loading = false
|
|
||||||
if(response.code == 200){
|
|
||||||
this.getList(this.queryParams)
|
|
||||||
}else{
|
|
||||||
this.loading = false
|
|
||||||
this.$message.error('删除出错:' + response.msg)
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
getPage1(){
|
/** 更新按钮操作 */
|
||||||
this.tableLoading1 = true
|
handleUpdate(item){
|
||||||
getPage1({
|
this.resetEditor();
|
||||||
current: this.page1.currentPage,
|
this.reset();
|
||||||
size: this.page1.pageSize,
|
this.articlesMediaId = item.mediaId
|
||||||
type:'image'
|
this.articlesAdd = JSON.parse(JSON.stringify(item.content.newsItem))
|
||||||
}).then(response => {
|
// 打开表单,并设置初始化
|
||||||
this.tableLoading1 = false
|
this.operateMaterial = 'edit'
|
||||||
this.imageListData = response.data.items
|
this.dialogNewsVisible = true
|
||||||
this.page1.total = response.data.totalCount
|
|
||||||
}).catch(() => {
|
|
||||||
this.tableLoading1 = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
openMaterial(){
|
|
||||||
this.imageListData = null
|
|
||||||
this.page1.currentPage = 1
|
|
||||||
this.getPage1()
|
|
||||||
this.dialogImageVisible = true
|
|
||||||
},
|
|
||||||
dialogNewsClose(done){
|
|
||||||
this.$confirm('修改内容可能还未保存,确定关闭吗?', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
this.hackResetEditor = false//销毁组件
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.hackResetEditor = true//重建组件
|
|
||||||
})
|
|
||||||
this.isActiveAddNews = 0
|
|
||||||
done()
|
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
@ -347,59 +303,23 @@ export default {
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.addMaterialLoading = false
|
this.addMaterialLoading = false
|
||||||
})
|
})
|
||||||
}
|
} else {
|
||||||
if(this.operateMaterial == 'edit'){
|
updateDraft(this.queryParams.accountId, this.articlesMediaId, this.articlesAdd).then(response => {
|
||||||
putObj({
|
this.$modal.msgSuccess("更新成功");
|
||||||
articles:this.articlesAdd,
|
this.dialogNewsVisible = false;
|
||||||
mediaId:this.articlesMediaId
|
this.getList()
|
||||||
}).then(response => {
|
}).finally(() => {
|
||||||
this.addMaterialLoading = false
|
|
||||||
this.dialogNewsVisible = false
|
|
||||||
if(response.code == 200){
|
|
||||||
this.isActiveAddNews = 0
|
|
||||||
this.articlesAdd = [
|
|
||||||
{
|
|
||||||
"title": '',
|
|
||||||
"thumbMediaId": '',
|
|
||||||
"author": '',
|
|
||||||
"digest": '',
|
|
||||||
"showCoverPic": '',
|
|
||||||
"content": '',
|
|
||||||
"contentSourceUrl": '',
|
|
||||||
"needOpenComment":'',
|
|
||||||
"onlyFansCanComment":'',
|
|
||||||
"thumbUrl":''
|
|
||||||
}
|
|
||||||
]
|
|
||||||
this.getList(this.queryParams)
|
|
||||||
}else{
|
|
||||||
this.$message.error('修改图文出错:' + response.msg)
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.addMaterialLoading = false
|
this.addMaterialLoading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEditNews(item){
|
// 关闭弹窗
|
||||||
this.hackResetEditor = false // 销毁组件
|
dialogNewsClose(done) {
|
||||||
this.$nextTick(() => {
|
this.$modal.confirm('修改内容可能还未保存,确定关闭吗?').then(() => {
|
||||||
this.hackResetEditor = true // 重建组件
|
this.reset()
|
||||||
})
|
this.resetEditor()
|
||||||
if (this.operateMaterial == 'add') {
|
done()
|
||||||
this.isActiveAddNews = 0
|
}).catch(() => {})
|
||||||
}
|
|
||||||
this.operateMaterial = 'edit'
|
|
||||||
this.articlesAdd = JSON.parse(JSON.stringify(item.content.newsItem))
|
|
||||||
this.articlesMediaId = item.mediaId
|
|
||||||
this.dialogNewsVisible = true
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.resetEditor();
|
|
||||||
this.reset();
|
|
||||||
// 打开表单,并设置初始化
|
|
||||||
this.operateMaterial = 'add'
|
|
||||||
this.dialogNewsVisible = true
|
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
|
@ -498,11 +418,20 @@ export default {
|
||||||
this.articlesAdd[this.isActiveAddNews].thumbMediaId = response.data.mediaId
|
this.articlesAdd[this.isActiveAddNews].thumbMediaId = response.data.mediaId
|
||||||
this.articlesAdd[this.isActiveAddNews].thumbUrl = response.data.url
|
this.articlesAdd[this.isActiveAddNews].thumbUrl = response.data.url
|
||||||
},
|
},
|
||||||
selectMaterial(item){
|
// 选择 or 上传完素材,设置回草稿
|
||||||
|
selectMaterial(item) {
|
||||||
this.dialogImageVisible = false
|
this.dialogImageVisible = false
|
||||||
this.articlesAdd[this.isActiveAddNews].thumbMediaId = item.mediaId
|
this.articlesAdd[this.isActiveAddNews].thumbMediaId = item.mediaId
|
||||||
this.articlesAdd[this.isActiveAddNews].thumbUrl = item.url
|
this.articlesAdd[this.isActiveAddNews].thumbUrl = item.url
|
||||||
},
|
},
|
||||||
|
// 打开素材选择
|
||||||
|
openMaterial() {
|
||||||
|
this.dialogImageVisible = true
|
||||||
|
try {
|
||||||
|
this.$refs['materialSelect'].queryParams.accountId = this.queryParams.accountId // 强制设置下 accountId,避免二次查询不对
|
||||||
|
this.$refs['materialSelect'].handleQuery(); // 刷新列表,失败也无所谓
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
|
|
||||||
// ======================== 草稿箱发布 ========================
|
// ======================== 草稿箱发布 ========================
|
||||||
handlePublishNews(item){
|
handlePublishNews(item){
|
||||||
|
@ -521,248 +450,270 @@ export default {
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
delMaterial(item){
|
||||||
|
this.$confirm('此操作将永久删除该草稿, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true
|
||||||
|
delObj({
|
||||||
|
id:item.mediaId
|
||||||
|
}).then(response => {
|
||||||
|
this.loading = false
|
||||||
|
if(response.code == 200){
|
||||||
|
this.getList(this.queryParams)
|
||||||
|
}else{
|
||||||
|
this.loading = false
|
||||||
|
this.$message.error('删除出错:' + response.msg)
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pagination {
|
.pagination {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 25px;
|
margin-right: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add_but {
|
.add_but {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ope-row {
|
.ope-row {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-top: 1px solid #eaeaea;
|
border-top: 1px solid #eaeaea;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-name {
|
.item-name {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-upload__tip {
|
.el-upload__tip {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*新增图文*/
|
/*新增图文*/
|
||||||
.left {
|
.left {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 35%;
|
width: 35%;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-top: 200px;
|
margin-top: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
margin-top: -40px;
|
margin-top: -40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader {
|
.avatar-uploader {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: unset !important;
|
text-align: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload:hover {
|
.avatar-uploader .el-upload:hover {
|
||||||
border-color: #165dff;
|
border-color: #165dff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader-icon {
|
.avatar-uploader-icon {
|
||||||
border: 1px solid #d9d9d9;
|
border: 1px solid #d9d9d9;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #8c939d;
|
color: #8c939d;
|
||||||
width: 120px;
|
width: 120px;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
line-height: 120px;
|
line-height: 120px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 230px;
|
width: 230px;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar1 {
|
.avatar1 {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.digest {
|
.digest {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*新增图文*/
|
/*新增图文*/
|
||||||
/*瀑布流样式*/
|
/*瀑布流样式*/
|
||||||
|
.waterfall {
|
||||||
|
width: 100%;
|
||||||
|
column-gap: 10px;
|
||||||
|
column-count: 5;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waterfall-item {
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
break-inside: avoid;
|
||||||
|
border: 1px solid #eaeaea;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) and (max-width: 1300px) {
|
||||||
.waterfall {
|
.waterfall {
|
||||||
width: 100%;
|
column-count: 3;
|
||||||
column-gap: 10px;
|
|
||||||
column-count: 5;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.waterfall-item {
|
|
||||||
padding: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
break-inside: avoid;
|
|
||||||
border: 1px solid #eaeaea;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
line-height: 30px;
|
color: red;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 992px) and (max-width: 1300px) {
|
@media (min-width: 768px) and (max-width: 991px) {
|
||||||
.waterfall {
|
.waterfall {
|
||||||
column-count: 3;
|
column-count: 2;
|
||||||
}
|
|
||||||
p {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
p {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) and (max-width: 991px) {
|
@media (max-width: 767px) {
|
||||||
.waterfall {
|
.waterfall {
|
||||||
column-count: 2;
|
column-count: 1;
|
||||||
}
|
|
||||||
p {
|
|
||||||
color: orange;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
/*瀑布流样式*/
|
||||||
.waterfall {
|
.news-main {
|
||||||
column-count: 1;
|
background-color: #FFFFFF;
|
||||||
}
|
width: 100%;
|
||||||
}
|
margin: auto;
|
||||||
|
height: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
/*瀑布流样式*/
|
.news-content {
|
||||||
.news-main {
|
background-color: #acadae;
|
||||||
background-color: #FFFFFF;
|
width: 100%;
|
||||||
width: 100%;
|
height: 120px;
|
||||||
margin: auto;
|
position: relative;
|
||||||
height: 120px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.news-content {
|
.news-content-title {
|
||||||
background-color: #acadae;
|
display: inline-block;
|
||||||
width: 100%;
|
font-size: 15px;
|
||||||
height: 120px;
|
color: #FFFFFF;
|
||||||
position: relative;
|
position: absolute;
|
||||||
}
|
left: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
background-color: black;
|
||||||
|
width: 98%;
|
||||||
|
padding: 1%;
|
||||||
|
opacity: 0.65;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.news-content-title {
|
.news-main-item {
|
||||||
display: inline-block;
|
background-color: #FFFFFF;
|
||||||
font-size: 15px;
|
padding: 5px 0px;
|
||||||
color: #FFFFFF;
|
border-top: 1px solid #eaeaea;
|
||||||
position: absolute;
|
width: 100%;
|
||||||
left: 0px;
|
margin: auto;
|
||||||
bottom: 0px;
|
}
|
||||||
background-color: black;
|
|
||||||
width: 98%;
|
|
||||||
padding: 1%;
|
|
||||||
opacity: 0.65;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
height: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.news-main-item {
|
.news-content-item {
|
||||||
background-color: #FFFFFF;
|
position: relative;
|
||||||
padding: 5px 0px;
|
margin-left: -3px
|
||||||
border-top: 1px solid #eaeaea;
|
}
|
||||||
width: 100%;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.news-content-item {
|
.news-content-item-title {
|
||||||
position: relative;
|
display: inline-block;
|
||||||
margin-left: -3px
|
font-size: 12px;
|
||||||
}
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
.news-content-item-title {
|
.news-content-item-img {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 12px;
|
width: 25%;
|
||||||
width: 70%;
|
background-color: #acadae
|
||||||
}
|
}
|
||||||
|
|
||||||
.news-content-item-img {
|
.input-tt {
|
||||||
display: inline-block;
|
padding: 5px;
|
||||||
width: 25%;
|
}
|
||||||
background-color: #acadae
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-tt {
|
.activeAddNews {
|
||||||
padding: 5px;
|
border: 5px solid #2bb673;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activeAddNews {
|
.news-main-plus {
|
||||||
border: 5px solid #2bb673;
|
width: 280px;
|
||||||
}
|
text-align: center;
|
||||||
|
margin: auto;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.news-main-plus {
|
.icon-plus {
|
||||||
width: 280px;
|
margin: 10px;
|
||||||
text-align: center;
|
font-size: 25px;
|
||||||
margin: auto;
|
}
|
||||||
height: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-plus {
|
.select-item {
|
||||||
margin: 10px;
|
width: 60%;
|
||||||
font-size: 25px;
|
padding: 10px;
|
||||||
}
|
margin: 0 auto 10px auto;
|
||||||
|
border: 1px solid #eaeaea;
|
||||||
|
}
|
||||||
|
|
||||||
.select-item {
|
.father .child {
|
||||||
width: 60%;
|
display: none;
|
||||||
padding: 10px;
|
text-align: center;
|
||||||
margin: 0 auto 10px auto;
|
position: relative;
|
||||||
border: 1px solid #eaeaea;
|
bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.father .child {
|
.father:hover .child {
|
||||||
display: none;
|
display: block;
|
||||||
text-align: center;
|
}
|
||||||
position: relative;
|
|
||||||
bottom: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.father:hover .child {
|
.thumb-div {
|
||||||
display: block;
|
display: inline-block;
|
||||||
}
|
width: 30%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.thumb-div {
|
.thumb-but {
|
||||||
display: inline-block;
|
margin: 5px;
|
||||||
width: 30%;
|
}
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumb-but {
|
.material-img {
|
||||||
margin: 5px;
|
width: 100%;
|
||||||
}
|
height: 100%;
|
||||||
|
}
|
||||||
.material-img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue