+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
-
-
-
-
-
- 搜索
-
- 重置
-
-
+
+ 搜索
+ 重置
+
-
-
+
+
-
+
+
+ {{ row.success ? "成功" : "失败" }}
+
-
+
-
+
-
-
-
\ No newline at end of file
+ id: "",
+ mailId: "",
+ success: "",
+ };
+};
+
\ No newline at end of file
diff --git a/src/components/ManageMail.vue b/src/components/ManageMail.vue
deleted file mode 100644
index cbadd57..0000000
--- a/src/components/ManageMail.vue
+++ /dev/null
@@ -1,275 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 自建信件
-
-
- 搜索
-
- 重置
-
- 导出信件
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 详情
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/ManageUser.vue b/src/components/ManageUser.vue
deleted file mode 100644
index b206bd2..0000000
--- a/src/components/ManageUser.vue
+++ /dev/null
@@ -1,281 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
-
- 重置
-
- 新增用户
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/layout/Index.vue b/src/layout/Index.vue
index 86e98b0..d9ca599 100644
--- a/src/layout/Index.vue
+++ b/src/layout/Index.vue
@@ -1,43 +1,58 @@
-
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 61ee9ba..e9cbcc7 100644
--- a/src/main.js
+++ b/src/main.js
@@ -10,9 +10,11 @@ import piniaPersist from 'pinia-plugin-persist'
import './assets/style/style.scss'
import 'element-plus/theme-chalk/src/message.scss'
-createApp(App)
- .use(router)
+const app = createApp(App);
+const p = createPinia().use(piniaPersist)
+
+app.use(router)
.use(ElementPlus, { locale: zhCn })
- .use(createPinia().use(piniaPersist))
+ .use(p)
.component('Icon', IconComponent)
.mount('#app')
diff --git a/src/router/index.js b/src/router/index.js
index b95e4be..303fb95 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -2,7 +2,6 @@ import { createRouter, createWebHashHistory } from 'vue-router'
import { getActivePinia } from 'pinia';
import { useTokenStore } from "@/stores/useTokenStore";
-import Home from '@/views/Home.vue'
import Layout from '@/layout/Index.vue'
import NotFound from '@/views/error/404.vue'
@@ -16,33 +15,29 @@ const constantRoutes = [
children: [
{
path: '/',
- component: () => import('@/components/ManageMail.vue'),
+ component: () => import('@/views/Mail12345.vue'),
},
{
- path: '/mailbox',
- component: () => import('@/components/ManageMail.vue'),
+ path: '/mail',
+ component: () => import('@/views/ManageMail.vue')
},
{
- path: '/mailbox/detail/:id',
- component: () => import('@/components/MailDetail.vue')
+ path: '/admin',
+ component: () => import('@/views/Admin.vue')
},
{
path: '/user',
- component: () => import('@/components/ManageUser.vue')
+ component: () => import('@/views/ManageUser.vue')
},
{
path: '/holiday',
component: () => import('@/components/HolidayList.vue')
- },
- {
- path: '/mail_etl',
- component: () => import('@/components/MailEtl.vue')
}
]
},
{
path: '/login',
- component: () => import('@/components/LoginView.vue')
+ component: () => import('@/views/Login.vue')
},
{
path: '/:catchAll(.*)',
@@ -59,14 +54,6 @@ const router = createRouter({
});
router.beforeEach((to, from, next) => {
- const data = sessionStorage.getItem('token');
- console.log(data);
- const tokens = useTokenStore(getActivePinia());
- const refreshToken = tokens.refresh_token;
- if (!refreshToken && to.path !== '/login') {
- next('/login');
- } else {
- next();
- }
+ next();
});
-export default router;
+export default router;
\ No newline at end of file
diff --git a/src/stores/useTokenStore.js b/src/stores/useTokenStore.js
index 3a6ada2..7f47b82 100644
--- a/src/stores/useTokenStore.js
+++ b/src/stores/useTokenStore.js
@@ -22,7 +22,7 @@ export const useTokenStore = defineStore('token', {
strategies: [
{
storage: localStorage,
- key: 'token'
+ key: 'admin_token'
}
]
}
diff --git a/src/util/cache.js b/src/util/cache.js
new file mode 100644
index 0000000..f7e6335
--- /dev/null
+++ b/src/util/cache.js
@@ -0,0 +1,22 @@
+const cache = {
+ //设置缓存(expire为缓存时效)
+ set(key, value) {
+ try {
+ window.localStorage.setItem(key, value)
+ } catch (e) {
+
+ }
+ },
+ get(key) {
+ try {
+ return window.localStorage.getItem(key)
+ } catch (e) {
+ return null
+ }
+ },
+ remove(key) {
+ window.localStorage.removeItem(key)
+ }
+}
+
+export default cache
diff --git a/src/util/request.js b/src/util/request.js
index b17c8fe..9d1a515 100644
--- a/src/util/request.js
+++ b/src/util/request.js
@@ -1,54 +1,97 @@
-const basePath = '/api'
-export function post(url, data) {
- return new Promise((resolve, reject) => {
- fetch(`${basePath}${url}`, {
- method: 'POST',
- body: data ? JSON.stringify(data) : '',
- })
- // .then(res => {
- // return res.json();
- // }).then(res => {
- // if (res.ok()) {
- // resolve(res)
- // } else {
- // reject(res)
- // }
- // })
- .then(res => {
- resolve(res);
- }).catch(e => {
- console.error("请求失败了,详细信息:" + JSON.stringify(e));
- reject(e);
- })
- })
+
+import {
+ ElMessage,
+ ElMessageBox
+} from 'element-plus'
+import { getToken } from './token'
+
+const BASE_PATH = '/admin-api'
+export function get(options) {
+ options.method = 'GET';
+ return ajax(options.url, options)
+}
+
+export function post(options) {
+ options.method = 'POST';
+ return ajax(options.url, options)
+}
+
+function put(options) {
+ options.method = 'PUT';
+ return ajax(options.url, options)
+}
+
+function del(options) {
+ options.method = 'DELETE';
+ return ajax(options.url, options)
}
-export function get(url) {
+
+let isRelogin = false;
+function ajax(url, options) {
+ const headers = {
+ "Content-Type": "application/json",
+ "Authorization": getToken()
+ };
+
+ let body;
+ if (options?.params && Object.keys(options.params).length > 0) {
+ if (options.method === 'GET') {
+ options.query = options.params;
+ } else {
+ body = JSON.stringify(options.params);
+ }
+ }
+ if (options?.query) {
+ url += (url.indexOf('?') > -1 ? '' : '?') + new URLSearchParams(options.query).toString();
+ }
+ if (options?.body) {
+ if (options.body === 'string' || options.body instanceof FormData) {
+ body = options.body;
+ } else {
+ if (Object.keys(options.body).length > 0) {
+ body = JSON.stringify(options.body);
+ }
+ }
+ }
return new Promise((resolve, reject) => {
- fetch(`${basePath}${url}`, {
- method: 'GET',
+ fetch(`${BASE_PATH}${url}`, {
+ method: options.method,
+ body: body,
+ headers: { ...headers, ...options.headers }
+ }).then(response => {
+ if (response.status === 413) {
+
+ return;
+ }
+ return response.json();
+ }).then(res => {
+ if (res.code === 200) {
+ resolve(res.data)
+ } else {
+ let message = res.msg;
+ if (res.code === 401) {
+ if (url === '/admin/self') {
+ feedback.msgError('登录状态已过期')
+ reject(res)
+ return
+ }
+ if (!isRelogin) {
+ isRelogin = true
+ ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '温馨提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
+ isRelogin = false;
+ // 调整登录
+ location.href = process.env.VITE_BASE + "#/login";
+ }).catch(() => {
+ isRelogin = false;
+ });
+ }
+ reject(res)
+ return
+ }
+ ElMessage.error(message || '系统异常')
+ reject(res)
+ }
+
})
- .then(res => {
- let data = res.text();//转成字符串判断
- return data.then(r => {
- if (r.length === 0) return null;
- else return JSON.parse(r);
- })
- })
- // .then(res => {
- // return res.json();
- // })
- // .then(res => {
- // if (res.ok()) {
- // resolve(res)
- // } else {
- // reject(res)
- // }
- // })
- .then(res => {
- resolve(res);
- }).catch(e => {
- console.error("请求失败了,详细信息:" + JSON.stringify(e));
- reject(e);
- })
})
}
\ No newline at end of file
diff --git a/src/util/token.js b/src/util/token.js
new file mode 100644
index 0000000..55efdcd
--- /dev/null
+++ b/src/util/token.js
@@ -0,0 +1,10 @@
+import cache from './cache'
+
+const TOKEN_KEY = 'token';
+export function getToken() {
+ return cache.get(TOKEN_KEY)
+}
+
+export function setToken(val) {
+ return cache.set(TOKEN_KEY, val)
+}
\ No newline at end of file
diff --git a/src/views/Admin.vue b/src/views/Admin.vue
new file mode 100644
index 0000000..790ae73
--- /dev/null
+++ b/src/views/Admin.vue
@@ -0,0 +1,153 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/Login.vue b/src/views/Login.vue
new file mode 100644
index 0000000..d29aa53
--- /dev/null
+++ b/src/views/Login.vue
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+

+
+
+
+ 用户登录
+
+
+
+
+
+
+
+
+
+
+
+ 登录
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/Mail12345.vue b/src/views/Mail12345.vue
new file mode 100644
index 0000000..578cd3c
--- /dev/null
+++ b/src/views/Mail12345.vue
@@ -0,0 +1,325 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增12345投诉
+ 信件导入
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 选择文件
+
+
+
+ 下载模版
+
+
+
+
+
+
+
+
+
+
+ 正确
+
+
+ 错误
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/ManageMail.vue b/src/views/ManageMail.vue
new file mode 100644
index 0000000..7a905be
--- /dev/null
+++ b/src/views/ManageMail.vue
@@ -0,0 +1,302 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ getSatisfactionLabel(row.satisfactionSms) }}
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeRow.id }}
+
+
+
+ {{ activeRow.createTime }}
+
+
+
+
+
+ {{ activeRow.contactName }}
+
+
+
+ {{ activeRow.contactPhone }}
+
+
+
+
+
+ {{ activeRow.contactIdCard }}
+
+
+
+
+
+
{{ activeRow.content }}
+
+
+
+
+
+ {{ activeRow.caseNumber }}
+
+
+
+ {{ activeRow.involvedDeptName }}
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/ManageUser.vue b/src/views/ManageUser.vue
new file mode 100644
index 0000000..0c81695
--- /dev/null
+++ b/src/views/ManageUser.vue
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除用户
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index 839ca10..3c756fc 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -51,6 +51,8 @@ export default ({ mode }) => {
host: '0.0.0.0',
proxy: {
'/admin-api': {
+ // http://118.253.151.67:8989/admin-api
+ // http://127.0.0.1:8083
target: 'http://127.0.0.1:8083',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/admin-api/, '')