update publish

This commit is contained in:
cmxdd 2020-08-05 09:15:02 +08:00
parent 3e45c9350a
commit 61756ac875
2 changed files with 85 additions and 63 deletions

View File

@ -2,8 +2,33 @@
<view id="release">
<u-form :model="form" ref="uForm">
<u-form-item label="标题" label-position="right"><u-input v-model="form.name" placeholder="请输入标题" /></u-form-item>
<!-- form-data -->
<view class="titles">封面</view>
<u-upload
:form-data="coverformdata"
:max-count="1"
:header="header"
name="article_cover"
:action="action"
del-color="#ececec"
upload-text="选择图片"
del-bg-color="#fff"
:file-list="fileListA"
@on-success="uploadcover"
></u-upload>
<view class="titles">图片</view>
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList"></u-upload>
<u-upload
:form-data="imgformdata"
name="article_image"
:header="header"
:action="action"
@on-success="uploadphoto"
del-color="#ececec"
upload-text="选择图片"
del-bg-color="#fff"
:max-count="5"
:file-list="fileListB"
></u-upload>
<!-- 标签 -->
<view>
<view class="titles">标签</view>
@ -14,7 +39,7 @@
</view>
<!-- 简介 -->
<view class="titles">简介</view>
<view class="titles_border"><textarea placeholder="请输入内容..."></textarea></view>
<view class="titles_border"><textarea placeholder="请输入内容..." v-model="form.intro"></textarea></view>
<!-- 底部弹框 商品选择 -->
<view class="show_two">
<u-popup v-model="show_two" mode="bottom" :closeable="true">
@ -41,20 +66,20 @@
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
</view>
<!-- 选择后的列表 -->
<view class="List_tosign" v-for="list in arres_list">
<view class="List_tosign" v-for="list in shoplist">
<view><image :src="list.goods_image" mode="scaleToFill"></image></view>
<view>{{ list.goods_name }}</view>
<view><image src="../../static/image/tosign/delete.png" mode="widthFix" @click="delarr(list.goods_id)"></image></view>
</view>
</view>
<!-- 提交 -->
<u-button class="custom-style" shape="circle" size="default">发表</u-button>
<u-button class="custom-style" shape="circle" size="default" @click="publish">发表</u-button>
</u-form>
<!-- 添加标签的按钮 -->
<u-popup v-model="show" mode="center" border-radius="14">
<view class="text">创建属于你的标签吧</view>
<view class="u-inputes"><u-input v-model="form.name" /></view>
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
<u-button class="custom-style-button" shape="circle" size="default" @click="creattag">确定</u-button>
</u-popup>
</view>
</template>
@ -69,8 +94,20 @@ export default {
sex: ''
},
// 使
action: 'http://www.example.com/upload',
fileList: [],
action: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
coverformdata: {
name: 'article_cover'
},
imgformdata: {
name: 'article_image'
},
fileListA: [],
fileListB: [],
imgarrA: [],
imgarrB: [],
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
fileListes: [],
show: false,
show_two: false,
@ -82,8 +119,8 @@ export default {
List_tosign: [],
scrollTop: 0,
imgarr: [], //
cover: '',//
selectarr:[]//
cover: '', //
selectarr: [] //
};
},
onLoad() {
@ -92,30 +129,38 @@ export default {
this.getLiveSpec();
},
methods: {
publish(){
console.log(this.imgarrA)
console.log(this.imgarrB)
console.log(this.selectarr)
console.log(this.form)
console.log(this.shoplist)
console.log(this.arres_list)
},
//
getshoplist(){
let arr = this.arres_list
let newarr = this.list
this.shoplist=[]
for(let index in arr){
for(let i in newarr){
if(arr[index]==newarr[i].goods_id){
this.shoplist.push(newarr[i])
getshoplist() {
let arr = this.arres_list;
let newarr = this.list;
this.shoplist = [];
for (let index in arr) {
for (let i in newarr) {
if (arr[index] == newarr[i].goods_id) {
this.shoplist.push(newarr[i]);
}
}
}
console.log(this.shoplist)
console.log(this.shoplist);
},
//
changeselect(num) {
if(this.fileListes[num].state == true){
this.fileListes[num].state=false
if (this.fileListes[num].state == true) {
this.fileListes[num].state = false;
that.arres_list.splice(this.fileListes[num].id, 1);
}else{
this.fileListes[num].state=true
this.selectarr.push(this.fileListes[num].id)
} else {
this.fileListes[num].state = true;
this.selectarr.push(this.fileListes[num].id);
}
console.log(this.selectarr)
console.log(this.selectarr);
},
//
getLiveSpec() {
@ -150,43 +195,17 @@ export default {
});
},
//
uploadcover(path) {
uni.uploadFile({
url: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
filePath: tempFilePaths[0],
name: 'article_cover',
formData: {
name: 'article_cover'
},
header: {
Authorization: 'Bearer' + ' ' + token
},
success: uploadFileRes => {
let obj = JSON.parse(uploadFileRes.data);
that.cover = obj.data.file_name;
that.num++;
console.log(that.cover);
}
});
uploadcover(data) {
let obj = data.data
obj.url = obj.file_path
this.imgarrA.push(obj)
},
//
uploadphoto(path) {
uni.uploadFile({
url: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
filePath: tempFilePaths[0],
name: 'article_image',
formData: {
name: 'article_image'
},
header: {
Authorization: 'Bearer' + ' ' + token
},
success: uploadFileRes => {
let obj = JSON.parse(uploadFileRes.data);
that.imgarr.push(obj.data);
console.log(that.imgarr);
}
});
//
uploadphoto(data) {
console.log(data)
let obj = data.data
obj.url = obj.file_path
this.imgarrB.push(obj)
},
changes() {
let that = this;
@ -213,8 +232,9 @@ export default {
if (id == '') {
console.log('为空');
} else {
that.arres_list.splice(id, 1);
that.getshoplist()
let index = that.arres_list.indexOf(id);
that.arres_list.splice(index, 1);
that.getshoplist();
}
},
//
@ -224,7 +244,7 @@ export default {
console.log('为空');
} else {
that.arres_list.push(id);
that.getshoplist()
that.getshoplist();
}
},
tosign() {

View File

@ -4,6 +4,8 @@
<u-form-item label="标题" label-position="right">
<u-input v-model="form.name" placeholder="请输入标题" />
</u-form-item>
<view class="titles">封面</view>
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList" ></u-upload>
<view class="titles">图片</view>
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList" ></u-upload>
<!-- 标签 -->