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..ad64f78 100644 --- a/pages/release/index.vue +++ b/pages/release/index.vue @@ -2,23 +2,50 @@ + + 封面 + 图片 - + 标签 + 新建标签 - {{ item }} + + {{ item.name }} + 简介 - + 选择商品 - + @@ -39,20 +66,20 @@ - - - 木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子 - + + + {{ list.goods_name }} + - 发表 + 发表 创建属于你的标签吧 - 确定 + 确定 @@ -67,38 +94,123 @@ export default { sex: '' }, // 演示地址,请勿直接使用 - action: 'http://www.example.com/upload', - fileList: [], - fileListes: ['美妆', '博主穿搭', '美妆', '美妆', '美妆', '美妆', '美妆', '博主穿搭'], + 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, 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: { + 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]); + } + } + } + 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(data) { + let obj = data.data + obj.url = obj.file_path + this.imgarrA.push(obj) + }, + // 上传图片 + uploadphoto(data) { + console.log(data) + let obj = data.data + obj.url = obj.file_path + this.imgarrB.push(obj) + }, 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 +221,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 +232,9 @@ export default { if (id == '') { console.log('为空'); } else { - that.arres_list.remove(id); + let index = that.arres_list.indexOf(id); + that.arres_list.splice(index, 1); + that.getshoplist(); } }, // 增加直播商品 @@ -131,22 +244,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 +290,9 @@ export default { margin-bottom: 28rpx; color: #fff; } + .active { + background: red; + } .scroll { width: 100%; height: 400px; 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 @@ + 封面 + 图片