From 61756ac8752cb8c4eeae6bbd59045e436c72069c Mon Sep 17 00:00:00 2001 From: cmxdd <86407334@qq.com> Date: Wed, 5 Aug 2020 09:15:02 +0800 Subject: [PATCH] update publish --- pages/release/index.vue | 146 +++++++++++++++++++++++----------------- pages/release/video.vue | 2 + 2 files changed, 85 insertions(+), 63 deletions(-) diff --git a/pages/release/index.vue b/pages/release/index.vue index f8a4b51..ad64f78 100644 --- a/pages/release/index.vue +++ b/pages/release/index.vue @@ -2,8 +2,33 @@ + + 封面 + 图片 - + 标签 @@ -14,7 +39,7 @@ 简介 - + @@ -41,20 +66,20 @@ - + {{ list.goods_name }} - 发表 + 发表 创建属于你的标签吧 - 确定 + 确定 @@ -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() { diff --git a/pages/release/video.vue b/pages/release/video.vue index 3d326c2..da2a9b6 100644 --- a/pages/release/video.vue +++ b/pages/release/video.vue @@ -4,6 +4,8 @@ + 封面 + 图片