diff --git a/index.html b/index.html index 8f7a6b9..1bb134c 100644 --- a/index.html +++ b/index.html @@ -143,7 +143,7 @@
Loading...
- + - \ No newline at end of file + diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..1d1b22a Binary files /dev/null and b/public/logo.png differ diff --git a/public/verifyimg/10-979x547.jpg b/public/verifyimg/10-979x547.jpg new file mode 100644 index 0000000..758f8ea Binary files /dev/null and b/public/verifyimg/10-979x547.jpg differ diff --git a/public/verifyimg/11-979x547.jpg b/public/verifyimg/11-979x547.jpg new file mode 100644 index 0000000..a0f44a5 Binary files /dev/null and b/public/verifyimg/11-979x547.jpg differ diff --git a/public/verifyimg/12-979x547.jpg b/public/verifyimg/12-979x547.jpg new file mode 100644 index 0000000..5691a12 Binary files /dev/null and b/public/verifyimg/12-979x547.jpg differ diff --git a/public/verifyimg/13-979x547.jpg b/public/verifyimg/13-979x547.jpg new file mode 100644 index 0000000..36a6134 Binary files /dev/null and b/public/verifyimg/13-979x547.jpg differ diff --git a/public/verifyimg/14-979x547.jpg b/public/verifyimg/14-979x547.jpg new file mode 100644 index 0000000..f610dbb Binary files /dev/null and b/public/verifyimg/14-979x547.jpg differ diff --git a/public/verifyimg/16-979x547.jpg b/public/verifyimg/16-979x547.jpg new file mode 100644 index 0000000..ab66ad0 Binary files /dev/null and b/public/verifyimg/16-979x547.jpg differ diff --git a/public/verifyimg/17-979x547.jpg b/public/verifyimg/17-979x547.jpg new file mode 100644 index 0000000..cb72bc8 Binary files /dev/null and b/public/verifyimg/17-979x547.jpg differ diff --git a/public/verifyimg/18-979x547.jpg b/public/verifyimg/18-979x547.jpg new file mode 100644 index 0000000..a8affa4 Binary files /dev/null and b/public/verifyimg/18-979x547.jpg differ diff --git a/public/verifyimg/19-979x547.jpg b/public/verifyimg/19-979x547.jpg new file mode 100644 index 0000000..c6fd0b0 Binary files /dev/null and b/public/verifyimg/19-979x547.jpg differ diff --git a/public/verifyimg/20-979x547.jpg b/public/verifyimg/20-979x547.jpg new file mode 100644 index 0000000..e583ee9 Binary files /dev/null and b/public/verifyimg/20-979x547.jpg differ diff --git a/public/verifyimg/28-979x547.jpg b/public/verifyimg/28-979x547.jpg new file mode 100644 index 0000000..b7c36d0 Binary files /dev/null and b/public/verifyimg/28-979x547.jpg differ diff --git a/public/verifyimg/29-979x547.jpg b/public/verifyimg/29-979x547.jpg new file mode 100644 index 0000000..7f6bbf8 Binary files /dev/null and b/public/verifyimg/29-979x547.jpg differ diff --git a/public/verifyimg/33-979x547.jpg b/public/verifyimg/33-979x547.jpg new file mode 100644 index 0000000..ae6f3e3 Binary files /dev/null and b/public/verifyimg/33-979x547.jpg differ diff --git a/public/verifyimg/37-979x547.jpg b/public/verifyimg/37-979x547.jpg new file mode 100644 index 0000000..6a5a88e Binary files /dev/null and b/public/verifyimg/37-979x547.jpg differ diff --git a/src/App.vue b/src/App.vue index c5ab5ef..8ceaf6b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,9 +7,9 @@ import useUserStore from './store/modules/user' import useAppStore from './store/modules/app' import { ElConfigProvider } from 'element-plus' -import zh from 'element-plus/lib/locale/lang/zh-cn' // 中文语言 -import en from 'element-plus/lib/locale/lang/en' // 英文语言 -import tw from 'element-plus/lib/locale/lang/zh-tw' //繁体 +import zh from 'element-plus/es/locale/lang/zh-cn' // 中文语言 +import en from 'element-plus/es/locale/lang/en' // 英文语言 +import tw from 'element-plus/es/locale/lang/zh-tw' //繁体 import defaultSettings from '@/settings' const { proxy } = getCurrentInstance() diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index 3615249..d254a5d 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -96,16 +96,16 @@ div:focus { text-align: center; } -.link-type, -.link-type:focus { - color: var(--el-color-primary); - cursor: pointer; +// .link-type, +// .link-type:focus { +// color: var(--el-color-primary); +// cursor: pointer; - &:hover { - // color: rgb(32, 160, 255); - opacity: 0.3; - } -} +// &:hover { +// // color: rgb(32, 160, 255); +// opacity: 0.3; +// } +// } /** 基础通用 **/ .pt5 { diff --git a/src/assets/styles/login.scss b/src/assets/styles/login.scss index 4c6580f..a550036 100644 --- a/src/assets/styles/login.scss +++ b/src/assets/styles/login.scss @@ -10,18 +10,18 @@ background-size: cover; } -.title { - margin: 0px auto 30px auto; - text-align: center; - // color: #fff; -} +// .title { +// margin: 0px auto 30px auto; +// text-align: center; +// // color: #fff; +// } .login-form { border-radius: 6px; background: #ffffff; - // background-color: hsla(0, 0%, 100%, 0.3); - width: var(--base-login-width); - padding: 25px 15px 5px 15px; + width: calc(100% - 30px - 70px); + margin: 0 auto; + padding: 15px; position: relative; .input-icon { @@ -31,19 +31,19 @@ } } -.login-tip { - font-size: 13px; - text-align: center; - color: #bfbfbf; -} +// .login-tip { +// font-size: 13px; +// text-align: center; +// color: #bfbfbf; +// } .login-code { - width: 33%; + width: 34%; height: 40px; float: right; img { - width: 100%; + // width: 100%; cursor: pointer; vertical-align: middle; } @@ -68,6 +68,12 @@ } .langSet { position: absolute; - right: 20px; - top: 10px; + left: 20px; + top: 13px; +} + +.link-wrapper { + height: 30px; + line-height: 30px; + text-align: right; } diff --git a/src/components/DragVerifyImgChip/index.vue b/src/components/DragVerifyImgChip/index.vue new file mode 100644 index 0000000..5dbda8a --- /dev/null +++ b/src/components/DragVerifyImgChip/index.vue @@ -0,0 +1,506 @@ + + + + diff --git a/src/components/LoginFormTitle/index.vue b/src/components/LoginFormTitle/index.vue new file mode 100644 index 0000000..e79cbb3 --- /dev/null +++ b/src/components/LoginFormTitle/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/i18n/pages/login/zh-cn.json b/src/i18n/pages/login/zh-cn.json index 5c15650..af74290 100644 --- a/src/i18n/pages/login/zh-cn.json +++ b/src/i18n/pages/login/zh-cn.json @@ -4,12 +4,14 @@ "password": "密码", "captcha": "验证码", "btnLogin": "登录", + "btnLoginLoading": "登录中...", "rememberMe": "记住密码", "loginSuccess": "登录成功", "loginTimeOut": "登录状态已过期,请重新登录", "reLogin": "重新登录", "invalidSession": "无效的会话,或者会话已过期,请重新登录。", "otherLoginWay": "其他登录方式", - "register": "注册" + "register": "注册", + "toLoginByEmail": "邮箱登录" } } diff --git a/src/main.js b/src/main.ts similarity index 85% rename from src/main.js rename to src/main.ts index c48be56..423d4d6 100644 --- a/src/main.js +++ b/src/main.ts @@ -5,7 +5,7 @@ import ElementPlus from 'element-plus' import 'dayjs/locale/zh-cn' import '@/assets/styles/index.scss' // global css -import App from './App' +import App from './App.vue' import router from './router' import directive from './directive' // directive // 注册指令 @@ -28,17 +28,17 @@ import { getDicts } from '@/api/system/dict/data' import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, download } from '@/utils/ruoyi' // 分页组件 -import Pagination from '@/components/Pagination' +import Pagination from '@/components/Pagination/index.vue' // 自定义表格工具组件 -import RightToolbar from '@/components/RightToolbar' +import RightToolbar from '@/components/RightToolbar/index.vue' // 文件上传组件 -import FileUpload from '@/components/FileUpload' +import FileUpload from '@/components/FileUpload/index.vue' // 图片上传组件 -import ImageUpload from '@/components/ImageUpload' +import ImageUpload from '@/components/ImageUpload/index.vue' // 图片预览组件 -import ImagePreview from '@/components/ImagePreview' +import ImagePreview from '@/components/ImagePreview/index.vue' // 字典标签组件 -import DictTag from '@/components/DictTag' +import DictTag from '@/components/DictTag/index.vue' // el-date-picker 快捷选项 import dateOptions from '@/utils/dateOptions' diff --git a/src/permission.js b/src/permission.js index 31fe0e1..a260169 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,9 +7,9 @@ import { isHttp } from '@/utils/validate' import useUserStore from '@/store/modules/user' import useSettingsStore from '@/store/modules/settings' import usePermissionStore from '@/store/modules/permission' -NProgress.configure({ showSpinner: false }); +NProgress.configure({ showSpinner: false }) -const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/socialLogin']; +const whiteList = ['/login', '/loginByEmail', '/auth-redirect', '/bind', '/register', '/socialLogin'] router.beforeEach((to, from, next) => { NProgress.start() @@ -22,22 +22,29 @@ router.beforeEach((to, from, next) => { } else { if (useUserStore().roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 - useUserStore().getInfo().then(() => { - usePermissionStore().generateRoutes().then(accessRoutes => { - // 根据roles权限生成可访问的路由表 - accessRoutes.forEach(route => { - if (!isHttp(route.path)) { - router.addRoute(route) // 动态添加可访问路由表 - } - }) - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + useUserStore() + .getInfo() + .then(() => { + usePermissionStore() + .generateRoutes() + .then((accessRoutes) => { + // 根据roles权限生成可访问的路由表 + accessRoutes.forEach((route) => { + if (!isHttp(route.path)) { + router.addRoute(route) // 动态添加可访问路由表 + } + }) + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + }) }) - }).catch(err => { - useUserStore().logOut().then(() => { - ElMessage.error(err != undefined ? err : '登录失败') - next({ path: '/' }) + .catch((err) => { + useUserStore() + .logOut() + .then(() => { + ElMessage.error(err != undefined ? err : '登录失败') + next({ path: '/' }) + }) }) - }) } else { next() } @@ -56,4 +63,4 @@ router.beforeEach((to, from, next) => { router.afterEach(() => { NProgress.done() -}) \ No newline at end of file +}) diff --git a/src/router/index.js b/src/router/index.js index 874564a..6ab6c45 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -39,6 +39,11 @@ export const constantRoutes = [ component: () => import('@/views/login'), hidden: true }, + { + path: '/loginByEmail', + component: () => import('@/views/loginByEmail'), + hidden: true + }, { path: '/sociallogin', component: () => import('@/views/socialLogin'), diff --git a/src/store/modules/user.js b/src/store/modules/user.js index bc7f1f1..39cf9dd 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -21,27 +21,26 @@ const useUserStore = defineStore('user', { // 登录 login(userInfo) { return new Promise((resolve, reject) => { - getRsaKey().then((response) => { - const publicKey = response.data.publicKey - const username = userInfo.username.trim() - const password = encryptByPublicKey(userInfo.password, publicKey) - const code = userInfo.code - const uuid = userInfo.uuid - login(username, password, code, uuid) - .then((res) => { - if (res.code == 200) { - setToken(res.data) - this.token = res.data - resolve() //then处理 - } else { - console.log('login error ', res) - reject(res) //catch处理 - } - }) - .catch((error) => { - reject(error) - }) - }) + // getRsaKey().then((response) => { + const username = userInfo.username.trim() + const password = encryptByPublicKey(userInfo.password) + const code = userInfo.code + const uuid = userInfo.uuid + login(username, password, code, uuid) + .then((res) => { + if (res.code == 200) { + setToken(res.data) + this.token = res.data + resolve() //then处理 + } else { + console.log('login error ', res) + reject(res) //catch处理 + } + }) + .catch((error) => { + reject(error) + }) + // }) }) }, /** diff --git a/src/utils/jsencrypt.js b/src/utils/jsencrypt.ts similarity index 58% rename from src/utils/jsencrypt.js rename to src/utils/jsencrypt.ts index 0181419..eae6dd3 100644 --- a/src/utils/jsencrypt.js +++ b/src/utils/jsencrypt.ts @@ -1,5 +1,5 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' -import jsrsasign from 'jsrsasign' +import { KEYUTIL, KJUR } from 'jsrsasign' // 密钥对生成 http://web.chacuo.net/netrsakeypair const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALj0zjON+EVdBsnMcR4Uj+jOYgp5ZipftQZ1utW8KvVioz+RSaotF1JHt59q9SC/mZcWWpbpcEqQ3WyyyCC33msCAwEAAQ==' @@ -7,6 +7,17 @@ const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALj0zjON+EVdBsnMcR4Uj+jOYgp5Z const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAuPTOM434RV0GycxxHhSP6M5iCnlmKl+1BnW61bwq9WKjP5FJqi0XUke3n2r1IL+ZlxZalulwSpDdbLLIILfeawIDAQABAkB5PYAtq1KjpWddwPYlkbUEFsWNuCaQgExZ/7KJiN9gGjo/UfUZ3W39Orb8PITIYf1NbasReqgddAcsfJNyoDWBAiEA7K89DyTmbjNSmekdD3rejRDdMzzXYtcbo69ZjHoowMUCIQDIDN8eg6PcWk4kiRcRYcNEfriUJR7Fg07ellSPv821bwIhAJA5TEyxIJUgQwI0cZfgOELfdtrlBR5ek6IPlNKsEa89AiBbMVroexPQWC41A3VLjChKagXUKpO7b98dIqRLnyCz6wIgP3qpvnO4IOxY7f5XarfCVyIHZJAMt/R1f16P5OkKv+A=' +const publicPem = ` +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo7yRx+lfHxy/c7lZFtZn +A3GBeQ+9nxBuOcSz/I8l0dP5JZsWVE+jMtmoxnFrTgCsnGuDHMNpSlexUc3IVcsp +bC4tSWh/r4Gy9KsIw0tIY0pulKsN/VhV//7dajMV/Dg+Rd5bwGGjWrlWOp2EPVYB +HI66uZ3PpEQe3FbEdaLkJRTENbywgGcGo1tqUpqY5BDGAu9IiXwZe4hdM2uniFS2 +RKcYDovCiJE1lA7yyx9HEUd9PhYMhPMLvIIdPWW2Gqxsi3IZgG25hER0+o3zICgq +G/2VbodBM65JTLBY+KnY6H3o80b0v2qwOB7TktVtWQR6Lz8Ud+qrlgeAzvZb5Fmp +DQIDAQAB +-----END PUBLIC KEY-----` + // 加密 export function encrypt(txt) { const encryptor = new JSEncrypt() @@ -21,7 +32,9 @@ export function decrypt(txt) { return encryptor.decrypt(txt) // 对数据进行解密 } -export const encryptByPublicKey = (txt, publicKey) => { - const pubKey = jsrsasign.KEYUTIL.getKey(publicKey) - return jsrsasign.KJUR.crypto.Cipher.encrypt(txt, pubKey) +export const encryptByPublicKey = (txt: string, publicKey: string = publicPem) => { + const pubKey = KEYUTIL.getKey(publicKey) + // const ciphertext = KJUR.crypto.Cipher.encrypt(txt, pubKey, 'RSA') + const ciphertext = pubKey.encrypt(txt) + return btoa(atob(ciphertext).padStart(128, '\0')) } diff --git a/src/utils/useCurrentInstance.ts b/src/utils/useCurrentInstance.ts new file mode 100644 index 0000000..bea1cc9 --- /dev/null +++ b/src/utils/useCurrentInstance.ts @@ -0,0 +1,11 @@ +import { ComponentCustomProperties, ComponentInternalInstance, getCurrentInstance } from 'vue' +interface UseCurrentInstance { + globalProperties: ComponentCustomProperties & Record +} +export default function useCurrentInstance(): UseCurrentInstance { + const { appContext } = getCurrentInstance() as ComponentInternalInstance + const globalProperties = appContext.config.globalProperties + return { + globalProperties + } +} diff --git a/src/views/index.vue b/src/views/index.vue index 788c504..d31c740 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -154,19 +154,6 @@ - -
-

- -

- -
- - -
@@ -177,7 +164,6 @@ const version = defaultSettings.version function goTarget(url) { window.open(url, '__blank') } -const open = ref(true) const promoteList2 = ref([ { id: 1, diff --git a/src/views/login.vue b/src/views/login.vue index 67949cc..c0c0bb7 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,56 +1,71 @@