From 3e45c9350a0c5ba5daa67c22857a3624328f05ef Mon Sep 17 00:00:00 2001 From: cmxdd <86407334@qq.com> Date: Fri, 31 Jul 2020 10:14:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=BE=E6=96=87=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=8F=91=E5=B8=83=EF=BC=8C=E6=96=87=E7=AB=A0=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=E6=B2=A1=E6=9C=89=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=AE=8C=EF=BC=8C=E9=9C=80=E8=A6=81=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.api.js | 2 + pages/index/index.vue | 19 ++++- pages/login/login.vue | 20 +++++- pages/release/index.vue | 156 ++++++++++++++++++++++++++++++++-------- 4 files changed, 161 insertions(+), 36 deletions(-) diff --git a/common/http.api.js b/common/http.api.js index ff974b1..5949753 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -4,12 +4,14 @@ const install = (Vue, vm) => { // 此处没有使用传入的params参数 let api = { + // 获取标签 getLiveSpec(){ return vm.$u.get("Streaming/getLiveSpec") }, login({member_name,member_password}){ return vm.$u.get("/Login/expertLogin",{member_name,member_password}) }, + // 创建标签 createLivesp({spec_name}){ return vm.$u.post("Streaming/createLivesp",{spec_name}) }, diff --git a/pages/index/index.vue b/pages/index/index.vue index 095ce29..a44db7b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -200,6 +200,15 @@ export default { // 投诉骑手 reportcar(type) { let that = this; + if(this.clickstate==false){ + this.clickstate=true + }else{ + this.$refs.uToast.show({ + title: "不能重复提交", + type: 'error' + }); + return + } if (that.reportcontent == '') { this.$refs.uToast.show({ title: "投诉内容不能为空", @@ -207,20 +216,25 @@ export default { }); return; } - console.log(that.reportinfo) + this.$u.api.reportorder({ order_id: that.reportinfo.order_id, takeawayer_id: that.reportinfo.takeawayer_id, order_list: that.reportinfo.order_list, content: that.reportcontent }).then(res => { - console.log(res); + // 恢复可点击状态 + this.clickstate=false if (res.errCode != 0) { this.$refs.uToast.show({ title: res.message, type: 'error' }); } else { + // 提交后清空选择 + that.reportinfo=null + that.reportcontent = "" + // 提示修改成功 that.showComplaint = true; } }); @@ -282,7 +296,6 @@ export default { type: type, page: that.num }).then(res => { - console.log(res); if (res.errCode != 0) { this.$refs.uToast.show({ title: res.message, diff --git a/pages/login/login.vue b/pages/login/login.vue index a1d9ada..dfbee8f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -61,7 +61,8 @@ export default { zhanghaoA: '18953829598 ', mimaA: '123456', url: '', - state:0 + state:0, + clickstate:false }; }, methods: { @@ -87,18 +88,30 @@ export default { }, loading() {}, logins() { + // 判断是否可以点击 + if(this.clickstate==false){ + this.clickstate=true + }else{ + this.$refs.uToast.show({ + title: "不能重复提交", + type: 'error' + }); + return + } // 清除本地存储才可以正常登陆(具体原因没有仔细检查) uni.clearStorage(); // 账号登录1达人0商家 if(this.state==1){ this.$u.api.login({ member_name: this.zhanghaoA, member_password: this.mimaA }).then(res => { - console.log(res); if (res.errCode != 0) { + // 恢复按钮可点击状态 + this.clickstate=false this.$refs.uToast.show({ title: res.message, type: 'error' }); } else { + uni.setStorageSync('token', res.data.token); uni.setStorageSync('userinfo', res.data); uni.setStorageSync('rongyun', res.data.rongcloud_token); @@ -109,8 +122,9 @@ export default { }); }else{ this.$u.api.shoplogin({ member_name: this.zhanghao, member_password: this.mima }).then(res => { - console.log(res); if (res.errCode != 0) { + // 恢复按钮可点击状态 + this.clickstate=false this.$refs.uToast.show({ title: res.message, type: 'error' diff --git a/pages/release/index.vue b/pages/release/index.vue index 202437e..f8a4b51 100644 --- a/pages/release/index.vue +++ b/pages/release/index.vue @@ -8,7 +8,9 @@ 标签 + 新建标签 - {{ item }} + + {{ item.name }} + 简介 @@ -18,7 +20,7 @@ 选择商品 - + @@ -39,10 +41,10 @@ - - - 木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子 - + + + {{ list.goods_name }} + @@ -69,36 +71,127 @@ export default { // 演示地址,请勿直接使用 action: 'http://www.example.com/upload', fileList: [], - fileListes: ['美妆', '博主穿搭', '美妆', '美妆', '美妆', '美妆', '美妆', '博主穿搭'], + fileListes: [], show: false, show_two: false, filesList: [], arres_list: [], + shoplist: [], checked: false, list: [], List_tosign: [], - scrollTop: 0 + scrollTop: 0, + imgarr: [], //上传图片数组 + cover: '',//图文封面 + selectarr:[]//选中标签 }; }, onLoad() { - // 定义删除数组的方法 - Array.prototype.remove = function(val) { - var index = this.indexOf(val); - if (index > -1) { - this.splice(index, 1); - } - }; // 缓存取选择好的数据 this.tosign(); + this.getLiveSpec(); }, methods: { + // 获取商品数组变化 + 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) + }, + // 改变选中状态 + changeselect(num) { + 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) + } + console.log(this.selectarr) + }, + // 获取标签 + getLiveSpec() { + let that = this; + this.$u.api.getLiveSpec({}).then(res => { + console.log(res); + if (res.errCode != 0) { + this.$refs.uToast.show({ + title: res.message, + type: 'error' + }); + } else { + let arr = res.data; + for (let index in arr) { + arr[index].state = false; + } + console.log(arr); + that.fileListes = arr; + } + }); + }, + // 创建标签 + addLiveSpec() { + this.$u.api.createLivesp({}).then(res => { + console.log(res); + if (res.data.live_stataes == 0) { + this.$u.route({ + url: `/pages/${url}` + }); + } else { + } + }); + }, + // 上传封面 + 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); + } + }); + }, + // 上传封面 + 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); + } + }); + }, changes() { let that = this; that.show_two = false; console.log(that.arres_list); - // 过滤数组 - that.arres_list = [...new Set(that.arres_list)]; - console.log(that.arres_list); }, show_add() { console.log(this.show); @@ -109,11 +202,10 @@ export default { let id = e.name; if (e.value == true) { this.pushes(id); - }else{ - this.delarr(id) + } else { + this.delarr(id); } - console.log(this.arres_list) - + console.log(this.arres_list); }, // 删除直播商品 delarr(id) { @@ -121,7 +213,8 @@ export default { if (id == '') { console.log('为空'); } else { - that.arres_list.remove(id); + that.arres_list.splice(id, 1); + that.getshoplist() } }, // 增加直播商品 @@ -131,22 +224,22 @@ export default { console.log('为空'); } else { that.arres_list.push(id); + that.getshoplist() } }, tosign() { console.log('111'); this.$u.api.canselectgood({}).then(res => { - console.log(res); - if(res.data.live_stataes==0){ + if (res.data.live_stataes == 0) { this.$u.route({ url: `/pages/${url}` }); - }else{ - let arr = res.data.list - for(let index in arr){ - arr[index].checked=false + } else { + let arr = res.data.list; + for (let index in arr) { + arr[index].checked = false; } - this.list = arr + this.list = arr; } }); // try { @@ -177,6 +270,9 @@ export default { margin-bottom: 28rpx; color: #fff; } + .active { + background: red; + } .scroll { width: 100%; height: 400px; -- 2.47.2 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 2/2] 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 @@ + 封面 + 图片 -- 2.47.2