This commit is contained in:
Putoo
2026-04-28 16:17:19 +08:00
parent 2996fa712c
commit 29b76bab65
5 changed files with 37 additions and 30 deletions

View File

@@ -12,6 +12,7 @@ namespace Application.Web.Controllers.Pub
{
private readonly IAreaService _areaService;
private readonly INoticeService _noticeService;
public PubController(IAreaService areaService, INoticeService noticeService)
{
_areaService = areaService;
@@ -24,7 +25,7 @@ namespace Application.Web.Controllers.Pub
/// <param name="sid"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetMain(string sid)
public async Task<IPoAction> GetMain(string? sid)
{
bool isOnline = false;
if (!string.IsNullOrEmpty(sid))
@@ -34,6 +35,7 @@ namespace Application.Web.Controllers.Pub
var areaData = await _areaService.GetAreaData();
var notice = await _noticeService.GetNoticeDataByTake(5);
int OnCount = 100;
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount });
}

View File

@@ -21,4 +21,9 @@ export class StateHelper {
this.userStore.setSid(sid);
}
static OffOnline()
{
this.userStore.offOnline();
}
}

View File

@@ -8,12 +8,12 @@ export class MessageExtend {
}
// 提示弹窗
static ShowDialog(message: string, title?: string) {
static ShowDialog(title: string, message: string) {
showDialog({ title: title, message: message })
}
// 确认提示弹窗
static Dialog(title: string, message: string, onConfirm?: () => void, onCancel?: () => void, confirmButtonText?: string) {
static ShowConfirmDialog(title: string, message: string, onConfirm?: () => void, onCancel?: () => void, confirmButtonText?: string) {
showConfirmDialog({
title: title,
message: message,

View File

@@ -1,34 +1,30 @@
<template>
<div>
<div class="head">
<div>
<img src="/images/logo.png" class="logo" />
<br />
驰骋四海&#xB7;社区版
</div>
驰骋四海
</div>
<div>
当前在线<strong> {{ OnCount }} </strong>位玩家在驰骋四海
</div>
<div class="content" style="font-size:17px">
<div class="content" style="font-size:17px" v-if="isOnline">
<div>
亲爱的&nbsp;<strong style="color:red">探玩玩家</strong>欢迎来到驰骋四海&#xB7;社区版!
</div>
<div style="margin-top:5px;">
<div>
<a href="http://m.twbar.cn/Home/Index?sid=KrWxKypJuDO0zFKrTig0bG">返回探玩驿站</a>
</div>
<div>
<a href="http://m.twbar.cn/b/1145?sid=KrWxKypJuDO0zFKrTig0bG">游戏论坛</a>&nbsp;&nbsp;<a class=""
href="/Login/LoginOut?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">退出游戏</a>
<a href="http://m.twbar.cn/b/1145?sid=KrWxKypJuDO0zFKrTig0bG">游戏论坛</a>&nbsp;&nbsp;
<a @click.stop="offOnline">退出游戏</a>
</div>
</div>
</div>
<div class="content" v-else>
<a href="https://3g.fan/Login">立即进入游戏?</a>
</div>
<div class="common">
<div class="title">
=====<a class="" href="/Pallet/GameOpen/GameUser?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">我的区服</a>=====
@@ -111,6 +107,7 @@ definePageMeta({
const areaData = ref<any>([]);
const isOnline = ref(false);
const OnCount = ref(0);
const Initialize = async (): Promise<void> => {
var result = await PubService.GetMain(StateHelper.Sid);
if (result.code == 0) {
@@ -124,18 +121,20 @@ const Initialize = async (): Promise<void> => {
}
};
//退出登录
const offOnline = () => {
MessageExtend.ShowConfirmDialog("退出游戏", "您确定要退出游戏吗?", () => {
StateHelper.OffOnline();
MessageExtend.ShowToast("退出成功!", "success");
});
}
onMounted(async () => {
//默认设置身份,正式环境删除
StateHelper.SetSid("kUVjj2cBUemcdokUEIBEKh0qhKkkSkui0x");
//StateHelper.SetSid('');
try {
const id = PageExtend.QueryString("id");
MessageExtend.ShowToast(id);
await Initialize();
}
finally {

View File

@@ -49,10 +49,11 @@ export const useUserStore = defineStore('user', {
},
// 退出登录:清空用户状态
clearUserInfo() {
offOnline() {
this.token = '',
this.refToken='',
this.sid=''
this.sid='',
this.userId = ''
}
},