增加
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
{
|
||||
[Tenant("Kg.SeaTime.Game")]
|
||||
public class game_account
|
||||
{
|
||||
/// <summary>
|
||||
/// accId
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||
public string accId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// userName
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 20, IsNullable = true)]
|
||||
public string? userName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// nick
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, IsNullable = true)]
|
||||
public string? nick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// pwd
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? pwd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// npwd
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? npwd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// status
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// remCode
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? remCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// remAccId
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? remAccId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// token
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// addTime
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? addTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// openId
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? openId { get; set; }
|
||||
}
|
||||
}
|
||||
7
Service/Application.Domain/Cache/UserCache.cs
Normal file
7
Service/Application.Domain/Cache/UserCache.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UserCache
|
||||
{
|
||||
public static string BaseCacheKey = "BaseUserCache:{0}";
|
||||
public static string BaseCacheKeys = "BaseUserCache:{0}:{1}";
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameAccountService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据OpenId获取账号信息
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> GetAccInfoByOpenId(string openId);
|
||||
/// <summary>
|
||||
/// 根据AccId获取账号信息
|
||||
/// </summary>
|
||||
/// <param name="accId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> GetAccInfoByAccId(string accId);
|
||||
|
||||
Task<game_account> GetAccInfoByToken(string token);
|
||||
/// <summary>
|
||||
/// 注册账号
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="nick"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <param name="remAccId"></param>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
string openId = "");
|
||||
|
||||
Task<bool> UpdateAccountToken(string accId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using Photon.Core.Assist;
|
||||
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameAccountService : IGameAccountService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
|
||||
public GameAccountService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
||||
{
|
||||
_dbClient = dbClient;
|
||||
_redisClient = redisClient;
|
||||
}
|
||||
|
||||
|
||||
public async Task<game_account> GetAccInfoByOpenId(string openId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "OpenId");
|
||||
if (await _redisClient.HExistsHashAsync(key, openId))
|
||||
{
|
||||
return await _redisClient.GetHashAsync<game_account>(key, openId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.openId == openId).FirstAsync();
|
||||
await _redisClient.AddHashAsync(key, openId, data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> GetAccInfoByAccId(string accId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "AccId");
|
||||
if (await _redisClient.HExistsHashAsync(key, accId))
|
||||
{
|
||||
return await _redisClient.GetHashAsync<game_account>(key, accId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.accId == accId).FirstAsync();
|
||||
await _redisClient.AddHashAsync(key, accId, data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> GetAccInfoByToken(string token)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.token == token).FirstAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task ClearCache(string clearId)
|
||||
{
|
||||
string openId = string.Empty;
|
||||
string accId = string.Empty;
|
||||
var accInfo = await GetAccInfoByAccId(clearId);
|
||||
if (accInfo != null)
|
||||
{
|
||||
accId = accInfo.accId;
|
||||
openId = accInfo.openId;
|
||||
}
|
||||
else
|
||||
{
|
||||
accInfo = await GetAccInfoByOpenId(clearId);
|
||||
if (accInfo != null)
|
||||
{
|
||||
accId = accInfo.accId;
|
||||
openId = accInfo.openId;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(openId))
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "OpenId");
|
||||
await _redisClient.DelHashAsync(key, openId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(accId))
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "AccId");
|
||||
await _redisClient.DelHashAsync(key, accId);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
string openId = "")
|
||||
{
|
||||
game_account result = new game_account();
|
||||
try
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
await _dbClient.AsTenant().BeginTranAsync();
|
||||
string accId = StringAssist.NewGuid;
|
||||
result.accId = accId;
|
||||
result.userName = userName;
|
||||
result.nick = nick;
|
||||
string sid = await CreateToken();
|
||||
result.token = sid;
|
||||
result.npwd = pwd;
|
||||
result.remAccId = remAccId;
|
||||
result.remCode = StringAssist.RandomString(6);
|
||||
result.pwd = EncryptAssist.Md5Encryption(pwd);
|
||||
result.status = 1;
|
||||
result.addTime = DateTime.Now;
|
||||
result.openId = openId;
|
||||
bool isok = await db.Insertable(result).ExecuteCommandAsync() > 0;
|
||||
if (isok)
|
||||
{
|
||||
await ClearCache(openId);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
await _dbClient.AsTenant().CommitTranAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = null;
|
||||
await _dbClient.AsTenant().RollbackTranAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<string> CreateToken()
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
string token = string.Empty;
|
||||
bool ok = true;
|
||||
while (ok)
|
||||
{
|
||||
token = string.Format("{0}", StringAssist.RandomString(32));
|
||||
if (await db.Queryable<game_account>().Where(it => it.token == token).AnyAsync() == false)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateAccountToken(string accId)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
string token = await CreateToken();
|
||||
bool result = await db.Updateable<game_account>().SetColumns(it => it.token == token)
|
||||
.Where(it => it.accId == accId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearCache(accId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
22
Service/Application.Web/Common/AutoLogin.cs
Normal file
22
Service/Application.Web/Common/AutoLogin.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Web;
|
||||
|
||||
public class AutoLogin
|
||||
{
|
||||
public async Task<TwResult> TwLogin(string code)
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
// 发送 GET 请求
|
||||
string url = $"https://m.twbar.cn/api/AppAuto/GetOpenInfo?code={code}";
|
||||
string responseText = await client.GetStringAsync(url);
|
||||
return JsonConvert.DeserializeObject<TwResult>(responseText);
|
||||
}
|
||||
}
|
||||
|
||||
public class TwResult
|
||||
{
|
||||
public string msg { get; set; } = "";
|
||||
public int code { get; set; }
|
||||
public object data { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Web.Controllers.Login
|
||||
{
|
||||
@@ -12,11 +13,12 @@ namespace Application.Web.Controllers.Login
|
||||
[ApiController]
|
||||
public class LoginController : ControllerBase
|
||||
{
|
||||
private readonly IHubContext<ChatHub> _hubContext;
|
||||
public LoginController(IHubContext<ChatHub> hubContext)
|
||||
private readonly IGameAccountService _accountService;
|
||||
public LoginController(IGameAccountService accountService)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
_accountService = accountService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录接口
|
||||
/// </summary>
|
||||
@@ -26,22 +28,89 @@ namespace Application.Web.Controllers.Login
|
||||
public async Task<IPoAction> Login([FromBody] LoginParms parms)
|
||||
{
|
||||
|
||||
|
||||
return PoAction.Ok(parms.code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试接口
|
||||
/// 探玩自动登录
|
||||
/// </summary>
|
||||
/// <param name="name">测试名</param>
|
||||
/// <param name="ttt">测试2</param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> Test(string name,string ttt)
|
||||
public async Task<IPoAction> TwLogin( string code)
|
||||
{
|
||||
await _hubContext.Clients.All.SendAsync("ReceiveMessage", "系统");
|
||||
|
||||
return PoAction.Ok(name);
|
||||
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
return PoAction.Message("code值错误!");
|
||||
}
|
||||
AutoLogin login = new AutoLogin();
|
||||
var loginInfo = await login.TwLogin(code);
|
||||
if (loginInfo.code == 0)
|
||||
{
|
||||
dynamic twInfo = JsonConvert.DeserializeObject<dynamic>(loginInfo.data.ToString());
|
||||
string openId = twInfo.openid;
|
||||
string nick = "探玩玩家";
|
||||
var accInfo = await _accountService.GetAccInfoByOpenId(openId);
|
||||
if (accInfo == null)
|
||||
{
|
||||
var userData = await _accountService.Regist("", nick, "", "", openId);
|
||||
if (userData == null)
|
||||
{
|
||||
return PoAction.Message("登录失败,请联系客服!");
|
||||
}
|
||||
else
|
||||
{
|
||||
object ret =new { token = userData.token };
|
||||
return PoAction.Ok(ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (accInfo.status != 1)
|
||||
{
|
||||
return PoAction.Message("账号被冻结!");
|
||||
}
|
||||
else
|
||||
{
|
||||
object ret =new { token = accInfo.token };
|
||||
return PoAction.Ok(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message(loginInfo.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> LoginOut(string? sid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sid))
|
||||
{
|
||||
return PoAction.Message("身份信息不存在!");
|
||||
}
|
||||
|
||||
var accInfo = await _accountService.GetAccInfoByToken(sid);
|
||||
if (accInfo == null)
|
||||
{
|
||||
return PoAction.Message("身份信息不存在!");
|
||||
}
|
||||
|
||||
if (await _accountService.UpdateAccountToken(accInfo.accId))
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("退出失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ const ConnectSignlar = (clientId: string) => {
|
||||
|
||||
// 初始化应用配置
|
||||
onMounted(() => {
|
||||
userStore.setToken("5555","111","222");
|
||||
// 初始化屏幕尺寸
|
||||
if (typeof window !== 'undefined') {
|
||||
appStore.updateScreenSize(window.innerWidth, window.innerHeight)
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
body, div, p, a, table, textarea, form, img, ul, li {
|
||||
body,
|
||||
div,
|
||||
p,
|
||||
a,
|
||||
table,
|
||||
textarea,
|
||||
form,
|
||||
img,
|
||||
ul,
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
@@ -10,18 +19,7 @@ body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.game_nav {
|
||||
background: #302828;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
padding: 2px 0px 2px 3px;
|
||||
color: white;
|
||||
font-style: italic;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.main {
|
||||
}
|
||||
.main {}
|
||||
|
||||
div {
|
||||
margin: 5px 2px;
|
||||
@@ -34,48 +32,31 @@ div {
|
||||
|
||||
div img {
|
||||
max-width: 100%;
|
||||
width: exPRession(document.body.clientWidth>250?"250px":"auto");
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.logo {
|
||||
max-height: 120px;
|
||||
}
|
||||
|
||||
.step-logo {
|
||||
max-height: 120px;
|
||||
}
|
||||
.head {}
|
||||
|
||||
.head {
|
||||
}
|
||||
.title {}
|
||||
|
||||
.title {
|
||||
}
|
||||
.content {}
|
||||
|
||||
.content {
|
||||
}
|
||||
|
||||
.item {
|
||||
}
|
||||
.item {}
|
||||
|
||||
.border {
|
||||
border-bottom: 1px dashed #9f8d8d;
|
||||
}
|
||||
|
||||
.tips {
|
||||
}
|
||||
|
||||
.menu {
|
||||
}
|
||||
|
||||
.clear {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
.foot {
|
||||
}
|
||||
.foot {}
|
||||
|
||||
body a {
|
||||
a {
|
||||
color: #1e5494;
|
||||
margin: 0 5px;
|
||||
text-decoration: underline;
|
||||
@@ -87,7 +68,9 @@ body a {
|
||||
margin: 3px 4px 3px 4px;
|
||||
}
|
||||
|
||||
a:hover, a:active, a:focus {
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
color: #FFFFFF;
|
||||
background: #1e5494;
|
||||
}
|
||||
@@ -108,526 +91,9 @@ body a {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.page-msg {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.common {
|
||||
}
|
||||
.common {}
|
||||
|
||||
.common img {
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.PageTips {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.algin-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.input {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.ipt {
|
||||
width: 60%;
|
||||
display: block;
|
||||
padding: 6px 12px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
||||
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
color: #fff;
|
||||
background-color: #d9534f;
|
||||
border-color: #d43f3a;
|
||||
}
|
||||
|
||||
.btn-waring {
|
||||
color: #fff;
|
||||
background-color: #FE5E08;
|
||||
border-color: #FE5E08;
|
||||
}
|
||||
|
||||
.btn-ret {
|
||||
border-color: #d2d2d2;
|
||||
background: 0 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.chat {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chat img {
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.em {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
.ftbtn {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.equImg-min {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.user-head {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
}
|
||||
/******装备样式******/
|
||||
.equImg {
|
||||
max-width: 130px;
|
||||
max-height: 230px;
|
||||
}
|
||||
|
||||
.tq {
|
||||
background-image: url('/images/site/equ/tq.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ty {
|
||||
background-image: url('/images/site/equ/ty.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ms {
|
||||
background-image: url('/images/site/equ/ms.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.zx {
|
||||
background-image: url('/images/site/equ/zx.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.sy {
|
||||
background-image: url('/images/site/equ/sy.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.gw {
|
||||
background-image: url('/images/site/equ/gw.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ly {
|
||||
background-image: url('/images/site/equ/ly.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.hm {
|
||||
background-image: url('/images/site/equ/hm.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.j_r {
|
||||
background-image: url('/images/site/equ/r.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.j_l {
|
||||
background-image: url('/images/site/equ/l.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
/**********End*******/
|
||||
/***副本***/
|
||||
.dup {
|
||||
background-image: url('/images/site/dup/dup.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
/***任务***/
|
||||
.task-ret {
|
||||
background-image: url('/images/site/tr.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.task-get {
|
||||
background-image: url('/images/site/tg.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
/*九宫图片*/
|
||||
.gray {
|
||||
-webkit-filter: grayscale(100%);
|
||||
-moz-filter: grayscale(100%);
|
||||
-ms-filter: grayscale(100%);
|
||||
-o-filter: grayscale(100%);
|
||||
filter: grayscale(100%);
|
||||
filter: gray;
|
||||
}
|
||||
|
||||
/*九宫样式*/
|
||||
.wrapper {
|
||||
display: grid;
|
||||
grid-template-columns: 51px 51px 51px;
|
||||
grid-template-rows: 51px 51px 51px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.list {
|
||||
background: #eee;
|
||||
margin-right: 1px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.list img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
/********其他*******/
|
||||
.mounthImg {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
/***广播***/
|
||||
.broad {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.broad-gift {
|
||||
background-image: url('/images/site/broad/gift.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.broad-system {
|
||||
background-image: url('/images/site/broad/system.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-award {
|
||||
background-image: url('/images/site/broad/award.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-remind {
|
||||
background-image: url('/images/site/broad/remind.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-promote {
|
||||
background-image: url('/images/site/broad/promote.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.broad-hot1 {
|
||||
background-image: url('/images/site/broad/hot1.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/****礼物***/
|
||||
.gift {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.attire {
|
||||
height: 200px;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
/****限时活动****/
|
||||
.act_item {
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #9f8d8d;
|
||||
border-radius: 16px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.act_menu a {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.act_content {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.act_header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_head {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_head {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_item {
|
||||
border-bottom: 1px dashed #9f8d8d;
|
||||
}
|
||||
|
||||
.m_act_title {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.m_act_con {
|
||||
font-size: 15px;
|
||||
padding: 3px;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.m_act_con a {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
}
|
||||
|
||||
.maxname {
|
||||
max-height: 150px;
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
/* ========== 自定义通知队列 ========== */
|
||||
#custom-notify-container {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.custom-notify-item {
|
||||
box-sizing: border-box;
|
||||
max-width: 90%;
|
||||
padding: 8px 16px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
pointer-events: auto;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
animation: notify-slide-in 300ms ease-out forwards;
|
||||
}
|
||||
|
||||
.custom-notify-item.leaving {
|
||||
animation: notify-fade-out 200ms ease-in forwards;
|
||||
}
|
||||
|
||||
@keyframes notify-slide-in {
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes notify-fade-out {
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
/* ========== 顶部通告栏 ========== */
|
||||
.custom-notice-bar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
z-index: 9998;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-icon {
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-text {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
padding-right: 50px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-wrap.scrolling {
|
||||
animation: notice-scroll var(--scroll-duration, 10s) linear infinite;
|
||||
}
|
||||
|
||||
@keyframes notice-scroll {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-close {
|
||||
flex-shrink: 0;
|
||||
margin-left: 8px;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
@@ -64,18 +64,30 @@ export class ApiService {
|
||||
}
|
||||
const result = response.data;
|
||||
if (result.code === 401) {
|
||||
//401刷新token
|
||||
|
||||
console.log(result.data);
|
||||
} else if (result.code === 40101) {
|
||||
this.redirectToLogin();
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/login/login",
|
||||
redirectTo: "/",//跳转回首页
|
||||
message: result.msg || "登录已失效"
|
||||
} satisfies HandledRedirectError;
|
||||
} else if (result.code === 500) {
|
||||
// 跳转错误页面
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/",//跳转回首页
|
||||
message: result.msg || "登录已失效"
|
||||
} satisfies HandledRedirectError;
|
||||
} else if (result.code === 404) {
|
||||
// 跳转不存在页面
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/",//跳转回首页
|
||||
message: result.msg || "登录已失效"
|
||||
} satisfies HandledRedirectError;
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -25,5 +25,12 @@ export class StateHelper {
|
||||
{
|
||||
this.userStore.offOnline();
|
||||
}
|
||||
static get IsAccLogin(){
|
||||
return this.userStore.isLoginAccount;
|
||||
}
|
||||
|
||||
static get IsLogin(){
|
||||
return this.userStore.isLogin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,42 +4,21 @@
|
||||
<Abar href="/">首页</Abar>>客服
|
||||
</div>
|
||||
<div class="content">
|
||||
微信客服:<a href="https://work.weixin.qq.com/kfid/kfc86bc348120aea3e7"
|
||||
target="_blank">点击咨询</a><br />客服QQ:531493955<br />官方QQ群:238938639<br />客服邮箱:531493955@qq.com<br />
|
||||
微信客服:<a href="https://work.weixin.qq.com/kfid/kfc86bc348120aea3e7" target="_blank">点击咨询</a><br />
|
||||
客服QQ:290555931<br />
|
||||
官方QQ群:931835791<br />
|
||||
客服邮箱:tanwan@kexunkeji.cn<br />
|
||||
</div>
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
|
||||
<!-- 分页组件示例 -->
|
||||
<div class="content" style="margin-top: 10px;">
|
||||
<Pagination :currentPage="currentPage" :totalPages="totalPages" @pageChange="data" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
let a = 1
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: 'page-loading'
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const totalPages = ref<number>(95);
|
||||
|
||||
const handlePageChange = (page: number): void => {
|
||||
currentPage.value = page;
|
||||
console.log('跳转到第', page, '页');
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const data = (data: any) => {
|
||||
console.log('子组件传的值', data);
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
PageLoading.Close();
|
||||
})
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: middleware.loading
|
||||
@@ -100,23 +101,43 @@ const Initialize = async (): Promise<void> => {
|
||||
};
|
||||
|
||||
//退出登录
|
||||
const offOnline = () => {
|
||||
MessageExtend.ShowConfirmDialog("退出游戏", "您确定要退出游戏吗?", () => {
|
||||
const offOnline = async () => {
|
||||
MessageExtend.ShowConfirmDialog("退出游戏", "您确定要退出游戏吗?", async () => {
|
||||
var result = await PubService.GetMain(StateHelper.Sid);
|
||||
if (result.code == 0) {
|
||||
StateHelper.OffOnline();
|
||||
isOnline.value = false;
|
||||
MessageExtend.ShowToast("退出成功!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg, "fail");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
//默认设置身份,正式环境删除
|
||||
StateHelper.SetSid("kUVjj2cBUemcdokUEIBEKh0qhKkkSkui0x");
|
||||
//StateHelper.SetSid('');
|
||||
try {
|
||||
|
||||
const login = async (code: string): Promise<void> => {
|
||||
var result = await LoginService.TwLogin(code);
|
||||
console.log(result);
|
||||
if (result.code == 0) {
|
||||
StateHelper.SetSid(result.data.token);
|
||||
await Initialize();
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg, "default");
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const code = PageExtend.QueryString("code");
|
||||
if (code != '' && StateHelper.IsAccLogin == false) {
|
||||
|
||||
//执行登录
|
||||
await login(code);
|
||||
}
|
||||
else {
|
||||
await Initialize();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
|
||||
29
Web/src/services/login/LoginService.ts
Normal file
29
Web/src/services/login/LoginService.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export class LoginService {
|
||||
/**
|
||||
* 登录接口
|
||||
* POST /Login/Login
|
||||
* 请求体: 登录请求参数
|
||||
* @param name 登录名/手机号
|
||||
* @param pwd 密码
|
||||
* @param code 验证码
|
||||
*/
|
||||
static async Login(name: string, pwd: string, code: string) {
|
||||
return await ApiService.Request("post", "/Login/Login", { name, pwd, code });
|
||||
}
|
||||
|
||||
/**
|
||||
* 探玩自动登录
|
||||
* GET /Login/TwLogin
|
||||
*/
|
||||
static async TwLogin(code: string) {
|
||||
return await ApiService.Request("get", "/Login/TwLogin", { code });
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* GET /Login/LoginOut
|
||||
*/
|
||||
static async LoginOut(sid: string) {
|
||||
return await ApiService.Request("get", "/Login/LoginOut", { sid });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user