Commit 8035bbed by zhaopanyu

zpy 10.9

parent 77d756c5
import request from "@/utils/request";
export function getCode(code) {
return request({
url: "/dd/user/login",
method: "get",
params: { code },
});
}
...@@ -6,17 +6,16 @@ import request from "@/utils/request"; ...@@ -6,17 +6,16 @@ import request from "@/utils/request";
export function getUserInfo(userId) { export function getUserInfo(userId) {
return request({ return request({
url: '/school/teacher/queryOne/' + userId, url: "/school/teacher/queryOne/" + userId,
method: 'get' method: "get",
}) });
} }
// 课表信息 // 课表信息
export function getCourseInfo(teacherId) { export function getCourseInfo(teacherId) {
return request({ return request({
url: '/schoolTimeTable/getTimeTable', url: "/schoolTimeTable/getTimeTable",
method: 'get', method: "get",
params: {teacherId} params: { teacherId },
}) });
} }
import Vue from 'vue' import Vue from "vue";
import Cookies from 'js-cookie' import Cookies from "js-cookie";
import Element from 'element-ui' import Element from "element-ui";
import './assets/styles/element-variables.scss' import "./assets/styles/element-variables.scss";
// import '@/assets/styles/element-ui.scss' // import '@/assets/styles/element-ui.scss'
import '@/assets/styles/index.scss' // global css import "@/assets/styles/index.scss"; // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css import "@/assets/styles/ruoyi.scss"; // ruoyi css
import App from './App' import App from "./App";
import store from './store' import store from "./store";
import router from './router' import router from "./router";
import directive from './directive' // directive import directive from "./directive"; // directive
import plugins from './plugins' // plugins import plugins from "./plugins"; // plugins
import {download} from '@/utils/request' import { download } from "@/utils/request";
import moment from "moment"; import moment from "moment";
import './assets/icons' // icon import "./assets/icons"; // icon
import './permission' // permission control import "./permission"; // permission control
import {getDicts} from '@/api/system/dict/data' import { getDicts } from "@/api/system/dict/data";
import {getConfigKey} from '@/api/system/config' import { getConfigKey } from "@/api/system/config";
import {parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree} from '@/utils/ruoyi' import {
import {throttle} from '@/utils/utilLibrary/throttle' parseTime,
resetForm,
addDateRange,
selectDictLabel,
selectDictLabels,
handleTree,
} from "@/utils/ruoyi";
import { throttle } from "@/utils/utilLibrary/throttle";
import { initDingH5RemoteDebug } from "dingtalk-h5-remote-debug";
initDingH5RemoteDebug();
//表格组件 //表格组件
import Table from '@/components/Table' import Table from "@/components/Table";
// 分页组件 // 分页组件
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
// 自定义表格工具组件 // 自定义表格工具组件
import RightToolbar from '@/components/RightToolbar' import RightToolbar from "@/components/RightToolbar";
// 富文本组件 // 富文本组件
import Editor from '@/components/Editor' import Editor from "@/components/Editor";
// 文件上传组件 // 文件上传组件
import FileUpload from '@/components/FileUpload' import FileUpload from "@/components/FileUpload";
// 图片上传组件 // 图片上传组件
import ImageUpload from '@/components/ImageUpload' import ImageUpload from "@/components/ImageUpload";
// 图片预览组件 // 图片预览组件
import ImagePreview from '@/components/ImagePreview' import ImagePreview from "@/components/ImagePreview";
// 字典标签组件 // 字典标签组件
import DictTag from '@/components/DictTag' import DictTag from "@/components/DictTag";
// 头部标签组件 // 头部标签组件
import VueMeta from 'vue-meta' import VueMeta from "vue-meta";
// 字典数据组件 // 字典数据组件
import DictData from '@/components/DictData' import DictData from "@/components/DictData";
// //使用vue-print-nb提供打印功能 // //使用vue-print-nb提供打印功能
// import Print from 'vue-print-nb'; // import Print from 'vue-print-nb';
// 列表用户头像 // 列表用户头像
import ListImage from '@/components/ListImage' import ListImage from "@/components/ListImage";
// 扩展组件Pagination // 扩展组件Pagination
import ExPagination from '@/components/ExPagination' import ExPagination from "@/components/ExPagination";
// 导出组件 // 导出组件
import ExportTable from '@/components/ExportTable' import ExportTable from "@/components/ExportTable";
import VueDND from 'awe-dnd' import VueDND from "awe-dnd";
import weather from 'vue-mini-weather' import weather from "vue-mini-weather";
import axios from 'axios' import axios from "axios";
Vue.prototype.$axios = axios Vue.prototype.$axios = axios;
Vue.use(weather) Vue.use(weather);
Vue.use(VueDND) Vue.use(VueDND);
import VXETable from 'vxe-table' import VXETable from "vxe-table";
import 'vxe-table/lib/style.css' import "vxe-table/lib/style.css";
Vue.use(VXETable) Vue.use(VXETable);
// 全局方法挂载 // 全局方法挂载
Vue.prototype.getDicts = getDicts Vue.prototype.getDicts = getDicts;
Vue.prototype.getConfigKey = getConfigKey Vue.prototype.getConfigKey = getConfigKey;
Vue.prototype.parseTime = parseTime Vue.prototype.parseTime = parseTime;
Vue.prototype.resetForm = resetForm Vue.prototype.resetForm = resetForm;
Vue.prototype.addDateRange = addDateRange Vue.prototype.addDateRange = addDateRange;
Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabel = selectDictLabel;
Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.selectDictLabels = selectDictLabels;
Vue.prototype.download = download Vue.prototype.download = download;
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree;
Vue.prototype.throttle = throttle Vue.prototype.throttle = throttle;
Vue.prototype.$moment = moment; Vue.prototype.$moment = moment;
// 全局组件挂载 // 全局组件挂载
Vue.component('DictTag', DictTag) Vue.component("DictTag", DictTag);
Vue.component('Pagination', Pagination) Vue.component("Pagination", Pagination);
Vue.component('RightToolbar', RightToolbar) Vue.component("RightToolbar", RightToolbar);
Vue.component('Editor', Editor) Vue.component("Editor", Editor);
Vue.component('FileUpload', FileUpload) Vue.component("FileUpload", FileUpload);
Vue.component('ImageUpload', ImageUpload) Vue.component("ImageUpload", ImageUpload);
Vue.component('ImagePreview', ImagePreview) Vue.component("ImagePreview", ImagePreview);
Vue.component('ListImage', ListImage) Vue.component("ListImage", ListImage);
Vue.component('ExPagination', ExPagination) Vue.component("ExPagination", ExPagination);
Vue.component('ExportTable', ExportTable) Vue.component("ExportTable", ExportTable);
Vue.component('Table', Table) Vue.component("Table", Table);
Vue.use(directive) Vue.use(directive);
Vue.use(plugins) Vue.use(plugins);
Vue.use(VueMeta) Vue.use(VueMeta);
DictData.install() DictData.install();
// Vue.use(Print); // Vue.use(Print);
/** /**
...@@ -103,18 +110,18 @@ DictData.install() ...@@ -103,18 +110,18 @@ DictData.install()
*/ */
// 修改elementUI默认样式-- 关于对话框中,当点击对话框外部区域或者键入【esc】是退出对话框的问题 // 修改elementUI默认样式-- 关于对话框中,当点击对话框外部区域或者键入【esc】是退出对话框的问题
Element.Dialog.props.closeOnClickModal = false Element.Dialog.props.closeOnClickModal = false;
Element.Dialog.props.closeOnPressEscape = false Element.Dialog.props.closeOnPressEscape = false;
Vue.use(Element, { Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size size: Cookies.get("size") || "medium", // set element-ui default size
}) });
Vue.config.productionTip = false Vue.config.productionTip = false;
new Vue({ new Vue({
el: '#app', el: "#app",
router, router,
store, store,
render: h => h(App) render: (h) => h(App),
}) });
import router from './router' import router from "./router";
import store from './store' import store from "./store";
import { Message } from 'element-ui' import { Message } from "element-ui";
import NProgress from 'nprogress' import NProgress from "nprogress";
import 'nprogress/nprogress.css' import "nprogress/nprogress.css";
import { getToken } from '@/utils/auth' import { getToken } from "@/utils/auth";
import { isRelogin } from '@/utils/request' import { isRelogin } from "@/utils/request";
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] const whiteList = ["/login", "/auth-redirect", "/bind", "/register", "/index"];
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start();
if (getToken()) { if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === "/login") {
next({ path: '/' }) next({ path: "/" });
NProgress.done() NProgress.done();
} else { } else {
if (store.getters.roles.length === 0) { if (store.getters.roles.length === 0) {
isRelogin.show = true isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => { store
isRelogin.show = false .dispatch("GetInfo")
store.dispatch('GenerateRoutes').then(accessRoutes => { .then(() => {
// 根据roles权限生成可访问的路由表 isRelogin.show = false;
router.addRoutes(accessRoutes) // 动态添加可访问路由表 store.dispatch("GenerateRoutes").then((accessRoutes) => {
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 // 根据roles权限生成可访问的路由表
}) router.addRoutes(accessRoutes); // 动态添加可访问路由表
}).catch(err => { next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
store.dispatch('LogOut').then(() => { });
Message.error(err)
next({ path: '/' })
})
}) })
.catch((err) => {
store.dispatch("LogOut").then(() => {
Message.error(err);
next({ path: "/" });
});
});
} else { } else {
next() next();
} }
} }
} else { } else {
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next();
} else { } else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
NProgress.done() NProgress.done();
} }
} }
}) });
router.afterEach(() => { router.afterEach(() => {
NProgress.done() NProgress.done();
}) });
...@@ -12,7 +12,6 @@ import classAdviser from "@/router/routerMenus/classAdviser"; ...@@ -12,7 +12,6 @@ import classAdviser from "@/router/routerMenus/classAdviser";
import officialWork from "@/router/routerMenus/officialWork"; import officialWork from "@/router/routerMenus/officialWork";
import othersManage from "@/router/routerMenus/othersManage"; import othersManage from "@/router/routerMenus/othersManage";
import examinationManage from "@/router/routerMenus/examinationManage"; import examinationManage from "@/router/routerMenus/examinationManage";
Vue.use(Router); Vue.use(Router);
/* Layout */ /* Layout */
import Layout from "@/layout"; import Layout from "@/layout";
...@@ -72,6 +71,7 @@ export const constantRoutes = [ ...@@ -72,6 +71,7 @@ export const constantRoutes = [
component: () => import("@/views/error/401"), component: () => import("@/views/error/401"),
hidden: true, hidden: true,
}, },
{ {
path: "", path: "",
component: Layout, component: Layout,
...@@ -204,6 +204,7 @@ Router.prototype.push = function push(location) { ...@@ -204,6 +204,7 @@ Router.prototype.push = function push(location) {
}; };
export default new Router({ export default new Router({
// base: "/zpy",
mode: "history", // 去掉url中的# mode: "history", // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes, routes: constantRoutes,
......
...@@ -87,7 +87,7 @@ const user = { ...@@ -87,7 +87,7 @@ const user = {
const teacher = res.teacher const teacher = res.teacher
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
const sign = (user.sign == "" || user.sign == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.sign; const sign = (user.sign == "" || user.sign == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.sign;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.roles &&/* */ res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.permissions)
} else { } else {
......
...@@ -28,6 +28,7 @@ service.interceptors.request.use(config => { ...@@ -28,6 +28,7 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交 // 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) { if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
} }
// get请求映射params参数 // get请求映射params参数
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-row :gutter="6"> <el-row :gutter="6">
<el-col :span="9"> <el-col :span="9">
<el-card :body-style="{ padding: '0px' }" > <el-card :body-style="{ padding: '0px' }">
<div style="background: #5a5e66; height: 170px; margin: 5px"> <div style="background: #5a5e66; height: 170px; margin: 5px">
<el-carousel height="170px"> <el-carousel height="170px">
<el-carousel-item v-for="item in images" :key="item.id"> <el-carousel-item v-for="item in images" :key="item.id">
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
<!-- 通知 --> <!-- 通知 -->
<div class="cardHeader" style="margin-top: 5px; width: 100%;"> <div class="cardHeader" style="margin-top: 5px; width: 100%;">
<div style="display: inline-block; margin-top: 5px"><i class="el-icon-message-solid" <div style="display: inline-block; margin-top: 5px"><i class="el-icon-message-solid"
style="color: #2f79ff"></i> <span>通知</span></div> style="color: #2f79ff"></i> <span>通知</span></div>
<div style="display: inline-block; height: 25px; float: right"> <div style="display: inline-block; height: 25px; float: right">
<el-button type="text" class="noticeMore" style="height: 25px; width: 100px; line-height: 25px" <el-button type="text" class="noticeMore" style="height: 25px; width: 100px; line-height: 25px"
@click.native.prevent="handleMore"> @click.native.prevent="handleMore">
查看更多 查看更多
<i class="el-icon-d-arrow-right el-icon--right" style="margin-left: -2px"></i> <i class="el-icon-d-arrow-right el-icon--right" style="margin-left: -2px"></i>
</el-button> </el-button>
...@@ -34,16 +34,15 @@ ...@@ -34,16 +34,15 @@
</li> </li>
</ol> </ol>
</el-card> </el-card>
<el-card :body-style="{ padding: '0px'}" <el-card :body-style="{ padding: '0px' }" style="height: 357px; margin-top: 3px; background-color: #ffffff">
style="height: 357px; margin-top: 3px; background-color: #ffffff">
<div class="cardHeader" style="margin-top:10px"> <div class="cardHeader" style="margin-top:10px">
<div style="display: inline-block; vertical-align:middle"> <div style="display: inline-block; vertical-align:middle">
<i class="el-icon-time" style="color: #2f79ff;"></i> <span>值班表</span> <i class="el-icon-time" style="color: #2f79ff;"></i> <span>值班表</span>
</div> </div>
<div style="display: inline-block; height: 25px;float: right"> <div style="display: inline-block; height: 25px;float: right">
<el-button type="text" class="noticeMore" <el-button type="text" class="noticeMore"
style="float: right; height: 25px; width: 100px; line-height: 25px; " style="float: right; height: 25px; width: 100px; line-height: 25px; "
@click.native.prevent="handleMore2"> 查看更多 @click.native.prevent="handleMore2"> 查看更多
<i class="el-icon-d-arrow-right el-icon--right"></i> <i class="el-icon-d-arrow-right el-icon--right"></i>
</el-button> </el-button>
</div> </div>
...@@ -51,20 +50,15 @@ ...@@ -51,20 +50,15 @@
<el-divider></el-divider> <el-divider></el-divider>
<div style="margin:5px"> <div style="margin:5px">
<!-- :row-style="{ height: '30px' }" :cell-style="{ padding: '0' }" style="font-size: 12px"--> <!-- :row-style="{ height: '30px' }" :cell-style="{ padding: '0' }" style="font-size: 12px"-->
<el-table border <el-table border :data="dutyTable" width="100%" height="300px" stripe @row-click="redirectDutyInfo">
:data="dutyTable" <el-table-column label="标题" prop="dutyName" min-width="120" show-overflow-tooltip align="center" />
width="100%"
height="300px"
stripe
@row-click="redirectDutyInfo">
<el-table-column label="标题" prop="dutyName" min-width="120" show-overflow-tooltip align="center"/>
<el-table-column label="类型" prop="dutyType" min-width="60" align="center"> <el-table-column label="类型" prop="dutyType" min-width="60" align="center">
<template v-slot="scope"> <template v-slot="scope">
{{ getDutyType(scope.row.dutyType) }} {{ getDutyType(scope.row.dutyType) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="节日" min-width="60" prop="holidayName" align="center"/> <el-table-column label="节日" min-width="60" prop="holidayName" align="center" />
<el-table-column label="说明" min-width="120" prop="remarks" show-overflow-tooltip align="center"/> <el-table-column label="说明" min-width="120" prop="remarks" show-overflow-tooltip align="center" />
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
...@@ -75,8 +69,9 @@ ...@@ -75,8 +69,9 @@
<el-card :body-style="{ padding: '0px' }" style="height: 220px; background-color: #ffffff"> <el-card :body-style="{ padding: '0px' }" style="height: 220px; background-color: #ffffff">
<div class="cardHeader" style="margin-top: 5px"> <div class="cardHeader" style="margin-top: 5px">
<div style="display: inline-block; vertical-align: middle"><i class="el-icon-user-solid" <div style="display: inline-block; vertical-align: middle"><i class="el-icon-user-solid"
style="color: #2f79ff"></i> style="color: #2f79ff"></i>
<span>&emsp;个人信息</span></div> <span>&emsp;个人信息</span>
</div>
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div style="margin-top: 15px"> <div style="margin-top: 15px">
...@@ -87,9 +82,7 @@ ...@@ -87,9 +82,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="17" :offset="1" class="info"> <el-col :span="17" :offset="1" class="info">
<el-row <el-row><span class="name">{{ userInfo.teacherName }}</span></el-row>
><span class="name">{{ userInfo.teacherName }}</span></el-row
>
<el-row style="margin: 13px 0px"> <el-row style="margin: 13px 0px">
<el-col :span="12"> <el-col :span="12">
<svg-icon icon-class="phone-telephone" style="font-size: 16px"></svg-icon> <svg-icon icon-class="phone-telephone" style="font-size: 16px"></svg-icon>
...@@ -101,7 +94,7 @@ ...@@ -101,7 +94,7 @@
<svg-icon icon-class="degree-hat" style="font-size: 16px"></svg-icon> <svg-icon icon-class="degree-hat" style="font-size: 16px"></svg-icon>
&emsp;<span>当前学历:</span> &emsp;<span>当前学历:</span>
<dict-tag style="display: inline-block" :options="dict.type.education" <dict-tag style="display: inline-block" :options="dict.type.education"
:value="userInfo.education"/> :value="userInfo.education" />
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin: 13px 0px"> <el-row style="margin: 13px 0px">
...@@ -133,19 +126,20 @@ ...@@ -133,19 +126,20 @@
<!-- 审批入口 --> <!-- 审批入口 -->
<el-row> <el-row>
<el-card :body-style="{ padding: '0px' }" <el-card :body-style="{ padding: '0px' }"
style="height: 210px; width: 100%; margin-top: 3px; background-color: #ffffff"> style="height: 210px; width: 100%; margin-top: 3px; background-color: #ffffff">
<div class="cardHeader" style="margin-top: 5px"> <div class="cardHeader" style="margin-top: 5px">
<div style="display: inline-block; vertical-align: middle"><i class="el-icon-s-check" style="color: #2f79ff"></i> <div style="display: inline-block; vertical-align: middle"><i class="el-icon-s-check"
<span>&emsp;我的任务</span></div> style="color: #2f79ff"></i>
<span>&emsp;我的任务</span>
</div>
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div class="card-blocks"> <div class="card-blocks">
<el-badge v-for="item in approves" <el-badge v-for="item in approves" style=" border-radius: 5px; margin: 10px 20px"
style=" border-radius: 5px; margin: 10px 20px" :class="{ headerBox: taskNumList.hasOwnProperty(item.name) && taskNumList[item.name] != 0 }"
:class="{ headerBox: taskNumList.hasOwnProperty(item.name) && taskNumList[item.name] != 0 }" :value="handleTaskNum(item)" :key="item.label">
:value="handleTaskNum(item)" :key="item.label">
<el-button @click="handleInto(item.path)" type="primary" plain size="mini" <el-button @click="handleInto(item.path)" type="primary" plain size="mini"
style="min-width: 118px; height: 30px"> style="min-width: 118px; height: 30px">
{{ item.label }} {{ item.label }}
</el-button> </el-button>
</el-badge> </el-badge>
...@@ -157,11 +151,12 @@ ...@@ -157,11 +151,12 @@
<el-card :body-style="{ padding: '0px' }" style="height: 315px; margin-top: 3px; background-color: #ffffff"> <el-card :body-style="{ padding: '0px' }" style="height: 315px; margin-top: 3px; background-color: #ffffff">
<div class="cardHeader" style="margin-top: 5px"> <div class="cardHeader" style="margin-top: 5px">
<div style="display: inline-block; vertical-align: middle"><i class="el-icon-message-solid" <div style="display: inline-block; vertical-align: middle"><i class="el-icon-message-solid"
style="color: #2f79ff"></i> style="color: #2f79ff"></i>
<span>&emsp;调整常用功能</span></div> <span>&emsp;调整常用功能</span>
</div>
<div style="display: inline-block; height: 25px; width: 100px; float: right"> <div style="display: inline-block; height: 25px; width: 100px; float: right">
<el-button type="text" class="noticeMore" style="height: 25px; line-height: 25px; margin-left: 20px" <el-button type="text" class="noticeMore" style="height: 25px; line-height: 25px; margin-left: 20px"
@click.native.prevent="handleCommonFunctions"> @click.native.prevent="handleCommonFunctions">
查看更多 查看更多
<i class="el-icon-d-arrow-right el-icon--right" style="margin-left: -2px"></i> <i class="el-icon-d-arrow-right el-icon--right" style="margin-left: -2px"></i>
</el-button> </el-button>
...@@ -173,7 +168,7 @@ ...@@ -173,7 +168,7 @@
<div @click="handleInto(item.path)"> <div @click="handleInto(item.path)">
<div style="margin-bottom: 5px"> <div style="margin-bottom: 5px">
<svg-icon :icon-class="item.menuPic == '#' ? '菜单管理' : item.menuPic" <svg-icon :icon-class="item.menuPic == '#' ? '菜单管理' : item.menuPic"
style="font-size: 28px"></svg-icon> style="font-size: 28px"></svg-icon>
</div> </div>
<span style="font-size: 14px">{{ item.menuName }}</span> <span style="font-size: 14px">{{ item.menuName }}</span>
</div> </div>
...@@ -186,11 +181,10 @@ ...@@ -186,11 +181,10 @@
<el-card :body-style="{ padding: '0px' }" style="background-color: #fdfdfe; height:750px"> <el-card :body-style="{ padding: '0px' }" style="background-color: #fdfdfe; height:750px">
<div style="height: 275px; width: 100%; position: relative"> <div style="height: 275px; width: 100%; position: relative">
<div style="position: absolute; width: 100%"> <div style="position: absolute; width: 100%">
<el-image :src="indexCalendarImg" style="width: 100%; height: 270px"/> <el-image :src="indexCalendarImg" style="width: 100%; height: 270px" />
</div> </div>
<div style="position: absolute; width: 100%"> <div style="position: absolute; width: 100%">
<div <div style="font-family: PingFang SC; color: #ffffff; font-size: 16px; margin-top: 20px; margin-left: 20px">
style="font-family: PingFang SC; color: #ffffff; font-size: 16px; margin-top: 20px; margin-left: 20px">
{{ user.userName }}, 欢迎登录智慧校园管理系统! {{ user.userName }}, 欢迎登录智慧校园管理系统!
</div> </div>
<div style="font-size: small; margin-top: 8px; color: #96c4f5; margin-left: 20px"> <div style="font-size: small; margin-top: 8px; color: #96c4f5; margin-left: 20px">
...@@ -213,8 +207,9 @@ ...@@ -213,8 +207,9 @@
</div> </div>
</div> </div>
<div class="cardHeader" style="position: absolute; top: 235px; margin-left: 10px"><i class="el-icon-date" <div class="cardHeader" style="position: absolute; top: 235px; margin-left: 10px"><i class="el-icon-date"
style="color: #2f79ff"></i> style="color: #2f79ff"></i>
<span>&emsp; </span></div> <span>&emsp; </span>
</div>
</div> </div>
<div class="calendar"> <div class="calendar">
<el-calendar v-model="today"> <el-calendar v-model="today">
...@@ -233,8 +228,8 @@ ...@@ -233,8 +228,8 @@
<div v-for="item in things" :key="item.label" style="margin-bottom: 5px; "> <div v-for="item in things" :key="item.label" style="margin-bottom: 5px; ">
<el-image :src="taskIcon" style="width: 15px; height: 15px"></el-image> <el-image :src="taskIcon" style="width: 15px; height: 15px"></el-image>
<span style="font-family: PingFang SC; font-weight: 700; margin-left: 10px; font-size: 15px">{{ <span style="font-family: PingFang SC; font-weight: 700; margin-left: 10px; font-size: 15px">{{
item.detailName item.detailName
}} </span> }} </span>
<span style="margin-top: 10px; font-weight: 200; font-size: 13px"> <span style="margin-top: 10px; font-weight: 200; font-size: 13px">
{{ item.startTime }} {{ item.startTime }}
~ ~
...@@ -262,7 +257,7 @@ ...@@ -262,7 +257,7 @@
<h1 style="display: inline-block">{{ form.title }}</h1> <h1 style="display: inline-block">{{ form.title }}</h1>
</div> </div>
<span class="info-container" :disabled="true" v-html="form.content"></span> <span class="info-container" :disabled="true" v-html="form.content"></span>
<br/><br/> <br /><br />
<div style="float: right;"> <div style="float: right;">
<el-descriptions :column="3"> <el-descriptions :column="3">
<el-descriptions-item label="接收人">{{ resolveRole(form.receivePacket) }}</el-descriptions-item> <el-descriptions-item label="接收人">{{ resolveRole(form.receivePacket) }}</el-descriptions-item>
...@@ -291,24 +286,24 @@ ...@@ -291,24 +286,24 @@
</el-row> </el-row>
<el-table key="a" v-if="dutyList.dutyType==='1'" border v-loading="loading2" <el-table key="a" v-if="dutyList.dutyType === '1'" border v-loading="loading2" :data="dutyList.list"
:data="dutyList.list" style="width: 100%" :span-method="objectSpanMethod2"> style="width: 100%" :span-method="objectSpanMethod2">
<el-table-column label="节日" align="center"> <el-table-column label="节日" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ dutyList.holidayName }} {{ dutyList.holidayName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="日期" align="center" prop="dutyDeDate"/> <el-table-column label="日期" align="center" prop="dutyDeDate" />
<el-table-column label="星期" align="center" prop="dutyDeWeek"/> <el-table-column label="星期" align="center" prop="dutyDeWeek" />
<el-table-column label="行政值班" align="center"> <el-table-column label="行政值班" align="center">
<el-table-column label="值班人员" align="center" prop="adminPerson"/> <el-table-column label="值班人员" align="center" prop="adminPerson" />
<el-table-column label="值班电话" align="center" prop="adminTel"/> <el-table-column label="值班电话" align="center" prop="adminTel" />
<el-table-column label="手机" align="center" prop="adminPhone"/> <el-table-column label="手机" align="center" prop="adminPhone" />
</el-table-column> </el-table-column>
<el-table-column label="办公室值班" align="center"> <el-table-column label="办公室值班" align="center">
<el-table-column label="人员" align="center" prop="officerPerson"/> <el-table-column label="人员" align="center" prop="officerPerson" />
<el-table-column label="值班电话" align="center" min-width="110px" prop="officerTel"/> <el-table-column label="值班电话" align="center" min-width="110px" prop="officerTel" />
<el-table-column label="手机" align="center" min-width="110px" prop="officerPhone"/> <el-table-column label="手机" align="center" min-width="110px" prop="officerPhone" />
</el-table-column> </el-table-column>
<el-table-column label="门卫值班" align="center"> <el-table-column label="门卫值班" align="center">
<el-table-column label="人员" min-width="110px" align="center" prop="guardPerson"> <el-table-column label="人员" min-width="110px" align="center" prop="guardPerson">
...@@ -318,8 +313,8 @@ ...@@ -318,8 +313,8 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="值班电话" min-width="110px" align="center" prop="guardTel"/> <el-table-column label="值班电话" min-width="110px" align="center" prop="guardTel" />
<el-table-column label="手机" min-width="110px" align="center" prop="guardPhone"/> <el-table-column label="手机" min-width="110px" align="center" prop="guardPhone" />
</el-table-column> </el-table-column>
<el-table-column label="学生宿舍值班" align="center"> <el-table-column label="学生宿舍值班" align="center">
<el-table-column label="人员" min-width="180px" align="center" prop="dormPerson"> <el-table-column label="人员" min-width="180px" align="center" prop="dormPerson">
...@@ -329,26 +324,25 @@ ...@@ -329,26 +324,25 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="手机" min-width="110px" align="center" prop="dormPhone"/> <el-table-column label="手机" min-width="110px" align="center" prop="dormPhone" />
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-table key="b" v-else border v-loading="loading2" :data="dutyList.list" <el-table key="b" v-else border v-loading="loading2" :data="dutyList.list" :span-method="objectSpanMethod">
:span-method="objectSpanMethod">
<el-table-column label="节日" align="center" width="180"> <el-table-column label="节日" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
{{ dutyList.holidayName }} {{ dutyList.holidayName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="日期" align="center" prop="dateAndWeek" min-width="80"/> <el-table-column label="日期" align="center" prop="dateAndWeek" min-width="80" />
<el-table-column label="带班领导" align="center" prop="leader"/> <el-table-column label="带班领导" align="center" prop="leader" />
<el-table-column label="职务" align="center" prop="postName"/> <el-table-column label="职务" align="center" prop="postName" />
<el-table-column label="电话" align="center" prop="dutyDeTel"/> <el-table-column label="电话" align="center" prop="dutyDeTel" />
<el-table-column label="手机" align="center" prop="dutyDePhone"/> <el-table-column label="手机" align="center" prop="dutyDePhone" />
<el-table-column label="值班人员、手机" align="center" prop="personAndPhone"/> <el-table-column label="值班人员、手机" align="center" prop="personAndPhone" />
</el-table> </el-table>
<br/> <br />
<p><b>说明:</b> {{ dutyList.remarks }}</p> <p><b>说明:</b> {{ dutyList.remarks }}</p>
<!-- </el-card>--> <!-- </el-card>-->
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -360,7 +354,7 @@ ...@@ -360,7 +354,7 @@
<div> <div>
<el-dialog title="常用功能列表" :visible.sync="viewDetail1" width="600px" append-to-body v-if="viewDetail1"> <el-dialog title="常用功能列表" :visible.sync="viewDetail1" width="600px" append-to-body v-if="viewDetail1">
<el-table @row-click="clickRow" ref="table" :data="adjustmentBlocks" @selection-change="handleSelectionChange" <el-table @row-click="clickRow" ref="table" :data="adjustmentBlocks" @selection-change="handleSelectionChange"
height="260px" v-loading="loading"> height="260px" v-loading="loading">
<el-table-column type="selection" width="100"></el-table-column> <el-table-column type="selection" width="100"></el-table-column>
<el-table-column prop="icon" label="功能图标" :show-overflow-tooltip="true"> <el-table-column prop="icon" label="功能图标" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -392,9 +386,9 @@ ...@@ -392,9 +386,9 @@
</template> </template>
<script> <script>
import {Blocks, approves} from '@/enums/home' import { Blocks, approves } from '@/enums/home'
import {getList, getInfoOne} from '@/api/smartSchool/informationPush/school' import { getList, getInfoOne } from '@/api/smartSchool/informationPush/school'
import {getCourseInfoData} from '@/utils/utilLibrary/getCourseInfo' import { getCourseInfoData } from '@/utils/utilLibrary/getCourseInfo'
import { import {
getDutyTableList, getDutyTableList,
getDutyDetail, getDutyDetail,
...@@ -406,10 +400,16 @@ import { ...@@ -406,10 +400,16 @@ import {
getNoticeList, getNoticeList,
getTaskNum getTaskNum
} from '@/api/smartSchool/index' } from '@/api/smartSchool/index'
import {getUser} from '@/api/system/user' import { getUser } from '@/api/system/user'
// 任务模块 // 任务模块
// import { taskList } from "@/api/smartSchool/studentManage/studentLeave"; // import { taskList } from "@/api/smartSchool/studentManage/studentLeave";
import {listPic} from '@/api/smartSchool/schoolManage/introduce/pic' import { listPic } from '@/api/smartSchool/schoolManage/introduce/pic'
import Cookies from "js-cookie";
import * as dd from 'dingtalk-jsapi';
import { getToken, setToken, removeToken } from '@/utils/auth'
import { getCode } from "@/api/ddLogin";
export default { export default {
name: 'Index', name: 'Index',
...@@ -502,9 +502,13 @@ export default { ...@@ -502,9 +502,13 @@ export default {
} }
}, },
created() { created() {
this.init() // 钉钉code码,正式时打开
// this.getCode()
// token,测试用
this.csToken()
}, },
mounted() { mounted() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.getMessageList() this.getMessageList()
this.taskNum() this.taskNum()
...@@ -526,10 +530,79 @@ export default { ...@@ -526,10 +530,79 @@ export default {
}, },
methods: { methods: {
// 获取code
getCode() {
dd.getAuthCode({
corpId: 'dingaa3937ff8b7dd267f2c783f7214b6d69',
success: (res) => {
console.log('获取新的免登码成功', res);
const code = res.code
// this.code = code;
// this.authCodeTimestamp = currentTime;
// console.log('this.authCodeTimestamp', this.authCodeTimestamp);
console.log('code', code);
this.getToken(code)
// console.log('loginResponse', loginResponse);
},
fail: (res) => {
console.log('获取免登码失败', res);
},
complete: () => { },
});
},
// 获取token
getToken(code) {
getCode(code).then(res => {
console.log('res', res.token);
if (res.token) {
setToken(res.token)
this.$store.commit('SET_TOKEN', res.token)
// this.$router.push({ path: '/index' });
// 判断当前用户是否已拉取完user_info信息
this.$store.dispatch('GetInfo').then((res) => {
this.$store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
this.init()
})
})
} else {
this.$message.error(res.message)
}
})
},
// 测试token
csToken() {
getCode(123).then(res => {
console.log('res', res.token);
if (res.token) {
setToken(res.token)
this.$store.commit('SET_TOKEN', res.token)
// this.$router.push({ path: '/index' });
// 判断当前用户是否已拉取完user_info信息
this.$store.dispatch('GetInfo').then((res) => {
this.$store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
this.init()
})
})
} else {
this.$message.error(res.message)
}
})
},
//从后端获取任务数量 //从后端获取任务数量
taskNum() { taskNum() {
getTaskNum().then(res => { getTaskNum().then(res => {
console.log('taskNumList',res) console.log('taskNumList', res)
this.taskNumList = res.data this.taskNumList = res.data
}) })
}, },
...@@ -576,7 +649,7 @@ export default { ...@@ -576,7 +649,7 @@ export default {
calendarClick(calendarDate) { calendarClick(calendarDate) {
this.todayWorkLoading = true this.todayWorkLoading = true
let date = new Date(calendarDate).toLocaleDateString() let date = new Date(calendarDate).toLocaleDateString()
getThingListByTime({calendarDate: date}).then(res => { getThingListByTime({ calendarDate: date }).then(res => {
if (res.data.length === 0) { if (res.data.length === 0) {
this.things = '' this.things = ''
this.haveThings = false this.haveThings = false
...@@ -614,7 +687,7 @@ export default { ...@@ -614,7 +687,7 @@ export default {
// 获取通知公告信息 // 获取通知公告信息
getMessageList() { getMessageList() {
getNoticeList({pageNum: 1, pageSize: 5}) getNoticeList({ pageNum: 1, pageSize: 5 })
.then(response => { .then(response => {
this.messageList = response.rows this.messageList = response.rows
}) })
...@@ -797,7 +870,7 @@ export default { ...@@ -797,7 +870,7 @@ export default {
// }, // },
// 合并单元格 // 合并单元格
objectSpanMethod({row, column, rowIndex, columnIndex}) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex % this.dutyList.list.length === 0) { if (rowIndex % this.dutyList.list.length === 0) {
return { return {
...@@ -814,7 +887,7 @@ export default { ...@@ -814,7 +887,7 @@ export default {
}, },
// 合并单元格 // 合并单元格
objectSpanMethod2({row, column, rowIndex, columnIndex}) { objectSpanMethod2({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex % this.dutyList.list.length === 0) { if (rowIndex % this.dutyList.list.length === 0) {
return { return {
...@@ -843,7 +916,7 @@ export default { ...@@ -843,7 +916,7 @@ export default {
} }
}, },
arraySpanMethod({row, column, rowIndex, columnIndex}) { arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 0) { if (columnIndex == 0) {
if (this.dateArr[rowIndex]) { if (this.dateArr[rowIndex]) {
//第1列 日期 //第1列 日期
...@@ -929,7 +1002,7 @@ export default { ...@@ -929,7 +1002,7 @@ export default {
let images = response.rows let images = response.rows
let imagess = images.filter(item => item.isShow == 1) let imagess = images.filter(item => item.isShow == 1)
this.images = imagess.map(item => { this.images = imagess.map(item => {
return {url: this.pev + item.picUrl} return { url: this.pev + item.picUrl }
}) })
}) })
} }
...@@ -979,9 +1052,11 @@ export default { ...@@ -979,9 +1052,11 @@ export default {
from { from {
border: 2px solid #ffffff; border: 2px solid #ffffff;
} }
50% { 50% {
border: 2px solid red; border: 2px solid red;
} }
to { to {
border: 2px solid #ffffff; border: 2px solid #ffffff;
} }
...@@ -1151,8 +1226,6 @@ a:hover { ...@@ -1151,8 +1226,6 @@ a:hover {
overflow: visible; overflow: visible;
align-items: center; align-items: center;
} }
</style> </style>
......
<template>
<!--<div class="login-container">-->
<!--<div class="login-page login-cover">-->
<!-- <div class="cover-container">-->
<!-- <div class="cover-center">-->
<!-- <div class="cover-center__left">-->
<!-- <p class="left-base-content">智慧校园</p>-->
<!-- <p>智慧校园系统是通过信息化手段,实现对校园内各类资源的有效集成 整合和优化,实现资源的有效配置和充分利用,将校务管理过程的优化协调。为校园提供数字化教学、数字化学习、数字化科研和数字化管理。</p>-->
<!-- </div>-->
<!-- <div class="cover-center__right">-->
<!-- <el-image-->
<!-- style="width: 600px;"-->
<!-- :src="require('@/assets/images/logo-login.gif')"-->
<!-- ></el-image>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<!--</div>-->
<div class="login">
<div class="login-card-container">
<div class="login-card-left">
<el-image
style="width: 600px;"
:src="require('@/assets/images/login.png')"
lazy
></el-image>
<!-- :src="require('@/assets/images/logo-login.gif')"-->
</div>
<div class="login-card-right">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">智慧校园管理系统</h3>
<el-form-item prop="phonenumber">
<el-input
v-model="loginForm.phonenumber"
type="text"
auto-complete="off"
placeholder="手机号码"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="text"
style="text-security:disc; -webkit-text-security:disc;"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<!-- <el-form-item prop="code" v-if="captchaEnabled">-->
<!-- <el-input-->
<!-- v-model="loginForm.code"-->
<!-- auto-complete="off"-->
<!-- placeholder="验证码"-->
<!-- style="width: 63%"-->
<!-- @keyup.enter.native="handleLogin"-->
<!-- >-->
<!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />-->
<!-- </el-input>-->
<!-- <div class="login-code">-->
<!-- <img :src="codeUrl" @click="getCode" class="login-code-img"/>-->
<!-- </div>-->
<!-- </el-form-item>-->
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</el-form>
</div>
</div>
<!-- 底部 -->
<div class="el-login-footer">
<span>© 2021 zhimin Copyright </span>
</div>
</div>
</template>
<script>
import {getCodeImg} from "@/api/login";
import Cookies from "js-cookie";
import {encrypt, decrypt} from '@/utils/jsencrypt'
export default {
name: "Login",
data() {
return {
codeUrl: "",
loginForm: {
// username: "admin",
phonenumber: '',
password: "",
rememberMe: false,
code: "",
uuid: ""
},
loginRules: {
// username: [
// { required: true, trigger: "blur", message: "请输入您的账号" }
// ],
phonenumber: [
{required: true, trigger: "blur", message: "请输入您的手机号码"}
],
password: [
{required: true, trigger: "blur", message: "请输入您的密码"}
],
// code: [{ required: true, trigger: "change", message: "请输入验证码" }]
},
loading: false,
// 验证码开关
// captchaEnabled: true,
captchaEnabled: false,
// 注册开关
register: false,
redirect: undefined
};
},
watch: {
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
}
},
created() {
},
mounted() {
this.getCode();
this.getCookie();
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
},
getCookie() {
// const username = Cookies.get("username");
// 获取手机号码
const phonenumber = Cookies.get("phonenumber");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
this.loginForm = {
// username: username === undefined ? this.loginForm.username : username,
phonenumber: phonenumber === undefined ? this.loginForm.phonenumber : phonenumber,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
// Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("phonenumber", this.loginForm.phonenumber, {expires: 30});
Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
} else {
// Cookies.remove("username");
Cookies.remove("phonenumber");
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({path: this.redirect || "/"}).catch(() => {
});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.login {
background-color: rgba(0,191,255,0.15);
}
.login-container {
//transition: transform .5s ease-in;
.login-page {
//height: 100vh;
}
}
// 封面背景
.login-cover {
//background-image: url("~@/assets/images/head_img.png");
background-size: cover;
}
// 封面内容
.cover-container {
width: 1200px;
margin: auto;
height: 100%;
display: flex;
flex-direction: column;
.cover-center {
position: relative;
.cover-center__left {
position: absolute;
left: 0;
top: 0;
display: flex;
flex-direction: column;
}
.cover-center__right {
position: absolute;
width: 559px;
height: 559px;
right: 0;
}
}
}
// 封面左侧内容
.left-base-content {
font-size: 50px;
}
// 登录页
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
//background-image: url("~@/assets/images/head_img.png");
background-size: cover;
.login-card-container {
display: flex;
//padding: 20px;
//justify-content: center;
//align-items: center;
.login-card-right {
display: flex;
padding-left: 256px;
}
}
}
.el-card.is-always-shadow {
-webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
background-color: #fff4;
backdrop-filter: blur(6px);
}
.title {
margin: 0px auto 30px auto;
text-align: center;
//color: #707070;
color: #0988ef;
}
.login-form {
border-radius: 6px;
border: 1px solid #e0e0e0;
box-shadow: 0 0 10px 1px #e0e0e0;
background: aliceblue;
width: 350px;
margin: auto;
padding: 30px 20px 20px 20px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
//color: #fff;
color: #989797;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
</style>
<template> <template>
<button @click="getCode">123</button>
<!--<div class="login-container">--> <!--<div class="login-container">-->
<!--<div class="login-page login-cover">--> <!--<div class="login-page login-cover">-->
<!-- <div class="cover-container">--> <!-- <div class="cover-container">-->
...@@ -17,64 +18,44 @@ ...@@ -17,64 +18,44 @@
<!-- </div>--> <!-- </div>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<div class="login"> <!-- <div class="login">
<div class="login-card-container"> <div class="login-card-container">
<div class="login-card-left"> <div class="login-card-left">
<el-image <el-image style="width: 600px;" :src="require('@/assets/images/login.png')" lazy></el-image> -->
style="width: 600px;" <!-- :src="require('@/assets/images/logo-login.gif')"-->
:src="require('@/assets/images/login.png')" <!-- </div> -->
lazy <!-- <div class="login-card-right">
></el-image>
<!-- :src="require('@/assets/images/logo-login.gif')"-->
</div>
<div class="login-card-right">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">智慧校园管理系统</h3> <h3 class="title">智慧校园管理系统</h3>
<el-form-item prop="phonenumber"> <el-form-item prop="phonenumber">
<el-input <el-input v-model="loginForm.phonenumber" type="text" auto-complete="off" placeholder="手机号码">
v-model="loginForm.phonenumber" <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
type="text"
auto-complete="off"
placeholder="手机号码"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input v-model="loginForm.password" type="text" style="text-security:disc; -webkit-text-security:disc;"
v-model="loginForm.password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin">
type="text" <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
style="text-security:disc; -webkit-text-security:disc;"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input> </el-input>
</el-form-item> </el-form-item> -->
<!-- <el-form-item prop="code" v-if="captchaEnabled">--> <!-- <el-form-item prop="code" v-if="captchaEnabled">-->
<!-- <el-input--> <!-- <el-input-->
<!-- v-model="loginForm.code"--> <!-- v-model="loginForm.code"-->
<!-- auto-complete="off"--> <!-- auto-complete="off"-->
<!-- placeholder="验证码"--> <!-- placeholder="验证码"-->
<!-- style="width: 63%"--> <!-- style="width: 63%"-->
<!-- @keyup.enter.native="handleLogin"--> <!-- @keyup.enter.native="handleLogin"-->
<!-- >--> <!-- >-->
<!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />--> <!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />-->
<!-- </el-input>--> <!-- </el-input>-->
<!-- <div class="login-code">--> <!-- <div class="login-code">-->
<!-- <img :src="codeUrl" @click="getCode" class="login-code-img"/>--> <!-- <img :src="codeUrl" @click="getCode" class="login-code-img"/>-->
<!-- </div>--> <!-- </div>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;"> <el-form-item style="width:100%;">
<el-button <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
:loading="loading" @click.native.prevent="handleLogin">
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span> <span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span> <span v-else>登 录 中...</span>
</el-button> </el-button>
...@@ -84,23 +65,34 @@ ...@@ -84,23 +65,34 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div> -->
<!-- 底部 --> <!-- 底部 -->
<div class="el-login-footer"> <!-- <div class="el-login-footer">
<span>© 2021 zhimin Copyright </span> <span>© 2021 zhimin Copyright </span>
</div> </div>
</div> </div> -->
</template> </template>
<script> <script>
import {getCodeImg} from "@/api/login"; import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import {encrypt, decrypt} from '@/utils/jsencrypt' import { encrypt, decrypt } from '@/utils/jsencrypt'
import * as dd from 'dingtalk-jsapi';
import { getCode } from "@/api/ddLogin";
import { getToken, setToken, removeToken } from '@/utils/auth'
import VueRouter from "vue-router";
export default { export default {
name: "Login", name: "Login",
data() { data() {
return { return {
code: null,
token: null,
authCodeTimestamp: 0, // 用于存储免登码的时间戳
authCodeExpiration: 5 * 60 * 1000, // 免登码有效期(假设为5分钟)
codeUrl: "", codeUrl: "",
loginForm: { loginForm: {
// username: "admin", // username: "admin",
...@@ -115,10 +107,10 @@ export default { ...@@ -115,10 +107,10 @@ export default {
// { required: true, trigger: "blur", message: "请输入您的账号" } // { required: true, trigger: "blur", message: "请输入您的账号" }
// ], // ],
phonenumber: [ phonenumber: [
{required: true, trigger: "blur", message: "请输入您的手机号码"} { required: true, trigger: "blur", message: "请输入您的手机号码" }
], ],
password: [ password: [
{required: true, trigger: "blur", message: "请输入您的密码"} { required: true, trigger: "blur", message: "请输入您的密码" }
], ],
// code: [{ required: true, trigger: "change", message: "请输入验证码" }] // code: [{ required: true, trigger: "change", message: "请输入验证码" }]
}, },
...@@ -140,70 +132,137 @@ export default { ...@@ -140,70 +132,137 @@ export default {
} }
}, },
created() { created() {
this.getCode();
}, },
mounted() { mounted() {
this.getCode(); // this.getCode();
this.getCookie(); // this.getCookie();
}, },
methods: { methods: {
// 获取code
getCode() { getCode() {
getCodeImg().then(res => { dd.getAuthCode({
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled; corpId: 'dingaa3937ff8b7dd267f2c783f7214b6d69',
if (this.captchaEnabled) { success: (res) => {
this.codeUrl = "data:image/gif;base64," + res.img; console.log('获取新的免登码成功', res);
this.loginForm.uuid = res.uuid; const code = res.code
} // this.code = code;
// this.authCodeTimestamp = currentTime;
// console.log('this.authCodeTimestamp', this.authCodeTimestamp);
console.log('code', code);
this.getToken(code)
// console.log('loginResponse', loginResponse);
},
fail: (res) => {
console.log('获取免登码失败', res);
},
complete: () => { },
}); });
}, },
getCookie() { // 获取token
// const username = Cookies.get("username"); getToken(code) {
// 获取手机号码 getCode(code).then(res => {
const phonenumber = Cookies.get("phonenumber"); console.log('res', res);
const password = Cookies.get("password"); if (res) {
const rememberMe = Cookies.get('rememberMe') setToken(res)
this.loginForm = { this.$store.commit('SET_TOKEN', res)
// username: username === undefined ? this.loginForm.username : username, this.$router.push({ path: '/' });
phonenumber: phonenumber === undefined ? this.loginForm.phonenumber : phonenumber, // 判断当前用户是否已拉取完user_info信息
password: password === undefined ? this.loginForm.password : decrypt(password), this.$store.dispatch('GetInfo').then((res) => {
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) this.$store.dispatch('GenerateRoutes').then(accessRoutes => {
}; // 根据roles权限生成可访问的路由表
}, router.addRoutes(accessRoutes) // 动态添加可访问路由表
handleLogin() { })
this.$refs.loginForm.validate(valid => { })
if (valid) { } else {
this.loading = true; this.$message.error(res.message)
if (this.loginForm.rememberMe) {
// Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("phonenumber", this.loginForm.phonenumber, {expires: 30});
Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
} else {
// Cookies.remove("username");
Cookies.remove("phonenumber");
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({path: this.redirect || "/"}).catch(() => {
});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
} }
});
} })
},
// 获取token
// async loginWithAuthCode(code) {
// console.log('code', code);
// try {
// // 向后端发送请求,使用免登码进行登录
// const loginResponse = await getCode({ code });
// console.log('code', code);
// this.$router.push({ path: '/index' });
// console.log('跳转页面');
// // 处理登录成功的情况,可能需要保存用户信息或者跳转到其他页面
// console.log('用户登录成功', loginResponse);
// const { token } = loginResponse.data; // 假设返回的数据中包含 token 字段
// console.log('用户 Token:', token); // 打印返回的 Token
// } catch (error) {
// // 处理登录失败的情况
// // console.error('登录失败', error);
// }
// }
// getCode() {
// getCodeImg().then(res => {
// this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
// if (this.captchaEnabled) {
// this.codeUrl = "data:image/gif;base64," + res.img;
// this.loginForm.uuid = res.uuid;
// }
// });
// },
// getCookie() {
// // const username = Cookies.get("username");
// // 获取手机号码
// const phonenumber = Cookies.get("phonenumber");
// const password = Cookies.get("password");
// const rememberMe = Cookies.get('rememberMe')
// this.loginForm = {
// // username: username === undefined ? this.loginForm.username : username,
// phonenumber: phonenumber === undefined ? this.loginForm.phonenumber : phonenumber,
// password: password === undefined ? this.loginForm.password : decrypt(password),
// rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
// };
// },
// handleLogin() {
// this.$refs.loginForm.validate(valid => {
// if (valid) {
// this.loading = true;
// if (this.loginForm.rememberMe) {
// // Cookies.set("username", this.loginForm.username, { expires: 30 });
// Cookies.set("phonenumber", this.loginForm.phonenumber, { expires: 30 });
// Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
// Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
// } else {
// // Cookies.remove("username");
// Cookies.remove("phonenumber");
// Cookies.remove("password");
// Cookies.remove('rememberMe');
// }
// this.$store.dispatch("Login", this.loginForm).then(() => {
// this.$router.push({ path: this.redirect || "/" }).catch(() => {
// });
// }).catch(() => {
// this.loading = false;
// if (this.captchaEnabled) {
// this.getCode();
// }
// });
// }
// });
// }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.login { .login {
background-color: rgba(0,191,255,0.15); background-color: rgba(0, 191, 255, 0.15);
} }
.login-container { .login-container {
//transition: transform .5s ease-in; //transition: transform .5s ease-in;
......
<template>
<div>
<button @click="getAuthCode">获取钉钉授权码</button>
</div>
</template>
<script>
import * as dd from 'dingtalk-jsapi';
import { getCode } from "@/api/ddLogin";
export default {
data() {
return {
redirect: "/index", // 这里假设要跳转到首页
code: null,
token: null,
authCodeTimestamp: 0, // 用于存储免登码的时间戳
authCodeExpiration: 5 * 60 * 1000, // 免登码有效期(假设为5分钟)
};
},
methods: {
getAuthCode() {
// 检查是否有有效的免登码
const currentTime = Date.now();
console.log(currentTime);
if (this.code && currentTime - this.authCodeTimestamp < this.authCodeExpiration) {
// 使用存储的免登码
console.log('使用缓存的免登码', this.code);
this.loginWithAuthCode(this.code);
return;
}
// 获取新的免登码
dd.getAuthCode({
corpId: 'dingaa3937ff8b7dd267f2c783f7214b6d69',
success: (res) => {
console.log('获取新的免登码成功', res);
const { code } = res;
// 存储新的免登码和时间戳
this.code = code;
this.authCodeTimestamp = currentTime;
},
fail: (res) => {
console.log('获取免登码失败', res);
},
complete: () => { },
});
},
async loginWithAuthCode(code) {
console.log('code', code);
try {
// 向后端发送请求,使用免登码进行登录
const loginResponse = await getCode({ code });
console.log('code', code);
console.log('跳转页面');
// 处理登录成功的情况,可能需要保存用户信息或者跳转到其他页面
console.log('用户登录成功', loginResponse);
const { token } = loginResponse.data; // 假设返回的数据中包含 token 字段
console.log('用户 Token:', token); // 打印返回的 Token
this.$router.push({ path: "/index" })
}
catch (error) {
// 处理登录失败的情况
// console.error('登录失败', error);
}
}
},
};
</script>
\ No newline at end of file
...@@ -20,6 +20,7 @@ module.exports = { ...@@ -20,6 +20,7 @@ module.exports = {
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/" : "/", publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
// publicPath: "/zpy",
outputDir: "dist", outputDir: "dist",
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: "static", assetsDir: "static",
...@@ -30,27 +31,28 @@ module.exports = { ...@@ -30,27 +31,28 @@ module.exports = {
productionSourceMap: false, productionSourceMap: false,
// webpack-dev-server 相关配置 // webpack-dev-server 相关配置
devServer: { devServer: {
host: "0.0.0.0", // host: "0.0.0.0",
port: port, host: "",
port: 1024,
hot: true, hot: true,
open: true, open: true,
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
//target: `http://localhost:8848`, //target: `http://localhost:8848`,
// target: ` http://192.168.137.1:8848`, // target: ` http://192.168.1.120:8848`,
//target: ` http://43.143.63.140:8848`, //target: ` http://43.143.63.140:8848`,
//target: ` http://43.143.63.140:8095`, //target: ` http://43.143.63.140:8095`,
//部署时后端地址 //部署时后端地址
//target: `http://47.105.176.202:8137`, //target: `http://47.105.176.202:8137`,
//学校内网 //学校内网
// target: `http://10.20.100.201:57321`, // target: `http://10.20.100.201:57321`,
target: `http://192.168.1.116:8848`, target: `http://47.105.176.202:5112`,
// target: `http://192.168.1.116:8848`, // target: `http://192.168.1.113:8848`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "", ["^" + process.env.VUE_APP_BASE_API]: " ",
}, },
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment