feature-yaojie #1
@ -4,4 +4,4 @@ NODE_ENV = 'development'
|
||||
# 开发模式连生产服
|
||||
VUE_APP_BASE_API = '/api-prod'
|
||||
VUE_APP_COOKIE = ''
|
||||
VUE_APP_APIII = 'http://nbxt.oa.x-lf.cn'
|
||||
VUE_APP_INNER='http://nbxt.oa.x-lf.cn'
|
2
auto-imports.d.ts
vendored
2
auto-imports.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
|
||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||
}
|
||||
|
40
components.d.ts
vendored
40
components.d.ts
vendored
@ -13,7 +13,44 @@ declare module '@vue/runtime-core' {
|
||||
DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default']
|
||||
Dropzone: typeof import('./src/components/Dropzone/index.vue')['default']
|
||||
EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.vue')['default']
|
||||
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
|
||||
ElBadge: typeof import('element-plus/es')['ElBadge']
|
||||
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
||||
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||
ElForm: typeof import('element-plus/es')['ElForm']
|
||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
|
||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||
ElSelectV2: typeof import('element-plus/es')['ElSelectV2']
|
||||
ElSlider: typeof import('element-plus/es')['ElSlider']
|
||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
ElTag: typeof import('element-plus/es')['ElTag']
|
||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
|
||||
GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default']
|
||||
Hamburger: typeof import('./src/components/Hamburger/index.vue')['default']
|
||||
@ -40,4 +77,7 @@ declare module '@vue/runtime-core' {
|
||||
UploadExcel: typeof import('./src/components/UploadExcel/index.vue')['default']
|
||||
VueCountTo: typeof import('./src/components/vue-count-to/vue-countTo.vue')['default']
|
||||
}
|
||||
export interface ComponentCustomProperties {
|
||||
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
||||
}
|
||||
}
|
||||
|
@ -355,12 +355,12 @@ export const asyncRoutes = [
|
||||
},
|
||||
|
||||
{
|
||||
path: '/tab',
|
||||
path: '/daily',
|
||||
component: 'layout/Layout',
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: 'views/tab/index',
|
||||
component: 'views/daily/index',
|
||||
name: 'Tab',
|
||||
meta: { title: 'Tab', icon: 'tab' }
|
||||
}
|
||||
@ -393,13 +393,13 @@ export const asyncRoutes = [
|
||||
},
|
||||
|
||||
{
|
||||
path: '/error-log',
|
||||
path: '/Message',
|
||||
component: 'layout/Layout',
|
||||
redirect: 'noRedirect',
|
||||
children: [
|
||||
{
|
||||
path: 'log',
|
||||
component: 'views/error-log/index',
|
||||
component: 'views/Message/index',
|
||||
name: 'ErrorLog',
|
||||
meta: { title: 'Error Log', icon: 'bug' }
|
||||
}
|
||||
@ -407,36 +407,36 @@ export const asyncRoutes = [
|
||||
},
|
||||
|
||||
{
|
||||
path: '/excel',
|
||||
path: '/examine',
|
||||
component: 'layout/Layout',
|
||||
redirect: '/excel/export-excel',
|
||||
redirect: '/examine/export-examine',
|
||||
name: 'Excel',
|
||||
meta: {
|
||||
title: 'Excel',
|
||||
icon: 'excel'
|
||||
icon: 'examine'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'export-excel',
|
||||
component: 'views/excel/export-excel',
|
||||
path: 'export-examine',
|
||||
component: 'views/examine/export-examine',
|
||||
name: 'ExportExcel',
|
||||
meta: { title: 'Export Excel' }
|
||||
},
|
||||
{
|
||||
path: 'export-selected-excel',
|
||||
component: 'views/excel/select-excel',
|
||||
path: 'export-selected-examine',
|
||||
component: 'views/examine/select-examine',
|
||||
name: 'SelectExcel',
|
||||
meta: { title: 'Select Excel' }
|
||||
},
|
||||
{
|
||||
path: 'export-merge-header',
|
||||
component: 'views/excel/merge-header',
|
||||
component: 'views/examine/merge-header',
|
||||
name: 'MergeHeader',
|
||||
meta: { title: 'Merge Header' }
|
||||
},
|
||||
{
|
||||
path: 'upload-excel',
|
||||
component: 'views/excel/upload-excel',
|
||||
path: 'upload-examine',
|
||||
component: 'views/examine/upload-examine',
|
||||
name: 'UploadExcel',
|
||||
meta: { title: 'Upload Excel' }
|
||||
}
|
||||
|
58
src/api/daily.js
Normal file
58
src/api/daily.js
Normal file
@ -0,0 +1,58 @@
|
||||
import request from '../utils/request';
|
||||
function getCurrentTimestamp() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
|
||||
// 获取日报
|
||||
export function GetMyDaily(data, token) {
|
||||
return request({
|
||||
url: '/daily/getMyDaily',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
//提交日报
|
||||
|
||||
export function DailyAdd(data, token) {
|
||||
return request({
|
||||
url: '/daily/add',
|
||||
method: 'post',
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type':'application/json;charset=utf-8',
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//编辑日报
|
||||
export function DailyUpdate(data, token) {
|
||||
return request({
|
||||
url: '/daily/update',
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type':'application/json;charset=utf-8',
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
//查询日报
|
||||
export function SearchDaily(data, token) {
|
||||
return request({
|
||||
url: '/daily/search',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
123
src/api/examine.js
Normal file
123
src/api/examine.js
Normal file
@ -0,0 +1,123 @@
|
||||
import request from '../utils/request';
|
||||
function getCurrentTimestamp() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
// 根据名称获取项目列表
|
||||
export function ProjectGetByName(data, token) {
|
||||
return request({
|
||||
url: '/project/get/name',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 项目名查询所有子系统
|
||||
export function ProjectChildGetName(data, token) {
|
||||
return request({
|
||||
url: '/project/child/get/id',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//根据项目和系统名查询系统所属子模块
|
||||
export function ProjectModuleGetName(data, token) {
|
||||
return request({
|
||||
url: '/project/module/get/id',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 提交申请
|
||||
export function ReviewAdd(data, token) {
|
||||
return request({
|
||||
url: '/review/add',
|
||||
method: 'post',
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type':'application/json;charset=utf-8',
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取我的审核列表
|
||||
export function GetMyReview(data, token) {
|
||||
return request({
|
||||
url: '/review/getMyReview',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//修改审核状态
|
||||
// id result
|
||||
export function UpdateReviewResult(data, token) {
|
||||
return request({
|
||||
url: '/review/updateReview',
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'content-type':'application/json;charset=utf-8',
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取审核记录
|
||||
export function ReviewRecords(data, token) {
|
||||
return request({
|
||||
url: '/review/getReviewRecords',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//查询我的审核
|
||||
export function ReviewSearchMyReview(data, token) {
|
||||
return request({
|
||||
url: '/review/searchMyReview',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//查询我的记录
|
||||
export function ReviewRecordsSearch(data, token) {
|
||||
return request({
|
||||
url: '/review/searchReviewRecords',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
29
src/api/message.js
Normal file
29
src/api/message.js
Normal file
@ -0,0 +1,29 @@
|
||||
import request from '../utils/request';
|
||||
|
||||
|
||||
function getCurrentTimestamp() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
export function messageGet(data, token) {
|
||||
return request({
|
||||
url: '/message/get',
|
||||
method: 'get',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function messageDelete(data, token) {
|
||||
return request({
|
||||
url: '/message/delete',
|
||||
method: 'delete',
|
||||
params: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
843
src/api/request.js
Normal file
843
src/api/request.js
Normal file
@ -0,0 +1,843 @@
|
||||
import axios from "axios";
|
||||
import getCurrentTimestamp from "@/js/methods.js";
|
||||
|
||||
const api = 'http://nbxt.oa.x-lf.cn'
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param data (user,password)
|
||||
* @returns {*}
|
||||
*/
|
||||
const login = (data) => {
|
||||
return axios({
|
||||
url: api+"/auth/login",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param data (username,password,address,phone,email,sex,age)
|
||||
* @returns {*}
|
||||
*/
|
||||
const register = (data) => {
|
||||
return axios({
|
||||
url: api + "/auth/register",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const logout = (token) => {
|
||||
return axios({
|
||||
url: api + "/auth/logout",
|
||||
method: "get",
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param data (oldPassword,newPassword,confirmPassword)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const changePassword = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/auth/password",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* @param data (email,check(邮箱验证码),newPassword)
|
||||
* @returns {*}
|
||||
*/
|
||||
const forgetPassword = (data) => {
|
||||
return axios({
|
||||
url: api + "/auth/password/forget",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱登录
|
||||
* @param params 对象(包含邮箱email:string,验证码code:integer)
|
||||
* @returns {*}
|
||||
*/
|
||||
const authLoginWithEmail = (params) => {
|
||||
return axios({
|
||||
url: api + "/auth/login/email",
|
||||
method: "get",
|
||||
params: params,
|
||||
headers: {
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮箱验证码
|
||||
* @param email 邮箱(string)
|
||||
* @returns {*}
|
||||
*/
|
||||
const authSendEmailCode = (email) => {
|
||||
return axios({
|
||||
url: api + "/auth/email/code",
|
||||
method: "get",
|
||||
params: email,
|
||||
headers: {
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部用户信息
|
||||
* @param data (page,limit,search,role)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userAllCurrent = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/user/current/all",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer ' + token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个用户信息(敏感)
|
||||
* @param params (id,username,email,phone)可以只传一个参数
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userCurrent = (params, token) => {
|
||||
return axios({
|
||||
url: api + "/user/current",
|
||||
method: "get",
|
||||
params: params,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
// 'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @param data (username,password,address,phone,email,sex,age)必须全部
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userAdd = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/user/add",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
* @param data (id,address,phone,email,age,signature,sex,avatar,nickname,description
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userEdit = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/user/edit",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userDelete = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/user/delete",
|
||||
method: "delete",
|
||||
params: {
|
||||
id: id
|
||||
},
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'content-type':'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
* @param data (id,isLock(1解锁))
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userLock = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/user/lock",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息(非敏感)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userGetProfile = (token) => {
|
||||
return axios({
|
||||
url: api + "/user/profile/get",
|
||||
method: "get",
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息(普通用户)
|
||||
* @param data (id,username,address,phone,email,sex,age,signature,avatar,nickname,description)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const userEditProfile = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/user/profile/edit",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色
|
||||
* @param id 可选,不填则是查询所有?
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleGet = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/role/get",
|
||||
method: "get",
|
||||
params: id,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
* @param data (name,displayName)示例(name:teacher, displayName:老师)必须
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleAdd = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/role/add",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑角色
|
||||
* @param data (id,name,displayName(中文))必须
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleEdit = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/role/edit",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
* @param id
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleDelete = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/role/delete",
|
||||
method: "delete",
|
||||
params: id,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 给角色添加用户
|
||||
* @param data (rid,uid)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleAddUser = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/role/user/add",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户的角色
|
||||
* @param data (uid,rid)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleChangeUser = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/role/user/change",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除用户的角色
|
||||
* @param uid
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const roleRemoveUser = (uid, token) => {
|
||||
return axios({
|
||||
url: api + "/role/user/remove",
|
||||
method: "delete",
|
||||
data: uid,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询轮播图(管理员)
|
||||
* @param id 可选
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const infoGetHeaderImage = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/info/header-image/get",
|
||||
method: "get",
|
||||
params: id,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑轮播图信息
|
||||
* @param data (id,displayOrder(排序顺序),image(图片地址),title,description,isActive(是否启用))
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const infoEditHeaderImage = ( data, token) => {
|
||||
return axios({
|
||||
url: api + "/info/header-image/edit",
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增轮播图
|
||||
* @param data (displayOrder,image,title,description,isActive)
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const infoAddHeaderImage = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/info/header-image/add",
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除轮播图
|
||||
* @param id
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const infoDeleteHeaderImage = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/info/header-image/del",
|
||||
method: "delete",
|
||||
params: id,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示轮播图,顺序或倒序
|
||||
* @param showType 0倒序,1顺序
|
||||
* @param token
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const infoEditSettingHeaderImage = (showType, token) => {
|
||||
return axios({
|
||||
url: api + "/info/header-image/edit-setting",
|
||||
method: "put",
|
||||
data: showType,
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示我负责的项目
|
||||
* @param data
|
||||
* @param token
|
||||
*/
|
||||
const projectGet =(data, token) => {
|
||||
const tags = data.tags
|
||||
const isFinish = data.isFinish
|
||||
// const principalUser = data.principalId
|
||||
const encodedTags = tags.map(tag => encodeURIComponent(tag));
|
||||
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
|
||||
const queryTags = `tags=${encodedTags.join('&tags=')}`;
|
||||
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
|
||||
return axios({
|
||||
url:api+ `/project/get?${queryTags}&${queryIsFinish}`,
|
||||
method: "get",
|
||||
headers:{
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
* @param token
|
||||
* @param data
|
||||
*/
|
||||
const projectAdd =(token,data) => {
|
||||
return axios({
|
||||
url:api+ "/project/add",
|
||||
method: "post",
|
||||
data:data,
|
||||
headers:{
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示游客查看的项目
|
||||
*/
|
||||
const projectGetCustom = (data) =>{
|
||||
const tags = data.tags
|
||||
const isFinish = data.isFinish
|
||||
// const principalUser = data.principalId
|
||||
const encodedTags = tags.map(tag => encodeURIComponent(tag));
|
||||
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
|
||||
const queryTags = `tags=${encodedTags.join('&tags=')}`;
|
||||
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
|
||||
return axios({
|
||||
url:`${api}/project/get/custom?id=${data.id}&${queryTags}&${queryIsFinish}`,
|
||||
method: "get",
|
||||
headers:{
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
// projectGetCustom().interceptors.request.use(config => {
|
||||
// let url = config.url
|
||||
// if (config.params) {
|
||||
// url += '?'
|
||||
// const keys = Object.keys(config.params)
|
||||
// for (const key of keys) {
|
||||
// url += `${key}=${encodeURIComponent(config.params[key])}&`
|
||||
// }
|
||||
// url = url.substring(0, url.length-1)
|
||||
// config.params = {}
|
||||
// }
|
||||
// config.url = url
|
||||
// return config
|
||||
// })
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 展示全部消息
|
||||
*
|
||||
*/
|
||||
const messageGet = (token) => {
|
||||
return axios({
|
||||
url:api + "/message/get",
|
||||
method:"get",
|
||||
headers:{
|
||||
'Authorization':'Bearer '+token,
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到tag列表
|
||||
* @param token
|
||||
*/
|
||||
const getTagsProjectList = () =>{
|
||||
return axios({
|
||||
url:api+ "/tags/project/list",
|
||||
method: "get",
|
||||
headers:{
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到tag列表
|
||||
* @param data
|
||||
* @param token
|
||||
* 获取项目的所有子系统
|
||||
*/
|
||||
// const projectWorkGet = (data,token) => {
|
||||
// return axios({
|
||||
// url:api + "/project/work/get",
|
||||
// method:"get",
|
||||
// data:data,
|
||||
// headers:{
|
||||
// 'Authorization':'Bearer '+token,
|
||||
// 'content-type': 'application/json;charset=utf-8',
|
||||
// 'Timestamp': getCurrentTimestamp()
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
const projectWorkGet = (data,token) =>{
|
||||
const tags = data.tags
|
||||
const isFinish = data.isFinish
|
||||
const encodedTags = tags.map(tag => encodeURIComponent(tag));
|
||||
const encodedIsFinish = isFinish.map(is => encodeURIComponent(is))
|
||||
const queryTags = `tags=${encodedTags.join('&tags=')}`;
|
||||
const queryIsFinish = `isFinish=${encodedIsFinish.join('&isFinish=')}`;
|
||||
return axios({
|
||||
url:`${api}/project/work/get?${queryTags}&${queryIsFinish}`,
|
||||
method: "get",
|
||||
headers:{
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目id获取项目信息
|
||||
* @param id 项目id
|
||||
* @param token 访问令牌
|
||||
* @returns {Promise<AxiosResponse<any>> | *}
|
||||
*/
|
||||
const projectGetById = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/project/get/id?id=" + id,
|
||||
method: "get",
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const projectWorkAdd = (data, token) => {
|
||||
return axios({
|
||||
url: api + "/project/work/add" ,
|
||||
method: "post",
|
||||
data:data,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// data(id)
|
||||
const projectDelete = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/project/delete" ,
|
||||
method: "delete",
|
||||
params: {
|
||||
id: id
|
||||
},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目id获取子系统的所有信息
|
||||
* @param projectId
|
||||
* @param token
|
||||
*/
|
||||
const moduleGetByProjectId = (projectId, token) => {
|
||||
return axios({
|
||||
url: api + "/module/get?projectId=" + projectId,
|
||||
method: "get",
|
||||
// params: {
|
||||
// projectId: projectId
|
||||
// },
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据子系统id获取子模块信息
|
||||
* @param sysId
|
||||
* @param token
|
||||
*/
|
||||
const moduleGetBySysId = (sysId, token) => {
|
||||
return axios({
|
||||
url: api + "/module/get/min?sysId=" + sysId,
|
||||
methods:"get",
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*const moduleGetByProjectId = (projectId, token) => {
|
||||
return axios ({
|
||||
url:api + "/module/get",
|
||||
methods:"get",
|
||||
params:projectId,
|
||||
headers:{
|
||||
'Authorization':'Bearer '+token,
|
||||
'content-type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
|
||||
const moduleDelete = (id, token) =>{
|
||||
return axios({
|
||||
url: api + "/module/delete/" + id,
|
||||
method: "delete",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp(),
|
||||
'Authorization':'Bearer '+ token
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模块/子系统信息
|
||||
* @param id
|
||||
* @param token
|
||||
* @returns {Promise<axios.AxiosResponse<any>> | *}
|
||||
*/
|
||||
const getModuleInfo = (id, token) => {
|
||||
return axios({
|
||||
url: api + "/project/getwork/id",
|
||||
method: 'get',
|
||||
params: {
|
||||
id: id
|
||||
},
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
// 'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getPrincipalUser = (token) => {
|
||||
return axios({
|
||||
url: api + "/project/pri",
|
||||
method: 'get',
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
// 'Content-Type': 'application/json;charset=utf-8',
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
login,
|
||||
register,
|
||||
logout,
|
||||
changePassword,
|
||||
forgetPassword,
|
||||
authLoginWithEmail,
|
||||
authSendEmailCode,
|
||||
|
||||
userAllCurrent,
|
||||
userCurrent,
|
||||
userAdd,
|
||||
userEdit,
|
||||
userDelete,
|
||||
userLock,
|
||||
userGetProfile,
|
||||
userEditProfile,
|
||||
|
||||
roleGet,
|
||||
roleEdit,
|
||||
roleAdd,
|
||||
roleDelete,
|
||||
roleAddUser,
|
||||
roleChangeUser,
|
||||
roleRemoveUser,
|
||||
|
||||
infoGetHeaderImage,
|
||||
infoEditHeaderImage,
|
||||
infoAddHeaderImage,
|
||||
infoDeleteHeaderImage,
|
||||
infoEditSettingHeaderImage,
|
||||
|
||||
|
||||
projectGet,
|
||||
projectGetCustom,
|
||||
projectAdd,
|
||||
projectGetById,
|
||||
projectWorkAdd,
|
||||
getTagsProjectList,
|
||||
projectWorkGet,
|
||||
projectDelete,
|
||||
|
||||
|
||||
moduleGetByProjectId,
|
||||
moduleGetBySysId,
|
||||
moduleDelete,
|
||||
getModuleInfo,
|
||||
|
||||
messageGet,
|
||||
getPrincipalUser
|
||||
|
||||
}
|
@ -1,25 +1,40 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
|
||||
function getCurrentTimestamp() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
export function login(data) {
|
||||
return request({
|
||||
url: '/vue-element-admin/user/login',
|
||||
url: '/auth/login',
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
headers: {
|
||||
'Timestamp':getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getInfo(token) {
|
||||
return request({
|
||||
url: '/vue-element-admin/user/info',
|
||||
url: '/user/profile/get',
|
||||
method: 'get',
|
||||
params: { token }
|
||||
// params: {token},
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function logout(token) {
|
||||
return request({
|
||||
url: '/vue-element-admin/user/logout',
|
||||
method: 'post',
|
||||
params: { token }
|
||||
url: '/auth/logout',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
<template>
|
||||
|
||||
<el-breadcrumb class="app-breadcrumb" separator="/">
|
||||
<transition-group name="breadcrumb">
|
||||
<el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path">
|
||||
<span v-if="item.redirect === 'noRedirect' || index == levelList.length - 1" class="no-redirect">{{
|
||||
item.meta.title
|
||||
item.meta.title
|
||||
}}</span>
|
||||
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
|
||||
</el-breadcrumb-item>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<!-- 顶部缩放侧边栏icon-->
|
||||
<!-- 顶部缩放侧边栏icon-->
|
||||
<div style="padding: 0 15px;" @click="toggleClick">
|
||||
<svg :class="{ 'is-active': isActive }" class="hamburger" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"
|
||||
width="64" height="64">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<!-- 顶部全屏icon-->
|
||||
<!-- 顶部全屏icon-->
|
||||
<div>
|
||||
<svg-icon :icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'" @click="click" />
|
||||
</div>
|
||||
|
@ -76,7 +76,7 @@ export default defineComponent({
|
||||
this.upload(rawFile);
|
||||
},
|
||||
upload(rawFile) {
|
||||
this.$refs['excel-upload-input'].value = null; // fix can't select the same excel
|
||||
this.$refs['excel-upload-input'].value = null; // fix can't select the same examine
|
||||
|
||||
if (!this.beforeUpload) {
|
||||
this.readerData(rawFile);
|
||||
|
@ -62,6 +62,7 @@ import Search from '@/components/HeaderSearch';
|
||||
import { defineComponent } from 'vue';
|
||||
import { CaretBottom } from '@element-plus/icons-vue';
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
Breadcrumb,
|
||||
@ -86,7 +87,11 @@ export default defineComponent({
|
||||
store.app().toggleSidebar();
|
||||
},
|
||||
async logout() {
|
||||
await store.user().logout();
|
||||
console.log('5989569898')
|
||||
// store.user().login()
|
||||
// await store.user().logoutBug();
|
||||
await store.user().logout();
|
||||
// await store.user().logoutTest();
|
||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`);
|
||||
}
|
||||
}
|
||||
|
@ -5,11 +5,13 @@ import NProgress from 'nprogress'; // progress bar
|
||||
import 'nprogress/nprogress.css'; // progress bar style
|
||||
import { getToken } from '@/utils/auth'; // get token from cookie
|
||||
import getPageTitle from '@/utils/get-page-title';
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
NProgress.configure({ showSpinner: false }); // NProgress Configuration
|
||||
|
||||
const whiteList = ['/login', '/auth-redirect']; // no redirect whitelist
|
||||
const whiteList = ['/login', '/auth-redirect', '/register']; // no redirect whitelist
|
||||
|
||||
//每次路由变动,都会调用这个路由守卫
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
console.log('router.beforeEach', to.path, from.path);
|
||||
// start progress bar
|
||||
@ -20,29 +22,43 @@ router.beforeEach(async (to, from, next) => {
|
||||
|
||||
// determine whether the user has logged in
|
||||
const hasToken = getToken();
|
||||
console.log('88888',hasToken)
|
||||
|
||||
if (hasToken) {
|
||||
//有token
|
||||
// 且前往登录
|
||||
if (to.path === '/login') {
|
||||
// if is logged in, redirect to the home page
|
||||
NProgress.done(); // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
||||
next({ path: '/' });
|
||||
} else {
|
||||
// 有token,但是不去登录
|
||||
// determine whether the user has obtained his permission roles through getInfo
|
||||
const hasRoles = userStore().roles && userStore().roles.length > 0;
|
||||
// const hasRoles = userStore().roles && userStore().roles.length > 0;
|
||||
const hasRoles = true;
|
||||
|
||||
// console.log('hasRoles=', hasRoles);
|
||||
// 如果用角色
|
||||
if (hasRoles) {
|
||||
// 继续执行
|
||||
const accessRoutes = await permissionStore().generateRoutes(['admin']);
|
||||
accessRoutes.forEach(item => {
|
||||
router.addRoute(item);
|
||||
});
|
||||
next();
|
||||
} else {
|
||||
// 没有角色
|
||||
try {
|
||||
// get user info
|
||||
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const infoRes = await userStore().getInfo() as any;
|
||||
let roles = [];
|
||||
const infoRes = await userStore().getInfo() as any; //获取角色,调用查询个人信息的接口
|
||||
console.log('permissionuserinfor:',infoRes)
|
||||
let roles:any = [];
|
||||
if (infoRes.roles) {
|
||||
roles = infoRes.roles;
|
||||
}
|
||||
|
||||
roles = ['admin']
|
||||
// generate accessible routes map based on roles
|
||||
const accessRoutes = await permissionStore().generateRoutes(roles);
|
||||
// console.log('accessRoutes=', accessRoutes)
|
||||
@ -68,6 +84,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有token
|
||||
/* has no token*/
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// in the free login whitelist, go directly
|
||||
|
@ -10,7 +10,7 @@ const Layout = ():RouteComponent => import('@/layout/index.vue');
|
||||
// import componentsRouter from './modules/components';
|
||||
// import chartsRouter from './modules/charts';
|
||||
// import nestedRouter from './modules/nested';
|
||||
import tableRouter from './modules/table';
|
||||
// import tableRouter from './modules/table';
|
||||
|
||||
/**
|
||||
* constantRoutes
|
||||
@ -51,26 +51,26 @@ export const constantRoutes:RouteRecordRaw[] = [
|
||||
component: () => import('@/views/error-page/401.vue'),
|
||||
meta: { hidden: true }
|
||||
},
|
||||
// {
|
||||
// path: '/',
|
||||
// component: Layout,
|
||||
// redirect: '/dashboard',
|
||||
// children: [
|
||||
// {
|
||||
// path: 'dashboard',
|
||||
// component: () => import('@/views/dashboard/index.vue'),
|
||||
// name: 'Dashboard',
|
||||
// meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
component: () => import('@/views/dashboard/index.vue'),
|
||||
name: 'Dashboard',
|
||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// path: '/documentation',
|
||||
// component: Layout,
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/documentation/index.vue'),
|
||||
// component: () => import('@/views/documentation/Message.vue'),
|
||||
// name: 'Documentation',
|
||||
// meta: { title: 'Documentation', icon: 'documentation', affix: true }
|
||||
// }
|
||||
@ -83,7 +83,7 @@ export const constantRoutes:RouteRecordRaw[] = [
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/guide/index.vue'),
|
||||
// component: () => import('@/views/guide/Message.vue'),
|
||||
// name: 'Guide',
|
||||
// meta: { title: 'Guide', icon: 'guide', noCache: true }
|
||||
// }
|
||||
@ -112,55 +112,96 @@ export const constantRoutes:RouteRecordRaw[] = [
|
||||
* 注意:hidden、alwaysShow 属性配置移动到了meta中!!!
|
||||
*/
|
||||
export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// {
|
||||
// path: '/permission',
|
||||
// component: Layout,
|
||||
// redirect: '/permission/page',
|
||||
// name: 'Permission',
|
||||
// meta: {
|
||||
// alwaysShow: true, // will always show the root menu
|
||||
// title: 'Permission',
|
||||
// icon: 'lock',
|
||||
// roles: ['admin', 'editor','teacher_user'] // you can set roles in root nav
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'page',
|
||||
// component: () => import('@/views/permission/page.vue'),
|
||||
// name: 'PagePermission',
|
||||
// meta: {
|
||||
// title: 'Page Permission',
|
||||
// roles: ['admin','teacher_user'] // or you can only set roles in sub nav
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// path: 'directive',
|
||||
// component: () => import('@/views/permission/directive.vue'),
|
||||
// name: 'DirectivePermission',
|
||||
// meta: {
|
||||
// title: 'Directive Permission'
|
||||
// // if do not set roles, means: this page does not require permission
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// path: 'role',
|
||||
// component: () => import('@/views/permission/role.vue'),
|
||||
// name: 'RolePermission',
|
||||
// meta: {
|
||||
// title: 'Role Permission',
|
||||
// roles: ['admin','teacher']
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
|
||||
// 个人项目
|
||||
{
|
||||
path: '/permission',
|
||||
path: '/myself',
|
||||
component: Layout,
|
||||
redirect: '/permission/page',
|
||||
name: 'Permission',
|
||||
redirect: '/myself',
|
||||
meta: {
|
||||
// alwaysShow: true, // will always show the root menu
|
||||
title: '内部系统'
|
||||
// icon: 'lock'
|
||||
// roles: ['admin', 'editor'] // you can set roles in root nav
|
||||
alwaysShow: true, // will always show the root menu
|
||||
title: '个人项目',
|
||||
icon: 'nested',
|
||||
roles: ['admin', 'teacher_user', 'principle', 'developer', 'console']
|
||||
},
|
||||
children: [
|
||||
// {
|
||||
// path: 'page',
|
||||
// component: () => import('@/views/permission/page.vue'),
|
||||
// name: 'PagePermission',
|
||||
// meta: {
|
||||
// title: 'Page Permission',
|
||||
// roles: ['admin'] // or you can only set roles in sub nav
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// path: 'directive',
|
||||
// component: () => import('@/views/permission/directive.vue'),
|
||||
// name: 'DirectivePermission',
|
||||
// meta: {
|
||||
// title: 'Directive Permission'
|
||||
// // if do not set roles, means: this page does not require permission
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// path: 'role',
|
||||
// component: () => import('@/views/permission/role.vue'),
|
||||
// name: 'RolePermission',
|
||||
// meta: {
|
||||
// title: 'Role Permission',
|
||||
// roles: ['admin']
|
||||
// }
|
||||
// }
|
||||
{
|
||||
// 我负责的
|
||||
path: 'charge',
|
||||
component: () => import('@/views/personal/project/charge.vue'),
|
||||
name: 'Charge',
|
||||
meta: { title: '我负责的', icon: 'user', affix: true, role: ['console'] }
|
||||
},
|
||||
{
|
||||
// 我管理的
|
||||
path: 'manage',
|
||||
component: () => import('@/views/personal/project/manage.vue'),
|
||||
name: 'Manage',
|
||||
meta: { title: '我管理的', icon: 'user', affix: true, role: ['principle', 'developer', 'console'] }
|
||||
},
|
||||
{
|
||||
// 我参与的
|
||||
path: 'participate',
|
||||
component: () => import('@/views/personal/project/participate.vue'),
|
||||
name: 'Participate',
|
||||
meta: { title: '我参与的', icon: 'user', affix: true, role: ['principle', 'developer', 'console'] }
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
// {
|
||||
// path: '/icon',
|
||||
// component: Layout,
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/icons/index.vue'),
|
||||
// component: () => import('@/views/icons/Message.vue'),
|
||||
// name: 'Icons',
|
||||
// meta: { title: 'Icons', icon: 'icon', noCache: true }
|
||||
// }
|
||||
@ -171,8 +212,8 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// componentsRouter,
|
||||
// chartsRouter,
|
||||
// nestedRouter,
|
||||
tableRouter,
|
||||
//
|
||||
// tableRouter,
|
||||
|
||||
// {
|
||||
// path: '/example',
|
||||
// component: Layout,
|
||||
@ -205,14 +246,14 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// },
|
||||
|
||||
{
|
||||
path: '/tab',
|
||||
path: '/daily',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/tab/index.vue'),
|
||||
path: 'd',
|
||||
component: () => import('@/views/daily/index.vue'),
|
||||
name: 'Tab',
|
||||
meta: { title: '日报', icon: 'tab' }
|
||||
meta: { title: '日报', icon: 'tab', role: ['principle', 'developer', 'console'] }
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -243,52 +284,46 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// },
|
||||
|
||||
{
|
||||
path: '/error-log',
|
||||
path: '/message',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'log',
|
||||
component: () => import('@/views/error-log/index.vue'),
|
||||
name: 'ErrorLog',
|
||||
meta: { title: '消息', icon: 'bug' }
|
||||
path: 'ms',
|
||||
component: () => import('@/views/Message/Message.vue'),
|
||||
name: 'email',
|
||||
meta: { title: '信息', icon: 'email', role: ['principle', 'developer', 'console'] }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/excel',
|
||||
path: '/examine',
|
||||
component: Layout,
|
||||
redirect: '/excel/export-excel',
|
||||
name: 'Excel',
|
||||
redirect: '/examine/export-examine',
|
||||
name: 'examine',
|
||||
meta: {
|
||||
title: '申请和审批',
|
||||
icon: 'excel'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'export-excel',
|
||||
component: () => import('@/views/excel/export-excel.vue'),
|
||||
path: 'submit-application',
|
||||
component: () => import('@/views/examine/submit-application.vue'),
|
||||
name: 'ExportExcel',
|
||||
meta: { title: '提交申请' }
|
||||
},
|
||||
{
|
||||
path: 'export-selected-excel',
|
||||
component: () => import('@/views/excel/select-excel.vue'),
|
||||
name: 'SelectExcel',
|
||||
path: 'export-selected-examine',
|
||||
component: () => import('@/views/examine/My-review.vue'),
|
||||
name: 'MyReview',
|
||||
meta: { title: '我的审批' }
|
||||
},
|
||||
{
|
||||
path: 'export-merge-header',
|
||||
component: () => import('@/views/excel/merge-header.vue'),
|
||||
name: 'MergeHeader',
|
||||
path: 'search-record',
|
||||
component: () => import('@/views/examine/search-records.vue'),
|
||||
name: 'searchRecord',
|
||||
meta: { title: '记录查询' }
|
||||
}
|
||||
// {
|
||||
// path: 'upload-excel',
|
||||
// component: () => import('@/views/excel/upload-excel.vue'),
|
||||
// name: 'UploadExcel',
|
||||
// meta: { title: 'Upload Excel' }
|
||||
// }
|
||||
]
|
||||
},
|
||||
|
||||
@ -301,7 +336,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// children: [
|
||||
// {
|
||||
// path: 'download',
|
||||
// component: () => import('@/views/zip/index.vue'),
|
||||
// component: () => import('@/views/zip/Message.vue'),
|
||||
// name: 'ExportZip',
|
||||
// meta: { title: 'Export Zip' }
|
||||
// }
|
||||
@ -315,7 +350,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/pdf/index.vue'),
|
||||
// component: () => import('@/views/pdf/Message.vue'),
|
||||
// name: 'PDF',
|
||||
// meta: { title: 'PDF', icon: 'pdf' }
|
||||
// }
|
||||
@ -326,19 +361,19 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// component: () => import('@/views/pdf/download.vue'),
|
||||
// meta: { hidden: true }
|
||||
// },
|
||||
|
||||
{
|
||||
path: '/theme',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/theme/index.vue'),
|
||||
name: 'Theme',
|
||||
meta: { title: '个人信息管理', icon: 'theme' }
|
||||
}
|
||||
]
|
||||
},
|
||||
//
|
||||
// {
|
||||
// path: '/theme',
|
||||
// component: Layout,
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/theme/Message.vue'),
|
||||
// name: 'Theme',
|
||||
// meta: { title: 'Theme', icon: 'theme' }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
|
||||
// {
|
||||
// path: '/clipboard',
|
||||
@ -346,7 +381,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// children: [
|
||||
// {
|
||||
// path: 'index',
|
||||
// component: () => import('@/views/clipboard/index.vue'),
|
||||
// component: () => import('@/views/clipboard/Message.vue'),
|
||||
// name: 'ClipboardDemo',
|
||||
// meta: { title: 'Clipboard', icon: 'clipboard' }
|
||||
// }
|
||||
@ -364,7 +399,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
//
|
||||
|
||||
// {
|
||||
// path: '/my-demo',
|
||||
// component: Layout,
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
const Layout = () => import('@/layout/index.vue');
|
||||
|
||||
//侧边栏
|
||||
const tableRouter = {
|
||||
path: '/table',
|
||||
component: Layout,
|
||||
|
@ -55,10 +55,15 @@ export default defineStore({
|
||||
this.routes = constantRoutes.concat(routes);
|
||||
},
|
||||
generateRoutes(roles: string[]) {
|
||||
console.log("asdasd")
|
||||
let accessedRoutes;
|
||||
if (roles.includes('admin')) {
|
||||
console.log("123")
|
||||
|
||||
accessedRoutes = asyncRoutes || [];
|
||||
} else {
|
||||
console.log("456")
|
||||
|
||||
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles);
|
||||
}
|
||||
this.setRoutes(accessedRoutes);
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { login as apiLogin, logout as apiLogout, getInfo as apiGetInfo } from '@/api/user';
|
||||
import {login as apiLogin, logout as apiLogout, getInfo as apiGetInfo, } from '@/api/user';
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth';
|
||||
import router, { resetRouter } from '@/router';
|
||||
import tagsViewStore from './tagsView';
|
||||
import permissionStore from './permission';
|
||||
// import {response} from "express";
|
||||
|
||||
export interface IUserState {
|
||||
token: string;
|
||||
@ -16,26 +17,59 @@ export interface IUserState {
|
||||
|
||||
export default defineStore({
|
||||
id: 'user',
|
||||
state: ():IUserState => ({
|
||||
state: ():{
|
||||
address: string;
|
||||
signature: string;
|
||||
sex: string;
|
||||
roles: any[];
|
||||
description: string;
|
||||
avatar: string;
|
||||
token: any;
|
||||
phone: string;
|
||||
nickname: string;
|
||||
id: string;
|
||||
email: string;
|
||||
age: string;
|
||||
username: string
|
||||
} => ({
|
||||
token: getToken(),
|
||||
userId: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
introduction: '',
|
||||
roles: []
|
||||
id:'',
|
||||
username:'',
|
||||
address:'',
|
||||
phone:'',
|
||||
email:'',
|
||||
age:'',
|
||||
signature:'',
|
||||
avatar:'',
|
||||
nickname:'',
|
||||
sex:'',
|
||||
description:'',
|
||||
roles:['admin']
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// user login
|
||||
|
||||
|
||||
login(userInfo):Promise<void> {
|
||||
const { username, password } = userInfo;
|
||||
return new Promise((resolve, reject) => {
|
||||
apiLogin({ username: username.trim(), password: password }).then(response => {
|
||||
apiLogin({ user: username.trim(), password: password }).then(response => {
|
||||
const { data } = response;
|
||||
this.token = data.token;
|
||||
setToken(data.token);
|
||||
// console.log("token", this.token)
|
||||
console.log("response", response)
|
||||
// @ts-ignore
|
||||
ElMessage.success(response.message)
|
||||
router.push('/')
|
||||
resolve();
|
||||
// console.log('2222',response)
|
||||
}).catch(error => {
|
||||
//@ts-ignore
|
||||
// ElMessage.error(response.message)
|
||||
console.log("login ERROR:", error)
|
||||
// console.log('3333',error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -46,23 +80,30 @@ export default defineStore({
|
||||
return new Promise((resolve, reject) => {
|
||||
apiGetInfo(this.token).then(response => {
|
||||
const { data } = response;
|
||||
|
||||
console.log('66666',data)
|
||||
if (!data) {
|
||||
reject('Verification failed, please Login again.');
|
||||
}
|
||||
|
||||
const { roles, name, avatar, introduction } = data;
|
||||
|
||||
const { id,username,address,phone,email,age,signature,avatar,nickname,sex,description,role } = data;
|
||||
// roles must be a non-empty array
|
||||
if (!roles || roles.length <= 0) {
|
||||
reject('getInfo: roles must be a non-null array!');
|
||||
}
|
||||
|
||||
this.roles = roles;
|
||||
this.name = name;
|
||||
// if (!roles || roles.length <= 0) {
|
||||
// reject('getInfo: roles must be a non-null array!');
|
||||
// }
|
||||
this.id = id;
|
||||
this.roles = role.name;
|
||||
// this.roles =['admin'];
|
||||
this.username = username;
|
||||
this.avatar = avatar;
|
||||
this.introduction = introduction;
|
||||
this.description = description;
|
||||
this.sex = sex;
|
||||
this.age = age;
|
||||
this.address = address;
|
||||
this.phone = phone;
|
||||
this.email = email;
|
||||
this.signature = signature;
|
||||
this.nickname = nickname;
|
||||
resolve(data);
|
||||
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
@ -71,23 +112,65 @@ export default defineStore({
|
||||
|
||||
// user logout
|
||||
logout():Promise<void> {
|
||||
console.log("token",this.token)
|
||||
return new Promise((resolve, reject) => {
|
||||
apiLogout(this.token).then(() => {
|
||||
this.token = '';
|
||||
this.roles = [];
|
||||
// console.log('退出',this.token)
|
||||
removeToken();
|
||||
resetRouter();
|
||||
|
||||
ElMessage.success("退出成功")
|
||||
// reset visited views and cached views
|
||||
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||
tagsViewStore().delAllViews();
|
||||
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
//logoutBug: 只删除后端的token,不删除浏览器的token
|
||||
logoutBug():Promise<void> {
|
||||
console.log("token",this.token)
|
||||
return new Promise((resolve, reject) => {
|
||||
apiLogout(this.token).then(() => {
|
||||
this.token = '';
|
||||
this.roles = [];
|
||||
resetRouter();
|
||||
// reset visited views and cached views
|
||||
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||
tagsViewStore().delAllViews();
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
//logoutTest: 只删除浏览器的token,后端不删除
|
||||
logoutTest(): void {
|
||||
removeToken();
|
||||
console.log("removeTokenTestSuccess");
|
||||
// console.log("token",this.token)
|
||||
// return new Promise((resolve, reject) => {
|
||||
// apiLogout(this.token).then(() => {
|
||||
// this.token = '';
|
||||
// this.roles = [];
|
||||
// console.log('退出',this.token)
|
||||
// // removeToken();
|
||||
// resetRouter();
|
||||
// // reset visited views and cached views
|
||||
// // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||
// tagsViewStore().delAllViews();
|
||||
// resolve();
|
||||
// }).catch(error => {
|
||||
// reject(error);
|
||||
// });
|
||||
//
|
||||
// });
|
||||
},
|
||||
|
||||
// remove token
|
||||
resetToken() {
|
||||
@ -105,11 +188,11 @@ export default defineStore({
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const infoRes = await this.getInfo() as any;
|
||||
let roles = [];
|
||||
let roles : any[] = [];
|
||||
if (infoRes.roles) {
|
||||
roles = infoRes.roles;
|
||||
}
|
||||
|
||||
roles = ['admin']
|
||||
resetRouter();
|
||||
|
||||
// generate accessible routes map based on roles
|
||||
|
@ -1,24 +1,28 @@
|
||||
import axios from 'axios';
|
||||
import store from '@/store';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import {useRouter} from 'vue-router'
|
||||
import {getToken, removeToken} from '@/utils/auth';
|
||||
import {resetRouter} from "@/router";
|
||||
|
||||
const BaseURL ='https://nbxt.oa.x-lf.cn'
|
||||
const router = useRouter();
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
baseURL: BaseURL, // url = base url + request url
|
||||
// withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 5000 // request timeout
|
||||
timeout: 10000 // request timeout
|
||||
});
|
||||
|
||||
// request interceptor
|
||||
service.interceptors.request.use(
|
||||
|
||||
config => {
|
||||
// do something before request is sent
|
||||
|
||||
if (store.user().token) {
|
||||
// let each request carry token
|
||||
// ['X-Token'] is a custom headers key
|
||||
// please modify it according to the actual situation
|
||||
config.headers['X-Token'] = getToken();
|
||||
config.headers['token'] = getToken();
|
||||
}
|
||||
return config;
|
||||
},
|
||||
@ -43,31 +47,43 @@ service.interceptors.response.use(
|
||||
*/
|
||||
response => {
|
||||
const res = response.data;
|
||||
// console.log("removeToken:",removeToken())
|
||||
console.log('999999',response)
|
||||
if (res.code === 40103) {
|
||||
store.user().logoutTest();
|
||||
console.log("返回登录成功")
|
||||
location.reload();
|
||||
|
||||
// if the custom code is not 20000, it is judged as an error.
|
||||
if (res.code !== 20000) {
|
||||
ElMessage({
|
||||
message: res.message || 'Error',
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
});
|
||||
|
||||
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
||||
if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
|
||||
// to re-login
|
||||
ElMessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
|
||||
confirmButtonText: 'Re-Login',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
store.user().resetToken();
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
return Promise.reject(new Error(res.message || 'Error'));
|
||||
} else {
|
||||
return res;
|
||||
// resetRouter()
|
||||
// router.push("/login")
|
||||
} else if (res.code !== 200) {
|
||||
ElMessage.error(res.message)
|
||||
}
|
||||
// if the custom code is not 20000, it is judged as an error.
|
||||
// if (res.code !== 20000 && res.code !== 200) {
|
||||
// ElMessage({
|
||||
// message: res.message || 'Error',
|
||||
// type: 'error',
|
||||
// duration: 5 * 1000
|
||||
// });
|
||||
//
|
||||
// // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
||||
// if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
|
||||
// // to re-login
|
||||
// ElMessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
|
||||
// confirmButtonText: 'Re-Login',
|
||||
// cancelButtonText: 'Cancel',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// store.user().resetToken();
|
||||
// location.reload();
|
||||
// });
|
||||
// }
|
||||
// return Promise.reject(new Error(res.message || 'Error'));
|
||||
// } else {
|
||||
// return res;
|
||||
// }
|
||||
return res;
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error); // for debug
|
||||
|
@ -15,7 +15,7 @@ export function isExternal(path) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function validUsername(str) {
|
||||
const valid_map = ['admin', 'editor'];
|
||||
const valid_map = ['admin', 'editor', 'teacher_user', 'teacher_demo', 'demo', 'xiao_lfeng', 'yangna'];
|
||||
return valid_map.indexOf(str.trim()) >= 0;
|
||||
}
|
||||
|
||||
|
2
src/vendor/Export2Excel.js
vendored
2
src/vendor/Export2Excel.js
vendored
@ -154,7 +154,7 @@ export function export_json_to_excel({
|
||||
bookType = 'xlsx'
|
||||
} = {}) {
|
||||
/* original data */
|
||||
filename = filename || 'excel-list'
|
||||
filename = filename || 'examine-list'
|
||||
data = [...data]
|
||||
data.unshift(header);
|
||||
|
||||
|
263
src/views/Message/Message.vue
Normal file
263
src/views/Message/Message.vue
Normal file
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header>
|
||||
<span>消息</span>
|
||||
</template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-between ">
|
||||
<div class="block">
|
||||
<span class="demonstration" style="margin-right: 8px">时间</span>
|
||||
<el-date-picker
|
||||
v-model="value2"
|
||||
type="datetimerange"
|
||||
:shortcuts="shortcuts"
|
||||
range-separator="To"
|
||||
start-placeholder="Start date"
|
||||
end-placeholder="End date"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px" @click="selectMessage">查询</el-button>
|
||||
<el-button style="width:80px" @click="resetting">重置</el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<el-button
|
||||
text
|
||||
>历史记录</el-button
|
||||
>
|
||||
<el-tag style="margin-right: 1.7vw">总数:{{messageData.total}}</el-tag>
|
||||
</div>
|
||||
|
||||
<div style="height: 43vh">
|
||||
<div v-for="(row) in messageData.data" :key="Message" class="table-row">
|
||||
<div class="table-author" style="text-align: left">
|
||||
<span class="date" style="display:flex;flex-direction: column">
|
||||
<span style="color:skyblue">{{row.senderName}}</span>
|
||||
<span>{{ row.text }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="table-time createdTime">
|
||||
<span>{{ formatDateTime(row.createdAt) }}</span>
|
||||
</div>
|
||||
<div class="table-btn table-cell-right">
|
||||
<el-button size="small" type="danger" @click="handleDelete(row);centerDialogVisible = true">Delete</el-button>
|
||||
<el-dialog v-model="centerDialogVisible" title="删除" width="500" :modal="false">
|
||||
<span>
|
||||
是否确认删除此条信息?
|
||||
</span>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="centerDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="deleteItem">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-pagination
|
||||
@current-change="pagination"
|
||||
background layout="prev, pager, next"
|
||||
:total="messageData.total"
|
||||
v-model:page-size="requestData.pageSize"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top: 0.5vh"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive, ref, watch} from 'vue';
|
||||
import {messageGet, messageDelete} from '@/api/message'
|
||||
import {getToken} from "@/utils/auth";
|
||||
// 删除对话框
|
||||
const centerDialogVisible = ref(false);
|
||||
// 时间选择器
|
||||
const value2 = ref('')
|
||||
const shortcuts = [
|
||||
{
|
||||
text: 'Last week',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - 7)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: 'Last month',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: 'Last 3 months',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setMonth(start.getMonth() - 3)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
// 表格
|
||||
interface Message {
|
||||
id: number
|
||||
createdAt: string
|
||||
name: string
|
||||
text: string
|
||||
}
|
||||
const deleteData = reactive({
|
||||
id: -1
|
||||
})
|
||||
const handleDelete = ( row: Message) => {
|
||||
deleteData.id = row.id
|
||||
console.log("time:select", value2.value[1])
|
||||
};
|
||||
|
||||
const messageData = reactive({
|
||||
data:[],
|
||||
total: 0
|
||||
|
||||
})
|
||||
|
||||
let requestData = reactive({
|
||||
page:1,
|
||||
pageSize: 5,
|
||||
begin: '',
|
||||
end: ''
|
||||
})
|
||||
// 监听时间选择器,对时间选择器的数据进行拆分并传到请求数据中。
|
||||
watch(value2, (newValue) => {
|
||||
if (newValue !== '') {
|
||||
requestData.begin = formatDateTime(newValue[0])
|
||||
requestData.end = formatDateTime(newValue[1])
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
flushData()
|
||||
})
|
||||
|
||||
function flushData() {
|
||||
messageGet(requestData, getToken()).then((res)=>{
|
||||
console.log("getMessageResult:",res.data.list);
|
||||
messageData.data = res.data.list
|
||||
messageData.total = res.data.total
|
||||
})
|
||||
}
|
||||
function pagination(currentPage: number) {
|
||||
requestData.page = currentPage
|
||||
flushData()
|
||||
}
|
||||
|
||||
|
||||
function deleteItem(){
|
||||
if (deleteData.id === -1) {
|
||||
ElMessage.error("删除异常,请重试!")
|
||||
} else {
|
||||
messageDelete(deleteData, getToken()).then((res) => {
|
||||
console.log(res,'删除')
|
||||
if (res.code === 200) {
|
||||
flushData()
|
||||
ElMessage.success("删除成功")
|
||||
}
|
||||
})
|
||||
}
|
||||
centerDialogVisible.value = false
|
||||
}
|
||||
|
||||
function selectMessage (){
|
||||
try {
|
||||
flushData()
|
||||
console.log(requestData)
|
||||
ElMessage.success('查询成功')
|
||||
}catch (e) {
|
||||
ElMessage.success('查询失败')
|
||||
}
|
||||
}
|
||||
function resetting(){
|
||||
requestData.begin = ''
|
||||
requestData.end = ''
|
||||
value2.value = ''
|
||||
}
|
||||
//自定义方法:格式化时间
|
||||
function formatDateTime(dateTimeString: string): string {
|
||||
const dateTime = new Date(dateTimeString);
|
||||
const year = dateTime.getFullYear();
|
||||
const month = String(dateTime.getMonth() + 1).padStart(2, '0');
|
||||
const date = String(dateTime.getDate()).padStart(2, '0');
|
||||
const hours = String(dateTime.getHours()).padStart(2, '0');
|
||||
const minutes = String(dateTime.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(dateTime.getSeconds()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.table-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.table-author {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
}
|
||||
.table-time {
|
||||
flex: 0.3;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
align-items: center;
|
||||
}
|
||||
.table-btn {
|
||||
flex: 0.3;
|
||||
padding: 0;
|
||||
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
align-items: center;
|
||||
/*background-color: #32fe04;*/
|
||||
}
|
||||
.createdTime{
|
||||
margin-left: 50px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.table-cell-right {
|
||||
justify-content: flex-end;
|
||||
margin-right:2vw;
|
||||
}
|
||||
.date {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.date el-icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
380
src/views/daily/index.vue
Normal file
380
src/views/daily/index.vue
Normal file
@ -0,0 +1,380 @@
|
||||
<template>
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header><span>日报</span></template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-around ">
|
||||
<div>
|
||||
项目
|
||||
<el-select-v2
|
||||
v-model="requestData.projectId"
|
||||
style="width: 240px;"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteMethod"
|
||||
clearable
|
||||
:options="options"
|
||||
:loading="loading"
|
||||
placeholder="请输入所属项目"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
时间
|
||||
<el-date-picker
|
||||
v-model="value2"
|
||||
type="datetimerange"
|
||||
:shortcuts="shortcuts"
|
||||
range-separator="To"
|
||||
start-placeholder="Start date"
|
||||
end-placeholder="End date"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px" @click="selectMessage">查询</el-button>
|
||||
<el-button style="width:80px" @click="resetting">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<div>
|
||||
<el-button text >历史记录</el-button>
|
||||
<el-tag>总条数:{{ messageData.total }}</el-tag>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" @click="AddDialogVisible=true">新建</el-button>
|
||||
<el-dialog v-model="AddDialogVisible" width="500" center :modal="false" :show-close="false">
|
||||
<template #header>
|
||||
<div style="display:flex;flex-direction: row;justify-content: flex-start;color:red;font-size:large" >新增日报</div>
|
||||
<el-divider content-position="left" style="background:red"><el-icon><CaretTop /></el-icon></el-divider>
|
||||
</template>
|
||||
|
||||
<div>
|
||||
<div style="margin-top:-4vh ">
|
||||
<span style="color:red">项目名称:</span>
|
||||
<el-select-v2
|
||||
v-model="AddContent.projectId"
|
||||
style="width: 240px;"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteMethod"
|
||||
clearable
|
||||
:options="options"
|
||||
:loading="loading"
|
||||
placeholder="请输入所属项目"
|
||||
/>
|
||||
</div>
|
||||
<div style="margin-top:2vh ">
|
||||
<span style="color:red"> 工作时间:</span>
|
||||
<el-date-picker
|
||||
v-model="AddContent.dailyTime"
|
||||
type="datetime"
|
||||
placeholder="Pick a Date"
|
||||
/>
|
||||
</div>
|
||||
<div style="margin-top:2vh ;display:flex;flex-direction:row;">
|
||||
<span style="color: red">日报内容:</span>
|
||||
<el-input
|
||||
v-model="AddContent.content"
|
||||
style="width: 360px;"
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="AddDialogVisible = false" type="info" style="width: 80px">取消 </el-button>
|
||||
<el-button type="danger" style="width:80px" @click="AddDailyMs">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<div style="height: 45vh;">
|
||||
<el-table :data="messageData.data" style="max-width: 100vw;">
|
||||
<el-table-column property="projectName" label="项目名称" width="120" />
|
||||
<el-table-column property="userName" label="项目负责人" />
|
||||
<el-table-column property="content" label="日报" />
|
||||
<el-table-column property="userName" label="日报填写者" />
|
||||
<el-table-column property="createdAt" label="填写时间" />
|
||||
<el-table-column property="dailyTime" label="工作时间" />
|
||||
<el-table-column property="id" label="操作" >
|
||||
<template #default="scope">
|
||||
<el-button size="small" text style="color:deepskyblue" @click="EditDailyMs(scope.row)">修改</el-button>
|
||||
<el-dialog v-model="EditDialogVisible" width="500" center :modal="false" :show-close="false">
|
||||
<template #header>
|
||||
<div style="display:flex;flex-direction: row;justify-content: flex-start;color:#409eff;font-size:large" >编辑日报</div>
|
||||
<el-divider content-position="left" style="background:red"><el-icon><CaretTop /></el-icon></el-divider>
|
||||
</template>
|
||||
|
||||
<div>
|
||||
<div style="margin-top:-4vh ">
|
||||
<span style="color:#409eff"> 工作时间:</span>
|
||||
<el-date-picker
|
||||
v-model="updateContent.dailyTime"
|
||||
type="datetime"
|
||||
placeholder="输入工作时间"
|
||||
/>
|
||||
</div>
|
||||
<div style="margin-top:2vh ;display:flex;flex-direction:row;">
|
||||
<span style="color:#409eff">日报内容:</span>
|
||||
<el-input
|
||||
v-model="updateContent.content"
|
||||
style="width: 360px;"
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="EditDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="EditDailyContent">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination
|
||||
@current-change="pagination"
|
||||
background layout="prev, pager, next"
|
||||
:total="messageData.total"
|
||||
v-model:page-size="requestData.pageSize"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top: 0.5vh"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive, ref, watch} from 'vue';
|
||||
import { ElTable } from 'element-plus';
|
||||
import {getToken} from "@/utils/auth";
|
||||
import { CaretTop } from '@element-plus/icons-vue';
|
||||
import {GetMyDaily,DailyUpdate,DailyAdd,SearchDaily} from '@/api/daily'
|
||||
import {ProjectGetByName} from "@/api/examine";
|
||||
// 修改对话框
|
||||
let EditDialogVisible = ref(false);
|
||||
const updateContent = reactive({
|
||||
dailyTime:'',
|
||||
content:'',
|
||||
id:null,
|
||||
projectId: null,
|
||||
})
|
||||
|
||||
function EditDailyMs(row){
|
||||
updateContent.content = row.content
|
||||
updateContent.dailyTime = row.dailyTime
|
||||
updateContent.id = row.id
|
||||
updateContent.projectId = row.projectId
|
||||
EditDialogVisible.value = true
|
||||
}
|
||||
// 新建对话框
|
||||
const AddDialogVisible = ref(false);
|
||||
const AddContent = reactive({
|
||||
projectId:<unknown>null,
|
||||
content:'',
|
||||
dailyTime:''
|
||||
|
||||
})
|
||||
function AddDailyMs(){
|
||||
AddContent.dailyTime = formatDateTime(AddContent.dailyTime)
|
||||
// console.log("requestAddData:", AddContent)
|
||||
DailyAdd(AddContent,getToken()).then((res)=>{
|
||||
console.log("新增日报Result",res)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success("新增成功")
|
||||
}
|
||||
flushData()
|
||||
AddContent.dailyTime = ''
|
||||
AddContent.content = ''
|
||||
AddContent.projectId = null
|
||||
})
|
||||
AddDialogVisible.value = false
|
||||
}
|
||||
|
||||
// 获取项目输入框
|
||||
let list: ProjectAll[] = []
|
||||
interface ProjectAll {
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
const value = ref()
|
||||
const options = ref<ProjectAll[]>([])
|
||||
const loading = ref(false)
|
||||
const qwe = reactive({
|
||||
data: <ProjectAll[]>[]
|
||||
})
|
||||
const remoteMethod = (query: string) => {
|
||||
if (query !== '') {
|
||||
loading.value = true
|
||||
setTimeout(() => {
|
||||
loading.value = false
|
||||
options.value = list.filter((item) => {
|
||||
// return item.name.toLowerCase().includes(query.toLowerCase())
|
||||
const lowerCaseName = item.label.toLowerCase();
|
||||
const lowerCaseQuery = query.toLowerCase();
|
||||
return lowerCaseName.includes(lowerCaseQuery);
|
||||
})
|
||||
// console.log("表单:",options.value)
|
||||
|
||||
}, 200)
|
||||
} else {
|
||||
// console.log("空")
|
||||
options.value = []
|
||||
}
|
||||
}
|
||||
// 获取数据
|
||||
let requestData = reactive({
|
||||
page:1,
|
||||
pageSize: 6,
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
projectId:<unknown>null,
|
||||
|
||||
})
|
||||
const messageData = reactive({
|
||||
data:[],
|
||||
total: 0
|
||||
|
||||
})
|
||||
onMounted(() => {
|
||||
flushData()
|
||||
|
||||
});
|
||||
|
||||
// 时间选择器
|
||||
// 监听时间选择器,对时间选择器的数据进行拆分并传到请求数据中。
|
||||
const value2 = ref('')
|
||||
|
||||
watch(value2, (newValue) => {
|
||||
if (newValue !== '') {
|
||||
requestData.beginTime = formatDateTime(newValue[0])
|
||||
requestData.endTime = formatDateTime(newValue[1])
|
||||
}
|
||||
})
|
||||
function pagination(currentPage: number) {
|
||||
requestData.page = currentPage
|
||||
flushData()
|
||||
}
|
||||
function flushData() {
|
||||
GetMyDaily(requestData, getToken()).then((res)=>{
|
||||
console.log('requestData',requestData)
|
||||
console.log("getMessageResult999:",res.data);
|
||||
messageData.data = res.data.list
|
||||
messageData.total = res.data.totalCount
|
||||
})
|
||||
|
||||
ProjectGetByName(projectByName, getToken()).then((res) => {
|
||||
qwe.data = res.data
|
||||
list = qwe.data.map((item): ProjectAll => {
|
||||
return { value: item.id, label: item.name }
|
||||
})
|
||||
})
|
||||
}
|
||||
const projectByName = reactive({
|
||||
name:''
|
||||
})
|
||||
|
||||
const state = ref('');
|
||||
|
||||
|
||||
// 时间选择器
|
||||
const shortcuts = [
|
||||
{
|
||||
text: 'Last week',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
return [start, end];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Last month',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
return [start, end];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Last 3 months',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
return [start, end];
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
function resetting(){
|
||||
requestData.beginTime = ''
|
||||
requestData.endTime = ''
|
||||
value2.value = ''
|
||||
requestData.projectId = ''
|
||||
|
||||
}
|
||||
// 查询接口
|
||||
function selectMessage (){
|
||||
if(requestData.projectId !==null ){
|
||||
SearchDaily(requestData,getToken()).then((res)=>{
|
||||
if (res.code === 200){
|
||||
messageData.data = res.data.list
|
||||
messageData.total = res.data.totalCount
|
||||
ElMessage.success("查询成功!")
|
||||
}else {
|
||||
ElMessage.error("查询失败!请重试!")
|
||||
}
|
||||
console.log('查询成功?',res)
|
||||
})
|
||||
}else {
|
||||
flushData()
|
||||
}
|
||||
}
|
||||
//自定义方法:格式化时间
|
||||
function formatDateTime(dateTimeString: string): string {
|
||||
const dateTime = new Date(dateTimeString);
|
||||
const year = dateTime.getFullYear();
|
||||
const month = String(dateTime.getMonth() + 1).padStart(2, '0');
|
||||
const date = String(dateTime.getDate()).padStart(2, '0');
|
||||
const hours = String(dateTime.getHours()).padStart(2, '0');
|
||||
const minutes = String(dateTime.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(dateTime.getSeconds()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
// 编辑接口
|
||||
function EditDailyContent(){
|
||||
|
||||
EditDialogVisible.value = false
|
||||
DailyUpdate(updateContent,getToken()).then((res)=>{
|
||||
if(res.code === 200){
|
||||
ElMessage.success('修改成功!')
|
||||
flushData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
</style>
|
@ -32,7 +32,7 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchData();
|
||||
// this.fetchData();
|
||||
},
|
||||
methods: {
|
||||
statusFilter(status) {
|
||||
|
@ -1,15 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--error code-->
|
||||
{{ a.a }}
|
||||
<!--error code-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ErrorTestA'
|
||||
});
|
||||
</script>
|
@ -1,13 +0,0 @@
|
||||
<template>
|
||||
<div />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
created() {
|
||||
this.b = b // eslint-disable-line
|
||||
}
|
||||
});
|
||||
</script>
|
184
src/views/examine/My-review.vue
Normal file
184
src/views/examine/My-review.vue
Normal file
@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header><strong >我的审批</strong></template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-between ">
|
||||
<div>
|
||||
名称
|
||||
<el-input v-model="requestData.content" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px" @click="SelectMyms">查询</el-button>
|
||||
<el-button style="width:80px" @click="resetting">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<el-button text >历史记录</el-button>
|
||||
<el-tag style="margin-right: 6vw">总数:{{ examineData.total }}</el-tag>
|
||||
</div>
|
||||
<div style="height: 40vh">
|
||||
<el-table type="index" :data="examineData.data" empty-text="无数据" style="width: 100%">
|
||||
<el-table-column fixed prop="name" label="申请名称" width="120" />
|
||||
<el-table-column prop="projectChildName" label="所属项目" width="120" />
|
||||
<el-table-column prop="projectModuleName" label="所属子系统" width="120" />
|
||||
<el-table-column prop="senderName" label="申请者" width="180" >
|
||||
</el-table-column>
|
||||
<el-table-column prop="category" label="类型" width="120" />
|
||||
<el-table-column prop="result" label="状态" width="120" >
|
||||
<el-tag type="warning" property="result">待审核</el-tag>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="applicationTime" label="申请时间" width="200" />
|
||||
<el-table-column prop="content" label="申请理由" width="400" />
|
||||
<el-table-column fixed="right" property="id" label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-popconfirm
|
||||
confirm-button-text="通过"
|
||||
cancel-button-text="关闭"
|
||||
:icon="InfoFilled"
|
||||
icon-color="#626AEF"
|
||||
title="确定要通过审核吗?"
|
||||
@confirm="okExamine(scope.row.id)"
|
||||
@cancel="cancelEvent"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button size="small" text style="color:deepskyblue">审核通过</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-divider direction="vertical" />
|
||||
<el-popconfirm
|
||||
confirm-button-text="拒绝"
|
||||
cancel-button-text="关闭"
|
||||
:icon="InfoFilled"
|
||||
icon-color="red"
|
||||
title="确认要拒绝通过吗?确定后不能改变"
|
||||
@confirm="offExamine(scope.row.id)"
|
||||
@cancel="cancelEvent"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button size="small" text style="color:red">拒绝申请</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination
|
||||
larger
|
||||
@current-change="pagination"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
v-model:page-size="requestData.pageSize"
|
||||
:total="examineData.total" class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {reactive, ref} from 'vue';
|
||||
import { ElTable } from 'element-plus';
|
||||
import { InfoFilled } from '@element-plus/icons-vue';
|
||||
import {GetMyReview, UpdateReviewResult,ReviewSearchMyReview} from '@/api/examine'
|
||||
import { onMounted } from 'vue';
|
||||
import {getToken} from "@/utils/auth";
|
||||
const cancelEvent = () => {
|
||||
console.log('cancel!')
|
||||
}
|
||||
const state = ref('');
|
||||
const okExamineRequestData = reactive({
|
||||
id: -1,
|
||||
result: -1
|
||||
})
|
||||
const requestData = reactive({
|
||||
page: 1,
|
||||
pageSize: 6,
|
||||
content:''
|
||||
})
|
||||
const examineData = reactive({
|
||||
data:[],
|
||||
total:0,
|
||||
})
|
||||
const content = ref()
|
||||
|
||||
function okExamine(id: number){
|
||||
okExamineRequestData.result = 1
|
||||
okExamineRequestData.id = id
|
||||
UpdateReviewResult(okExamineRequestData, getToken()).then((res) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.success("已通过此审批")
|
||||
flushData()
|
||||
} else {
|
||||
ElMessage.error("通过审批失败,请重试")
|
||||
flushData()
|
||||
}
|
||||
// console.log("确认通过审核:", res)
|
||||
})
|
||||
}
|
||||
function offExamine(id: number) {
|
||||
okExamineRequestData.result = 0
|
||||
okExamineRequestData.id = id
|
||||
UpdateReviewResult(okExamineRequestData, getToken()).then((res) => {
|
||||
// console.log("拒绝通过审核:", res)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success("拒绝审核成功!")
|
||||
flushData()
|
||||
}else {
|
||||
ElMessage.error("拒绝审核失败,请重试")
|
||||
flushData()
|
||||
}
|
||||
})
|
||||
}
|
||||
function flushData(){
|
||||
GetMyReview(requestData, getToken()).then((res) => {
|
||||
console.log('获取审批',res)
|
||||
examineData.data = res.data.reviews
|
||||
examineData.total = res.data.totalCount
|
||||
// ElMessage.success("查询成功!")
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function pagination(currentPage: number) {
|
||||
requestData.page = currentPage
|
||||
flushData()
|
||||
}
|
||||
onMounted(() => {
|
||||
flushData()
|
||||
});
|
||||
|
||||
// 查询
|
||||
|
||||
function SelectMyms(){
|
||||
ReviewSearchMyReview(requestData,getToken()).then((res) => {
|
||||
console.log('输出查询',res)
|
||||
|
||||
if (res.code === 200){
|
||||
examineData.data = res.data.reviews
|
||||
examineData.total = res.data.totalCount
|
||||
ElMessage.success('查询成功!')
|
||||
}else {
|
||||
ElMessage.error('查询失败!请重试!')
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
// 重置
|
||||
function resetting(){
|
||||
requestData.content = ''
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
</style>
|
144
src/views/examine/search-records.vue
Normal file
144
src/views/examine/search-records.vue
Normal file
@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header><strong >记录查询</strong></template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-around ">
|
||||
<div>
|
||||
名称
|
||||
<el-input v-model="requestData.content" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
状态
|
||||
<el-select
|
||||
v-model="requestData.statue"
|
||||
placeholder="请选择"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
label="已审核"
|
||||
value=1
|
||||
/>
|
||||
<el-option
|
||||
label="已拒绝"
|
||||
value=0
|
||||
/>
|
||||
<el-option
|
||||
label="待审核"
|
||||
value=2
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px" @click="selectMessage">查询</el-button>
|
||||
<el-button style="width:80px" @click="resetting">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<el-button text >历史记录</el-button>
|
||||
<el-tag style="margin-right: 6vw">总条数:{{historyData.total}}</el-tag>
|
||||
</div>
|
||||
<div style="height: 45vh">
|
||||
<el-table :data="historyData.data" style="width: 100%">
|
||||
<!-- <el-table-column prop="date" label="序号" width="150" />-->
|
||||
<el-table-column prop="name" label="申请名称" width="120" />
|
||||
<el-table-column prop="projectChildName" label="所属项目" width="120" />
|
||||
<el-table-column prop="projectChildId" label="所属子系统" width="120" />
|
||||
|
||||
<el-table-column prop="category" label="类型" width="120" />
|
||||
<el-table-column label="状态" width="120" >
|
||||
<template #default="scope">
|
||||
<el-tag type="success" v-show="scope.row.result === '已通过'" >已通过</el-tag>
|
||||
<el-tag type="warning" v-show="scope.row.result === '待审核'">待审核</el-tag>
|
||||
<el-tag type="danger" v-show="scope.row.result === '已拒绝'">已拒绝</el-tag>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="senderName" label="申请者" width="180" >
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicationTime" label="申请时间" width="200" />
|
||||
<el-table-column prop="content" label="申请理由" width="400" />
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination
|
||||
larger
|
||||
background
|
||||
@current-change="pagination"
|
||||
v-model:page-size="requestData.pageSize"
|
||||
layout="prev, pager, next"
|
||||
:total="historyData.total" class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top: 0.5vh"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {reactive} from 'vue';
|
||||
import { ElTable } from 'element-plus';
|
||||
import {ReviewRecords, ReviewRecordsSearch} from '@/api/examine';
|
||||
import { onMounted } from 'vue';
|
||||
import {getToken} from "@/utils/auth";
|
||||
import pagination from "@/components/Pagination/index.vue";
|
||||
const historyData = reactive({
|
||||
data:[],
|
||||
total:0,
|
||||
})
|
||||
const requestData = reactive({
|
||||
page: 1,
|
||||
pageSize: 6,
|
||||
content:'',
|
||||
statue: <unknown>null,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
flushData();
|
||||
});
|
||||
|
||||
// 查询记录
|
||||
function resetting(){
|
||||
requestData.statue = null
|
||||
requestData.content = ''
|
||||
}
|
||||
function selectMessage(){
|
||||
console.log("requestData:", requestData)
|
||||
ReviewRecordsSearch(requestData,getToken()).then((res) => {
|
||||
console.log('查询我的记录',res)
|
||||
historyData.total = res.data.totalCount
|
||||
historyData.data = res.data.reviews
|
||||
})
|
||||
}
|
||||
function flushData(){
|
||||
ReviewRecords(requestData,getToken()).then((res) => {
|
||||
console.log("记录查询",res)
|
||||
historyData.total = res.data.totalCount
|
||||
historyData.data = res.data.reviews
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
207
src/views/examine/submit-application.vue
Normal file
207
src/views/examine/submit-application.vue
Normal file
@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<el-card style="max-width: 100vw; margin: 1.5vw;height: 81vh">
|
||||
<template #header>
|
||||
<strong >提交申请</strong>
|
||||
</template>
|
||||
<div>
|
||||
<div class="selectedContent">
|
||||
<span class="selectedHeader">01.申请类别</span>
|
||||
<el-select v-model="form.region" placeholder="请选择申请类别" style="width: 15vw">
|
||||
<el-option label="子系统" value="system" />
|
||||
<el-option label="模块" value="module" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectedContent">
|
||||
<span class="selectedHeader">02.申请所属</span>
|
||||
<el-select-v2
|
||||
v-model="value"
|
||||
style="width: 240px;"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteMethod"
|
||||
clearable
|
||||
:options="options"
|
||||
:loading="loading"
|
||||
placeholder="请输入所属项目"
|
||||
/>
|
||||
</div>
|
||||
<div class="selectedContent">
|
||||
<el-select v-model="selectedSystem" class="selectedChild" v-show="form.region === 'module'" placeholder="所属子系统" style="width: 15vw">
|
||||
<el-option v-for="(row, index) in systemData" :value="row.id" :label="row.name"/>
|
||||
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectedContent" v-if="form.region === 'module'">
|
||||
<span class="selectedHeader">03.申请名称</span>
|
||||
<el-select style="width: 15vw" v-model="selectedModule">
|
||||
<el-option v-for="(row) in moduleData" :value="row.id" :label="row.name"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectedContent" v-else>
|
||||
<span class="selectedHeader">03.申请名称</span>
|
||||
<el-select style="width: 15vw" v-model="selectedSystem">
|
||||
<el-option v-for="(row) in systemData" :value="row.id" :label="row.name"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectedContent" style="display: flex;flex-direction: row">
|
||||
<span class="selectedHeader">04.申请理由</span>
|
||||
<el-input
|
||||
v-model="textarea"
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
placeholder="Please input"
|
||||
style="width: 20vw"
|
||||
/>
|
||||
</div>
|
||||
<el-button type="primary" style="margin: 7vh 45vw " @click="submitCommit">提交申请</el-button>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {onMounted, reactive, ref, watch} from "vue";
|
||||
import {ProjectGetByName, ProjectChildGetName, ReviewAdd, ProjectModuleGetName} from '@/api/examine';
|
||||
import {getToken} from "@/utils/auth";
|
||||
const qwe = reactive({
|
||||
data: <ProjectAll[]>[]
|
||||
})
|
||||
let list: ProjectAll[] = []
|
||||
//项目id
|
||||
const value = ref()
|
||||
const options = ref<ProjectAll[]>([])
|
||||
const loading = ref(false)
|
||||
const getSystemByProjectName = reactive({
|
||||
id: null
|
||||
})
|
||||
const systemData = ref([])
|
||||
//子系统id
|
||||
const selectedSystem = ref()
|
||||
//模块id
|
||||
const selectedModule = ref()
|
||||
|
||||
const moduleRequestData = reactive({
|
||||
childId:null
|
||||
})
|
||||
const moduleData = ref([])
|
||||
|
||||
const textarea = ref('')
|
||||
const form = reactive({
|
||||
region:'',
|
||||
})
|
||||
const projectByName = reactive({
|
||||
name:''
|
||||
})
|
||||
const submitRequestData = reactive({
|
||||
name: '无',
|
||||
content: '',
|
||||
projectId: null,
|
||||
projectChildId: null,
|
||||
projectModuleId: null
|
||||
})
|
||||
|
||||
interface ProjectAll {
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
onMounted(() => {
|
||||
flushData()
|
||||
})
|
||||
|
||||
watch(value, async (newValue, oldValue) => {
|
||||
console.log("new:", newValue)
|
||||
console.log("old:", oldValue)
|
||||
getSystemByProjectName.id = newValue
|
||||
if (newValue !== null) {
|
||||
await ProjectChildGetName(getSystemByProjectName, getToken()).then((res) => {
|
||||
console.log("system:",res)
|
||||
systemData.value = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
watch(selectedSystem, async (newValue, oldValue) => {
|
||||
console.log("new:", newValue)
|
||||
console.log("old:", oldValue)
|
||||
moduleRequestData.childId = newValue
|
||||
|
||||
if (newValue !== null) {
|
||||
await ProjectModuleGetName(moduleRequestData, getToken()).then((res) => {
|
||||
console.log("modules",res)
|
||||
moduleData.value = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const remoteMethod = (query: string) => {
|
||||
if (query !== '') {
|
||||
loading.value = true
|
||||
setTimeout(() => {
|
||||
loading.value = false
|
||||
options.value = list.filter((item) => {
|
||||
// return item.name.toLowerCase().includes(query.toLowerCase())
|
||||
const lowerCaseName = item.label.toLowerCase();
|
||||
const lowerCaseQuery = query.toLowerCase();
|
||||
return lowerCaseName.includes(lowerCaseQuery);
|
||||
})
|
||||
// console.log("表单:",options.value)
|
||||
|
||||
}, 200)
|
||||
} else {
|
||||
// console.log("空")
|
||||
options.value = []
|
||||
}
|
||||
}
|
||||
|
||||
watch(form, () => {
|
||||
clearData()
|
||||
})
|
||||
|
||||
function flushData() {
|
||||
//项目所属数据
|
||||
ProjectGetByName(projectByName, getToken()).then((res) => {
|
||||
qwe.data = res.data
|
||||
list = qwe.data.map((item): ProjectAll => {
|
||||
return { value: item.id, label: item.name }
|
||||
})
|
||||
})
|
||||
}
|
||||
function clearData() {
|
||||
value.value = null
|
||||
selectedSystem.value = null
|
||||
selectedModule.value = null
|
||||
textarea.value = ''
|
||||
}
|
||||
function submitCommit(){
|
||||
submitRequestData.content = textarea.value
|
||||
submitRequestData.projectId = value.value
|
||||
submitRequestData.projectChildId = selectedSystem.value
|
||||
if (form.region === 'module') {
|
||||
submitRequestData.projectModuleId = selectedModule.value
|
||||
}
|
||||
console.log("submitRequestData",submitRequestData)
|
||||
ReviewAdd(submitRequestData, getToken()).then((res) => {
|
||||
console.log("submitResult:", res)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success("提交申请成功!")
|
||||
form.region = ''
|
||||
clearData()
|
||||
}else {
|
||||
ElMessage.error("提交失败,请重试!")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.selectedHeader{
|
||||
font-weight: bold;
|
||||
margin-right: 2vw;
|
||||
}
|
||||
.selectedContent{
|
||||
margin-left: 35vw;
|
||||
margin-top:5vh
|
||||
}
|
||||
.selectedChild{
|
||||
margin-left: 7.7vw;
|
||||
}
|
||||
</style>
|
@ -1,36 +0,0 @@
|
||||
<template>
|
||||
<div style="display:inline-block;">
|
||||
<label class="radio-label">Cell Auto-Width: </label>
|
||||
<el-radio-group v-model="autoWidth">
|
||||
<el-radio :label="true" border>
|
||||
True
|
||||
</el-radio>
|
||||
<el-radio :label="false" border>
|
||||
False
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
autoWidth: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:modelValue', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,41 +0,0 @@
|
||||
<template>
|
||||
<div style="display:inline-block;">
|
||||
<label class="radio-label">Book Type: </label>
|
||||
<el-select v-model="bookType" style="width:120px;">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: 'xlsx'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: ['xlsx', 'csv', 'txt']
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
bookType: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:modelValue', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,35 +0,0 @@
|
||||
<template>
|
||||
<div style="display:inline-block;">
|
||||
<label class="radio-label" style="padding-left:0;">Filename: </label>
|
||||
<el-input v-model="filename" placeholder="Please enter the file name (default excel-list)" style="width:345px;" :prefix-icon="IconDocument" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import { Document as IconDocument } from '@element-plus/icons-vue';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
IconDocument: markRaw(IconDocument)
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
filename: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:modelValue', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,120 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div style="margin: 0 0 20px 0;">
|
||||
<FilenameOption v-model="filename" />
|
||||
<AutoWidthOption v-model="autoWidth" />
|
||||
<BookTypeOption v-model="bookType" />
|
||||
<el-button :loading="downloadLoading" style="margin:0 0 0 20px;" type="primary" :icon="IconDocument" @click="handleDownload">
|
||||
Export Excel
|
||||
</el-button>
|
||||
<a href="https://vue3-element-admin-site.midfar.com/feature/component/excel.html" target="_blank" style="margin-left:15px;">
|
||||
<el-tag type="info" size="large">Documentation</el-tag>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="listLoading" :data="list" element-loading-text="Loading..." border fit highlight-current-row>
|
||||
<el-table-column align="center" label="Id" width="95">
|
||||
<template v-slot="scope">
|
||||
{{ scope.$index }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Title">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.title }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Author" width="110" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-tag>{{ scope.row.author }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Readings" width="115" align="center">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.pageviews }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="Date" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-icon><IconTimer /></el-icon>
|
||||
<span>{{ parseTime(scope.row.timestamp, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import { fetchList } from '@/api/article';
|
||||
import { parseTime } from '@/utils';
|
||||
// options components
|
||||
import FilenameOption from './components/FilenameOption';
|
||||
import AutoWidthOption from './components/AutoWidthOption';
|
||||
import BookTypeOption from './components/BookTypeOption';
|
||||
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ExportExcel',
|
||||
components: { FilenameOption, AutoWidthOption, BookTypeOption, IconTimer },
|
||||
data() {
|
||||
return {
|
||||
IconDocument: markRaw(IconDocument),
|
||||
list: null,
|
||||
listLoading: true,
|
||||
downloadLoading: false,
|
||||
filename: '',
|
||||
autoWidth: true,
|
||||
bookType: 'xlsx'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchData();
|
||||
},
|
||||
methods: {
|
||||
parseTime,
|
||||
fetchData() {
|
||||
this.listLoading = true;
|
||||
fetchList().then(response => {
|
||||
this.list = response.data.items;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true;
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date'];
|
||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'];
|
||||
const list = this.list;
|
||||
const data = this.formatJson(filterVal, list);
|
||||
excel.export_json_to_excel({
|
||||
header: tHeader,
|
||||
data,
|
||||
filename: this.filename,
|
||||
autoWidth: this.autoWidth,
|
||||
bookType: this.bookType
|
||||
});
|
||||
this.downloadLoading = false;
|
||||
});
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j]);
|
||||
} else {
|
||||
return v[j];
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.radio-label {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 40px;
|
||||
padding: 0 12px 0 30px;
|
||||
}
|
||||
</style>
|
@ -1,106 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-button :loading="downloadLoading" style="margin-bottom:20px" type="primary" :icon="IconDocument" @click="handleDownload">Export</el-button>
|
||||
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column align="center" label="Id" width="95">
|
||||
<template v-slot="scope">
|
||||
{{ scope.$index }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Main Information" align="center">
|
||||
<el-table-column label="Title">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.title }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Author" width="110" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-tag>{{ scope.row.author }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Readings" width="115" align="center">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.pageviews }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="Date" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-icon><IconTimer /></el-icon>
|
||||
<span>{{ parseTime(scope.row.timestamp, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import { fetchList } from '@/api/article';
|
||||
import { parseTime } from '@/utils';
|
||||
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MergeHeader',
|
||||
components: { IconTimer },
|
||||
data() {
|
||||
return {
|
||||
IconDocument: markRaw(IconDocument),
|
||||
list: null,
|
||||
listLoading: true,
|
||||
downloadLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchData();
|
||||
},
|
||||
methods: {
|
||||
parseTime,
|
||||
fetchData() {
|
||||
this.listLoading = true;
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.items;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true;
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const multiHeader = [['Id', 'Main Information', '', '', 'Date']];
|
||||
const header = ['', 'Title', 'Author', 'Readings', ''];
|
||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'];
|
||||
const list = this.list;
|
||||
const data = this.formatJson(filterVal, list);
|
||||
const merges = ['A1:A2', 'B1:D1', 'E1:E2'];
|
||||
excel.export_json_to_excel({
|
||||
multiHeader,
|
||||
header,
|
||||
merges,
|
||||
data
|
||||
});
|
||||
this.downloadLoading = false;
|
||||
});
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j]);
|
||||
} else {
|
||||
return v[j];
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,113 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div style="margin-bottom:20px">
|
||||
<el-input v-model="filename" placeholder="Please enter the file name (default excel-list)" style="width:350px;" :prefix-icon="IconDocument" />
|
||||
<el-button :loading="downloadLoading" type="primary" :icon="IconDocument" @click="handleDownload">
|
||||
Export Selected Items
|
||||
</el-button>
|
||||
<a href="https://panjiachen.github.io/vue-element-admin-site/feature/component/excel.html" target="_blank" style="margin-left:15px;">
|
||||
<el-tag type="info" size="large">Documentation</el-tag>
|
||||
</a>
|
||||
</div>
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="拼命加载中"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" align="center" />
|
||||
<el-table-column align="center" label="Id" width="95">
|
||||
<template v-slot="scope">
|
||||
{{ scope.$index }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Title">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.title }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Author" width="110" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-tag>{{ scope.row.author }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Readings" width="115" align="center">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.pageviews }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="PDate" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-icon><IconTimer /></el-icon>
|
||||
<span>{{ scope.row.display_time }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import { fetchList } from '@/api/article';
|
||||
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SelectExcel',
|
||||
components: { IconTimer },
|
||||
data() {
|
||||
return {
|
||||
IconDocument: markRaw(IconDocument),
|
||||
list: null,
|
||||
listLoading: true,
|
||||
multipleSelection: [],
|
||||
downloadLoading: false,
|
||||
filename: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchData();
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
this.listLoading = true;
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.items;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleDownload() {
|
||||
if (this.multipleSelection.length) {
|
||||
this.downloadLoading = true;
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date'];
|
||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'];
|
||||
const list = this.multipleSelection;
|
||||
const data = this.formatJson(filterVal, list);
|
||||
excel.export_json_to_excel({
|
||||
header: tHeader,
|
||||
data,
|
||||
filename: this.filename
|
||||
});
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.downloadLoading = false;
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
message: 'Please select at least one item',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => v[j]));
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" />
|
||||
<el-table :data="tableData" border highlight-current-row style="width: 100%;margin-top:20px;">
|
||||
<el-table-column v-for="item of tableHeader" :key="item" :prop="item" :label="item" />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import UploadExcelComponent from '@/components/UploadExcel/index.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UploadExcel',
|
||||
components: { UploadExcelComponent },
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
tableHeader: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
beforeUpload(file) {
|
||||
const isLt1M = file.size / 1024 / 1024 < 1;
|
||||
|
||||
if (isLt1M) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ElMessage({
|
||||
message: 'Please do not upload files larger than 1m in size.',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
},
|
||||
handleSuccess({ results, header }) {
|
||||
this.tableData = results;
|
||||
this.tableHeader = header;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
417
src/views/login/Register.vue
Normal file
417
src/views/login/Register.vue
Normal file
@ -0,0 +1,417 @@
|
||||
<!--<template>-->
|
||||
<!-- <div>-->
|
||||
<!-- <div class="container">-->
|
||||
<!-- <div class="forms-container">-->
|
||||
<!-- <div class="signin-signup">-->
|
||||
<!-- <a-card style="width: 25vw; display: flex; margin-left: 10vw; justify-content: center; background-color: #f9f9f9">-->
|
||||
<!-- <h1 style="display: flex; justify-content: center; font-weight: bold; font-size: large; margin-top:2vh">用户注册</h1>-->
|
||||
<!-- <a-form-->
|
||||
<!-- :label-col="{ span: 6 }"-->
|
||||
<!-- :model="formState"-->
|
||||
<!-- autocomplete="off"-->
|
||||
<!-- name="basic"-->
|
||||
<!-- style="margin-top: 3vh"-->
|
||||
<!-- @finish="onFinish"-->
|
||||
<!-- @finishFailed="onFinishFailed"-->
|
||||
<!-- >-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入您的用户名!' }]"-->
|
||||
<!-- label="用户名"-->
|
||||
<!-- name="username"-->
|
||||
<!-- style="margin-top: 20px;"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input v-model:value="formState.username" class="h-10 w-64 border-gray-300 rounded-md" type="text"/>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入您的密码!' }]"-->
|
||||
<!-- label="用户密码"-->
|
||||
<!-- name="password"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input v-model:value="formState.password" class="h-10 w-64 border-gray-300 rounded-md" type="password" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入家庭地址!' }]"-->
|
||||
<!-- label="家庭地址"-->
|
||||
<!-- name="address"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input v-model:value="formState.address" class="h-10 w-64 border-gray-300 rounded-md" type="text" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入手机号码!' }]"-->
|
||||
<!-- label="手机号"-->
|
||||
<!-- name="phone"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input v-model:value="formState.phone" class="h-10 w-64 border-gray-300 rounded-md" type="text" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入邮箱!' }]"-->
|
||||
<!-- label="邮箱"-->
|
||||
<!-- name="email"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input v-model:value="formState.email" class="h-10 w-64 border-gray-300 rounded-md" type="email" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入年龄!' }]"-->
|
||||
<!-- label="年龄"-->
|
||||
<!-- name="age"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input-number v-model:value="formState.age" class="h-10 w-64 border-gray-300 rounded-md" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item-->
|
||||
<!-- :rules="[{ required: true, message: '请输入性别!' }]"-->
|
||||
<!-- label="性别"-->
|
||||
<!-- name="sex"-->
|
||||
<!-- >-->
|
||||
<!-- <a-radio-group v-model:value="formState.sex">-->
|
||||
<!-- <a-radio :value="0">保密</a-radio>-->
|
||||
<!-- <a-radio :value="1">男</a-radio>-->
|
||||
<!-- <a-radio :value="2">女</a-radio>-->
|
||||
<!-- </a-radio-group>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item :wrapper-col="{ offset: 6, span: 16 }" style="margin-top: 4vh">-->
|
||||
<!-- <a-button html-type="submit" style="background-color: dodgerblue; color: white;width: 10vw" type="primary" @click="registerUser">立即注册</a-button>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-form>-->
|
||||
<!-- </a-card>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <div class="panels-container">-->
|
||||
<!-- <div class="panel left-panel">-->
|
||||
<!-- <div class="content">-->
|
||||
<!-- <h3>加入我们</h3>-->
|
||||
<!-- <p>-->
|
||||
<!-- 加入我们,成为团队的一份子。-->
|
||||
<!-- </p>-->
|
||||
<!-- <button id="sign-up-btn" class="btn transparent" @click="$router.push('/login')">-->
|
||||
<!-- 去登录-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <!– <img src="log.svg" class="image" alt="" />–>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
<!--</template>-->
|
||||
<template>
|
||||
注册
|
||||
</template>
|
||||
<!--<script setup>-->
|
||||
<!--import {reactive} from 'vue';-->
|
||||
<!--import requests from '@/js/request.js'-->
|
||||
<!--// import {message} from "ant-design-vue";-->
|
||||
<!--import {useRouter} from "vue-router";-->
|
||||
|
||||
<!--const router = useRouter()-->
|
||||
|
||||
<!--message.config({-->
|
||||
<!-- background: true-->
|
||||
<!--})-->
|
||||
|
||||
<!--const formState = reactive({-->
|
||||
<!-- username: '',-->
|
||||
<!-- password: '',-->
|
||||
<!-- address:'',-->
|
||||
<!-- phone:'',-->
|
||||
<!-- email:'',-->
|
||||
<!-- sex:'',-->
|
||||
<!-- age:0,-->
|
||||
<!--});-->
|
||||
<!--const onFinish = values => {-->
|
||||
<!-- console.log('Success:', values);-->
|
||||
<!--};-->
|
||||
<!--const onFinishFailed = errorInfo => {-->
|
||||
<!-- console.log('Failed:', errorInfo);-->
|
||||
<!--};-->
|
||||
|
||||
<!--function registerUser() {-->
|
||||
|
||||
<!-- formState.sex = parseInt(formState.sex)-->
|
||||
<!-- console.log("registerData:",formState)-->
|
||||
<!-- requests.register(formState).then((res) => {-->
|
||||
<!-- console.log("registerData:",formState)-->
|
||||
<!-- console.log("registerResult:",res)-->
|
||||
<!-- if (res.data.code === 200) {-->
|
||||
<!-- //注册成功,提示+跳转页面-->
|
||||
<!-- console.log('注册成功')-->
|
||||
<!-- message.success('注册成功')-->
|
||||
<!-- router.push("/login")-->
|
||||
<!-- } else {-->
|
||||
<!-- //注册失败,消息提示-->
|
||||
<!-- console.log('注册失败')-->
|
||||
<!-- }-->
|
||||
<!-- console.log(res)-->
|
||||
<!-- })-->
|
||||
<!--}-->
|
||||
|
||||
<!--</script>-->
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body,
|
||||
input {
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
|
||||
.signin-signup {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
left: 75%;
|
||||
width: 50%;
|
||||
transition: 1s 0.7s ease-in-out;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.btn {
|
||||
width: 150px;
|
||||
background-color: #5995fd;
|
||||
border: none;
|
||||
outline: none;
|
||||
height: 49px;
|
||||
border-radius: 49px;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
font-weight: 600;
|
||||
margin: 10px 0;
|
||||
cursor: pointer;
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: #4d84e2;
|
||||
}
|
||||
.panels-container {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.container:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
top: -10%;
|
||||
right: 48%;
|
||||
transform: translateY(-50%);
|
||||
background-image: linear-gradient(-45deg, #4481eb 0%, #04befe 100%);
|
||||
transition: 1.8s ease-in-out;
|
||||
border-radius: 50%;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
transition: transform 1.1s ease-in-out;
|
||||
transition-delay: 0.4s;
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: space-around;
|
||||
text-align: center;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
pointer-events: all;
|
||||
padding: 3rem 17% 2rem 12%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.panel .content {
|
||||
color: #fff;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.6s;
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.panel p {
|
||||
font-size: 0.95rem;
|
||||
padding: 0.7rem 0;
|
||||
}
|
||||
|
||||
.btn.transparent {
|
||||
margin: 0;
|
||||
background: none;
|
||||
border: 2px solid #fff;
|
||||
width: 130px;
|
||||
height: 41px;
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.right-panel .image,
|
||||
.right-panel .content {
|
||||
transform: translateX(800px);
|
||||
}
|
||||
|
||||
/* ANIMATION */
|
||||
|
||||
.container.sign-up-mode .left-panel .image,
|
||||
.container.sign-up-mode .left-panel .content {
|
||||
transform: translateX(-800px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .signin-signup {
|
||||
left: 25%;
|
||||
}
|
||||
|
||||
.container.sign-up-mode form.sign-in-form {
|
||||
opacity: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.container.sign-up-mode .right-panel .image,
|
||||
.container.sign-up-mode .right-panel .content {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .left-panel {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 870px) {
|
||||
.container {
|
||||
min-height: 800px;
|
||||
height: 100vh;
|
||||
}
|
||||
.signin-signup {
|
||||
width: 100%;
|
||||
top: 95%;
|
||||
transform: translate(-50%, -100%);
|
||||
transition: 1s 0.8s ease-in-out;
|
||||
}
|
||||
|
||||
.signin-signup,
|
||||
.container.sign-up-mode .signin-signup {
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.panels-container {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 1fr 2fr 1fr;
|
||||
}
|
||||
|
||||
.panel {
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 2.5rem 8%;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
|
||||
|
||||
.left-panel {
|
||||
grid-row: 1 / 2;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 200px;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.6s;
|
||||
}
|
||||
|
||||
.panel .content {
|
||||
padding-right: 15%;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.8s;
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.panel p {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
.btn.transparent {
|
||||
width: 110px;
|
||||
height: 35px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.container:before {
|
||||
width: 1500px;
|
||||
height: 1500px;
|
||||
transform: translateX(-50%);
|
||||
left: 30%;
|
||||
bottom: 68%;
|
||||
right: initial;
|
||||
top: initial;
|
||||
transition: 2s ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.container.sign-up-mode .left-panel .image,
|
||||
.container.sign-up-mode .left-panel .content {
|
||||
transform: translateY(-300px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .right-panel .image,
|
||||
.container.sign-up-mode .right-panel .content {
|
||||
transform: translateY(0px);
|
||||
}
|
||||
|
||||
.right-panel .image,
|
||||
.right-panel .content {
|
||||
transform: translateY(300px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .signin-signup {
|
||||
top: 5%;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 570px) {
|
||||
form {
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: none;
|
||||
}
|
||||
.panel .content {
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
.container {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.container:before {
|
||||
bottom: 72%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
@ -1,65 +1,92 @@
|
||||
<template>
|
||||
<div class="login-container">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on"
|
||||
label-position="left">
|
||||
<div>
|
||||
<div class="container">
|
||||
<div class="forms-container">
|
||||
<div class="signin-signup">
|
||||
<a-card class="sign-in-form" style="width: 25vw;margin-left: 10vw; display: flex; justify-content: center; align-items: center; background-color: #f9f9f9" >
|
||||
<div class="login-container">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on"
|
||||
label-position="left">
|
||||
|
||||
<div class="title-container">
|
||||
<h3 class="title">Login Form</h3>
|
||||
</div>
|
||||
<div class="title-container">
|
||||
<h3 class="title">Login Form</h3>
|
||||
</div>
|
||||
|
||||
<el-form-item prop="username">
|
||||
<span class="svg-container">
|
||||
<svg-icon icon-class="user" />
|
||||
</span>
|
||||
<el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text"
|
||||
tabindex="1" autocomplete="on" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="username" style="margin-bottom: 20px; margin-top: 20px; background-color: #C5C5C53C ">
|
||||
<span class="svg-container">
|
||||
<svg-icon icon-class="user" />
|
||||
</span>
|
||||
<el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text"
|
||||
tabindex="1" autocomplete="on" />
|
||||
</el-form-item>
|
||||
|
||||
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
|
||||
<el-form-item prop="password">
|
||||
<span class="svg-container">
|
||||
<svg-icon icon-class="password" />
|
||||
</span>
|
||||
<el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
|
||||
placeholder="Password" name="password" tabindex="2" autocomplete="on" @keyup="checkCapslock"
|
||||
@blur="capsTooltip = false" @keyup.enter="handleLogin" />
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
|
||||
<el-form-item prop="password" style="margin-bottom: 20px; background-color: rgba(197,197,197,0.24)">
|
||||
<span class="svg-container">
|
||||
<svg-icon icon-class="password" />
|
||||
</span>
|
||||
<el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
|
||||
placeholder="Password" name="password" tabindex="2" autocomplete="on" @keyup="checkCapslock"
|
||||
@blur="capsTooltip = false" @keyup.enter="handleLogin" />
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-tooltip>
|
||||
|
||||
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.prevent="handleLogin">
|
||||
Login</el-button>
|
||||
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.prevent="handleLogin">
|
||||
Login</el-button>
|
||||
|
||||
<div style="position:relative">
|
||||
<div class="tips">
|
||||
<span>Username : admin</span>
|
||||
<span>Password : any</span>
|
||||
</div>
|
||||
<div class="tips">
|
||||
<span style="margin-right:18px;">Username : editor</span>
|
||||
<span>Password : any</span>
|
||||
<div style="position:relative; margin-top: 20px">
|
||||
<!-- <div class="tips">-->
|
||||
<!-- <span>Username : admin</span>-->
|
||||
<!-- <span>Password : any</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="tips">-->
|
||||
<!-- <span style="margin-right:18px;">Username : editor</span>-->
|
||||
<!-- <span>Password : any</span>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<el-button class="thirdparty-button" type="primary" @click="showDialog = true">
|
||||
Or connect with
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<el-dialog title="Or connect with" v-model="showDialog">
|
||||
Can not be simulated on local, so please combine you own business simulation! ! !
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<social-sign />
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panels-container">
|
||||
<div class="panel left-panel">
|
||||
<div class="content">
|
||||
<h3>加入我们</h3>
|
||||
<p>
|
||||
加入我们,成为团队的一份子。
|
||||
</p>
|
||||
<button class="btn transparent" id="sign-up-btn" @click="SendRegister">
|
||||
去注册
|
||||
</button>
|
||||
</div>
|
||||
<!-- <img src="log.svg" class="image" alt="" />-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-button class="thirdparty-button" type="primary" @click="showDialog = true">
|
||||
Or connect with
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<el-dialog title="Or connect with" v-model="showDialog">
|
||||
Can not be simulated on local, so please combine you own business simulation! ! !
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<social-sign />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { validUsername } from '@/utils/validate';
|
||||
// import { validUsername } from '@/utils/validate';
|
||||
import { defineComponent } from 'vue';
|
||||
import SocialSign from './components/SocialSignin.vue';
|
||||
import type { FormItemRule } from 'element-plus';
|
||||
@ -71,11 +98,11 @@ export default defineComponent({
|
||||
components: { SocialSign },
|
||||
data() {
|
||||
const validateUsername: FormItemRule['validator'] = (_rule, value, callback) => {
|
||||
if (!validUsername(value)) {
|
||||
callback(new Error('Please enter the correct user name'));
|
||||
} else {
|
||||
// if (!validUsername(value)) {
|
||||
// callback(new Error('Please enter the correct user name'));
|
||||
// } else {
|
||||
callback();
|
||||
}
|
||||
// }
|
||||
};
|
||||
const validatePassword: FormItemRule['validator'] = (_rule, value, callback) => {
|
||||
if (value.length < 6) {
|
||||
@ -86,8 +113,8 @@ export default defineComponent({
|
||||
};
|
||||
return {
|
||||
loginForm: {
|
||||
username: 'admin',
|
||||
password: '111111'
|
||||
username: 'principal_user',
|
||||
password: 'jsl_nbxt'
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
||||
@ -166,7 +193,10 @@ export default defineComponent({
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
},
|
||||
SendRegister(){
|
||||
this.$router.push("/register")
|
||||
}
|
||||
// afterQRScan() {
|
||||
// if (e.key === 'x-admin-oauth-code') {
|
||||
// const code = getQueryObject(e.newValue)
|
||||
@ -193,7 +223,7 @@ export default defineComponent({
|
||||
/* 修复input 背景不协调 和光标变色 */
|
||||
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
||||
|
||||
$bg: #283443;
|
||||
$bg: #ffffff;
|
||||
$light_gray: #fff;
|
||||
$cursor: #fff;
|
||||
|
||||
@ -214,12 +244,12 @@ $cursor: #fff;
|
||||
background: transparent;
|
||||
border: 0px;
|
||||
-webkit-appearance: none;
|
||||
border-radius: 0px;
|
||||
border-radius: 20px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 12px 5px 12px 15px;
|
||||
padding: 7px 0px 0px 10px;
|
||||
color: $light_gray;
|
||||
height: 47px;
|
||||
caret-color: $cursor;
|
||||
@ -233,17 +263,17 @@ $cursor: #fff;
|
||||
|
||||
.el-form-item {
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
background: rgba(213, 23, 23, 0.1);
|
||||
border-radius: 5px;
|
||||
color: #454545;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$bg: #2d3a4b;
|
||||
$bg: rgba(110, 103, 103, 0.02);
|
||||
$dark_gray: #889aa4;
|
||||
$light_gray: #eee;
|
||||
$light_gray: rgb(64, 158, 255);
|
||||
|
||||
.login-container {
|
||||
min-height: 100%;
|
||||
@ -255,7 +285,7 @@ $light_gray: #eee;
|
||||
position: relative;
|
||||
width: 520px;
|
||||
max-width: 100%;
|
||||
padding: 160px 35px 0;
|
||||
padding: 50px 35px 50px;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
@ -286,7 +316,7 @@ $light_gray: #eee;
|
||||
.title {
|
||||
font-size: 26px;
|
||||
color: $light_gray;
|
||||
margin: 0px auto 40px auto;
|
||||
margin: 0px auto 0px auto;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -315,3 +345,270 @@ $light_gray: #eee;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body,
|
||||
input {
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
.signin-signup {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
left: 75%;
|
||||
width: 50%;
|
||||
transition: 1s 0.7s ease-in-out;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 150px;
|
||||
background-color: #5995fd;
|
||||
border: none;
|
||||
outline: none;
|
||||
height: 49px;
|
||||
border-radius: 49px;
|
||||
color: #fff;
|
||||
text-transform: uppercase;
|
||||
font-weight: 600;
|
||||
margin: 10px 0;
|
||||
cursor: pointer;
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: #4d84e2;
|
||||
}
|
||||
.panels-container {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.container:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
height: 1500px;
|
||||
width: 1500px;
|
||||
top: -10%;
|
||||
right: 48%;
|
||||
transform: translateY(-50%);
|
||||
background-image: linear-gradient(-45deg, #4481eb 0%, #04befe 100%);
|
||||
transition: 1.8s ease-in-out;
|
||||
border-radius: 50%;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
transition: transform 1.1s ease-in-out;
|
||||
transition-delay: 0.4s;
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: space-around;
|
||||
text-align: center;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
pointer-events: all;
|
||||
padding: 3rem 17% 2rem 12%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.panel .content {
|
||||
color: #fff;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.6s;
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.panel p {
|
||||
font-size: 0.95rem;
|
||||
padding: 0.7rem 0;
|
||||
}
|
||||
|
||||
.btn.transparent {
|
||||
margin: 0;
|
||||
background: none;
|
||||
border: 2px solid #fff;
|
||||
width: 130px;
|
||||
height: 41px;
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.right-panel .image,
|
||||
.right-panel .content {
|
||||
transform: translateX(800px);
|
||||
}
|
||||
|
||||
/* ANIMATION */
|
||||
|
||||
.container.sign-up-mode .left-panel .image,
|
||||
.container.sign-up-mode .left-panel .content {
|
||||
transform: translateX(-800px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .signin-signup {
|
||||
left: 25%;
|
||||
}
|
||||
|
||||
.container.sign-up-mode form.sign-in-form {
|
||||
opacity: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.container.sign-up-mode .right-panel .image,
|
||||
.container.sign-up-mode .right-panel .content {
|
||||
transform: translateX(0%);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .left-panel {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 870px) {
|
||||
.container {
|
||||
min-height: 800px;
|
||||
height: 100vh;
|
||||
}
|
||||
.signin-signup {
|
||||
width: 100%;
|
||||
top: 95%;
|
||||
transform: translate(-50%, -100%);
|
||||
transition: 1s 0.8s ease-in-out;
|
||||
}
|
||||
|
||||
.signin-signup,
|
||||
.container.sign-up-mode .signin-signup {
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.panels-container {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 1fr 2fr 1fr;
|
||||
}
|
||||
|
||||
.panel {
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 2.5rem 8%;
|
||||
grid-column: 1 / 2;
|
||||
}
|
||||
|
||||
|
||||
.left-panel {
|
||||
grid-row: 1 / 2;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 200px;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.6s;
|
||||
}
|
||||
|
||||
.panel .content {
|
||||
padding-right: 15%;
|
||||
transition: transform 0.9s ease-in-out;
|
||||
transition-delay: 0.8s;
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.panel p {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
.btn.transparent {
|
||||
width: 110px;
|
||||
height: 35px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.container:before {
|
||||
width: 1500px;
|
||||
height: 1500px;
|
||||
transform: translateX(-50%);
|
||||
left: 30%;
|
||||
bottom: 68%;
|
||||
right: initial;
|
||||
top: initial;
|
||||
transition: 2s ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.container.sign-up-mode .left-panel .image,
|
||||
.container.sign-up-mode .left-panel .content {
|
||||
transform: translateY(-300px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .right-panel .image,
|
||||
.container.sign-up-mode .right-panel .content {
|
||||
transform: translateY(0px);
|
||||
}
|
||||
|
||||
.right-panel .image,
|
||||
.right-panel .content {
|
||||
transform: translateY(300px);
|
||||
}
|
||||
|
||||
.container.sign-up-mode .signin-signup {
|
||||
top: 5%;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 570px) {
|
||||
form {
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: none;
|
||||
}
|
||||
.panel .content {
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
.container {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.container:before {
|
||||
bottom: 72%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
3
src/views/personal/project/charge.vue
Normal file
3
src/views/personal/project/charge.vue
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
hello
|
||||
</template>
|
124
src/views/personal/project/manage.vue
Normal file
124
src/views/personal/project/manage.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header><strong >项目1</strong></template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-around ">
|
||||
<div>
|
||||
名称
|
||||
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
状态
|
||||
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px">查询</el-button>
|
||||
<el-button style="width:80px">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<el-button
|
||||
text
|
||||
type=''
|
||||
>子系统列表</el-button
|
||||
>
|
||||
</div>
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
:data="tableData"
|
||||
style="max-width: 100vw;"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" />-->
|
||||
<el-table-column label="序号" width="120">
|
||||
<template #default="scope">{{ scope.row.date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="name" label="子系统名称" width="120" />
|
||||
<el-table-column property="address" label="工作量" show-overflow-tooltip />
|
||||
<el-table-column property="address" label="周期" />
|
||||
<el-table-column property="address" label="负责人" />
|
||||
<el-table-column property="address" label="状态" />
|
||||
<el-table-column property="address" label="子系统简介" />
|
||||
<el-table-column property="address" label="截止时间" />
|
||||
<el-table-column property="address" label="操作" >
|
||||
<el-button
|
||||
link
|
||||
style="color:deepskyblue"
|
||||
>查看详情</el-button
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
larger
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:total="50"
|
||||
class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { ElTable } from 'element-plus';
|
||||
interface User {
|
||||
date: string
|
||||
name: string
|
||||
address: string
|
||||
}
|
||||
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
|
||||
const multipleSelection = ref<User[]>([]);
|
||||
|
||||
const handleSelectionChange = (val: User[]) => {
|
||||
multipleSelection.value = val;
|
||||
};
|
||||
|
||||
const tableData: User[] = [
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
3
src/views/personal/project/participate.vue
Normal file
3
src/views/personal/project/participate.vue
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
hi
|
||||
</template>
|
@ -1,104 +0,0 @@
|
||||
<template>
|
||||
<el-table :data="list" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column
|
||||
v-loading="loading"
|
||||
align="center"
|
||||
label="ID"
|
||||
width="65"
|
||||
element-loading-text="请给我点时间!"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="180px" align="center" label="Date">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.timestamp,'{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column min-width="300px" label="Title">
|
||||
<template v-slot="{row}">
|
||||
<span>{{ row.title }}</span>
|
||||
<el-tag>{{ row.type }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="110px" align="center" label="Author">
|
||||
<template v-slot="scope">
|
||||
<span>{{ scope.row.author }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="120px" label="Importance">
|
||||
<template v-slot="scope">
|
||||
<svg-icon v-for="n in +scope.row.importance" :key="n" icon-class="star" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="Readings" width="95">
|
||||
<template v-slot="scope">
|
||||
<span>{{ scope.row.pageviews }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column class-name="status-col" label="Status" width="110">
|
||||
<template v-slot="{row}">
|
||||
<el-tag :type="statusFilter(row.status)">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { parseTime } from '@/utils';
|
||||
import { fetchList } from '@/api/article';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'CN'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 5,
|
||||
type: this.type,
|
||||
sort: '+id'
|
||||
},
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
parseTime,
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
};
|
||||
return statusMap[status];
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.$emit('create'); // for test
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.items;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
137
src/views/table/dynamic-table/EngageChildModel.vue
Normal file
137
src/views/table/dynamic-table/EngageChildModel.vue
Normal file
@ -0,0 +1,137 @@
|
||||
|
||||
<template>
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;max-height:100vh;height:80vh ">
|
||||
<template #header>
|
||||
<strong>子模块1</strong>
|
||||
</template>
|
||||
|
||||
<!-- <div style=" display: flex;flex-direction: column;justify-content: center">-->
|
||||
<div class="ModuleData" style="margin-left: 30vw;width: 24vw;height: 55vh;display: flex;flex-direction: column;justify-content: space-around;
|
||||
">
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>01.模块名称 </strong>
|
||||
<span style="width: 250px">子模块1</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>02.模块周期</strong>
|
||||
<span style="width: 250px">13天</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>03.工作量 </strong>
|
||||
<span style="width: 250px">子模块1</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>04.负责人 </strong>
|
||||
<span style="width: 250px">子模块1</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>05.状态 </strong>
|
||||
<el-autocomplete
|
||||
v-model="state"
|
||||
:fetch-suggestions="querySearch"
|
||||
popper-class="my-autocomplete"
|
||||
placeholder="Please input"
|
||||
@select="handleSelect"
|
||||
style="width: 250px"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="el-input__icon" @click="handleIconClick">
|
||||
<edit />
|
||||
</el-icon>
|
||||
</template>
|
||||
<template #default="{ item }">
|
||||
<div class="value">{{ item.value }}</div>
|
||||
<span class="link">{{ item.link }}</span>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>06.截止时间 </strong>
|
||||
<span style="width: 250px">子模块1</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row;justify-content: space-between">
|
||||
<strong>07.简介 </strong>
|
||||
<el-input
|
||||
v-model="textarea2"
|
||||
style="width: 250px"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
type="textarea"
|
||||
placeholder="Please input"
|
||||
:row="4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div>-->
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { Edit } from '@element-plus/icons-vue';
|
||||
|
||||
interface LinkItem {
|
||||
value: string
|
||||
link: string
|
||||
}
|
||||
|
||||
const state = ref('');
|
||||
const links = ref<LinkItem[]>([]);
|
||||
|
||||
const querySearch = (queryString: string, cb) => {
|
||||
const results = queryString
|
||||
? links.value.filter(createFilter(queryString))
|
||||
: links.value;
|
||||
// call callback function to return suggestion objects
|
||||
cb(results);
|
||||
};
|
||||
const createFilter = (queryString) => {
|
||||
return (restaurant) => {
|
||||
return (
|
||||
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
||||
);
|
||||
};
|
||||
};
|
||||
const loadAll = () => {
|
||||
return [
|
||||
{ value: 'vue', link: 'https://github.com/vuejs/vue' },
|
||||
{ value: 'element', link: 'https://github.com/ElemeFE/element' },
|
||||
{ value: 'cooking', link: 'https://github.com/ElemeFE/cooking' },
|
||||
{ value: 'mint-ui', link: 'https://github.com/ElemeFE/mint-ui' },
|
||||
{ value: 'vuex', link: 'https://github.com/vuejs/vuex' },
|
||||
{ value: 'vue-router', link: 'https://github.com/vuejs/vue-router' },
|
||||
{ value: 'babel', link: 'https://github.com/babel/babel' }
|
||||
];
|
||||
};
|
||||
const handleSelect = (item: LinkItem) => {
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
const handleIconClick = (ev: Event) => {
|
||||
console.log(ev);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
links.value = loadAll();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
202
src/views/table/dynamic-table/EngageChildSystem.vue
Normal file
202
src/views/table/dynamic-table/EngageChildSystem.vue
Normal file
@ -0,0 +1,202 @@
|
||||
<template>
|
||||
|
||||
<div style=" width:100%">
|
||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||
<template #header><strong >子系统1</strong></template>
|
||||
<div style="display:flex;flex-direction:row;justify-content: space-around ">
|
||||
<div>
|
||||
名称
|
||||
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
状态
|
||||
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="width:80px">查询</el-button>
|
||||
<el-button style="width:80px">重置</el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
|
||||
<div style="display:flex;flex-direction: row;justify-content: space-between">
|
||||
<el-button
|
||||
text
|
||||
type=''
|
||||
>子模块列表</el-button
|
||||
>
|
||||
</div>
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
:data="tableData"
|
||||
style="max-width: 100vw;"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" />-->
|
||||
<el-table-column label="序号" width="120">
|
||||
<template #default="scope">{{ scope.row.date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="name" label="子模块名称" width="120" />
|
||||
<el-table-column property="address" label="工作量" show-overflow-tooltip />
|
||||
<el-table-column property="address" label="周期" />
|
||||
<el-table-column property="address" label="负责人" />
|
||||
<el-table-column property="address" label="状态" />
|
||||
<el-table-column property="address" label="子模块简介" />
|
||||
<el-table-column property="address" label="截止时间" />
|
||||
<el-table-column property="address" label="操作" >
|
||||
<el-button
|
||||
link
|
||||
style="color:deepskyblue"
|
||||
>查看详情</el-button
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
larger
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:total="50"
|
||||
class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { ElTable } from 'element-plus';
|
||||
|
||||
interface User {
|
||||
date: string
|
||||
name: string
|
||||
address: string
|
||||
}
|
||||
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
|
||||
const multipleSelection = ref<User[]>([]);
|
||||
|
||||
const handleSelectionChange = (val: User[]) => {
|
||||
multipleSelection.value = val;
|
||||
};
|
||||
|
||||
const tableData: User[] = [
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles'
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
// 输入框1
|
||||
import { onMounted } from 'vue';
|
||||
import { Edit } from '@element-plus/icons-vue';
|
||||
|
||||
interface LinkItem {
|
||||
value: string
|
||||
link: string
|
||||
}
|
||||
|
||||
const state = ref('');
|
||||
const links = ref<LinkItem[]>([]);
|
||||
|
||||
const querySearch = (queryString: string, cb) => {
|
||||
const results = queryString
|
||||
? links.value.filter(createFilter(queryString))
|
||||
: links.value;
|
||||
// call callback function to return suggestion objects
|
||||
cb(results);
|
||||
};
|
||||
const createFilter = (queryString) => {
|
||||
return (restaurant) => {
|
||||
return (
|
||||
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
||||
);
|
||||
};
|
||||
};
|
||||
const loadAll = () => {
|
||||
return [
|
||||
{ value: '1' },
|
||||
{ value: '2' },
|
||||
{ value: '3' },
|
||||
{ value: '4' },
|
||||
{ value: '5' }
|
||||
|
||||
];
|
||||
};
|
||||
const handleSelect = (item: LinkItem) => {
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
const handleIconClick = (ev: Event) => {
|
||||
console.log(ev);
|
||||
};
|
||||
|
||||
// 时间选择器
|
||||
const value1 = ref('');
|
||||
const value2 = ref('');
|
||||
|
||||
const shortcuts = [
|
||||
{
|
||||
text: 'Last week',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
return [start, end];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Last month',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
return [start, end];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Last 3 months',
|
||||
value: () => {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
return [start, end];
|
||||
}
|
||||
}
|
||||
];
|
||||
</script>
|
||||
<style>
|
||||
.my-autocomplete li {
|
||||
line-height: normal;
|
||||
padding: 7px;
|
||||
}
|
||||
.my-autocomplete li .name {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.my-autocomplete li .addr {
|
||||
font-size: 12px;
|
||||
color: #b4b4b4;
|
||||
}
|
||||
.my-autocomplete li .highlighted .addr {
|
||||
color: #ddd;
|
||||
}
|
||||
</style>
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div>
|
||||
<div class="app-container">
|
||||
<el-card class="box-card">
|
||||
<template #header>
|
||||
<a class="link-type link-title" target="_blank" href="https://vue3-element-admin-site.midfar.com/guide/advanced/theme.html">
|
||||
@ -32,7 +33,6 @@
|
||||
Danger
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<el-button type="primary" :icon="IconEdit" />
|
||||
<el-button type="primary" :icon="IconShare" />
|
||||
@ -68,8 +68,10 @@
|
||||
<div class="block">
|
||||
<el-slider v-model="slideValue" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
@ -117,6 +119,8 @@ export default defineComponent({
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style scoped>
|
||||
.field-label{
|
||||
vertical-align: middle;
|
||||
@ -126,12 +130,11 @@ export default defineComponent({
|
||||
max-width: 100%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.block {
|
||||
padding: 30px 24px;
|
||||
}
|
||||
|
||||
.tag-item {
|
||||
margin-right: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -65,13 +65,12 @@ export default defineConfig(({ command, mode }) => {
|
||||
host: 'localhost',
|
||||
port: 8001,
|
||||
proxy: {
|
||||
'/api-test': {
|
||||
target: 'https://api.midfar.com/dspt_test/api',
|
||||
'/api-prod': {
|
||||
target: 'https://nbxt.oa.x-lf.cn',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api-test/, '')
|
||||
},
|
||||
headers: {
|
||||
Cookie: env.VUE_APP_COOKIE
|
||||
pathRewrite: {
|
||||
'^/api-prod': ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user