teamList.vue 4.09 KB
<template>
	<view class="fixedbody">
		<uni-group mode="card" title="我的参赛队" top="20">
			<view class="wBox">
					<button class="poKxBtn" type="primary" plain="true" @click="newGroup">+新建参赛队</button>
					<view class="matchItem" v-for="(g,index) in dataList" :key="index">
						<view class="leftImg">
							<image :src="g.imgUrl" mode="aspectFill"></image>
						</view>
						<view class="rightWen">
							<view class="name">{{g.name}}</view>
							<view class="pp">地区:
								{{g.regionStr}}
							</view>
							<view class="pp">类型:{{g.typeStr}}</view>
						</view>
						<view class="bottomFunc">
							<view class="textButtom" @click="view(g)">查看</view>
							<text class="greenline">|</text>
							<view class="textButtom" @click="del(g)">删除</view>
						</view>
					</view>
					<view class="nodata" v-if="dataList.length==0">
						<image mode="aspectFit" src="/static/nodata.png"></image>
						<text>还没有参赛队,点击新建参赛队立即创建吧~</text>
					</view>
				</view>
		</uni-group>


	</view>
 </template>

<script setup>
import { ref } from 'vue';
import * as match from '@/common/match.js'
import { onShow } from '@dcloudio/uni-app'
const baseFormData = ref({});
const dataList = ref([]);
const memberList = ref([{id:1},{id:2}]);
const avatarUrl = ref('');
const kindList = ref(['全部','运动员','教练','领队','其他']);
const tagList = ref([{text: '运动员',value: 0},{text: '教练',value: 1},{text: '领队',value: 2},{text: '其他',value: 3},]);
const typeList = ref([{text: '学校',value: 0}, {text: '场馆',value: 1}, {text: '俱乐部',value: 2}, {text: '机构',value: 3}]);
const regionsList = ref([]);
const current = ref(0);
const editIng = ref(false);
const showEditForm = ref(false);
const query = ref({
	type: 0
})

onShow(()=>{
	getRegionsList()
	getList()
})

function getList(){
	match.getMyGroupList(query).then(res => {
		dataList.value = res.data
	})
}
function newGroup() {
	uni.navigateTo({
		url: `/pages/usercenter/teamInfo`
	});
}
function getRegionsList(){
	match.regionsList().then(res => {
		regionsList.value = res.data 
	})
}
function onchange(){
	
}
function onnodeclick(){
	
}
function onClickItem(e){
	console.log(current.value)
	if (current.value != e.currentIndex) {
	    current.value = e.currentIndex;
	}
}
function goNext() {
	baseFormData.value.src = avatarUrl.value
	
}
function onChooseavatar(e) {
	if(editIng.value){
		match.uploadFile(e).then(data => {
			avatarUrl.value = data.data
		})
	} else {
		return
	}

}
function editTeamInfo(){
	editIng.value = true
}
function goChooseCoach(n){
	uni.navigateTo({
		url: `/pages_match/match/choose_coach?id=${n||0}`
	});
}
function goEditCoach(n){
	uni.navigateTo({
		url: `/pages_match/match/add_coach?id=${n||0}`
	});
}
function view(g){
	uni.navigateTo({
		url: `/pages/usercenter/teamInfo?groupId=${g.id}`
	});
}
function del(g){
	// 删除团
	uni.showModal({
		title: '提示',
		content: '确定删除吗',
		success: function (res) {
			if (res.confirm) {
				match.deleteMyGroup(g.id).then(res=>{
					uni.showToast({
						icon:'none',
						title: res.msg
					})
					getList()
				})
			} else if (res.cancel) {
				console.log('用户点击取消');
			}
		}
	});
}
function saveMyteam() {
	match.saveMyGroup(baseFormData.value).then(res=>{
		uni.showToast({
			title: '保存成功',
			duration: 2000
		});
		editIng.value = false
	})
}
</script>

<style scope lang="scss">
.wBox {position: relative;background: #ffffff;border-radius: 15px;box-sizing: border-box;}
.avatarUrl{width: 200rpx;height:200rpx;}
.avatarUrl button{padding: 0;display: block;line-height: 1;}
.refreshIcon{width: 200rpx;height:200rpx;}

.matchItem{background: #FBFCFD; margin: 0 0 90rpx;padding:20rpx;border: #eee solid 1rpx;
	.bottomFunc{background: #FBFCFD;border: #eee solid 1rpx;}
}
.poKxBtn{position: absolute;    top: -100rpx;
    right: 0;
    font-size: 24rpx;
    line-height: 2;
}
.pp{display: flex;
		.uni-data-tree{font-size: 24rpx;
			.selected-list{padding: 0;}
			.input-value{line-height:normal;padding: 0;}
		}
}
.matchItem .leftImg image{width: 200rpx;height: 150rpx;border-radius: 4px;}
</style>