|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
<view class="item"> |
|
|
|
|
<view class="a">文章标题<text>*</text></view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<input v-model="detail.title" placeholder="请输入分类名称" type="text"/> |
|
|
|
|
<input v-model="detail.title" placeholder="请输入文章标题" type="text"/> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item"> |
|
|
|
@ -16,12 +16,11 @@ |
|
|
|
|
<view class="items"> |
|
|
|
|
<view class="a">封面图片<text>*</text></view> |
|
|
|
|
<view class="c"> |
|
|
|
|
<u-upload :action="action" width="180" height="180" :file-list="fileList" :custom-btn="true" max-count="8"> |
|
|
|
|
<u-upload :action="action" :header="header" @on-uploaded="success" width="180" height="180" :file-list="fileList" :custom-btn="true" max-count="1"> |
|
|
|
|
<template v-slot:addBtn> |
|
|
|
|
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150"> |
|
|
|
|
<image src="/static/news/icon-upload.png"></image> |
|
|
|
|
<view class="1">上传图片</view> |
|
|
|
|
<view class="l">1/8</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
</u-upload> |
|
|
|
@ -53,16 +52,14 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import Config from '@/core/config' |
|
|
|
|
import * as ArticleApi from '@/api/article' |
|
|
|
|
import * as CategoryApi from '@/api/article/category' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
fileList: [ |
|
|
|
|
{ |
|
|
|
|
url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg', |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
action: "", |
|
|
|
|
fileList: [], |
|
|
|
|
detail: {}, |
|
|
|
|
formats: {}, |
|
|
|
|
isShow: false, |
|
|
|
@ -78,11 +75,26 @@ |
|
|
|
|
this.getCategoryList(); |
|
|
|
|
this.id = o.article_id; |
|
|
|
|
this.type = o.type; |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title: !this.id?'新增文章':'编辑文章' |
|
|
|
|
}) |
|
|
|
|
if(this.id){ |
|
|
|
|
this.getArticleDetail(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
|
this.action = (Config.get('apiUrl')+'user/image').replace("index.php?s=/","") |
|
|
|
|
this.header = { |
|
|
|
|
'Storeid': uni.getStorageSync('Store').storeInfo.store_id, |
|
|
|
|
'AccessToken': uni.getStorageSync('AccessToken'), |
|
|
|
|
'platform': "MP-WEIXIN", |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
success(a,b) { |
|
|
|
|
console.log(a) |
|
|
|
|
console.log(b) |
|
|
|
|
}, |
|
|
|
|
// 获取文章详情 |
|
|
|
|
async getArticleDetail() { |
|
|
|
|
const {status, message, data} = await ArticleApi.detail(this.articleId); |
|
|
|
@ -99,7 +111,34 @@ |
|
|
|
|
}, |
|
|
|
|
//提交修改 |
|
|
|
|
async toSubmit(){ |
|
|
|
|
|
|
|
|
|
if(!this.detail.title){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "文章标题不能为空!" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.detail.category_id){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "请选择分类!" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.detail.image_id){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "请上传封面!" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.detail.content){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "文章内容不能为空!" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onStatusChange(e) { |
|
|
|
|
const formats = e.detail |
|
|
|
@ -130,16 +169,13 @@ |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.goods{ |
|
|
|
|
.ql-container { |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|
left: 0; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
width: 100%; |
|
|
|
|
color: #212121; |
|
|
|
|
font-size: 26rpx; |
|
|
|
|
overflow: auto; |
|
|
|
|
padding: 10rpx 10rpx 20rpx 10rpx; |
|
|
|
|
border: 1px solid #ECECEC; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
width: 100%; |
|
|
|
|
color: #212121; |
|
|
|
|
font-size: 26rpx; |
|
|
|
|
overflow: auto; |
|
|
|
|
padding: 10rpx 10rpx 20rpx 10rpx; |
|
|
|
|
border: 1px solid #ECECEC; |
|
|
|
|
} |
|
|
|
|
padding: 0 0 130rpx; |
|
|
|
|
overflow: hidden; |
|
|
|
@ -285,6 +321,7 @@ |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
font-weight: 500; |
|
|
|
|
color: #FFFFFF; |
|
|
|
|
margin: 0 auto; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
&-classify{ |
|
|
|
|