12121
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
【
|
||||
<Acheak @click="ChangeBag('0')" :on-value="type" on-cheak="0">好友</Acheak>|<Acheak @click="ChangeBag('1')"
|
||||
:on-value="type" on-cheak="1">密友</Acheak>|<Acheak @click="ChangeBag('2')" :on-value="type" on-cheak="2">
|
||||
师徒</Acheak>|<Acheak @click="ChangeBag('3')" :on-value="type" on-cheak="3">仇人</Acheak>
|
||||
<Acheak @click="ChangeData('0')" :on-value="type" on-cheak="0">好友</Acheak>|<Acheak @click="ChangeData('1')"
|
||||
:on-value="type" on-cheak="1">密友</Acheak>|<Acheak @click="ChangeData('2')" :on-value="type" on-cheak="2">
|
||||
师徒</Acheak>|<Acheak @click="ChangeData('3')" :on-value="type" on-cheak="3">仇人</Acheak>
|
||||
】
|
||||
</div>
|
||||
<div class="content">
|
||||
@@ -98,8 +98,8 @@ const BindData = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
/**切换背包 */
|
||||
const ChangeBag = async (_type: string): Promise<void> => {
|
||||
/**切换数据 */
|
||||
const ChangeData = async (_type: string): Promise<void> => {
|
||||
type.value = _type;
|
||||
await BindData();
|
||||
}
|
||||
|
||||
@@ -1 +1,157 @@
|
||||
<template></template>
|
||||
<template>
|
||||
<div v-if="state != 2">
|
||||
<div class="content">
|
||||
【我的队伍】.<Abar href="/user/team/team">队伍列表</Abar>
|
||||
</div>
|
||||
<div class="content" v-if="state == 0">
|
||||
暂无队伍,<Abutton @click="CreateTeam">立即创建</Abutton>?
|
||||
</div>
|
||||
<div class="content" v-if="state == 1">
|
||||
名称:{{ team.name }} <span v-if="isMaster">(<Abutton @click="ShowUpdateName">修改</Abutton>)</span><br>
|
||||
成员:({{ user.length }}/{{ team.count }})<br>
|
||||
分类:{{ codeTips }}<br>
|
||||
队长:<GameUser :data="master.user" :show-icon="0"></GameUser>
|
||||
<span>{{ master.isOnline == 1 ? "(在线)" : "(离线)" }}</span><br>
|
||||
<div>
|
||||
<span v-if="member.length == 0">
|
||||
->暂无队员.
|
||||
</span>
|
||||
<div v-for="item in member">
|
||||
队员:<GameUser :data="item.user" :show-icon="0"></GameUser>
|
||||
<span>{{ item.isOnline == 1 ? "(在线)" : "(离线)" }}</span>
|
||||
<span v-if="isMaster">
|
||||
[<Abutton @click="RemoveUser(item.user.userId)">踢出</Abutton>]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
✦<Abutton @click="ExitTeam">退出队伍</Abutton>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="state == 2">
|
||||
<div class="content">
|
||||
【创建队伍】
|
||||
</div>
|
||||
<div class="content">
|
||||
1.<Abutton @click="AddTeam(0, '')">创建普通队伍</Abutton><br>
|
||||
</div>
|
||||
</div>
|
||||
<GamePopup v-model:show="showInfo" title="【修改队名】" style="min-width: 50%;">
|
||||
<!-- 自定义内容 -->
|
||||
<div class="content">
|
||||
<div class="common serch" style="font-size: 16px; margin-top: 10px;">
|
||||
队名: <input type="text" class="search-ipt" v-model="teamName" max-height="25">
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<button class="ipt-btn" name="serch" @click="UpdateTeamName">修改</button>
|
||||
</div>
|
||||
</div>
|
||||
</GamePopup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
const state = ref(0);
|
||||
const codeTips = ref('');
|
||||
const team = ref<any>({});
|
||||
const user = ref<Array<any>>([]);
|
||||
const master = ref<any>({});
|
||||
const member = ref<Array<any>>([]);
|
||||
const teamName = ref('');
|
||||
const isMaster = ref(false);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
let result = await TeamService.GetMyTeam();
|
||||
if (result.code == 0) {
|
||||
state.value = result.data.state;
|
||||
team.value = result.data.team;
|
||||
user.value = result.data.user;
|
||||
codeTips.value = result.data.codeTips;
|
||||
master.value = user.value.find(it => it.user.userId == team.value.masterId);
|
||||
member.value = user.value.filter(it => it.user.userId != team.value.masterId);
|
||||
teamName.value = team.value.name;
|
||||
isMaster.value = team.value.masterId == StateHelper.userId;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
const AddTeam = async (type: number, par: string) => {
|
||||
MessageExtend.LoadingToast("创建中...");
|
||||
let result = await TeamService.CreateTeam(type, par);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
await BindData();
|
||||
MessageExtend.Notify("队伍创建成功!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("创建队伍", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
const CreateTeam = () => {
|
||||
state.value = 2;
|
||||
}
|
||||
|
||||
const ExitTeam = async () => {
|
||||
MessageExtend.ShowConfirmDialogAsyc("退出队伍", `您确定要退出队伍吗?(队长退出则队伍解散)`, async () => {
|
||||
let result = await TeamService.ExitTeam();
|
||||
if (result.code == 0) {
|
||||
await BindData();
|
||||
MessageExtend.Notify("成功退出队伍!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.Notify(result.msg, "danger");
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
const showInfo = ref(false);
|
||||
const UpdateTeamName = async () => {
|
||||
MessageExtend.LoadingToast("修改中...");
|
||||
let result = await TeamService.UpdateTeamName(teamName.value);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
showInfo.value = false;
|
||||
await BindData();
|
||||
MessageExtend.Notify("修改成功!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("修改队名", result.msg);
|
||||
}
|
||||
|
||||
}
|
||||
const ShowUpdateName = () => {
|
||||
showInfo.value = true;
|
||||
}
|
||||
|
||||
const RemoveUser = async (user: string) => {
|
||||
MessageExtend.ShowConfirmDialogAsyc("踢出队员", `您确定要把Ta踢出队伍吗?`, async () => {
|
||||
let result = await TeamService.RemoveUser(user);
|
||||
if (result.code == 0) {
|
||||
await BindData();
|
||||
MessageExtend.Notify("成功踢出队伍!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.Notify(result.msg, "danger");
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
1
Web/src/pages/user/team/info.vue
Normal file
1
Web/src/pages/user/team/info.vue
Normal file
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
102
Web/src/pages/user/team/team.vue
Normal file
102
Web/src/pages/user/team/team.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
【队伍列表】 <Abutton @click="Refresh">刷新</Abutton><br>
|
||||
<Acheak @click="ChangeData('0')" :on-value="type" on-cheak="0">普通</Acheak>|
|
||||
<Acheak @click="ChangeData('1')" :on-value="type" on-cheak="1">副本</Acheak>|
|
||||
<Acheak @click="ChangeData('2')" :on-value="type" on-cheak="2">其他</Acheak>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span v-if="data.length == 0">暂无队伍.</span>
|
||||
<div v-for="(item, index) in data" :key="index">
|
||||
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
|
||||
<Abar :href='"/user/team/info?id=" + item.team.teamId'>{{ item.team.name
|
||||
}}({{ item.user.length }}/{{ item.team.count }})</Abar>
|
||||
[<Abutton @click="JoinTeam(item.team.teamId)">加入</Abutton>]
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<Pagination :currentPage="currentPage" :limit="10" :total="total" @pageChange="handlePageChange" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
interface teamStorage {
|
||||
type: string
|
||||
page: number
|
||||
}
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const total = ref<number>(0);
|
||||
const data = ref<Array<any>>([]);
|
||||
const type = ref('0');
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
let localData = LocalStorageExtend.Get<teamStorage>("TeamCache");
|
||||
if (localData != null) {
|
||||
type.value = localData.type;
|
||||
currentPage.value = localData.page;
|
||||
}
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
let result = await TeamService.GetTeamData(Number(type.value), currentPage.value);
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.data;
|
||||
total.value = result.data.total;
|
||||
//存储请求参数
|
||||
let addLocalData: teamStorage = { type: type.value, page: currentPage.value };
|
||||
LocalStorageExtend.Set("TeamCache", addLocalData);
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
/**切换数据 */
|
||||
const ChangeData = async (_type: string): Promise<void> => {
|
||||
type.value = _type;
|
||||
await BindData();
|
||||
}
|
||||
|
||||
|
||||
/**刷新 */
|
||||
const Refresh = async (): Promise<void> => {
|
||||
MessageExtend.LoadingToast("刷新中...");
|
||||
currentPage.value = 1;
|
||||
await BindData();
|
||||
MessageExtend.LoadingClose();
|
||||
PageExtend.ScrollToTop();
|
||||
}
|
||||
|
||||
/**翻页 */
|
||||
const handlePageChange = async (page: number): Promise<void> => {
|
||||
currentPage.value = page;
|
||||
await BindData();
|
||||
};
|
||||
|
||||
|
||||
const JoinTeam = async (teamId: string) => {
|
||||
MessageExtend.LoadingToast("加入中...");
|
||||
let result = await TeamService.JoinTeam(teamId);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
PageExtend.Redirect("/user/team");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("加入队伍", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
66
Web/src/services/Index/TeamService.ts
Normal file
66
Web/src/services/Index/TeamService.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
export class TeamService {
|
||||
/**
|
||||
* 获取我的队伍
|
||||
* GET /Team/GetMyTeam
|
||||
*/
|
||||
static async GetMyTeam() {
|
||||
return await ApiService.Request("get", "/Team/GetMyTeam");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建队伍
|
||||
* GET /Team/CreateTeam
|
||||
*/
|
||||
static async CreateTeam(type: number, par: string) {
|
||||
return await ApiService.Request("get", "/Team/CreateTeam", { type, par });
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入队伍
|
||||
* GET /Team/JoinTeam
|
||||
*/
|
||||
static async JoinTeam(teamId: string) {
|
||||
return await ApiService.Request("get", "/Team/JoinTeam", { teamId });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队伍信息
|
||||
* GET /Team/GetTeamInfo
|
||||
*/
|
||||
static async GetTeamInfo(teamId: string) {
|
||||
return await ApiService.Request("get", "/Team/GetTeamInfo", { teamId });
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出队伍
|
||||
* GET /Team/ExitTeam
|
||||
*/
|
||||
static async ExitTeam() {
|
||||
return await ApiService.Request("get", "/Team/ExitTeam");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改队名
|
||||
* POST /Team/UpdateTeamName
|
||||
* @param name body
|
||||
*/
|
||||
static async UpdateTeamName(name: string) {
|
||||
return await ApiService.Request("post", "/Team/UpdateTeamName", { name });
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢出成员
|
||||
* GET /Team/RemoveUser
|
||||
*/
|
||||
static async RemoveUser(user: string) {
|
||||
return await ApiService.Request("get", "/Team/RemoveUser", { user });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队伍列表
|
||||
* GET /Team/GetTeamData
|
||||
*/
|
||||
static async GetTeamData(type: number, page: number) {
|
||||
return await ApiService.Request("get", "/Team/GetTeamData", { type, page });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user