Commit b08ac9ea authored by sunxiwei's avatar sunxiwei

修改审核比赛界面格式、上传头像前后端交互、个人界面最近比赛修改为个人比赛

parent de938a2f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<v-app> <v-app>
<!-- {{ filteredMatches }} --> <!-- {{ filteredMatches }} -->
<v-container> <v-container>
<v-data-table :headers="headers" :items="filteredMatches" item-key="id" :search="search.value" <v-data-table class="overflow-auto " :headers="headers" :items="filteredMatches" item-key="id" :search="search.value"
:items-per-page="10"> :items-per-page="10">
<template v-slot:top> <template v-slot:top>
<v-toolbar flat> <v-toolbar flat>
...@@ -13,19 +13,22 @@ ...@@ -13,19 +13,22 @@
</v-toolbar> </v-toolbar>
</template> </template>
<template v-slot:item.date="{ item }"> <template v-slot:item.date="{ item }">
{{ item.date }} <p style="width:60px" >{{ item.date }}</p>
</template> </template>
<template v-slot:item.team="{ item }"> <template v-slot:item.team="{ item }">
{{ item.homeTeam }} VS {{ item.awayTeam }} <p style="width:120px">{{ item.homeTeam }} VS {{ item.awayTeam }}</p>
</template> </template>
<template v-slot:item.score="{ item }"> <template v-slot:item.score="{ item }">
{{ item.homeScore }} - {{ item.awayScore }} <p style="width:30px">{{ item.homeScore }} - {{ item.awayScore }}</p>
</template> </template>
<template v-slot:item.actions="{ item }"> <template v-slot:item.actions="{ item }">
<v-icon v-if="!item.shenhe" small color="green" @click="opendialog(item, 'approve')" <div style="width:45px"> <v-icon v-if="!item.shenhe" small color="green" @click="opendialog(item, 'approve')"
style="padding-right: 20px;">mdi-check</v-icon> style="padding-right: 20px;">mdi-check</v-icon>
<v-icon v-if="!item.shenhe" small color="red" @click="opendialog(item, 'reject')" style="padding-left: 20px;">mdi-close</v-icon> <v-icon v-if="!item.shenhe" small color="red" @click="opendialog(item, 'reject')" style="padding-left: 20px;">mdi-close</v-icon>
<div v-if="item.shenhe" variant="text">已审核</div> <div v-if="item.shenhe" variant="text">已审核</div></div>
</template> </template>
</v-data-table> </v-data-table>
<v-dialog v-model="dialog" width="auto"> <v-dialog v-model="dialog" width="auto">
...@@ -49,6 +52,13 @@ ...@@ -49,6 +52,13 @@
</template> </template>
<style>
.table{
width: 60px;
}
</style>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { reactive } from 'vue'; import { reactive } from 'vue';
......
...@@ -104,6 +104,8 @@ const selectedDate = ref(new Date()); ...@@ -104,6 +104,8 @@ const selectedDate = ref(new Date());
const arr = ref(new Array()); const arr = ref(new Array());
const id = ref(null); const id = ref(null);
const form = ref(null); const form = ref(null);
const form1 = ref(null);
const form2 = ref(null);
var s1; var s1;
var s2; var s2;
var p1_id; var p1_id;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<v-text-field v-model="usrname" variant="filled" :rules="[rules.usrname]" color="indigo" label="用户名"></v-text-field> <v-text-field v-model="usrname" variant="filled" :rules="[rules.usrname]" color="indigo" label="用户名"></v-text-field>
<v-text-field v-model="password" variant="filled" :rules="[rules.password]" color="indigo" label="密码" <v-text-field v-model="password" variant="filled" :rules="[rules.password]" color="indigo" label="密码"
type="password"></v-text-field> type="password"></v-text-field>
<v-text-field v-model="confirmpassword" variant="filled" :rules="[rules.confirmpassword]" color="indigo" label="确认密码" <v-text-field v-model="confirmpassword" variant="filled" :rules="[rules.confirmpassword]" color="indigo"
type="password"></v-text-field> label="确认密码" type="password"></v-text-field>
</v-form> </v-form>
<v-card-actions> <v-card-actions>
<v-btn :disabled="!isValid" :loading="loading" block class="text-none mb-4" color="indigo" size="x-large" <v-btn :disabled="!isValid" :loading="loading" block class="text-none mb-4" color="indigo" size="x-large"
...@@ -58,35 +58,34 @@ watch(password, (newVal, oldVal) => { ...@@ -58,35 +58,34 @@ watch(password, (newVal, oldVal) => {
} }
}); });
function register(){ function register() {
loading.value =true; loading.value = true;
axios.post('/api/register', { axios.post('/api/register', {
usrname:usrname.value, usrname: usrname.value,
psword:password.value psword: password.value
}) })
.then(function (response) { .then(function (response) {
const data = response.data; const data = response.data;
if(data.status == 'SUCCESS'){ if (data.status == 'SUCCESS') {
info('注册成功!', ""); info('注册成功!', "");
} }
else if(data.status == 'FAILED') else if (data.status == 'FAILED') {
{
info('用户名已存在!', ""); info('用户名已存在!', "");
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
loading.value =false; loading.value = false;
} }
const cardtitle = ref(null); const cardtitle = ref(null);
const cardtext = ref(null); const cardtext = ref(null);
const dialog = ref(false); const dialog = ref(false);
function info(title,text) { function info(title, text) {
cardtitle.value = title; cardtitle.value = title;
cardtext.value = text; cardtext.value = text;
dialog.value=true; dialog.value = true;
} }
</script> </script>
\ No newline at end of file
<template> <template>
<div class="background"> <div class="background" @click="dialog2 = true">
<img src="../assets/背景.jpg" class="img1"></img> <img :src="pre_background_image" class="img1" alt="上传背景图">
<!-- <v-overlay activator="parent" /> --> <!-- <v-overlay activator="parent" /> -->
</div> </div>
<!-- <v-overlay activator=".img1" /> --> <!-- <v-overlay activator=".img1" /> -->
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn icon v-bind="props" class="float-left" size="80px"> <v-btn icon v-bind="props" class="float-left" size="80px">
<v-avatar size="80px" style="border:3px solid white"> <v-avatar size="80px" style="border:3px solid white">
<img src="../assets/头像.jpg" class="img2" alt="Avatar"> <img :src="pre_avatar_image" class="img2" alt="上传头像">
</v-avatar> </v-avatar>
</v-btn> </v-btn>
</template> </template>
...@@ -20,64 +20,23 @@ ...@@ -20,64 +20,23 @@
<v-card-text> <v-card-text>
<div class="mx-auto text-center"> <div class="mx-auto text-center">
<v-avatar size="50px"> <v-avatar size="50px">
<img src="../assets/头像.jpg" class="img2" alt="Avatar"> <img :src="pre_avatar_image" class="img2" alt="上传头像">
</v-avatar> </v-avatar>
<div class="text-h5 relative1"> <div class="text-h5 relative1">
{{ username }} {{ username }}
</div> </div>
<v-divider class="my-2"></v-divider> <v-divider class="my-2"></v-divider>
<!-- <v-btn variant="text" rounded class="jiacu"> <v-btn @click="dialog1 = true" variant="text" rounded class="jiacu">
上传头像
</v-btn> -->
<v-dialog>
<template v-slot:activator="{ props: activatorProps }">
<v-btn v-bind="activatorProps" variant="text" rounded class="jiacu">
上传头像 上传头像
</v-btn> </v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-card title="Dialog">
<v-card-text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore
et dolore magna aliqua.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text="Close Dialog" @click="isActive.value = false"></v-btn>
</v-card-actions>
</v-card>
</template>
</v-dialog>
<v-divider class="my-2"></v-divider> <v-divider class="my-2"></v-divider>
<v-dialog> <v-btn variant="text" rounded class="jiacu">
<template v-slot:activator="{ props: activatorProps }">
<v-btn v-bind="activatorProps" variant="text" rounded class="jiacu">
修改个人信息 修改个人信息
</v-btn> </v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-card title="Dialog">
<v-card-text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore
et dolore magna aliqua.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text="Close Dialog" @click="isActive.value = false"></v-btn>
</v-card-actions>
</v-card>
</template>
</v-dialog>
</div> </div>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-menu> </v-menu>
<!-- <v-avatar size="80px" class="float-left" style="border:solid white;">
<img src="../assets/头像.jpg" class="img2" alt="Avatar">
</v-avatar> -->
<!-- 用户名 -->
<div class="float-left"> <div class="float-left">
<div class="text-h6 user float-left"> <div class="text-h6 user float-left">
{{ username }} {{ username }}
...@@ -95,88 +54,168 @@ ...@@ -95,88 +54,168 @@
<h class="text-h6 float-right">更多</h> <h class="text-h6 float-right">更多</h>
<v-divider thickness="3px"></v-divider> <v-divider thickness="3px"></v-divider>
<v-card class="card1"> <v-card class="card1">
<div class="text-h6" style="height: 33px;" v-for="(item, index) in items" :key="index"> <div class="text-subtitle-1" style="height: 33px;" v-for="(item, index) in items" :key="index">
<div class="float-left zhibiao1"> <div class="float-left">
{{ item.username }} {{ item.date }}
</div>
<div class="float-left zhibiao1" style="width: 20%;">
{{ item.homeTeam }}
</div> </div>
<div class="float-left zhibiao2"> <div class="float-left zhibiao2">
{{ item.score1 }} {{ item.homeScore }}
</div> </div>
<div class="float-left"> <div class="float-left">
: :
</div> </div>
<div class="float-left zhibiao2"> <div class="float-left zhibiao2">
{{ item.score2 }} {{ item.awayScore }}
</div> </div>
<div class="float-left zhibiao1"> <div class="float-left zhibiao1" style="width: 20%;">
{{ item.username1 }} {{ item.awayTeam }}
</div> </div>
<div class="float-right" style="line-height: 32px;"> <div class="float-right">
<v-dialog>
<template v-slot:activator="{ props: activatorProps }">
<v-icon>mdi-chevron-right</v-icon> <v-icon>mdi-chevron-right</v-icon>
</template> </div>
<template v-slot:default="{ isActive }"> <br>
<v-card title="Dialog"> <!-- <v-divider :thickness="2"></v-divider> -->
</div>
</v-card>
</div>
</div>
<v-dialog v-model="dialog1" width="auto">
<v-card width="300px">
<v-card-text> <v-card-text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore 头像上传
et dolore magna aliqua. </v-card-text>
<v-card-text>
<v-file-input accept="image/*" id="avatarInput" label="上传头像" prepend-icon="mdi-camera"
variant="solo"></v-file-input>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn text="Close Dialog" @click="isActive.value = false"></v-btn> <v-btn color="indigo" text="取消" @click="dialog1 = false"></v-btn>
<v-btn color="indigo" text="确认上传" @click="setAvatar"></v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template>
</v-dialog> </v-dialog>
</div> <v-dialog v-model="dialog2" width="auto">
<br> <v-card width="300px">
</div> <v-card-text>
背景上传
</v-card-text>
<v-card-text>
<v-file-input accept="image/*" id="backgroundInput" label="上传背景" prepend-icon="mdi-camera"
variant="solo"></v-file-input>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="indigo" text="取消" @click="dialog1 = false"></v-btn>
<v-btn color="indigo" text="确认上传" @click="setBackground"></v-btn>
</v-card-actions>
</v-card> </v-card>
</div> </v-dialog>
</div>
<!-- </v-container> --> <!-- </v-container> -->
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { reactive } from 'vue'; // import { reactive } from 'vue';
import axios from 'axios'; import axios from 'axios';
const username = ref('XXX'); const username = ref('XXX');
const score = ref(1); const score = ref(1);
const level = ref("A"); const level = ref("A");
const items = reactive([ const items = ref(new Array());
{ const dialog1 = ref(false);
username: 'User1', const dialog2 = ref(false);
score1: 10, const pre_avatar_image = ref('');
score2: 5, const pre_background_image = ref('');
username1: 'User2', const my_id = ref(null);
extraInfo: 'adas'
},
{
username: 'User3',
score1: 8,
score2: 3,
username1: 'User4',
extraInfo: 'adas'
}
]
);
axios.get('/api/currentUser',) axios.get('/api/currentUser',)
.then(function(response){ .then(function (response) {
const data = response.data; const data1 = response.data;
if(data.status === "SUCCESS"){ if (data1.status === "SUCCESS") {
username.value = data.username; my_id.value = data1.user_id;
username.value = data1.username;
pre_avatar_image.value = data1.profile_file;
// pre_background_image.value = data1.background_file;
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}) })
axios.get('/api/games',)
.then(function (response) {
const data2 = response.data;
let j = 0;
for (var i = 0; i < data2.Games.length; i++) {
if (data2.Games[i].player1_id === my_id.value || data2.Games[i].player2_id === my_id.value) {
var item = {
id: data2.Games[i].id,
date: data2.Games[i].game_date,
homeTeam: data2.Games[i].player1_real_name,
awayTeam: data2.Games[i].player2_real_name,
homeScore: data2.Games[i].score1,
awayScore: data2.Games[i].score2,
}
items.value[j] = item;
j++;
}
}
})
.catch(function (error) {
console.log(error);
})
function setAvatar() {
const fileInput = document.querySelector('#avatarInput');
const file = fileInput.files[0];
// 使用FormData对象上传文件
const formData = new FormData();
formData.append('avatar', file);
axios.post('/api/setAvatar', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(response => {
console.log('上传成功', response.data);
pre_avatar_image.value = response.data.new_avatar_path;
}).catch(error => {
console.error('上传失败', error);
});
dialog1.value = false;
}
function setBackground() {
const background_fileInput = document.querySelector('#backgroundInput');
const background_file = background_fileInput.files[0];
// 使用FormData对象上传文件
const background_formData = new FormData();
background_formData.append('background', background_file);
axios.post('/api/setBackground', background_formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(response => {
console.log('上传成功', response.data);
pre_background_image.value = response.data.new_background_path;
}).catch(error => {
console.error('上传失败', error);
});
dialog2.value = false;
}
</script> </script>
<style> <style>
.background { .background {
width: 100%; width: 100%;
...@@ -254,7 +293,6 @@ axios.get('/api/currentUser',) ...@@ -254,7 +293,6 @@ axios.get('/api/currentUser',)
} }
.zhibiao1 { .zhibiao1 {
width: 25%;
text-align: center; text-align: center;
} }
......
...@@ -12,21 +12,18 @@ ...@@ -12,21 +12,18 @@
</v-toolbar> </v-toolbar>
</template> </template>
<template v-slot:item.date="{ item }"> <template v-slot:item.date="{ item }">
{{ item.date }} <p style="width:60px" >{{ item.date }}</p>
</template> </template>
<template v-slot:item.name="{ item }"> <template v-slot:item.name="{ item }">
{{ item.username }} VS {{ item.opponentname }} <p style="width:120px">{{ item.username }} VS {{ item.opponentname }}</p>
</template> </template>
<template v-slot:item.score="{ item }"> <template v-slot:item.score="{ item }">
{{ item.userScore }} - {{ item.opponentScore }} <p style="width:30px">{{ item.userScore }} - {{ item.opponentScore }}</p>
</template> </template>
<template v-slot:item.verified="{ item }"> <template v-slot:item.verified="{ item }">
<v-icon v-if="item.verified === 'WAITING'" color="blue">mdi-help-circle</v-icon> <div style="width:80px"><v-icon v-if="item.verified === 'WAITING'" color="blue">mdi-help-circle</v-icon>
<v-icon v-else-if="item.verified === 'PASSED'" color="green">mdi-check-circle</v-icon> <v-icon v-else-if="item.verified === 'PASSED'" color="green">mdi-check-circle</v-icon>
<v-icon v-else-if="item.verified === 'REJECT'" color="red">mdi-close-circle</v-icon> <v-icon v-else-if="item.verified === 'REJECT'" color="red">mdi-close-circle</v-icon></div>
<!-- <v-icon :color="item.verified != 1 ? (item.verified == 2 ? 'green' : 'red') : 'red'">{{ item.verified ?
'mdi-check-circle' :
'mdi-close-circle' }}</v-icon> -->
</template> </template>
</v-data-table> </v-data-table>
</v-app> </v-app>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment