teamList.vue
4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
121
122
123
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<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>