自助借阅登陆

master
lion 1 day ago
parent 88e1e9747d
commit da0ab68457

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.content_box[data-v-163b6a9e]{background:#e9f5f3;width:100vw;height:100vh;position:relative;padding:61px 156px 0 156px}.content_box .content_box_header[data-v-163b6a9e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;position:relative}.content_box .content_box_header .content_box_header_logout[data-v-163b6a9e]{position:absolute;right:0;top:0;padding:8px 20px;background:#d6eade;border-radius:24px;font-size:16px;color:#006756;cursor:pointer}.content_box .content_box_bottom_name[data-v-163b6a9e]{margin:0 auto}.content_box .content_box_body[data-v-163b6a9e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;z-index:99;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin-top:10%;padding:0 15%}.content_box .content_box_body .content_box_body_btn .content_box_body_btn_img[data-v-163b6a9e]{width:413.6px;height:292px}.content_box .content_box_body--login[data-v-163b6a9e]{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-top:8%}.content_box .login-panel[data-v-163b6a9e]{width:520px;max-width:90vw;background:hsla(0,0%,100%,.92);border-radius:10px;padding:48px 40px 40px;-webkit-box-shadow:0 8px 24px rgba(0,103,86,.12);box-shadow:0 8px 24px rgba(0,103,86,.12)}.content_box .login-panel[data-v-163b6a9e] .el-input__inner{height:48px;line-height:48px;font-size:16px}.content_box .login-panel .login-panel_btn[data-v-163b6a9e]{margin-top:24px;cursor:pointer}.content_box .login-panel .login-panel_btn .login-panel_btn_inner[data-v-163b6a9e]{width:180px;height:55px;background:-webkit-gradient(linear,left bottom,left top,from(#066c5b),to(#79c4b7));background:linear-gradient(0deg,#066c5b,#79c4b7);-webkit-box-shadow:0 1px 10px 0 rgba(0,103,86,.35);box-shadow:0 1px 10px 0 rgba(0,103,86,.35);border-radius:10px;font-size:18px;font-family:PingFang SC;font-weight:400;color:#fff;line-height:55px;text-align:center;margin:0 auto}.content_box .login-panel .login-panel_btn .login-panel_btn_inner.is-loading[data-v-163b6a9e]{opacity:.8;pointer-events:none}.content_box .content_box_bottom[data-v-163b6a9e]{background:url(../../static/img/index_bottom.4e5a1226.png) no-repeat;width:100%;height:50%;background-size:cover;position:fixed;left:0;bottom:0;z-index:1}.content_box .content_box_bottom_right[data-v-163b6a9e]{background:url(../../static/img/index_bottom_right.7e0b39d8.png) no-repeat;width:395px;height:145px;background-size:cover;position:fixed;right:0;bottom:0;z-index:1}

@ -1 +0,0 @@
.content_box[data-v-3b18b798]{background:#e9f5f3;width:100vw;height:100vh;position:relative;padding:61px 156px 0 156px}.content_box .content_box_bottom_logo[data-v-3b18b798]{position:absolute;left:156px;top:60px!important}.content_box .content_box_header[data-v-3b18b798]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.content_box .content_box_header .content_box_header_text[data-v-3b18b798]{font-size:36px;font-family:MicrosoftYaHei;font-weight:400;color:#333;line-height:60px}.content_box .content_box_bottom_name[data-v-3b18b798]{margin:0 auto}.content_box .content_box_body[data-v-3b18b798]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;z-index:99;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin-top:10%;padding:0 15%}.content_box .content_box_body .content_box_body_btn .content_box_body_btn_img[data-v-3b18b798]{width:413.6px;height:292px}.content_box .content_box_bottom[data-v-3b18b798]{background:url(../../static/img/index_bottom.4e5a1226.png) no-repeat;width:100%;height:50%;background-size:cover;position:fixed;left:0;bottom:0;z-index:1}.content_box .content_box_bottom_right[data-v-3b18b798]{background:url(../../static/img/index_bottom_right.7e0b39d8.png) no-repeat;width:395px;height:145px;background-size:cover;position:fixed;right:0;bottom:0;z-index:1}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6fe7362b"],{a434:function(t,e,n){"use strict";var r=n("23e7"),o=n("23cb"),a=n("a691"),i=n("50c4"),u=n("7b0b"),f=n("65f0"),c=n("8418"),d=n("1dde"),l=n("ae40"),s=d("splice"),h=l("splice",{ACCESSORS:!0,0:0,1:2}),b=Math.max,p=Math.min,y=9007199254740991,g="Maximum allowed length exceeded";r({target:"Array",proto:!0,forced:!s||!h},{splice:function(t,e){var n,r,d,l,s,h,v=u(this),w=i(v.length),m=o(t,w),S=arguments.length;if(0===S?n=r=0:1===S?(n=0,r=w-m):(n=S-2,r=p(b(a(e),0),w-m)),w+n-r>y)throw TypeError(g);for(d=f(v,r),l=0;l<r;l++)s=m+l,s in v&&c(d,l,v[s]);if(d.length=r,n<r){for(l=m;l<w-r;l++)s=l+r,h=l+n,s in v?v[h]=v[s]:delete v[h];for(l=w;l>w-r+n;l--)delete v[l-1]}else if(n>r)for(l=w-r;l>m;l--)s=l+r-1,h=l+n-1,s in v?v[h]=v[s]:delete v[h];for(l=0;l<n;l++)v[l+m]=arguments[l+2];return v.length=w-r+n,d}})},b85c:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));n("a4d3"),n("e01a"),n("d28b"),n("d3b7"),n("3ca3"),n("ddb0");var r=n("06c5");function o(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Object(r["a"])(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,a=function(){};return{s:a,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){f=!0,i=t},f:function(){try{u||null==n["return"]||n["return"]()}finally{if(f)throw i}}}}},e9c4:function(t,e,n){var r=n("23e7"),o=n("d066"),a=n("d039"),i=o("JSON","stringify"),u=/[\uD800-\uDFFF]/g,f=/^[\uD800-\uDBFF]$/,c=/^[\uDC00-\uDFFF]$/,d=function(t,e,n){var r=n.charAt(e-1),o=n.charAt(e+1);return f.test(t)&&!c.test(o)||c.test(t)&&!f.test(r)?"\\u"+t.charCodeAt(0).toString(16):t},l=a((function(){return'"\\udf06\\ud834"'!==i("\udf06\ud834")||'"\\udead"'!==i("\udead")}));i&&r({target:"JSON",stat:!0,forced:l},{stringify:function(t,e,n){var r=i.apply(null,arguments);return"string"==typeof r?r.replace(u,d):r}})}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-23d44527"],{2321:function(e,t,o){"use strict";o("7ac7")},"4dfe":function(e,t,o){},5755:function(e,t,o){"use strict";o("4dfe")},"7ac7":function(e,t,o){},"9ed6":function(e,t,o){"use strict";o.r(t);var s=function(){var e=this,t=e.$createElement,o=e._self._c||t;return e.showLogin?o("div",{staticClass:"login-container"},[o("vue-particles",{attrs:{color:"#ffffff",particleOpacity:.7,particlesNumber:80,shapeType:"circle",particleSize:4,linesColor:"#ffffff",linesWidth:1,lineLinked:!0,lineOpacity:.4,linesDistance:150,moveSpeed:3,hoverEffect:!0,hoverMode:"grab",clickEffect:!0,clickMode:"push"}}),o("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.loginRules,"auto-complete":"on","label-position":"left"}},[o("div",{staticClass:"title-container"},[o("h3",{staticClass:"title"},[e._v(e._s(e.title))])]),o("el-form-item",{attrs:{prop:"username"}},[o("span",{staticClass:"svg-container"},[o("svg-icon",{attrs:{"icon-class":"user"}})],1),o("el-input",{ref:"username",attrs:{placeholder:"请输入登录名",name:"username",type:"text",tabindex:"1","auto-complete":"on"},model:{value:e.loginForm.username,callback:function(t){e.$set(e.loginForm,"username",t)},expression:"loginForm.username"}})],1),o("el-form-item",{attrs:{prop:"password"}},[o("span",{staticClass:"svg-container"},[o("svg-icon",{attrs:{"icon-class":"password"}})],1),o("el-input",{key:e.passwordType,ref:"password",attrs:{type:e.passwordType,placeholder:"请输入密码",name:"password",tabindex:"2","auto-complete":"on"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}}),o("span",{staticClass:"show-pwd",on:{click:e.showPwd}},[o("svg-icon",{attrs:{"icon-class":"password"===e.passwordType?"eye":"eye-open"}})],1)],1),o("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v("登录")])],1)],1):e._e()},n=[],r=o("61f7"),i=o("83d6"),a={name:"Login",data:function(){var e=function(e,t,o){Object(r["b"])(t)?o():o(new Error("请正确输入登录名"))},t=function(e,t,o){t.length<6?o(new Error("密码输入错误")):o()};return{title:"",showLogin:!0,loginForm:{username:"",password:""},loginRules:{username:[{required:!0,trigger:"blur",validator:e}],password:[{required:!0,trigger:"blur",validator:t}]},loading:!1,passwordType:"password",redirect:void 0}},watch:{$route:{handler:function(e){this.redirect=e.query&&e.query.redirect},immediate:!0}},created:function(){this.title=i.title},methods:{showPwd:function(){var e=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick((function(){e.$refs.password.focus()}))},handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return console.log("error submit!!"),!1;e.loading=!0,e.$store.dispatch("user/login",e.loginForm).then((function(){e.$router.push({path:e.redirect||"/"}),e.loading=!1})).catch((function(){e.loading=!1}))}))}}},l=a,c=(o("2321"),o("5755"),o("2877")),d=Object(c["a"])(l,s,n,!1,null,"93afe56e",null);t["default"]=d.exports}}]);
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7f4c2ce9"],{2321:function(e,t,o){"use strict";o("7ac7")},"4dfe":function(e,t,o){},5755:function(e,t,o){"use strict";o("4dfe")},"7ac7":function(e,t,o){},"9ed6":function(e,t,o){"use strict";o.r(t);var s=function(){var e=this,t=e.$createElement,o=e._self._c||t;return e.showLogin?o("div",{staticClass:"login-container"},[o("vue-particles",{attrs:{color:"#ffffff",particleOpacity:.7,particlesNumber:80,shapeType:"circle",particleSize:4,linesColor:"#ffffff",linesWidth:1,lineLinked:!0,lineOpacity:.4,linesDistance:150,moveSpeed:3,hoverEffect:!0,hoverMode:"grab",clickEffect:!0,clickMode:"push"}}),o("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.loginRules,"auto-complete":"on","label-position":"left"}},[o("div",{staticClass:"title-container"},[o("h3",{staticClass:"title"},[e._v(e._s(e.title))])]),o("el-form-item",{attrs:{prop:"username"}},[o("span",{staticClass:"svg-container"},[o("svg-icon",{attrs:{"icon-class":"user"}})],1),o("el-input",{ref:"username",attrs:{placeholder:"请输入登录名",name:"username",type:"text",tabindex:"1","auto-complete":"on"},model:{value:e.loginForm.username,callback:function(t){e.$set(e.loginForm,"username",t)},expression:"loginForm.username"}})],1),o("el-form-item",{attrs:{prop:"password"}},[o("span",{staticClass:"svg-container"},[o("svg-icon",{attrs:{"icon-class":"password"}})],1),o("el-input",{key:e.passwordType,ref:"password",attrs:{type:e.passwordType,placeholder:"请输入密码",name:"password",tabindex:"2","auto-complete":"on"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}}),o("span",{staticClass:"show-pwd",on:{click:e.showPwd}},[o("svg-icon",{attrs:{"icon-class":"password"===e.passwordType?"eye":"eye-open"}})],1)],1),o("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v("登录")])],1)],1):e._e()},n=[],r=o("61f7"),i=o("83d6"),a={name:"Login",data:function(){var e=function(e,t,o){Object(r["b"])(t)?o():o(new Error("请正确输入登录名"))},t=function(e,t,o){t.length<6?o(new Error("密码输入错误")):o()};return{title:"",showLogin:!0,loginForm:{username:"",password:""},loginRules:{username:[{required:!0,trigger:"blur",validator:e}],password:[{required:!0,trigger:"blur",validator:t}]},loading:!1,passwordType:"password",redirect:void 0}},watch:{$route:{handler:function(e){this.redirect=e.query&&e.query.redirect},immediate:!0}},created:function(){this.title=i.title},methods:{showPwd:function(){var e=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick((function(){e.$refs.password.focus()}))},handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return console.log("error submit!!"),!1;e.loading=!0,e.$store.dispatch("user/login",e.loginForm).then((function(){e.$router.push({path:e.redirect||"/"}),e.loading=!1})).catch((function(){e.loading=!1}))}))}}},l=a,c=(o("2321"),o("5755"),o("2877")),p=Object(c["a"])(l,s,n,!1,null,"93afe56e",null);t["default"]=p.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-d6962c30"],{"0ee8":function(t,n,o){},2889:function(t,n,o){"use strict";o.r(n);var c=function(){var t=this,n=t.$createElement,c=t._self._c||n;return c("div",{staticClass:"content_box"},[t._m(0),c("div",{staticClass:"content_box_body"},[c("div",{staticClass:"content_box_body_btn",on:{click:function(n){return t.todo("/brrow")}}},[c("img",{staticClass:"content_box_body_btn_img",attrs:{src:o("dd44")}})]),c("div",{staticClass:"content_box_body_btn",on:{click:function(n){return t.todo("/return")}}},[c("img",{staticClass:"content_box_body_btn_img",attrs:{src:o("baf9")}})])]),c("div",{staticClass:"content_box_bottom"}),c("div",{staticClass:"content_box_bottom_right"})])},e=[function(){var t=this,n=t.$createElement,c=t._self._c||n;return c("div",{staticClass:"content_box_header"},[c("div",{staticClass:"content_box_bottom_name"},[c("img",{attrs:{src:o("f34e")}})]),c("div",{staticClass:"content_box_header_text"})])}],s={data:function(){return{}},methods:{todo:function(t){this.$router.push(t)}},mounted:function(){},created:function(){}},i=s,a=(o("34aa"),o("2877")),r=Object(a["a"])(i,c,e,!1,null,"3b18b798",null);n["default"]=r.exports},"34aa":function(t,n,o){"use strict";o("0ee8")},baf9:function(t,n,o){t.exports=o.p+"static/img/index_return.fb2742bb.png"},dd44:function(t,n,o){t.exports=o.p+"static/img/index_brrow.9820ed8d.png"},f34e:function(t,n,o){t.exports=o.p+"static/img/index_name.cc517924.png"}}]);

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -0,0 +1,10 @@
import mobileRequest from '@/utils/mobileRequest'
export function mobileLogin(data) {
return mobileRequest({
url: '/api/mobile/auth/login',
method: 'post',
data,
isLoading: true
})
}

@ -1,45 +1,47 @@
import request from '@/utils/request'
import mobileRequest from '@/utils/mobileRequest'
export function userIndex(params) {
return request({
return mobileRequest({
url: '/api/mobile/other/user-index',
method: 'get',
params
})
}
export function bookIndex(params) {
return mobileRequest({
url: '/api/mobile/other/book-index',
method: 'get',
params
})
}
export function bookDetail(params) {
return request({
return mobileRequest({
url: '/api/mobile/other/book-detail',
method: 'get',
params
})
}
export function bookBorrow(data) {
return request({
return mobileRequest({
url: '/api/mobile/other/book-borrow',
method: 'post',
data
})
}
export function bookReturn(data) {
return request({
return mobileRequest({
url: '/api/mobile/other/book-return',
method: 'post',
data
})
}
export function checkBookBorrow(data) {
return request({
return mobileRequest({
url: '/api/mobile/other/check-book-borrow',
method: 'post',
data

@ -4,11 +4,13 @@ import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import { getMobileToken } from '@/utils/mobileAuth'
import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login','/index','/brrow','/return'] // no redirect whitelist
const whiteList = ['/login'] // admin pages no redirect whitelist
const lendCenterAuthRoutes = ['/brrow', '/return']
router.beforeEach(async(to, from, next) => {
// start progress bar
@ -17,6 +19,21 @@ router.beforeEach(async(to, from, next) => {
// set page title
document.title = getPageTitle(to.meta.title)
// 自助借阅:首页内登录;借书/还书需 token
if (to.path === '/index') {
next()
return
}
if (lendCenterAuthRoutes.includes(to.path)) {
if (!getMobileToken()) {
next(`/index?redirect=${to.path}`)
NProgress.done()
return
}
next()
return
}
// determine whether the user has logged in
const hasToken = getToken()

@ -0,0 +1,15 @@
import Cookies from 'js-cookie'
const MobileTokenKey = 'hjjc_book_mobile_token'
export function getMobileToken() {
return Cookies.get(MobileTokenKey)
}
export function setMobileToken(token) {
return Cookies.set(MobileTokenKey, token)
}
export function removeMobileToken() {
return Cookies.remove(MobileTokenKey)
}

@ -0,0 +1,81 @@
import axios from 'axios'
import { Message, Loading } from 'element-ui'
import { getMobileToken, removeMobileToken } from '@/utils/mobileAuth'
import router from '@/router'
let loading
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
timeout: 5000,
isLoading: true
})
service.interceptors.request.use(
config => {
if (config.isLoading) {
loading = Loading.service({
lock: true,
background: 'rgba(0,0,0,0.4)',
text: '正在加载中...'
})
}
const token = getMobileToken()
if (token) {
config.headers['Authorization'] = 'Bearer ' + token
}
return config
},
error => {
return Promise.reject(error)
}
)
service.interceptors.response.use(
response => {
if (loading) {
loading.close()
}
const res = response.data
if (res.hasOwnProperty('errcode')) {
Message({
message: res.errmsg || 'Error',
type: 'error',
duration: 5 * 1000
})
return Promise.reject(new Error(res.errmsg || 'Error'))
}
return res
},
error => {
if (loading) {
loading.close()
}
if (error.response && (error.response.status === 401 || error.response.status === 403)) {
removeMobileToken()
Message({
message: '登录已失效,请重新登录',
type: 'error',
duration: 3 * 1000
})
if (router.currentRoute.path !== '/index') {
router.replace({
path: '/index',
query: { redirect: router.currentRoute.fullPath }
})
}
} else {
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
})
}
return Promise.reject(error)
}
)
export default service

@ -1,18 +1,48 @@
<template>
<div class="content_box">
<!-- <div class="content_box_bottom_logo">-->
<!-- <img src="../../assets/center/index_logo.png" />-->
<!-- </div>-->
<div class="content_box_header">
<div class="content_box_bottom_name">
<img src="../../assets/center/index_name.png" />
</div>
<div class="content_box_header_text">
<div v-if="isLoggedIn" class="content_box_header_logout" @click="handleLogout">
退出登录
</div>
</div>
<!-- 未登录首页内登录 -->
<div v-if="!isLoggedIn" class="content_box_body content_box_body--login">
<div class="login-panel">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<el-form-item prop="username">
<el-input
ref="username"
v-model="loginForm.username"
placeholder="请输入用户名"
prefix-icon="el-icon-user"
/>
</el-form-item>
<el-form-item prop="password">
<el-input
ref="password"
v-model="loginForm.password"
type="password"
placeholder="请输入密码"
prefix-icon="el-icon-lock"
show-password
@keyup.enter.native="handleLogin"
/>
</el-form-item>
<div class="login-panel_btn" @click="handleLogin">
<div class="login-panel_btn_inner" :class="{ 'is-loading': loading }">
{{ loading ? '登录中...' : '登录' }}
</div>
</div>
</el-form>
</div>
</div>
<div class="content_box_body">
<!-- 已登录借书 / 还书 -->
<div v-else class="content_box_body">
<div class="content_box_body_btn" @click="todo('/brrow')">
<img class="content_box_body_btn_img" src="../../assets/center/index_brrow.png" />
</div>
@ -21,102 +51,212 @@
</div>
</div>
<div class="content_box_bottom">
</div>
<div class="content_box_bottom_right">
</div>
<div class="content_box_bottom"></div>
<div class="content_box_bottom_right"></div>
</div>
</template>
<script>
export default {
data() {
return {}
},
methods: {
todo(route) {
this.$router.push(route)
}
},
mounted() {
import { mobileLogin } from '@/api/lendCenter/auth'
import { getMobileToken, setMobileToken, removeMobileToken } from '@/utils/mobileAuth'
export default {
data() {
return {
isLoggedIn: false,
loginForm: {
username: '',
password: ''
},
loginRules: {
username: [{
required: true,
message: '请输入用户名',
trigger: 'blur'
}],
password: [{
required: true,
message: '请输入密码',
trigger: 'blur'
}]
},
loading: false,
redirect: '/index'
}
},
watch: {
$route: {
handler(route) {
this.redirect = (route.query && route.query.redirect) || '/index'
this.isLoggedIn = !!getMobileToken()
},
immediate: true
}
},
created() {
this.isLoggedIn = !!getMobileToken()
},
mounted() {
if (!this.isLoggedIn) {
this.$nextTick(() => {
this.$refs.username && this.$refs.username.focus()
})
}
},
methods: {
todo(route) {
this.$router.push(route)
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (!valid) {
return false
}
this.loading = true
mobileLogin({
username: this.loginForm.username.trim(),
password: this.loginForm.password
}).then(res => {
const token = res.access_token || (res.data && res.data.access_token)
if (!token) {
this.$Message.error('登录失败,未获取到 token')
return
}
setMobileToken(token)
this.isLoggedIn = true
this.$Message.success('登录成功')
if (this.redirect && this.redirect !== '/index') {
this.$router.replace(this.redirect)
}
}).catch(() => {}).finally(() => {
this.loading = false
})
})
},
created() {}
handleLogout() {
removeMobileToken()
this.isLoggedIn = false
this.loginForm.password = ''
this.$router.replace('/index')
}
}
}
</script>
<style lang="scss" scoped>
.content_box {
background: #e9f5f3;
width: 100vw;
height: 100vh;
.content_box {
background: #e9f5f3;
width: 100vw;
height: 100vh;
position: relative;
padding: 61px 156px 0px 156px;
.content_box_header {
display: flex;
align-items: center;
flex-direction: column;
position: relative;
padding: 61px 156px 0px 156px;
.content_box_bottom_logo {
.content_box_header_logout {
position: absolute;
left: 156px;
top:60px !important;
right: 0;
top: 0;
padding: 8px 20px;
background: #d6eade;
border-radius: 24px;
font-size: 16px;
color: #006756;
cursor: pointer;
}
}
.content_box_header {
display: flex;
align-items: center;
flex-direction: column;
.content_box_bottom_name {
margin: 0 auto;
}
.content_box_header_text {
font-size: 36px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: #333333;
line-height: 60px;
.content_box_body {
display: flex;
flex-direction: row;
align-items: center;
position: relative;
z-index: 99;
justify-content: space-between;
margin-top: 10%;
padding: 0 15%;
.content_box_body_btn {
.content_box_body_btn_img {
width: 517*.8px;
height: 365*.8px;
}
}
.content_box_bottom_name {
margin: 0 auto;
&--login {
justify-content: center;
margin-top: 8%;
}
}
.content_box_body {
display: flex;
flex-direction: row;
align-items: center;
position: relative;
z-index: 99;
justify-content: space-between;
margin-top: 10%;
padding: 0 15%;
.content_box_body_btn {
.content_box_body_btn_img {
width: 517*.8px;
height: 365*.8px;
}
}
.login-panel {
width: 520px;
max-width: 90vw;
background: rgba(255, 255, 255, 0.92);
border-radius: 10px;
padding: 48px 40px 40px;
box-shadow: 0px 8px 24px rgba(0, 103, 86, 0.12);
::v-deep .el-input__inner {
height: 48px;
line-height: 48px;
font-size: 16px;
}
.login-panel_btn {
margin-top: 24px;
cursor: pointer;
.login-panel_btn_inner {
width: 180px;
height: 55px;
background: linear-gradient(0deg, #066c5b, #79c4b7);
box-shadow: 0px 1px 10px 0px rgba(0, 103, 86, 0.35);
border-radius: 10px;
font-size: 18px;
font-family: PingFang SC;
font-weight: 400;
color: #FFFFFF;
line-height: 55px;
text-align: center;
margin: 0 auto;
.content_box_bottom {
background: url("../../assets/center/index_bottom.png") no-repeat;
width: 100%;
height: 50%;
background-size: cover;
position: fixed;
left: 0;
bottom: 0;
z-index: 1;
&.is-loading {
opacity: 0.8;
pointer-events: none;
}
}
}
}
.content_box_bottom_right {
background: url("../../assets/center/index_bottom_right.png") no-repeat;
width: 395px;
height: 145px;
background-size: cover;
position: fixed;
right: 0;
bottom: 0;
z-index: 1;
}
.content_box_bottom {
background: url("../../assets/center/index_bottom.png") no-repeat;
width: 100%;
height: 50%;
background-size: cover;
position: fixed;
left: 0;
bottom: 0;
z-index: 1;
}
.content_box_bottom_right {
background: url("../../assets/center/index_bottom_right.png") no-repeat;
width: 395px;
height: 145px;
background-size: cover;
position: fixed;
right: 0;
bottom: 0;
z-index: 1;
}
}
</style>

Loading…
Cancel
Save