Browse Source

管理员登录相关

pull/14/head
longchao 4 weeks ago
parent
commit
a6b3d489cb
  1. 161
      package-lock.json
  2. 8
      src/router/index.js
  3. 2
      src/views/HomeView.vue
  4. 382
      src/views/adminLogin.vue
  5. 3
      src/views/paymentMethod.vue

161
package-lock.json

@ -15,6 +15,7 @@
"regenerator-runtime": "^0.14.1",
"vue": "^2.6.14",
"vue-clickaway": "^2.2.2",
"vue-qr": "^4.0.9",
"vue-router": "^3.5.1",
"vuex": "^3.6.2"
},
@ -3874,8 +3875,7 @@
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/base64-js": {
"version": "1.5.1",
@ -4989,6 +4989,21 @@
}
}
},
"node_modules/decompress-response": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
"license": "MIT",
"dependencies": {
"mimic-response": "^3.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmmirror.com/deep-is/-/deep-is-0.1.4.tgz",
@ -6497,8 +6512,7 @@
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/fsevents": {
"version": "2.3.3",
@ -7113,7 +7127,6 @@
"resolved": "https://registry.npmmirror.com/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
@ -7122,8 +7135,7 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ipaddr.js": {
"version": "2.2.0",
@ -7377,6 +7389,12 @@
"@sideway/pinpoint": "^2.0.0"
}
},
"node_modules/js-binary-schema-parser": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz",
"integrity": "sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg==",
"license": "MIT"
},
"node_modules/js-message": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/js-message/-/js-message-1.0.7.tgz",
@ -7954,6 +7972,18 @@
"node": ">=6"
}
},
"node_modules/mimic-response": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mini-css-extract-plugin": {
"version": "2.9.2",
"resolved": "https://registry.npmmirror.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.2.tgz",
@ -8375,7 +8405,6 @@
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"dependencies": {
"wrappy": "1"
}
@ -8541,6 +8570,12 @@
"node": ">=6"
}
},
"node_modules/parenthesis": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/parenthesis/-/parenthesis-3.1.8.tgz",
"integrity": "sha512-KF/U8tk54BgQewkJPvB4s/US3VQY68BRDpH638+7O/n58TpnwiwnOtGIOsT2/i+M78s61BBpeC83STB88d8sqw==",
"license": "MIT"
},
"node_modules/parse-json": {
"version": "5.2.0",
"resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz",
@ -10271,6 +10306,51 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"node_modules/simple-concat": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/simple-get": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"decompress-response": "^6.0.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
}
},
"node_modules/sirv": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/sirv/-/sirv-2.0.4.tgz",
@ -10459,6 +10539,15 @@
"safe-buffer": "~5.2.0"
}
},
"node_modules/string-split-by": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/string-split-by/-/string-split-by-1.0.0.tgz",
"integrity": "sha512-KaJKY+hfpzNyet/emP81PJA9hTVSfxNLS9SFTWxdCnnW1/zOOwiV248+EfoX7IQFcBaOp4G5YE6xTJMF+pLg6A==",
"license": "MIT",
"dependencies": {
"parenthesis": "^3.1.5"
}
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
@ -11209,6 +11298,59 @@
}
}
},
"node_modules/vue-qr": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/vue-qr/-/vue-qr-4.0.9.tgz",
"integrity": "sha512-pAISV94T0MNEYA3NGjykUpsXRE2QfaNxlu9ZhEL6CERgqNc21hJYuP3hRVzAWfBQlgO18DPmZTbrFerJC3+Ikw==",
"license": "MIT",
"dependencies": {
"glob": "^8.0.1",
"js-binary-schema-parser": "^2.0.2",
"simple-get": "^4.0.1",
"string-split-by": "^1.0.0"
}
},
"node_modules/vue-qr/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/vue-qr/node_modules/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/vue-qr/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/vue-router": {
"version": "3.6.5",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz",
@ -11807,8 +11949,7 @@
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/ws": {
"version": "7.5.10",

8
src/router/index.js

@ -14,7 +14,7 @@ const routes = [
component: () => import('../views/login.vue'),
meta: {
hideBreadcrumb: true, // 首页不显示面包屑
requiresAuth:true
requiresAuth:false
}
},
{
@ -123,13 +123,13 @@ const router = new VueRouter({
router.beforeEach((to, from, next) => {
// 检查本地存储是否有nick
const hasNick = localStorage.getItem('nick');
// 如果有nick且访问的是根路径,则重定向到/hospitalManage
if (hasNick && to.path === '/') {
next('/hospitalManage');
return;
}
// 如果没有nick且尝试访问需要认证的页面(如/hospitalManage),则重定向到首页
if (!hasNick && to.meta.requiresAuth) {
next('/');
@ -150,7 +150,7 @@ router.beforeEach((to, from, next) => {
} else {
store.commit('SET_HEADER', true); // 其他页面显示顶部
}
next();
});

2
src/views/HomeView.vue

@ -147,7 +147,7 @@ export default {
allChecked: false,
pageShow:false,
doctorIds:[],
payList:[]
payList:false
}
},
components: {

382
src/views/adminLogin.vue

@ -0,0 +1,382 @@
<template>
<div class="index_loginPage__K_bGK login-wrap">
<div class="index_banner__1d8CU">
<div class="index_rootContainer">
<b class="title">扫码登录</b>
<p class="sub_title mt32">打开 <b>微信</b> 扫码登录</p>
<div class=" mb32" v-if="status == 'waiting'">
<vue-qr :text="qrCodeUrl" :size="192" :dot-scale="1"></vue-qr>
</div>
<div class="refreshCode" v-if="status == 'expired'" @click="refreshCode">
<i class="el-icon-refresh"></i>
刷新二维码
</div>
<!-- :logo-src="logoUrl"
:logo-scale="0.2" -->
<div class="attention gap10">
<el-checkbox v-model="checked"></el-checkbox>
<b>登录即代表同意 <a @click="jumpDoc">用户协议</a> <a @click="jumpDoc">隐私条款</a></b>
</div>
<p class="tip">若无账号请先联系客服注册</p>
</div>
</div>
<div class="style_footerWrapper">
<div class="left flex">
<img src="@/assets/doctor_h5.svg" alt="">
<div>
<b>手机端</b>
<p>微信扫码体验</p>
</div>
</div>
<div class="center">
<p><b>入驻指南</b>个人入驻 组织医院等入驻</p>
<p><b>人工咨询</b>扫左侧码进入手机端-我的-页面底部联系我们</p>
</div>
<div class="right">
<p><b>网站备案</b>© 2012-2025 something , <a href="">Inc. All rights 测试</a></p>
<p></p>
</div>
</div>
</div>
</template>
<script>
import VueQr from 'vue-qr'
export default {
components: {
VueQr
},
data() {
return {
checked: true,
qrCodeUrl: 'https://example.com',
token: '',
status: 'expired', // waiting, scanned, confirmed, expired, error
loginTime:'',
}
},
created(){
// this.generateQRCode()
},
beforeDestroy() {
this.clearTimers();
},
methods: {
jumpDoc() {
},
//
refreshCode() {
},
async generateQRCode() {
this.status = 'waiting';
this.qrCodeUrl = '';
return
// try {
// await this.$http('POST', '/api/admin/generate_qrcode', {
// device_type: 'web',
// timestamp: Date.now()
// }).then(response => {
// this.token = response.data.token;
// this.qrCodeUrl = response.data.qr_code_url;
// //
// this.startPolling();
// // 5
// this.setExpireTimer();
// }).catch(error => {
// console.error(':', error);
// this.status = 'error';
// });
// } catch (error) {
// console.error(':', error);
// this.status = 'error';
// }
},
//
startPolling() {
this.clearTimers();
// this.pollInterval = setInterval(async () => {
// if (this.status === 'confirmed' || this.status === 'expired' || this.status === 'error') {
// this.clearTimers();
// return;
// }
// try {
// await this.$http('POST', '/api/admin/check_scan_status', {
// token: this.token
// }).then(response => {
// this.status = response.data.status;
// if (response.data.status === 'scanned') {
// //
// setTimeout(() => {
// this.handleLoginConfirm();
// }, 2000);
// } else if (response.data.status === 'confirmed') {
// this.handleLoginSuccess(response.data);
// } else if (response.data.status === 'expired') {
// this.status = 'expired';
// this.clearTimers();
// }
// }).catch(error => {
// console.error(':', error);
// this.status = 'error';
// this.clearTimers();
// });
// } catch (error) {
// console.error(':', error);
// this.status = 'error';
// this.clearTimers();
// }
// }, 2000);
},
//
async handleLoginConfirm() {
// try {
// await this.$http('POST', '/api/admin/confirm_login', {
// token: this.token
// }).then(response => {
// if (response.data.success) {
// this.handleLoginSuccess(response.data);
// } else {
// this.status = 'expired';
// }
// }).catch(error => {
// console.error(':', error);
// this.status = 'error';
// });
// } catch (error) {
// console.error(':', error);
// this.status = 'error';
// }
},
//
handleLoginSuccess(data) {
this.status = 'confirmed';
this.userInfo = data.user_info;
this.loginTime = new Date().toLocaleString();
//
localStorage.setItem('authToken', data.auth_token);
localStorage.setItem('nick', JSON.stringify(data.nick));
localStorage.setItem('userInfo', JSON.stringify(data.user_info));
setTimeout(() => {
this.isLoggedIn = true;
this.$emit('login-success', data);
}, 1000);
},
//
setExpireTimer() {
this.expireTimer = setTimeout(() => {
if (this.status !== 'confirmed') {
this.status = 'expired';
this.clearTimers();
}
}, 5 * 60 * 1000); // 5
},
//
clearTimers() {
if (this.pollInterval) {
clearInterval(this.pollInterval);
this.pollInterval = null;
}
if (this.expireTimer) {
clearTimeout(this.expireTimer);
this.expireTimer = null;
}
},
}
}
</script>
<style lang="scss" scoped>
.index_banner__1d8CU {
align-items: center;
background-image: url(../assets/login_backImg.svg);
background-size: cover;
display: flex;
flex: 1 1;
justify-content: flex-end;
-webkit-transition: padding-right .5s;
transition: padding-right .5s;
width: 100%;
}
.index_rootContainer {
background: #fff;
border-radius: 16px;
box-shadow: 0 6px 40px 0 rgba(53, 76, 166, .08);
display: inline-block;
flex-shrink: 0;
height: 480px;
overflow: hidden;
width: 432px;
margin-right: 192px;
padding: 40px;
box-sizing: border-box;
display: flex;
flex-direction: column;
.title {
font-family: Microsoft YaHei;
font-size: 22px;
font-weight: bold;
line-height: normal;
text-align: center;
letter-spacing: 0.08em;
color: #1E2226;
}
.sub_title {
font-family: Microsoft YaHei;
font-size: 12px;
font-weight: normal;
line-height: normal;
letter-spacing: 0.08em;
color: #626573;
margin-top: 32px;
margin-bottom: 12px;
}
.img {
width: 192px;
height: 192px;
background: #006AFF;
margin: 0 auto;
margin-bottom: 32px;
}
}
.attention,
.tip {
font-size: 12px;
font-weight: normal;
line-height: 13px;
letter-spacing: 0.08em;
color: #626573;
text-align: center;
display: flex;
justify-content: center;
b {
font-size: 12px;
font-weight: normal;
a {
text-decoration: none;
color: #006AFF;
cursor: pointer;
}
}
}
.attention {
margin-bottom: 12px;
}
.refreshCode {
width: 172px;
height: 172px;
background: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
gap: 10px;
justify-content: center;
align-items: center;
color: #626573;
font-family: Arial, sans-serif;
font-weight: bold;
cursor: pointer;
margin: 20px auto;
i{
font-size: 28px;
}
}
@media(max-width: 1420px) {
.index_rootContainer {
margin-right: 102px;
}
}
.style_footerWrapper {
background: #f3f4f6;
display: flex;
align-items: center;
justify-content: center;
padding: 46px 49px;
width: 100%;
height: 192px;
box-sizing: border-box;
gap: 72px;
b {
font-size: 12px;
font-weight: bold;
line-height: 13px;
letter-spacing: 0.08em;
color: #1E2226;
}
.left {
gap: 12px;
div {
display: flex;
flex-direction: column;
gap: 8px;
text-align: left;
}
img {
width: 97px;
height: 100px;
}
}
.center,
.right {
display: flex;
flex-direction: column;
gap: 24px;
text-align: left;
p {
display: flex;
gap: 8px;
}
}
}
.style_iconWrapper__3qi7l {
flex-basis: 80px;
}
.index_loginPage__K_bGK {
display: flex;
flex-direction: column;
height: 100vh;
min-width: 1200px;
}
#ecomLoginForm {
height: 280px;
}
</style>

3
src/views/paymentMethod.vue

@ -135,7 +135,8 @@ export default {
async getBindpayList() {
await this.$http('POST', '/api/admin/get_pay_list', {
doctor_id: this.doctor_id,
depart_id: this.depart_id
depart_id: this.depart_id,
index:1
}).then(response => {
this.payList = response.data;
}).catch(error => {

Loading…
Cancel
Save