diff --git a/.env b/.env index fadd1db..95d5f87 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ VITE_APP_TITLE=金融产品设计及数字化营销沙盘 VITE_PORT=9520 -VITE_PROXY=http://192.168.31.126:8080 +VITE_PROXY=http://192.168.31.125:8080 VITE_PUBLIC_PATH=./ -VITE_BASE_API=/api +VITE_BASE_API=http://192.168.31.217:9000 VITE_I18N_LOCALE=zh-cn VITE_I18N_FALLBACK_LOCALE=zh-cn diff --git a/src/api/bank.ts b/src/api/bank.ts new file mode 100644 index 0000000..e0113fb --- /dev/null +++ b/src/api/bank.ts @@ -0,0 +1,8 @@ +import axios from '@/utils/request'; + +export const queryStorageList = async (params?: Record): Promise => (await axios.get('/backend/core/storage', { params })).data; +export const queryStorage = async (id: number): Promise => (await axios.get(`/backend/core/storage/${id}`)).data; +export const updateStorage = async (data: Record): Promise => (await axios.post('/backend/core/storage?_method=put', data)).data; + +export const primaryTypeOfGuarantee = async (): Promise => (await axios.post('/product/bankGuaranteeType/primaryTypeOfGuarantee')).data; +export const bankingProductsList = async (data: Record): Promise => (await axios.post('/product/product/bank/products/bankingProductsList', data)).data; diff --git a/src/api/system.ts b/src/api/system.ts deleted file mode 100644 index 96a196e..0000000 --- a/src/api/system.ts +++ /dev/null @@ -1,28 +0,0 @@ -import axios from '@/utils/request'; - -export const queryStorageList = async (params?: Record): Promise => (await axios.get('/backend/core/storage', { params })).data; -export const queryStorage = async (id: number): Promise => (await axios.get(`/backend/core/storage/${id}`)).data; -export const createStorage = async (data: Record): Promise => (await axios.post('/backend/core/storage', data)).data; -export const updateStorage = async (data: Record): Promise => (await axios.post('/backend/core/storage?_method=put', data)).data; -export const updateStorageOrder = async (data: number[]): Promise => (await axios.post('/backend/core/storage/order?_method=put', data)).data; -export const deleteStorage = async (data: number[]): Promise => (await axios.post('/backend/core/storage?_method=delete', data)).data; - -export const querySiteList = async (params?: Record): Promise => (await axios.get('/backend/core/site', { params })).data; -export const querySite = async (id: number): Promise => (await axios.get(`/backend/core/site/${id}`)).data; -export const createSite = async (data: Record): Promise => (await axios.post('/backend/core/site', data)).data; -export const updateSite = async (data: Record): Promise => (await axios.post('/backend/core/site?_method=put', data)).data; -export const updateSiteOrder = async (data: number[]): Promise => (await axios.post('/backend/core/site/order?_method=put', data)).data; -export const deleteSite = async (data: number[]): Promise => (await axios.post('/backend/core/site?_method=delete', data)).data; -export const querySiteThemeList = async (id: number): Promise => (await axios.get(`/backend/core/site/${id}/theme`)).data; - -export const queryAttachmentPage = async (params?: Record): Promise => (await axios.get('/backend/core/attachment', { params })).data; -export const queryAttachment = async (id: number): Promise => (await axios.get(`/backend/core/attachment/${id}`)).data; -export const createAttachment = async (data: Record): Promise => (await axios.post('/backend/core/attachment', data)).data; -export const updateAttachment = async (data: Record): Promise => (await axios.post('/backend/core/attachment?_method=put', data)).data; -export const deleteAttachment = async (data: number[]): Promise => (await axios.post('/backend/core/attachment?_method=delete', data)).data; - -export const queryTaskPage = async (params?: Record): Promise => (await axios.get('/backend/core/task', { params })).data; -export const queryTask = async (id: number): Promise => (await axios.get(`/backend/core/task/${id}`)).data; -export const createTask = async (data: Record): Promise => (await axios.post('/backend/core/task', data)).data; -export const updateTask = async (data: Record): Promise => (await axios.post('/backend/core/task?_method=put', data)).data; -export const deleteTask = async (data: number[]): Promise => (await axios.post('/backend/core/task?_method=delete', data)).data; diff --git a/src/assets/images/7.png b/src/assets/images/7.png new file mode 100644 index 0000000..7599d3c Binary files /dev/null and b/src/assets/images/7.png differ diff --git a/src/assets/images/8.png b/src/assets/images/8.png new file mode 100644 index 0000000..1f364c9 Binary files /dev/null and b/src/assets/images/8.png differ diff --git a/src/assets/images/9.png b/src/assets/images/9.png new file mode 100644 index 0000000..3205b43 Binary files /dev/null and b/src/assets/images/9.png differ diff --git a/src/assets/images/plus.png b/src/assets/images/plus.png new file mode 100644 index 0000000..3d2f3d4 Binary files /dev/null and b/src/assets/images/plus.png differ diff --git a/src/assets/images/search.png b/src/assets/images/search.png new file mode 100644 index 0000000..2afe6fc Binary files /dev/null and b/src/assets/images/search.png differ diff --git a/src/assets/images/search1.png b/src/assets/images/search1.png new file mode 100644 index 0000000..f4e2e36 Binary files /dev/null and b/src/assets/images/search1.png differ diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 177056f..20e375d 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -19,7 +19,7 @@ import { ref, onMounted, computed } from 'vue'; import { setCookieLocale, getSessionSiteId, setSessionSiteId } from '@/utils/common'; import { toTree, flatTree } from '@/utils/tree'; -import { querySiteList } from '@/api/system'; +// import { querySiteList } from '@/api/bank'; import { currentUser, perm, logout } from '@/store/useCurrentUser'; import { appState, toggleSidebar } from '@/store/useAppState'; import Logo from './Logo.vue'; @@ -28,10 +28,10 @@ const siteId = ref(getSessionSiteId()); const siteList = ref([]); const site = computed(() => siteList.value.find((item) => item.id === siteId.value)); const fetchSiteList = async () => { - siteList.value = flatTree(toTree(await querySiteList())); - if (siteId.value == null) { - siteId.value = siteList.value[0]?.id; - } + // siteList.value = flatTree(toTree(await querySiteList())); + // if (siteId.value == null) { + // siteId.value = siteList.value[0]?.id; + // } }; const changeSiteId = (id: number) => { setSessionSiteId(id); @@ -39,7 +39,7 @@ const changeSiteId = (id: number) => { window.location.reload(); }; onMounted(() => { - fetchSiteList(); + // fetchSiteList(); }); const handleLogout = () => { diff --git a/src/layout/components/Logo.vue b/src/layout/components/Logo.vue index 47a0b40..499d653 100644 --- a/src/layout/components/Logo.vue +++ b/src/layout/components/Logo.vue @@ -1,9 +1,7 @@ @@ -23,7 +21,6 @@ export default defineComponent({ data() { return { title: Settings.title, - logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png', }; }, }); diff --git a/src/router/index.ts b/src/router/index.ts index e6a5b7d..8fd1271 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -8,18 +8,25 @@ declare module 'vue-router' { hidden?: boolean; title?: string; icon?: Component; - requiresPermission?: string; + // requiresPermission?: string; } } export const routes: Array = [ - // { path: '/login', component: () => import('@/views/Login.vue'), meta: { hidden: true } }, + // { path: '/product', component: () => import('@/views/product/index.vue'), meta: { hidden: true } }, { path: '/404', component: () => import('@/views/404.vue'), meta: { hidden: true } }, { path: '/403', component: () => import('@/views/403.vue'), meta: { hidden: true } }, { path: '', component: Layout, meta: { hidden: true }, - children: [{ path: '', component: () => import('@/views/Home.vue'), meta: { title: 'menu.home', requiresPermission: 'auth' } }], + children: [{ path: '', component: () => import('@/views/Home.vue'), meta: { title: 'menu.home' } }], + }, + { + path: '/product', + redirect: '/product/index', + component: Layout, + meta: { title: '产品经理', icon: UserFilled }, + children: [{ path: 'index', component: () => import('@/views/product/index.vue'), meta: { title: '产品经理' } }], }, // 404 page must be placed at the end !!! { diff --git a/src/store/useCurrentUser.ts b/src/store/useCurrentUser.ts index 9df30f6..7bc1e89 100644 --- a/src/store/useCurrentUser.ts +++ b/src/store/useCurrentUser.ts @@ -14,7 +14,6 @@ import { setSessionTimeout, removeSessionTimeout, removeRefreshToken, - removeAccessAt, removeRefreshAt, } from '@/utils/auth'; @@ -49,7 +48,6 @@ export const login = async (params: LoginParam): Promise => { }; export const logout = (): void => { - removeAccessAt(); removeRefreshAt(); removeAccessToken(); removeRefreshToken(); diff --git a/src/styles/index.scss b/src/styles/index.scss index 9badd1b..0dfb577 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -16,8 +16,9 @@ body { } // global css -.app-block { - @apply shadow-sm; +.block { + @apply p-5; + @apply rounded-lg; @apply bg-white; } diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 4069a92..db2da37 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -1,58 +1,56 @@ import Cookies from 'js-cookie'; -const JWT_ACCESS_TOKEN = 'jwt-access-token'; -const JWT_ACCESS_AT = 'jwt-access-at'; -const JWT_REFRESH_TOKEN = 'jwt-refresh-token'; -const JWT_REFRESH_AT = 'jwt-refresh-at'; -const JWT_SESSION_TIMEOUT = 'jwt-session-timeout'; +const SAND_ACCESS_TOKEN = 'sand-token'; +const SAND_ACCESS_AT = 'jwt-access-at'; +const SAND_REFRESH_TOKEN = 'jwt-refresh-token'; +const SAND_REFRESH_AT = 'jwt-refresh-at'; +const SAND_SESSION_TIMEOUT = 'jwt-session-timeout'; -export const getAccessToken = (): string | undefined => Cookies.get(JWT_ACCESS_TOKEN); +export const getAccessToken = (): string | undefined => Cookies.get(SAND_ACCESS_TOKEN); export const setAccessToken = (token: string): void => { - Cookies.set(JWT_ACCESS_TOKEN, token); + Cookies.set(SAND_ACCESS_TOKEN, token); }; -export const removeAccessToken = (): void => Cookies.remove(JWT_ACCESS_TOKEN); +export const removeAccessToken = (): void => Cookies.remove(SAND_ACCESS_TOKEN); -export const getRefreshToken = (): string | undefined => Cookies.get(JWT_REFRESH_TOKEN); +export const getRefreshToken = (): string | undefined => Cookies.get(SAND_REFRESH_TOKEN); export const setRefreshToken = (token: string): void => { - Cookies.set(JWT_REFRESH_TOKEN, token); + Cookies.set(SAND_REFRESH_TOKEN, token); }; export const removeRefreshToken = (): void => { - Cookies.remove(JWT_REFRESH_TOKEN); + Cookies.remove(SAND_REFRESH_TOKEN); }; export const getRefreshAt = (): number => { - const refreshAt = Cookies.get(JWT_REFRESH_AT); + const refreshAt = Cookies.get(SAND_REFRESH_AT); return refreshAt ? Number(refreshAt) : 0; }; export const setRefreshAt = (refreshAt: number): void => { - Cookies.set(JWT_REFRESH_AT, String(refreshAt)); + Cookies.set(SAND_REFRESH_AT, String(refreshAt)); }; export const removeRefreshAt = (): void => { - Cookies.remove(JWT_REFRESH_AT); + Cookies.remove(SAND_REFRESH_AT); }; export const getAccessAt = (): number => { - const accessAt = Cookies.get(JWT_ACCESS_AT); + const accessAt = Cookies.get(SAND_ACCESS_AT); return accessAt ? Number(accessAt) : 0; }; export const setAccessAt = (accessAt: number): void => { - Cookies.set(JWT_ACCESS_AT, String(accessAt)); + Cookies.set(SAND_ACCESS_AT, String(accessAt)); }; -export const removeAccessAt = () => Cookies.remove(JWT_ACCESS_AT); export const getSessionTimeout = (): number => { - const sessionTimeout = Cookies.get(JWT_SESSION_TIMEOUT); + const sessionTimeout = Cookies.get(SAND_SESSION_TIMEOUT); // 默认 30 分钟 return sessionTimeout ? Number(sessionTimeout) : 30; }; export const setSessionTimeout = (sessionTimeout: number): void => { - Cookies.set(JWT_SESSION_TIMEOUT, String(sessionTimeout)); + Cookies.set(SAND_SESSION_TIMEOUT, String(sessionTimeout)); }; export const removeSessionTimeout = (): void => { - Cookies.remove(JWT_SESSION_TIMEOUT); + Cookies.remove(SAND_SESSION_TIMEOUT); }; export const getAuthHeaders = (): any => { - const accessToken = getAccessToken(); - return { Authorization: accessToken ? `Bearer ${accessToken}` : '' }; + return { token: getAccessToken() }; }; diff --git a/src/utils/request.ts b/src/utils/request.ts index 62973f2..3e1b1d1 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -15,7 +15,7 @@ service.interceptors.request.use( (config) => { setAccessAt(new Date().getTime()); // eslint-disable-next-line - config.headers = { ...config.headers, ...getAuthHeaders(), ...getSiteHeaders() }; + config.headers = { ...config.headers, ...getAuthHeaders() }; return config; }, (error) => Promise.reject(error), @@ -30,12 +30,11 @@ service.interceptors.response.use( status, }, } = e; + console.log('🚀 ~ file: request.ts:27 ~ e:', e, status, message); const { global: { t }, } = i18n; - if (exception === 'com.ujcms.core.exception.LogicException') { - ElMessageBox.alert(message, { type: 'warning' }); - } else if (status === 401) { + if (status === 401) { ElMessageBox.confirm(t('confirmLogin'), { confirmButtonText: t('loginAgain'), type: 'warning' }).then(() => { // 未登录。刷新页面以触发登录。无法直接使用router,会导致其它函数不可用的奇怪问题。 window.location.reload(); diff --git a/src/views/Home.vue b/src/views/Home.vue index 6b97079..3c97442 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,9 +1,12 @@