add:
1.注册 2.登录
Showing
8 changed files
with
67 additions
and
20 deletions
| ... | @@ -164,10 +164,10 @@ onMounted(() => { | ... | @@ -164,10 +164,10 @@ onMounted(() => { |
| 164 | if (useUserStore().user) { | 164 | if (useUserStore().user) { |
| 165 | isLogin.value = true | 165 | isLogin.value = true |
| 166 | } | 166 | } |
| 167 | if (window.location.href.indexOf('en') > -1) { | 167 | // if (window.location.href.indexOf('en') > -1) { |
| 168 | cache.local.set('language', 1) | 168 | // cache.local.set('language', 1) |
| 169 | // location.reload() | 169 | // // location.reload() |
| 170 | } | 170 | // } |
| 171 | if (route.fullPath.indexOf('news') > -1) { | 171 | if (route.fullPath.indexOf('news') > -1) { |
| 172 | activeIndex.value = '/news' | 172 | activeIndex.value = '/news' |
| 173 | } else if (route.fullPath.indexOf('notice') > -1) { | 173 | } else if (route.fullPath.indexOf('notice') > -1) { | ... | ... |
| ... | @@ -17,7 +17,7 @@ import 'virtual:svg-icons-register' | ... | @@ -17,7 +17,7 @@ import 'virtual:svg-icons-register' |
| 17 | import SvgIcon from '@/components/SvgIcon' | 17 | import SvgIcon from '@/components/SvgIcon' |
| 18 | import elementIcons from '@/components/SvgIcon/svgicon' | 18 | import elementIcons from '@/components/SvgIcon/svgicon' |
| 19 | 19 | ||
| 20 | import './permissionPc' // permission control | 20 | // import './permissionPc' // permission control |
| 21 | import * as socket from './utils/sockets' | 21 | import * as socket from './utils/sockets' |
| 22 | 22 | ||
| 23 | import { useDict } from '@/utils/dict' | 23 | import { useDict } from '@/utils/dict' |
| ... | @@ -95,7 +95,6 @@ app.component('Editor', Editor) | ... | @@ -95,7 +95,6 @@ app.component('Editor', Editor) |
| 95 | app.component('Draggable', draggable) | 95 | app.component('Draggable', draggable) |
| 96 | app.component('WePay', wePay) | 96 | app.component('WePay', wePay) |
| 97 | 97 | ||
| 98 | |||
| 99 | if (language == 0) { | 98 | if (language == 0) { |
| 100 | app.use(routerCn) | 99 | app.use(routerCn) |
| 101 | app.use(ElementPlus, { | 100 | app.use(ElementPlus, { | ... | ... |
| 1 | import router from './routerPc/index' | 1 | import router from './routerPc/cn' |
| 2 | import { ElMessage } from 'element-plus' | 2 | import { ElMessage } from 'element-plus' |
| 3 | import NProgress from 'nprogress' | 3 | import NProgress from 'nprogress' |
| 4 | import 'nprogress/nprogress.css' | 4 | import 'nprogress/nprogress.css' |
| ... | @@ -10,7 +10,7 @@ NProgress.configure({ showSpinner: false }) | ... | @@ -10,7 +10,7 @@ NProgress.configure({ showSpinner: false }) |
| 10 | 10 | ||
| 11 | router.beforeEach((to, from, next) => { | 11 | router.beforeEach((to, from, next) => { |
| 12 | NProgress.start() | 12 | NProgress.start() |
| 13 | // debugger | 13 | debugger |
| 14 | if (getToken()) { | 14 | if (getToken()) { |
| 15 | // 判断当前用户是否已拉取完user_info信息 | 15 | // 判断当前用户是否已拉取完user_info信息 |
| 16 | if (!useUserStore().user) { | 16 | if (!useUserStore().user) { | ... | ... |
| ... | @@ -6,6 +6,11 @@ import { | ... | @@ -6,6 +6,11 @@ import { |
| 6 | /* Layout */ | 6 | /* Layout */ |
| 7 | import Layout from '@/layoutPc' | 7 | import Layout from '@/layoutPc' |
| 8 | import Empty from '@/layoutPc/empty' | 8 | import Empty from '@/layoutPc/empty' |
| 9 | import NProgress from "nprogress"; | ||
| 10 | import {getToken} from "@/utils/auth"; | ||
| 11 | import useUserStore from "@/store/modules/user"; | ||
| 12 | import {isRelogin} from "@/utils/request"; | ||
| 13 | import {ElMessage} from "element-plus"; | ||
| 9 | // import useUserStore from '@/store/modules/user' | 14 | // import useUserStore from '@/store/modules/user' |
| 10 | 15 | ||
| 11 | /** | 16 | /** |
| ... | @@ -517,4 +522,34 @@ const router = createRouter({ | ... | @@ -517,4 +522,34 @@ const router = createRouter({ |
| 517 | } | 522 | } |
| 518 | }) | 523 | }) |
| 519 | 524 | ||
| 525 | NProgress.configure({ showSpinner: false }) | ||
| 526 | |||
| 527 | router.beforeEach((to, from, next) => { | ||
| 528 | NProgress.start() | ||
| 529 | if (getToken()) { | ||
| 530 | // 判断当前用户是否已拉取完user_info信息 | ||
| 531 | if (!useUserStore().user) { | ||
| 532 | isRelogin.show = true | ||
| 533 | useUserStore().getInfo().then(() => { | ||
| 534 | isRelogin.show = false | ||
| 535 | next() // hack方法 确保addRoutes已完成 | ||
| 536 | }).catch(err => { | ||
| 537 | useUserStore().logOut().then(() => { | ||
| 538 | ElMessage.error(err) | ||
| 539 | next({ path: '/' }) | ||
| 540 | }) | ||
| 541 | }) | ||
| 542 | } else { | ||
| 543 | next() | ||
| 544 | } | ||
| 545 | } else { | ||
| 546 | // 没有token | ||
| 547 | next() | ||
| 548 | } | ||
| 549 | }) | ||
| 550 | |||
| 551 | router.afterEach((to) => { | ||
| 552 | NProgress.done() | ||
| 553 | }) | ||
| 554 | |||
| 520 | export default router | 555 | export default router | ... | ... |
| ... | @@ -103,9 +103,14 @@ | ... | @@ -103,9 +103,14 @@ |
| 103 | @keyup.enter="handleLogin" | 103 | @keyup.enter="handleLogin" |
| 104 | > | 104 | > |
| 105 | <template #append> | 105 | <template #append> |
| 106 | <span class="text-primary" @click="sendsmsMsg"> | 106 | <el-button type="primary" plain style="width: 110px" @click="sendsmsMsg"> |
| 107 | <count-down v-if="counting" v-slot="{ totalSeconds }" :time="60000" @end="counting=false"> | ||
| 108 | {{ totalSeconds }} 秒 | ||
| 109 | </count-down> | ||
| 110 | <span v-else> | ||
| 107 | 发送验证码 | 111 | 发送验证码 |
| 108 | </span> | 112 | </span> |
| 113 | </el-button> | ||
| 109 | </template> | 114 | </template> |
| 110 | </el-input> | 115 | </el-input> |
| 111 | <div class="vcodeBox" :style="isShow?'height:240px':'height:0'"> | 116 | <div class="vcodeBox" :style="isShow?'height:240px':'height:0'"> |
| ... | @@ -152,6 +157,8 @@ | ... | @@ -152,6 +157,8 @@ |
| 152 | </template> | 157 | </template> |
| 153 | 158 | ||
| 154 | <script setup> | 159 | <script setup> |
| 160 | import Vcode from "vue3-puzzle-vcode" | ||
| 161 | import CountDown from '@chenfengyuan/vue-countdown' | ||
| 155 | import { getCodeImg } from '@/api/login' | 162 | import { getCodeImg } from '@/api/login' |
| 156 | import * as match from '@/apiPc/match' | 163 | import * as match from '@/apiPc/match' |
| 157 | import Cookies from 'js-cookie' | 164 | import Cookies from 'js-cookie' |
| ... | @@ -411,4 +418,11 @@ function sendsmsMsg() { | ... | @@ -411,4 +418,11 @@ function sendsmsMsg() { |
| 411 | } | 418 | } |
| 412 | &:hover{color: #fff;} | 419 | &:hover{color: #fff;} |
| 413 | } | 420 | } |
| 421 | .el-input-group__append{ flex: 1 1 auto;} | ||
| 422 | .el-input-group__append button.el-button, .el-input-group__append button.el-button:hover{ | ||
| 423 | color: var(--el-color-primary); | ||
| 424 | background: #efefff; | ||
| 425 | border: var(--el-color-primary) solid 1px; | ||
| 426 | border-radius: 0; | ||
| 427 | } | ||
| 414 | </style> | 428 | </style> | ... | ... |
| ... | @@ -32,8 +32,7 @@ | ... | @@ -32,8 +32,7 @@ |
| 32 | </template> | 32 | </template> |
| 33 | 33 | ||
| 34 | <script setup> | 34 | <script setup> |
| 35 | import {reactive} from "@vue/runtime-core"; | 35 | import {reactive,toRefs} from 'vue' |
| 36 | import {toRefs} from "@vueuse/shared/index"; | ||
| 37 | import Vcode from "vue3-puzzle-vcode" | 36 | import Vcode from "vue3-puzzle-vcode" |
| 38 | import { ElMessage } from 'element-plus' | 37 | import { ElMessage } from 'element-plus' |
| 39 | import CountDown from '@chenfengyuan/vue-countdown' | 38 | import CountDown from '@chenfengyuan/vue-countdown' | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | <el-card> | 2 | <el-card> |
| 3 | <div class="border-info text-center"> | 3 | <div class="border-info text-center"> |
| 4 | 4 | ||
| 5 | <label>登录账号</label> 321 | 5 | <label>登录账号</label> {{ accont }} |
| 6 | 6 | ||
| 7 | </div> | 7 | </div> |
| 8 | <div class="leftboderTT">登录密码 <span>(登录时需要验证,保护账户信息)</span></div> | 8 | <div class="leftboderTT">登录密码 <span>(登录时需要验证,保护账户信息)</span></div> |
| ... | @@ -80,11 +80,13 @@ import {setToken} from "@/utils/auth"; | ... | @@ -80,11 +80,13 @@ import {setToken} from "@/utils/auth"; |
| 80 | const { proxy } = getCurrentInstance() | 80 | const { proxy } = getCurrentInstance() |
| 81 | const emit = defineEmits(['submit','prev']) | 81 | const emit = defineEmits(['submit','prev']) |
| 82 | const props = defineProps({ | 82 | const props = defineProps({ |
| 83 | 83 | accont:{ | |
| 84 | type:String, | ||
| 85 | required:true | ||
| 86 | } | ||
| 84 | }) | 87 | }) |
| 85 | const data = reactive({ | 88 | const data = reactive({ |
| 86 | form: { | 89 | form: { |
| 87 | username:'eryewawa@163.com' | ||
| 88 | }, | 90 | }, |
| 89 | loading:false, | 91 | loading:false, |
| 90 | countryList: [], | 92 | countryList: [], | ... | ... |
| ... | @@ -10,14 +10,10 @@ | ... | @@ -10,14 +10,10 @@ |
| 10 | <el-step title="注册完成" /> | 10 | <el-step title="注册完成" /> |
| 11 | </el-steps> | 11 | </el-steps> |
| 12 | </el-card> | 12 | </el-card> |
| 13 | |||
| 14 | <div class="mt20"></div> | 13 | <div class="mt20"></div> |
| 15 | <Step1 v-if="activeStep==0" @submit="toStep2" @userName="getUserName" /> | 14 | <Step1 v-if="activeStep==0" @submit="toStep2" @userName="getUserName" /> |
| 16 | <Step2 v-if="activeStep==1" @submit="toStep3" @prev="toStep1"/> | 15 | <Step2 v-if="activeStep==1" @submit="toStep3" @prev="toStep1" :accont="form.userName"/> |
| 17 | <Step3 v-if="activeStep==2"/> | 16 | <Step3 v-if="activeStep==2"/> |
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | </div> | 17 | </div> |
| 22 | </div> | 18 | </div> |
| 23 | </div> | 19 | </div> |
| ... | @@ -34,7 +30,9 @@ const data = reactive({ | ... | @@ -34,7 +30,9 @@ const data = reactive({ |
| 34 | isShow:false, | 30 | isShow:false, |
| 35 | isCodeTrue:false, | 31 | isCodeTrue:false, |
| 36 | counting:false, | 32 | counting:false, |
| 37 | form:{}, | 33 | form:{ |
| 34 | userName:'1111' | ||
| 35 | }, | ||
| 38 | activeStep: 0 | 36 | activeStep: 0 |
| 39 | }) | 37 | }) |
| 40 | const {isShow,isCodeTrue,counting,form,activeStep} = toRefs(data) | 38 | const {isShow,isCodeTrue,counting,form,activeStep} = toRefs(data) | ... | ... |
-
Please register or sign in to post a comment