Browse Source

登录

master
linquan 3 weeks ago
parent
commit
afb9fa193b
  1. 2
      src/utils/utils.ts
  2. 9
      src/views/gameRole/role/index.vue
  3. 35
      src/views/login/component/email.vue
  4. 32
      src/views/login/component/mobile.vue

2
src/utils/utils.ts

@ -107,6 +107,7 @@ export function getAccount(account: string, channel: string) {
} }
export function channelFill(val: any) { export function channelFill(val: any) {
val += '';
let len = val.length; let len = val.length;
for (let i = 0; i < 6 - len; i++) { for (let i = 0; i < 6 - len; i++) {
val = '0' + val; val = '0' + val;
@ -115,6 +116,5 @@ export function channelFill(val: any) {
} }
export function getCompleteChannel(channel: any, subChannel: any) { export function getCompleteChannel(channel: any, subChannel: any) {
return channelFill(channel) + channelFill(subChannel); return channelFill(channel) + channelFill(subChannel);
} }

9
src/views/gameRole/role/index.vue

@ -856,11 +856,10 @@ export default defineComponent({
} }
}); });
state.tableData.data = roleList; state.tableData.data = roleList;
// console.log('gameRoleList: ', roleList);
}); });
state.queryParams.orderAccount = list[0].AccountName; state.queryParams.orderAccount = list[0].AccountName;
state.queryParams.channel = getCompleteChannel(list[0].Channel, list[0].SubChannel); state.queryParams.channel = getCompleteChannel(list[0].Channel, list[0].SubChannel);
console.log('gameRoleList: ', list[0],list[0].Channel, list[0].SubChannel, state.queryParams, getCompleteChannel(list[0].Channel, list[0].SubChannel)); // console.log('gameRoleList: ', list[0],list[0].Channel, list[0].SubChannel, state.queryParams, getCompleteChannel(list[0].Channel+"", list[0].SubChannel+""));
orderList(); orderList();
loginOut(); loginOut();
loginOutLog(); loginOutLog();
@ -904,7 +903,7 @@ export default defineComponent({
const loginOut = () => { const loginOut = () => {
state.tableData.loginOutData = []; state.tableData.loginOutData = [];
gameLoginOut({ gameLoginOut({
account: state.queryParams.orderAccount, account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
serverId: state.queryParams.serverId, serverId: state.queryParams.serverId,
id: state.queryParams.id, id: state.queryParams.id,
pageSize: state.queryParams.loginOutPageSize, pageSize: state.queryParams.loginOutPageSize,
@ -922,7 +921,7 @@ export default defineComponent({
const loginOutLog = () => { const loginOutLog = () => {
state.tableData.loginOutLogData = []; state.tableData.loginOutLogData = [];
gameLoginOutLog({ gameLoginOutLog({
account: state.queryParams.orderAccount, account:getAccount(state.queryParams.orderAccount, state.queryParams.channel),
id: state.queryParams.id, id: state.queryParams.id,
serverId: state.queryParams.serverId, serverId: state.queryParams.serverId,
pageSize: state.queryParams.loginOutLogPageSize, pageSize: state.queryParams.loginOutLogPageSize,
@ -940,7 +939,7 @@ export default defineComponent({
const itemRecord = () => { const itemRecord = () => {
state.tableData.itemRecordData = []; state.tableData.itemRecordData = [];
gameItemRecord({ gameItemRecord({
account: state.queryParams.orderAccount, account: getAccount(state.queryParams.orderAccount, state.queryParams.channel),
id: state.queryParams.id, id: state.queryParams.id,
serverId: state.queryParams.serverId, serverId: state.queryParams.serverId,
pageSize: state.queryParams.itemPageSize, pageSize: state.queryParams.itemPageSize,

35
src/views/login/component/email.vue

@ -21,7 +21,10 @@
</el-col> </el-col>
<el-col :span="1"></el-col> <el-col :span="1"></el-col>
<el-col :span="8"> <el-col :span="8">
<el-button class="login-content-code" @click="smsCode">{{ $t('message.email.codeText') }}</el-button> <el-button class="login-content-code" @click="smsCode" :disabled="disabled">
<div v-if="disabled">{{ countDown }}秒后重新获取</div>
<div v-else>{{ $t('message.email.codeText') }}</div>
</el-button>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item class="login-animation3"> <el-form-item class="login-animation3">
@ -29,7 +32,7 @@
<span>{{ $t('message.email.btnText') }}</span> <span>{{ $t('message.email.btnText') }}</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
<!-- <div class="font12 mt30 login-animation4 login-msg">{{ $t('message.email.msgText') }}</div>--> <!-- <div class="font12 mt30 login-animation4 login-msg">{{ $t('message.email.msgText') }}</div>-->
</el-form> </el-form>
</template> </template>
@ -44,7 +47,6 @@ import { useStore } from '/@/store';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { formatAxis } from '/@/utils/formatTime'; import { formatAxis } from '/@/utils/formatTime';
import initIconfont from '/@/utils/getStyleSheets';
export default defineComponent({ export default defineComponent({
name: 'loginEmail', name: 'loginEmail',
@ -55,6 +57,8 @@ export default defineComponent({
const router = useRouter(); const router = useRouter();
const { proxy } = <any>getCurrentInstance(); const { proxy } = <any>getCurrentInstance();
const state = reactive({ const state = reactive({
disabled: false,
countDown: 60,
ruleForm: { ruleForm: {
userName: '', userName: '',
code: '', code: '',
@ -129,19 +133,24 @@ export default defineComponent({
}; };
const smsCode = () => { const smsCode = () => {
// console.log(state.ruleForm); // console.log(state.ruleForm);
state.disabled = true;
let timer = setInterval(function () {
if (state.countDown > 0) {
state.countDown--;
} else {
clearInterval(timer);
state.disabled = false;
state.countDown = 60;
}
}, 1000);
emailCode(state.ruleForm).then((res) => { emailCode(state.ruleForm).then((res) => {
console.log(res); console.log(res);
}); }).catch(()=>{
clearInterval(timer);
state.disabled = false;
state.countDown = 60;
});
}; };
// onMounted(() => {
// // initGetStyleSheets();
// });
// const initGetStyleSheets = () => {
// initIconfont.ali().then((res: any) => {
// // state.sheetsIconList = res;
// // console.log(res);
// });
// };
return { return {
sendSms, sendSms,
smsCode, smsCode,

32
src/views/login/component/mobile.vue

@ -1,5 +1,5 @@
<template> <template>
<el-form ref="loginForm" size="large" class="login-content-form" :model="ruleForm"> <el-form ref="loginForm" size="large" class="login-content-form" :model="ruleForm">
<el-form-item class="login-animation1"> <el-form-item class="login-animation1">
<el-input type="text" :placeholder="$t('message.mobile.placeholder1')" v-model="ruleForm.userName" clearable autocomplete="off"> <el-input type="text" :placeholder="$t('message.mobile.placeholder1')" v-model="ruleForm.userName" clearable autocomplete="off">
<template #prefix> <template #prefix>
@ -19,7 +19,10 @@
</el-col> </el-col>
<el-col :span="1"></el-col> <el-col :span="1"></el-col>
<el-col :span="8"> <el-col :span="8">
<el-button class="login-content-code" @click="smsCode">{{ $t('message.mobile.codeText') }}</el-button> <el-button class="login-content-code" @click="smsCode" :disabled="disabled">
<div v-if="disabled">{{ countDown }}秒后重新获取</div>
<div v-else>{{ $t('message.mobile.codeText') }}</div>
</el-button>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item class="login-animation3"> <el-form-item class="login-animation3">
@ -27,7 +30,7 @@
<span>{{ $t('message.mobile.btnText') }}</span> <span>{{ $t('message.mobile.btnText') }}</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
<!-- <div class="font12 mt30 login-animation4 login-msg">{{ $t('message.mobile.msgText') }}</div>--> <!-- <div class="font12 mt30 login-animation4 login-msg">{{ $t('message.mobile.msgText') }}</div>-->
</el-form> </el-form>
</template> </template>
@ -52,6 +55,8 @@ export default defineComponent({
const router = useRouter(); const router = useRouter();
const { proxy } = <any>getCurrentInstance(); const { proxy } = <any>getCurrentInstance();
const state = reactive({ const state = reactive({
disabled: false,
countDown: 60,
ruleForm: { ruleForm: {
userName: '', userName: '',
code: '', code: '',
@ -65,7 +70,8 @@ export default defineComponent({
return formatAxis(new Date()); return formatAxis(new Date());
}); });
const sendSms = () => { const sendSms = () => {
proxy.$refs.loginForm.validate((valid: boolean) => { proxy.$refs.loginForm
.validate((valid: boolean) => {
if (valid) { if (valid) {
loginMobile(state.ruleForm) loginMobile(state.ruleForm)
.then(async (res) => { .then(async (res) => {
@ -124,10 +130,24 @@ export default defineComponent({
ElMessage.success(`${currentTimeInfo}${signInText}`); ElMessage.success(`${currentTimeInfo}${signInText}`);
}; };
const smsCode = () => { const smsCode = () => {
// console.log(state.ruleForm); // console.log(state.ruleForm);
state.disabled = true;
let timer = setInterval(function () {
if (state.countDown > 0) {
state.countDown--;
} else {
clearInterval(timer);
state.disabled = false;
state.countDown = 60;
}
}, 1000);
mobileCode(state.ruleForm).then((res) => { mobileCode(state.ruleForm).then((res) => {
console.log(res); console.log(res);
}); }).catch(()=>{
clearInterval(timer);
state.disabled = false;
state.countDown = 60;
});
}; };
return { return {
sendSms, sendSms,

Loading…
Cancel
Save