diff --git a/.env.dev_prod b/.env.dev_prod index 08f44b5..b59552e 100644 --- a/.env.dev_prod +++ b/.env.dev_prod @@ -3,4 +3,5 @@ NODE_ENV = 'development' # 开发模式连生产服 VUE_APP_BASE_API = '/api-prod' -VUE_APP_COOKIE = '' \ No newline at end of file +VUE_APP_COOKIE = '' +VUE_APP_INNER='http://nbxt.oa.x-lf.cn' \ No newline at end of file diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 24e619c..08908ed 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -1,6 +1,5 @@ // Generated by 'unplugin-auto-import' export {} declare global { - const ElMessage: typeof import('element-plus/es')['ElMessage'] - const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] + } diff --git a/components.d.ts b/components.d.ts index 55a1ce3..3521563 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,12 +13,38 @@ 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'] + 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'] + 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'] + 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'] + 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'] diff --git a/mock/demo/_routes.js b/mock/demo/_routes.js index 3211d63..c9c9a26 100644 --- a/mock/demo/_routes.js +++ b/mock/demo/_routes.js @@ -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' } } diff --git a/src/api/article.js b/src/api/article.js index e2783e4..fb3238a 100644 --- a/src/api/article.js +++ b/src/api/article.js @@ -1,5 +1,5 @@ import request from '@/utils/request'; - +const a = process.env.VUE_APP_APIII; export function fetchList(query) { return request({ url: '/vue-element-admin/article/list', diff --git a/src/api/daily.js b/src/api/daily.js new file mode 100644 index 0000000..846efbb --- /dev/null +++ b/src/api/daily.js @@ -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() + } + }); +} \ No newline at end of file diff --git a/src/api/examine.js b/src/api/examine.js new file mode 100644 index 0000000..0d98c28 --- /dev/null +++ b/src/api/examine.js @@ -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() + } + }); +} \ No newline at end of file diff --git a/src/api/message.js b/src/api/message.js new file mode 100644 index 0000000..4d5aacc --- /dev/null +++ b/src/api/message.js @@ -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() + } + }) +} \ No newline at end of file diff --git a/src/api/request.js b/src/api/request.js new file mode 100644 index 0000000..d752ab4 --- /dev/null +++ b/src/api/request.js @@ -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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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> | *} + */ +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 + +} \ No newline at end of file diff --git a/src/api/user.js b/src/api/user.js index 37bc37f..9c199f3 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -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() + } }); } diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 516f2e0..bb5074a 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -3,7 +3,7 @@ {{ - item.meta.title + item.meta.title }} {{ item.meta.title }} diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index 931fd91..0ebc0af 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -1,4 +1,5 @@