qsh 3 months ago
parent 5eccb83e3f
commit 076f301920
  1. 10
      src/permission.js
  2. 10
      src/router/modules/remaining.ts
  3. 8
      src/views/Basic/Role/Comp/ReportDaily.vue
  4. 65
      src/views/Login/MPLogin.vue

@ -14,7 +14,15 @@ const { start, done } = useNProgress()
const { loadStart, loadDone } = usePageLoading() const { loadStart, loadDone } = usePageLoading()
// 路由不重定向白名单 // 路由不重定向白名单
const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/swagger'] const whiteList = [
'/login',
'/mp-login',
'/social-login',
'/auth-redirect',
'/bind',
'/register',
'/swagger'
]
// 路由加载前 // 路由加载前
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {

@ -161,6 +161,16 @@ const remainingRouter: AppRouteRecordRaw[] = [
noTagsView: true noTagsView: true
} }
}, },
{
path: '/mp-login',
component: () => import('@/views/Login/MPLogin.vue'),
name: 'MPLogin',
meta: {
hidden: true,
title: '用户绑定',
noTagsView: true
}
},
{ {
path: '/sso', path: '/sso',
component: () => import('@/views/Login/Login.vue'), component: () => import('@/views/Login/Login.vue'),

@ -1,6 +1,13 @@
<template> <template>
<div class="pl-20px pr-20px"> <div class="pl-20px pr-20px">
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading"> <el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading">
<el-form-item label="开启通知">
<el-radio-group v-model="form.kaiqitongzhi">
<el-radio :label="1"> 开启 </el-radio>
<el-radio :label="0"> 关闭 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发送途径"> <el-form-item label="发送途径">
<el-checkbox-group v-model="form.fasongtujing"> <el-checkbox-group v-model="form.fasongtujing">
<el-checkbox :label="1">系统通知</el-checkbox> <el-checkbox :label="1">系统通知</el-checkbox>
@ -96,6 +103,7 @@ async function getReportInfo() {
try { try {
formLoading.value = true formLoading.value = true
form.value = { form.value = {
kaiqitongzhi: 1,
fasongtujing: [1, 2], fasongtujing: [1, 2],
sendTime: '21:00:00', sendTime: '21:00:00',
sendContent: [21, 22, 23] sendContent: [21, 22, 23]

@ -0,0 +1,65 @@
<template>
<div class="p-20px">
<p class="mb-30px font-bold text-20px">微信授权登陆</p>
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto">
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名" />
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入密码" show-password type="password" />
</el-form-item>
</el-form>
<el-button type="primary" class="w-full" @click="onSubmit">授权登陆</el-button>
<div v-if="form.code">code: {{ form.code }}</div>
</div>
</template>
<script setup name="MPLogin">
const form = ref({
code: undefined,
username: undefined,
password: undefined
})
const formRef = ref()
const rules = {
username: { required: true, message: '用户名不可为空', trigger: 'blur' },
password: { required: true, message: '密码不可为空', trigger: 'blur' }
}
//
const WX_AUTH_URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?'
// -
const REDIRECT = '#wechat_redirect'
const params = ref({
appid: 'wxf87aa1f474c0494f', // APP ID
redirect_uri: ``, // 使 urlEncode
response_type: 'code', //
scope: 'snsapi_base' // snsapi_base open id snsapi_userinfo
// state:'code', // a-zA-Z0-9128
})
function onSubmit() {
// code
if (!form.value.code) {
const access_url = WX_AUTH_URL + `${new URLSearchParams(params.value)}` + REDIRECT
location.href = access_url
} else {
alert(`授权成功!`)
}
}
onMounted(() => {
const uri = location.origin + location.pathname
params.value.redirect_uri = encodeURI(uri)
//
const param = new URLSearchParams(location.search)
form.value.code = param.get('code')
if (!form.value.code) {
const access_url = WX_AUTH_URL + `${new URLSearchParams(params.value)}` + REDIRECT
location.href = access_url
}
})
</script>
<style lang="scss" scoped></style>
Loading…
Cancel
Save