Commit 144fc0c1efefa8e5a807badb095f7019a0738578

Authored by liujun001
1 parent 3a100eef

统一登录平台

.env.devTest
1 1 # 页面标题
2   -VITE_APP_TITLE = 临港巴士岗前检测系统
  2 +VITE_APP_TITLE = 岗前检查流程信息管理
3 3  
4 4 # 测试
5 5 VITE_APP_ENV = 'devTest'
6 6  
7 7 # 签到机系统/测试
8   -VITE_APP_BASE_API = 'http://61.169.120.202:8100'
  8 +VITE_APP_BASE_API = 'http://192.168.169.100:8100'
  9 +#VITE_APP_BASE_API = 'http://127.0.0.1:8100'
9 10 # VITE_APP_BASE_API = 'http://101.95.136.202:8100'
10 11  
11 12 # 是否在打包时开启压缩,支持 gzip 和 brotli
... ...
.env.development
1 1 # 页面标题
2   -VITE_APP_TITLE = 临港巴士岗前检测系统
  2 +VITE_APP_TITLE = 岗前检查流程信息管理系统
3 3  
4 4 # 开发环境配置
5 5 VITE_APP_ENV = 'development'
... ...
.env.production
1 1 # 页面标题
2   -VITE_APP_TITLE = "临港巴士岗前检测系统"
  2 +VITE_APP_TITLE = "岗前检查流程信息管理系统"
3 3  
4 4 # 生产环境配置
5 5 VITE_APP_ENV = 'production'
6 6  
7 7 # 签到机系统/生产环境
8 8 # VITE_APP_BASE_API = 'http://101.95.136.202:8100'
9   -VITE_APP_BASE_API = 'http://61.169.120.202:8102'
  9 +VITE_APP_BASE_API = 'http://10.10.150.173:8102'
10 10 # VITE_APP_BASE_API = 'http://1.14.107.94:8100'
11 11  
12 12 # 是否在打包时开启压缩,支持 gzip 和 brotli
... ...
.env.staging
1 1 # 页面标题
2   -VITE_APP_TITLE = 临港巴士岗前检测系统
  2 +VITE_APP_TITLE = 岗前检查流程信息管理系统
3 3  
4 4 # 测试
5 5 VITE_APP_ENV = 'staging'
... ...
index.html
... ... @@ -9,7 +9,7 @@
9 9 content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
10 10 />
11 11 <link rel="icon" href="public/favicon.ico" />
12   - <title>临港巴士岗前检测系统</title>
  12 + <title>岗前检查流程信息管理系统</title>
13 13 <!--[if lt IE 11
14 14 ]><script>
15 15 window.location.href = "/html/ie.html";
... ...
package.json
1 1 {
2 2 "name": "bsth",
3 3 "version": "3.8.5",
4   - "description": "临港巴士岗前检测系统",
  4 + "description": "岗前检查流程信息管理系统",
5 5 "author": "bsth",
6 6 "license": "MIT",
7 7 "scripts": {
... ...
src/api/login.js
... ... @@ -18,6 +18,14 @@ export function login(username, password, code, uuid) {
18 18 })
19 19 }
20 20  
  21 +export function getInfo(token) {
  22 +
  23 + return request({
  24 + url: '/getInfo?token='+token,
  25 + method: 'get'
  26 + })
  27 +}
  28 +
21 29 // 注册方法
22 30 export function register(data) {
23 31 return request({
... ... @@ -30,13 +38,13 @@ export function register(data) {
30 38 })
31 39 }
32 40  
33   -// 获取用户详细信息
34   -export function getInfo() {
35   - return request({
36   - url: '/getInfo',
37   - method: 'get'
38   - })
39   -}
  41 +// // 获取用户详细信息
  42 +// export function getInfo() {
  43 +// return request({
  44 +// url: '/getInfo',
  45 +// method: 'get'
  46 +// })
  47 +// }
40 48  
41 49 // 退出方法
42 50 export function logout() {
... ...
src/api/scheduling/keyWorkLocation/keyWorkLocation.js
... ... @@ -3,7 +3,6 @@ import request from &#39;@/utils/request&#39;
3 3  
4 4 // 分页查询列表
5 5 export function listLimitOfLinggangKeyWorkLocation(params,page,limit) {
6   - console.log("page------------------------->"+page);
7 6  
8 7 return request({
9 8 url: '/linggang/key/work/location/list/limit/'+page+'/'+limit,
... ...
src/components/FileUpload/index.vue
... ... @@ -165,7 +165,6 @@ function uploadedSuccessfully() {
165 165  
166 166 // 获取文件名称
167 167 function getFileName(name) {
168   - console.log(name);
169 168 try {
170 169 if (name.lastIndexOf("/") > -1) {
171 170 return name.slice(name.lastIndexOf("/") + 1);
... ...
src/components/ImageUpload/index.vue
... ... @@ -73,14 +73,12 @@ const showTip = computed(
73 73 );
74 74  
75 75 watch(() => props.modelValue, val => {
76   - console.log("value=========>"+val);
77 76  
78 77 if (val) {
79 78 // 首先将值转为数组
80 79 const list = Array.isArray(val) ? val : props.modelValue.split(",");
81 80 // 然后将数组转为对象数组
82 81 fileList.value = list.map(item => {
83   - console.log("111111111111111111111111");
84 82  
85 83 if (typeof item === "string") {
86 84 item = { name: item, url: item };
... ...
src/layout/components/Navbar.vue
... ... @@ -91,7 +91,8 @@ function logout() {
91 91 type: 'warning'
92 92 }).then(() => {
93 93 userStore.logOut().then(() => {
94   - location.href = '/index';
  94 + location.href = '/login';
  95 + //window.open('','_self').close()
95 96 })
96 97 }).catch(() => { });
97 98 }
... ...
src/layout/components/Sidebar/Logo.vue
... ... @@ -30,7 +30,7 @@ defineProps({
30 30 }
31 31 })
32 32  
33   -const title = ref('临港巴士岗前检测系统');
  33 +const title = ref('岗前检查流程信息管理');
34 34 const settingsStore = useSettingsStore();
35 35 const sideTheme = computed(() => settingsStore.sideTheme);
36 36 </script>
... ...
src/permission.js
1 1 import usePermissionStore from '@/store/modules/permission'
2 2 import useSettingsStore from '@/store/modules/settings'
3 3 import useUserStore from '@/store/modules/user'
4   -import { getToken } from '@/utils/auth'
  4 +import { getToken,setToken } from '@/utils/auth'
5 5 import { isRelogin } from '@/utils/request'
6 6 import { isHttp } from '@/utils/validate'
7 7 import { ElMessage } from 'element-plus'
... ... @@ -11,11 +11,12 @@ import router from &#39;./router&#39;
11 11  
12 12 NProgress.configure({ showSpinner: false });
13 13  
14   -const whiteList = ['/login', '/register','/in','/home/index'];
  14 +const whiteList = ['/login', '/register','/in','/home/index','/getInfo'];
15 15  
16 16 router.beforeEach((to, from, next) => {
17 17 NProgress.start()
18 18 if (getToken()) {
  19 +
19 20 to.meta.title && useSettingsStore().setTitle(to.meta.title)
20 21 /* has token*/
21 22 if (to.path === '/login') {
... ... @@ -37,10 +38,20 @@ router.beforeEach((to, from, next) =&gt; {
37 38 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
38 39 })
39 40 }).catch(err => {
  41 + // useUserStore().logOut().then(() => {
  42 + // ElMessage.error(err)
  43 + // next({ path: '/' })
  44 + // })
40 45 useUserStore().logOut().then(() => {
41   - ElMessage.error(err)
42   - next({ path: '/' })
43   - })
  46 + // Message.error(err)
  47 + // next({ path: '/' })
  48 + let index = to.path.indexOf("?");
  49 + let length = to.path.length;
  50 + let param = to.path.substring(index,length);
  51 +
  52 + location.href = '/';
  53 + })
  54 +
44 55 })
45 56 } else {
46 57 next()
... ... @@ -52,12 +63,46 @@ router.beforeEach((to, from, next) =&gt; {
52 63 // 在免登录白名单,直接进入
53 64 next()
54 65 } else {
55   - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
  66 + let params = getURLParams1();
  67 + let url = null;
  68 + if(params && params.token){
  69 + setToken(params.token)
  70 +
  71 + url = "/?token="+params.token;
  72 + }else{
  73 + url = `${to.fullPath}`;
  74 + if(url.indexOf("redirect") == -1){
  75 + if(url.indexOf(url,"?") > -1){
  76 + url =url.replace("?", "&");
  77 + }
  78 + url = `/login?redirect=`+url;
  79 + }else{
  80 + url = `/login`+url;
  81 + }
  82 + }
  83 +
  84 + next(url) // 否则全部重定向到登录页
56 85 NProgress.done()
57 86 }
58 87 }
59 88 })
60 89  
  90 +
  91 +function getURLParams1() {
  92 + const searchParams = window.location.search.substring(1).split('&');
  93 + const params = {
  94 +
  95 + };
  96 +
  97 + for (const param of searchParams) {
  98 + const [key, value] = param.split('=');
  99 + params[key] = value;
  100 + }
  101 +
  102 + return params;
  103 +}
  104 +
  105 +
61 106 router.afterEach(() => {
62 107 NProgress.done()
63 108 })
... ...
src/router/index.js
... ... @@ -37,6 +37,12 @@ export const constantRoutes = [
37 37 }
38 38 ]
39 39 },
  40 + //单点开始
  41 + {
  42 + path: '/getInfo',
  43 + component: (resolve) => require(['@/views/getInfo'], resolve),
  44 + hidden: true
  45 + },
40 46 {
41 47 path: '/login',
42 48 component: () => import('@/views/login'),
... ...
src/store/modules/user.js
... ... @@ -19,18 +19,30 @@ const useUserStore = defineStore(
19 19 const password = userInfo.password
20 20 const code = userInfo.code
21 21 const uuid = userInfo.uuid
  22 + let that = this;
22 23 return new Promise((resolve, reject) => {
23 24 login(username, password, code, uuid).then(res => {
24   - setToken(res.token)
25   - this.token = res.token
26   - resolve()
  25 +
  26 + that.refreshTokenFun(res.token,resolve);
27 27 }).catch(error => {
28 28 reject(error)
29 29 })
30 30 })
31 31 },
  32 +
  33 + refreshTokenFun(token,resolve){
  34 + setToken(token)
  35 + this.token = token
  36 + try{
  37 + resolve()
  38 + }catch(e){
  39 +
  40 + }
  41 +
  42 + },
32 43 // 获取用户信息
33 44 getInfo() {
  45 +
34 46 return new Promise((resolve, reject) => {
35 47 getInfo().then(res => {
36 48 const user = res.user
... ...
src/utils/request.js
... ... @@ -86,9 +86,17 @@ service.interceptors.response.use(res =&gt; {
86 86 if (!isRelogin.show) {
87 87 isRelogin.show = true;
88 88 ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
89   - isRelogin.show = false;
90   - useUserStore().logOut().then(() => {
91   - location.href = '/index';
  89 + // isRelogin.show = false;
  90 + // useUserStore().logOut().then(() => {
  91 + // location.href = '/index';
  92 + // })
  93 + store.dispatch('LogOut').then(() => {
  94 + // location.href = '/index';
  95 + //单点开始
  96 + console.log("================================>7");
  97 +
  98 + location.href = '/getInfo';
  99 + //单点结束
92 100 })
93 101 }).catch(() => {
94 102 isRelogin.show = false;
... ...
src/views/equipment/carinfo/carInfo.vue
... ... @@ -63,7 +63,7 @@
63 63 </el-table-column>
64 64 </el-table>
65 65  
66   - <pagination v-show="totalOfCarInfo > 0" :total="totalOfCarInfo" v-model:pageOfCarInfo="queryParamsOfCarInfo.pageNum" v-model:limit="queryParamsOfCarInfo.pageSize"
  66 + <pagination v-show="totalOfCarInfo > 0" :total="totalOfCarInfo" v-model:page="queryParamsOfCarInfo.pageNum" v-model:limit="queryParamsOfCarInfo.pageSize"
67 67 @pagination="getListOfCarInfo" />
68 68  
69 69 <el-dialog :title="titleOfCarInfo" v-model="openOfCarInfo" width="500px" append-to-body>
... ...
src/views/equipment/equipment_keyinfo/keyInfo.vue
... ... @@ -58,7 +58,7 @@
58 58 </el-table-column>
59 59 </el-table>
60 60  
61   - <pagination v-show="totalOfKeyInfo > 0" :total="totalOfKeyInfo" v-model:pageOfKeyInfo="queryParamsOfKeyInfo.pageNum" v-model:limit="queryParamsOfKeyInfo.pageSize"
  61 + <pagination v-show="totalOfKeyInfo > 0" :total="totalOfKeyInfo" v-model:page="queryParamsOfKeyInfo.pageNum" v-model:limit="queryParamsOfKeyInfo.pageSize"
62 62 @pagination="getListOfKeyInfo" />
63 63  
64 64 <el-dialog :title="titleOfKeyInfo" v-model="openOfKeyInfo" width="500px" append-to-body>
... ...
src/views/home/index.vue
... ... @@ -7,7 +7,7 @@
7 7 <div class="big-view-container-title">
8 8 <!-- 标题 -->
9 9 <div class="big-view-container-box">
10   - 临港巴士岗前检查
  10 + 岗前检查流程信息管理系统
11 11 </div>
12 12 <div class="big-view-container-time">
13 13 <text>
... ... @@ -248,8 +248,6 @@ const startUpdateDataTaskScheduler = () =&gt; {
248 248 }, 1000);
249 249 }
250 250  
251   -
252   -
253 251 /** 监听数据更新日期 */
254 252 watch(() => timeTaskObject.updateDateObject, (val1, val2) => {
255 253 // 发送请求更新数据
... ...
src/views/login.vue
1 1 <template>
2 2 <div class="login">
3 3 <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
4   - <h3 class="title">临港巴士岗前检测系统</h3>
  4 + <h3 class="title">岗前检查流程信息管理系统</h3>
5 5 <el-form-item prop="username">
6 6 <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
7 7 <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
... ... @@ -85,6 +85,7 @@ function handleLogin() {
85 85 }
86 86 // 调用action的登录方法
87 87 userStore.login(loginForm.value).then(() => {
  88 +
88 89 router.push({ path: redirect.value || "/" });
89 90 }).catch(() => {
90 91 loading.value = false;
... ... @@ -118,8 +119,37 @@ function getCookie() {
118 119 };
119 120 }
120 121  
  122 +function getURLParams() {
  123 + const searchParams = window.location.search.substring(1).split('&');
  124 + const params = {
  125 +
  126 + };
  127 +
  128 + for (const param of searchParams) {
  129 + const [key, value] = param.split('=');
  130 + params[key] = value;
  131 + }
  132 +
  133 + return params;
  134 + }
  135 +
  136 +function singleSignOn(fun){
  137 + let params = getURLParams();
  138 + console.log(params);
  139 +
  140 + if(params.token && params.redirect){
  141 +
  142 + userStore.refreshTokenFun(params.token);
  143 + console.log(params.token);
  144 + router.push("/index?token="+params.token);
  145 + }
  146 +}
  147 +
  148 +singleSignOn()
121 149 getCode();
122 150 getCookie();
  151 +
  152 +
123 153 </script>
124 154  
125 155 <style lang='scss' scoped>
... ...
src/views/refresh/page.vue
... ... @@ -19,8 +19,8 @@
19 19 import { refreshScheduling, refreshKeyInfoLocal, refreshDriver, refreshDriverImageByJob,refreshDriverImageByName } from "@/api/refresh/page";
20 20 const { proxy } = getCurrentInstance();
21 21  
22   - const imagePath=ref();
23   - const device =ref("/data/lingang/images");
  22 + const imagePath=ref("/images");
  23 + const device =ref();
24 24  
25 25 function refreshSchedulingFun(){
26 26 refreshScheduling().then(res=>{
... ...
src/views/register.vue
1 1 <template>
2 2 <div class="register">
3 3 <el-form ref="registerRef" :model="registerForm" :rules="registerRules" class="register-form">
4   - <h3 class="title">临港巴士岗前检测系统</h3>
  4 + <h3 class="title">岗前检查流程信息管理系统</h3>
5 5 <el-form-item prop="username">
6 6 <el-input v-model="registerForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
7 7 <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
... ...
src/views/system/venueInfo/venueInfo.vue
... ... @@ -54,7 +54,7 @@
54 54 </el-table-column>
55 55 </el-table>
56 56  
57   - <pagination v-show="totalOfVenueInfo > 0" :total="totalOfVenueInfo" v-model:pageOfVenueInfo="queryParamsOfVenueInfo.pageNum" v-model:limit="queryParamsOfVenueInfo.pageSize"
  57 + <pagination v-show="totalOfVenueInfo > 0" :total="totalOfVenueInfo" v-model:page="queryParamsOfVenueInfo.pageNum" v-model:limit="queryParamsOfVenueInfo.pageSize"
58 58 @pagination="getListOfVenueInfo" />
59 59  
60 60 <el-dialog :title="titleOfVenueInfo" v-model="openOfVenueInfo" width="500px" append-to-body>
... ...