myVlog.vue 3.5 KB
Newer Older
zhoucong's avatar
zhoucong committed
1 2
<template>
	<view class="content">
cc_inu's avatar
cc_inu committed
3 4
		<view v-if="vlogList.length>0 && show===false" class="noEmpty">
			<view style="height: 20rpx;"></view>
zhoucong's avatar
zhoucong committed
5 6
			<u-search bg-color="#434957" color="#ffffff" placeholder="景区/关键词搜索" v-model="search" :clearabled="true"
				@search="query" :show-action="false"></u-search>
cc_inu's avatar
cc_inu committed
7
			<view class="body">
zhoucong's avatar
zhoucong committed
8 9 10 11
				<view class="item" v-for="(item,index) in vlogList" :key="index" @click="navTo(item)">
					<image :src="item.thumbImageUrl" mode="widthFix"></image>
					<text>{{item.merchantName}}</text>
				</view>
zhoucong's avatar
zhoucong committed
12 13
			</view>
		</view>
cc_inu's avatar
cc_inu committed
14 15
		<view v-else-if="vlogList.length===0 && show===false" class="empty">
			<view class="row">
16
				<text>空空如也...</text>
zhoucong's avatar
zhoucong committed
17 18 19 20 21 22
				<image src="../../../static/img/vlog/icon/icon_thereisnovideo.png"></image>
			</view>
			<navigator url="../vlogface/vlogface" class="btnn">
				<view>点击获取我的Vlog</view>
			</navigator>
		</view>
zhoucong's avatar
zhoucong committed
23
		<view v-else></view>
zhoucong's avatar
zhoucong committed
24 25 26 27 28 29 30
	</view>
</template>

<script>
	export default {
		data() {
			return {
zhoucong's avatar
zhoucong committed
31
				show: true, //跳转过渡页面
zhoucong's avatar
zhoucong committed
32
				vlogList: [], //我的vlog集合
zhoucong's avatar
zhoucong committed
33 34
			}
		},
zhoucong's avatar
zhoucong committed
35 36
		onReady() {},
		onLoad() {
潘永坪's avatar
潘永坪 committed
37 38
			this.$request('distribution/vlog/getVlogCreateInfo', {//获取结果
					userId: uni.getStorageSync('openid')
zhoucong's avatar
zhoucong committed
39
			}).then(res=>{
zhoucong's avatar
zhoucong committed
40 41 42
				setTimeout(()=>{
					this.getMyVlogList()
				},1000)
zhoucong's avatar
zhoucong committed
43
			})
zhoucong's avatar
zhoucong committed
44 45
		},
		methods: {
zhoucong's avatar
zhoucong committed
46
			navTo(item){
潘永坪's avatar
潘永坪 committed
47
				this.$u.route('/pages/vlog/vlogList/vlogList?merchantId='+item.merchantId)
zhoucong's avatar
zhoucong committed
48 49
			},
			getMyVlogList(){
潘永坪's avatar
潘永坪 committed
50 51
				this.$request('wechatUser/myPage/getVlogRecord', {
					openid: uni.getStorageSync('openid'),
52
					productType:0
zhoucong's avatar
zhoucong committed
53
				}).then(res => {
zhoucong's avatar
zhoucong committed
54
					this.show = false
潘永坪's avatar
潘永坪 committed
55
					if(res.code==='00'){
zhoucong's avatar
zhoucong committed
56 57 58 59 60 61 62 63 64 65 66
						this.vlogList = res.data
						if (this.vlogList.length > 0) { //如果有数据
							uni.setNavigationBarColor({ //动态更改导航条颜色
								frontColor: '#ffffff',
								backgroundColor: '#192033',
								animation: {
									duration: 1,
									timingFunc: 'easeIn'
								}
							})
							uni.setBackgroundColor({
潘永坪's avatar
潘永坪 committed
67 68
								backgroundColor: '#192033'
							})
zhoucong's avatar
zhoucong committed
69 70 71
						} else { //数据为空
							this.show = false
						}
zhoucong's avatar
zhoucong committed
72 73 74 75 76 77
					}else{
						uni.showModal({
							title: '提示',
							content: res.message,
							showCancel: false,
						})
zhoucong's avatar
zhoucong committed
78 79 80 81
					}
				})
			},
			query(e) {
cc_inu's avatar
cc_inu committed
82 83
				console.log(e)
			},
zhoucong's avatar
zhoucong committed
84 85 86 87 88
		}
	}
</script>

<style lang="scss" scoped>
zhoucong's avatar
zhoucong committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
	.content {
		height: 100%;
		width: 100%;
		text-align: center;
		.noEmpty {
			color: #fff;
			height: 100%;
			width: 100%;
			background-color: #192033;
			padding: 0 20rpx;

			.body {
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				margin-top: 30rpx;

				.item {
					width: 49%;
					height: 250rpx;
					margin-top: 20rpx;

					image {
						width: 100%;
						height: 80%;
						border-radius: 10rpx;
					}

					text {
						font-weight: bold;
					}
zhoucong's avatar
zhoucong committed
121
				}
zhoucong's avatar
zhoucong committed
122
			}
cc_inu's avatar
cc_inu committed
123
		}
zhoucong's avatar
zhoucong committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

		.empty {
			height: 100%;
			width: 100%;
			background-color: #fff;
			padding: 0 20rpx;
			text-align: center;
			padding-top: 30rpx;

			.row {
				height: 200rpx;
				background: linear-gradient(90deg, #ECF5FF 0%, #CEE5FF 100%);
				line-height: 200rpx;
				border-radius: 10rpx;
				margin-bottom: 300rpx;

				text {
					font-weight: bold;
					font-size: 32rpx;
					float: left;
					margin-left: 120rpx;
				}

				image {
					height: 180rpx;
					width: 200rpx;
					float: right;
					margin-right: 50rpx;
				}
zhoucong's avatar
zhoucong committed
153
			}
zhoucong's avatar
zhoucong committed
154 155 156 157 158 159 160 161 162

			.btnn {
				display: inline-block;
				font-size: 28rpx;
				border-radius: 40rpx;
				background-color: #FFE600;
				padding: 20rpx 40rpx;
				margin: 30rpx 0;
				font-weight: bold;
zhoucong's avatar
zhoucong committed
163 164 165 166
			}
		}
	}
</style>