main.vue 5.1 KB
Newer Older
赵十四's avatar
赵十四 已提交
1 2
<template>
	<view>
2
222000134 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

		<!-- 添加小队按钮 -->
		<add-team-tag></add-team-tag>

		<!-- 标签栏 -->
		<u-tabs :list="list" lineWidth="30" lineColor="#F1992D" :activeStyle="{
		            color: '#F1992D',
		            fontWeight: 'bold',
		            transform: 'scale(1.05)'
		        }" :inactiveStyle="{
		            color: '#606266',
		            transform: 'scale(1)'
		        }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;" @click="tabChange" :current="current">
		</u-tabs>


		<!-- 我的小队 -->
		<view v-if="current == 0">
			<view class="icon-with-name">
22 23 24
				<image :src="icon" class="icon" @click="showMember" />
				<text class="name" @click="showMember">{{name}}</text>
				<image src="../../static/team/out.png" class="out-team" @click="toggleMessage()" />
2
222000134 已提交
25 26
			</view>
			<view class="content" v-if="join==null">
27
				<view class="one-activity" v-for="item in activityList" @click="showActivityDetail(item.activityId)">
2
222000134 已提交
28 29 30 31 32 33 34 35 36
					<image class="horn-icon" :src="'../../static/team/horn.png'"
						style="width: 60px;height: 60px;margin-left: 10px;" />
					<text class="text-content">{{item.title}}</text>
				</view>
			</view>
			<view class="content" v-if="join==false">
				<view class="no-join">
					<view class="nojoin-icon-view">
						<image class="nojoin-icon" :src="'../../static/team/nojoin.png'"
37
							style="width: 230px;height: 200px;" />
2
222000134 已提交
38 39 40 41 42 43
					</view>
					<view class="text-no-view">
						<text class="text-no">您还没有加入任何小队哦~-</text>
					</view>
				</view>
			</view>
44 45 46 47
			<uni-popup ref="popupDialog" type="dialog">
				<uni-popup-dialog title="提示" content="是否确定退出小队?" :before-close="true" @confirm="dialogConfirm"
					@close="dialogClose" />
			</uni-popup>
2
222000134 已提交
48 49 50 51 52 53 54 55 56 57 58

		</view>
		<!-- 加入小队 -->
		<view v-if="current == 1">

		</view>





赵十四's avatar
赵十四 已提交
59 60 61 62 63
	</view>
</template>

<script>
	export default {
2
222000134 已提交
64 65 66

		data() {
			return {
67
				icon:'/static/icon/1.png',
2
222000134 已提交
68 69 70
				current: 0,
				show: false,
				value1: "",
71
				join: null,
2
222000134 已提交
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
				userId: '644a643a0c801ca878983559',
				list: [{
					name: '我的小队'
				}, {
					name: '加入小队',
				}, ],
				name: '昵称',
				activityList: [{
						activityId: 1,
						title: '跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步跑步步跑步跑步跑步跑步步跑步跑步跑步跑步步跑步跑步跑步跑步步跑步跑步跑步跑步!'
					},
					{
						activityId: 2,
						title: '一起来!'
					}
				]
			};
		},
		methods: {
			tabChange(index) {
				this.current = index.index;
			},
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 121 122 123 124 125 126 127
			showActivityDetail(activityId){
				uni.reLaunch({
					url: '/pages/team/activity-detail?activityId='+activityId,
					animationType: 'pop-in',
					animationDuration: 300
				})
			},
			showMember(){
				uni.reLaunch({
					url: '/pages/team/member-list',
					animationType: 'pop-in',
					animationDuration: 300
				})
			},
			toggleMessage() {
				this.$refs['popupDialog'].open();
			},
			dialogConfirm() {
				uniCloud.callFunction({
						name: 'fe-team-leaveTeam',
						data: {
							userId: this.userId
						}
					})
					.then(res => {
						console.log(res)
						this.join = false
						console.log(this.join)
					})
				this.$refs['popupDialog'].close();
			},
			dialogClose() {
				this.$refs.popupDialog.close();
			},
2
222000134 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141

		},
		onLoad() {
			uniCloud.callFunction({
					name: 'fe-team-activityList',
					data: {
						userId: this.userId
					}
				})
				.then(res => {
					console.log(res),
						this.name = res.result.data.username,
						this.activityList = res.result.data.activityList,
						this.join = res.result.join,
142
						this.icon = res.result.data.icon
2
222000134 已提交
143 144 145
						console.log(this.join)
				})
		}
赵十四's avatar
赵十四 已提交
146 147 148 149
	}
</script>

<style>
2
222000134 已提交
150 151 152 153 154
	.content {
		margin-top: 10px;
	}

	.icon-with-name {
155
		width: 100%;
2
222000134 已提交
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
		height: 45px;
		margin-left: 10px;
		margin-top: 15px;
		margin-bottom: 15px;
		float: left;
		overflow: auto;

	}

	.icon {
		width: 45px;
		height: 45px;
		border-radius: 50%;
		float: left;
	}

172 173 174 175 176 177 178 179
	.out-team {
		float: right;
		margin-right: 30px;
		width: 30px;
		margin-top: 11px;
		height: 30px;
	}

2
222000134 已提交
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
	.name {
		float: left;
		margin-bottom: auto;
		margin-left: 10px;
		margin-top: 9px;
		font-size: 18px;
		font-weight: bold;
		width: 60%;
	}

	.one-activity {
		width: 90%;
		background-color: rgb(245 154 35 / 30%);
		margin-left: auto;
		margin-right: auto;
		margin-top: 20px;
		border-radius: 15px;
		overflow: auto;
		display: flex;
		flex-direction: row;
		padding: 10px;
	}

	.no-join {
		width: 90%;
		margin-left: auto;
		margin-right: auto;
		margin-top: 20px;
		border-radius: 15px;
		overflow: auto;
		display: flex;
		flex-direction: column;
		padding: 10px;
	}

	.text-content {
		font-weight: bold;
		display: flex;
		margin-left: 10px;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		word-wrap: break-word;
	}
224 225

	.text-no {
2
222000134 已提交
226 227 228 229 230
		font-weight: bold;
		display: flex;
		margin: auto;
		flex-direction: column;
		color: #F1992D;
231

2
222000134 已提交
232
	}
233

2
222000134 已提交
234 235 236 237
	.horn-icon {
		flex-shrink: 0;
		margin: auto 0;
	}
238 239

	.nojoin-icon {
2
222000134 已提交
240 241 242 243 244
		display: flex;
		flex-direction: column;
		margin: auto;
		display: block;
	}
245 246

	.nojoin-icon-view {
2
222000134 已提交
247 248
		margin-top: 50px;
	}
249 250

	.text-no-view {
2
222000134 已提交
251 252
		margin: 30px auto;
	}
赵十四's avatar
赵十四 已提交
253
</style>