cmx #19
@ -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})
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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'
 | 
			
		||||
 | 
			
		||||
@ -2,23 +2,50 @@
 | 
			
		||||
	<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>
 | 
			
		||||
				<view class="form-view" @click="show_add()">+ 新建标签</view>
 | 
			
		||||
				<view class="form-view" v-for="(item, index) in fileListes" :key="index">{{ item }}</view>
 | 
			
		||||
				<view :class="[item.state == true ? 'active' : '', 'form-view']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
 | 
			
		||||
					{{ item.name }}
 | 
			
		||||
				</view>
 | 
			
		||||
			</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">
 | 
			
		||||
					<view class="title"><text>选择商品</text></view>
 | 
			
		||||
					<!-- 商品列表 -->
 | 
			
		||||
					<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll" >
 | 
			
		||||
					<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
 | 
			
		||||
						<view class="listes_shoping" v-for="(item, index) in list" :key="index">
 | 
			
		||||
							<view>
 | 
			
		||||
								<u-checkbox-group>
 | 
			
		||||
@ -39,20 +66,20 @@
 | 
			
		||||
					<image class="images" src="../../static/image/tosign/bhottom.png"></image>
 | 
			
		||||
				</view>
 | 
			
		||||
				<!-- 选择后的列表 -->
 | 
			
		||||
				<view class="List_tosign" v-if="List_tosign != ''">
 | 
			
		||||
					<view><image src="../../static/image/tosign/tosigin(5).png" mode="scaleToFill"></image></view>
 | 
			
		||||
					<view>木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子</view>
 | 
			
		||||
					<view><image src="../../static/image/tosign/delete.png" mode="widthFix"></image></view>
 | 
			
		||||
				<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>
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
				<!-- 标签 -->
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user