加入vuex模块!
This commit is contained in:
parent
b960ddfa5d
commit
554bb14c36
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-02-15 09:25:52
|
* @Date: 2023-02-15 09:25:52
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-02-28 19:14:16
|
* @LastEditTime: 2023-03-01 23:17:06
|
||||||
* @FilePath: /task_schedule/src/main.js
|
* @FilePath: /task_schedule/src/main.js
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { router } from "./router/index.js";
|
import { router } from "./router/index.js";
|
||||||
|
import store from "@/store/index";
|
||||||
|
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
@ -32,4 +33,5 @@ for (const [key, component,] of Object.entries(ElementPlusIconsVue))
|
|||||||
|
|
||||||
app.use(ElementPlus);
|
app.use(ElementPlus);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
app.use(store);
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: Kane
|
|
||||||
* @Date: 2023-03-01 18:23:32
|
|
||||||
* @LastEditors: Kane
|
|
||||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/store/index.js
|
|
||||||
* @Description: vuex配置文件
|
|
||||||
*
|
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
|
||||||
*/
|
|
19
code/web/task_schedule/src/store/index.ts
Normal file
19
code/web/task_schedule/src/store/index.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-03-01 18:23:32
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /task_schedule/src/store/index.ts
|
||||||
|
* @Description: vuex配置文件
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
import { createStore } from "vuex";
|
||||||
|
import app from "./modules/app";
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
modules: {
|
||||||
|
app,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default store;
|
24
code/web/task_schedule/src/store/modules/app.ts
Normal file
24
code/web/task_schedule/src/store/modules/app.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-03-01 23:03:02
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /task_schedule/src/store/modules/app.ts
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
const state = {
|
||||||
|
staffInfo: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const getters = {};
|
||||||
|
const mutations = {};
|
||||||
|
const actions = {};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state,
|
||||||
|
getters,
|
||||||
|
mutations,
|
||||||
|
actions,
|
||||||
|
};
|
@ -2,12 +2,14 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-02-28 19:30:40
|
* @Date: 2023-02-28 19:30:40
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/utils/api/url.ts
|
* @FilePath: /task_schedule/src/utils/api/url.ts
|
||||||
* @Description: 对URL的操作
|
* @Description: 对URL的操作
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
type stringkey = Record<string, string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将url的参数拆分成对象
|
* 将url的参数拆分成对象
|
||||||
* @param url 访问的url
|
* @param url 访问的url
|
||||||
@ -17,7 +19,7 @@ function getURLParams(url: string)
|
|||||||
{
|
{
|
||||||
const arr = url.split("?");
|
const arr = url.split("?");
|
||||||
const params = arr[1].split("&");
|
const params = arr[1].split("&");
|
||||||
const obj = {};
|
const obj: stringkey = {};
|
||||||
|
|
||||||
for (let i = 0; i < params.length; i++)
|
for (let i = 0; i < params.length; i++)
|
||||||
{
|
{
|
||||||
@ -34,11 +36,12 @@ function getURLParams(url: string)
|
|||||||
* @param url url字符串
|
* @param url url字符串
|
||||||
* @returns 返回包含url中参数作为key,值作为value的对象。
|
* @returns 返回包含url中参数作为key,值作为value的对象。
|
||||||
*/
|
*/
|
||||||
function getParamsFromURL(url: string): any
|
function getParamsFromURL(url: string): stringkey
|
||||||
{
|
{
|
||||||
|
|
||||||
const indexOfQuestionMark: number = url.indexOf("?");
|
const indexOfQuestionMark: number = url.indexOf("?");
|
||||||
const indexOfSharp: number = url.indexOf("#");
|
const indexOfSharp: number = url.indexOf("#");
|
||||||
const paramObj = {};
|
const paramObj: stringkey = {};
|
||||||
let paramString;
|
let paramString;
|
||||||
|
|
||||||
//url中没有问号,说明没有参数
|
//url中没有问号,说明没有参数
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-02-28 00:57:21
|
* @Date: 2023-02-28 00:57:21
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/views/Login.vue
|
* @FilePath: /task_schedule/src/views/Login.vue
|
||||||
* @Description:
|
* @Description:
|
||||||
* 登录页面,路由默认指向这个页面
|
* 登录页面,路由默认指向这个页面
|
||||||
* 1、判断url中的参数,取得用户信息,根据用户的部门改变路由
|
* 1、判断url中的参数,取得用户信息,根据用户的部门改变路由
|
||||||
@ -12,6 +12,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-wrap">
|
<div class="page-wrap">
|
||||||
<span v-show="ui.showNeedAccountTip">请在链接中提供用户的P13账号或P09工号。</span>
|
<span v-show="ui.showNeedAccountTip">请在链接中提供用户的P13账号或P09工号。</span>
|
||||||
|
<span v-show="ui.showAccountErrorTip">P13账号或P09工号错误,请核实!</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -31,14 +32,12 @@ export default {
|
|||||||
p13uid: "",
|
p13uid: "",
|
||||||
savedP13uid: "",
|
savedP13uid: "",
|
||||||
showNeedAccountTip: false,
|
showNeedAccountTip: false,
|
||||||
|
showAccountErrorTip: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
//根据url获取用户账号
|
//根据url获取用户账号
|
||||||
const urlParams = getParamsFromURL(window.location.href);
|
const urlParams = getParamsFromURL(window.location.href);
|
||||||
|
|
||||||
console.log(window.location.href);
|
|
||||||
console.log(urlParams);
|
|
||||||
|
|
||||||
if (urlParams.account != undefined)
|
if (urlParams.account != undefined)
|
||||||
{
|
{
|
||||||
//根据账号查询员工信息
|
//根据账号查询员工信息
|
||||||
@ -56,9 +55,9 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.page-wrap {
|
.page-wrap {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: calc(100vh - 100px);
|
height: calc(100vh - 10mm);
|
||||||
width: calc(100vw - 100px);
|
width: calc(100vw - 10mm);
|
||||||
margin: 50px;
|
margin: 5mm;
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
41
code/web/task_schedule/tsconfig.json
Normal file
41
code/web/task_schedule/tsconfig.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-03-01 23:38:12
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @FilePath: /task_schedule/tsconfig.json
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2015",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "CommonJS",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"sourceMap": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"baseUrl": "./", // paths 路径解析起点
|
||||||
|
"paths": {
|
||||||
|
"@/*": [
|
||||||
|
"src/*"
|
||||||
|
] // 别名路径设置
|
||||||
|
},
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"vite/client"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.tsx",
|
||||||
|
"src/**/*.vue",
|
||||||
|
"*.d.ts",
|
||||||
|
],
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user