加入vuex模块!

This commit is contained in:
Kane 2023-03-02 00:35:21 +08:00
parent b960ddfa5d
commit 554bb14c36
8 changed files with 4759 additions and 4680 deletions

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-02-28 19:14:16
* @LastEditTime: 2023-03-01 23:17:06
* @FilePath: /task_schedule/src/main.js
* @Description:
*
@ -10,6 +10,7 @@
*/
import { createApp } from 'vue';
import { router } from "./router/index.js";
import store from "@/store/index";
import App from './App.vue';
@ -32,4 +33,5 @@ for (const [key, component,] of Object.entries(ElementPlusIconsVue))
app.use(ElementPlus);
app.use(router);
app.use(store);
app.mount('#app');

View File

@ -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.
*/

View 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;

View 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,
};

View File

@ -2,12 +2,14 @@
* @Author: Kane
* @Date: 2023-02-28 19:30:40
* @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的操作
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
type stringkey = Record<string, string>;
/**
* url的参数拆分成对象
* @param url 访url
@ -17,7 +19,7 @@ function getURLParams(url: string)
{
const arr = url.split("?");
const params = arr[1].split("&");
const obj = {};
const obj: stringkey = {};
for (let i = 0; i < params.length; i++)
{
@ -34,11 +36,12 @@ function getURLParams(url: string)
* @param url url字符串
* @returns url中参数作为keyvalue的对象
*/
function getParamsFromURL(url: string): any
function getParamsFromURL(url: string): stringkey
{
const indexOfQuestionMark: number = url.indexOf("?");
const indexOfSharp: number = url.indexOf("#");
const paramObj = {};
const paramObj: stringkey = {};
let paramString;
//url中没有问号说明没有参数

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2023-02-28 00:57:21
* @LastEditors: Kane
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/views/Login.vue
* @FilePath: /task_schedule/src/views/Login.vue
* @Description:
* 登录页面路由默认指向这个页面
* 1判断url中的参数取得用户信息根据用户的部门改变路由
@ -12,6 +12,7 @@
<template>
<div class="page-wrap">
<span v-show="ui.showNeedAccountTip">请在链接中提供用户的P13账号或P09工号</span>
<span v-show="ui.showAccountErrorTip">P13账号或P09工号错误请核实</span>
</div>
</template>
@ -31,14 +32,12 @@ export default {
p13uid: "",
savedP13uid: "",
showNeedAccountTip: false,
showAccountErrorTip: false,
});
//url
const urlParams = getParamsFromURL(window.location.href);
console.log(window.location.href);
console.log(urlParams);
if (urlParams.account != undefined)
{
//
@ -56,9 +55,9 @@ export default {
<style scoped>
.page-wrap {
box-sizing: border-box;
height: calc(100vh - 100px);
width: calc(100vw - 100px);
margin: 50px;
height: calc(100vh - 10mm);
width: calc(100vw - 10mm);
margin: 5mm;
border: 1px solid red;
display: flex;
justify-content: center;

View 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