diff --git a/.env.development b/.env.development index 67b0aeefd192aa6e5dab18ac737831c9b66a9704..e30117693815a7926bbc59254114b9c2b5fb2014 100644 --- a/.env.development +++ b/.env.development @@ -1 +1 @@ -VUE_APP_API_BASE_URL=http://dev.iczer.com +VUE_APP_API_BASE_URL=http://platform.kuopu.net:9300 diff --git a/package.json b/package.json index ed7ffbadc75690056f6a27e727b90629e9964c76..e7e25718c464207a082d2c27af31c2979e24e2d5 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "axios": "^0.19.2", "clipboard": "^2.0.6", "core-js": "^3.6.5", + "crypto-js": "^4.0.0", "date-fns": "^2.14.0", "enquire.js": "^2.1.6", "highlight.js": "^10.2.1", diff --git a/src/main.js b/src/main.js index 1683c72531e4c1b0c1f90c2ffde3f175f46789d4..0e3c62f60b48f3b217664f5e58ec72fe4d501729 100644 --- a/src/main.js +++ b/src/main.js @@ -5,30 +5,29 @@ import Viser from 'viser-vue'; import Router from 'vue-router'; import { initRouter } from './router'; import VueI18n from 'vue-i18n'; -import {accountModule, settingModule} from './pages/frame/store'; +import { accountModule, settingModule } from './pages/frame/store'; import App from './App.vue'; -import "tailwindcss/tailwind.css" +import 'tailwindcss/tailwind.css'; import 'animate.css/source/animate.css'; import './theme/index.less'; import Plugins from './plugins'; import { loadRoutes, loadGuards, setAppOptions } from './utils/routerUtil'; -import { loadInterceptors } from './utils/requestUtil'; import guards from './router/guards'; -import interceptors from './router/interceptors'; +import { loadResponseInterceptor } from './utils/requestUtil'; -import '@/mock'; +// import '@/mock'; import 'moment/locale/zh-cn'; -//设置为非生产提示 +//设置为非生产提示 Vue.config.productionTip = false; //装载Vuex控件 -Vue.use(Vuex) -//加载 框架的module包括 命名空间accountModule,settingModule +Vue.use(Vuex); +//加载 框架的module包括 命名空间accountModule,settingModule const store = new Vuex.Store({ - modules: {accountModule, settingModule} + modules: { accountModule, settingModule }, }); //装载vue-router控件 如果开发时 不用动态可直接修改这里 isAsynRount=false @@ -44,11 +43,12 @@ const localeLang = store.state.settingModule.lang; //default'EN' const fallbackLang = store.state.settingModule.fallbackLang; const i18n = new VueI18n({ - locale: localeLang, - fallbackLocale: fallbackLang, - silentFallbackWarn: true, + locale: localeLang, + fallbackLocale: fallbackLang, + silentFallbackWarn: true, }); - + + //装载antd控件 Vue.use(Antd); @@ -60,17 +60,26 @@ Vue.use(Plugins); //启动引导方法应用启动时需要执行的操作放在这里 //设置应用配置 setAppOptions({ router, store, i18n }); -// 加载 axios 拦截器 -loadInterceptors(interceptors, { router, store, i18n, message: Vue.prototype.$message }); + // 加载路由 loadRoutes(); // 加载路由守卫 loadGuards(guards, { router, store, i18n, message: Vue.prototype.$message }); +// this.$notification.open({ +// message: 'Notification Title', +// description: +// 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', +// onClick: () => { +// console.log('Notification Clicked!'); +// }, +// }); + +loadResponseInterceptor(); new Vue({ - router, - store, - i18n, - render: h => h(App), + router, + store, + i18n, + render: h => h(App), }).$mount('#app'); diff --git a/src/pages/frame/components/header/LayoutTopHeaderLang.vue b/src/pages/frame/components/header/LayoutTopHeaderLang.vue index 8ceab99fd1db7600fb71f6eceb2b5694ea2f1ee7..1aabba52913c0100d461de8472fc856a8a47ffcc 100644 --- a/src/pages/frame/components/header/LayoutTopHeaderLang.vue +++ b/src/pages/frame/components/header/LayoutTopHeaderLang.vue @@ -1,38 +1,35 @@ - - diff --git a/src/pages/frame/services/accountService.js b/src/pages/frame/services/accountService.js index 19e846892c404d9c30a034fc104235026bf4ad3a..c33c8d8bc47b0936fc4023f5d1e73b4acfa34bac 100644 --- a/src/pages/frame/services/accountService.js +++ b/src/pages/frame/services/accountService.js @@ -1,5 +1,5 @@ -import { request, METHOD, removeAuthorization } from '@/utils/requestUtil'; -import BASE_URL from '@/utils/baseUrlUtil'; +import { request, METHOD } from '@/utils/requestUtil'; +import md5 from 'crypto-js/md5'; /** * 登录服务,登录成功后 根据用户ID 获取用户 角色 + 菜单 + 功能权限 + 用户基本信息 @@ -7,27 +7,25 @@ import BASE_URL from '@/utils/baseUrlUtil'; * @param password 账户密码 * @returns {Promise>} */ -export async function login(name, password) { - let loginApi = `${BASE_URL}/login`; - return request(loginApi, METHOD.POST, { - name: name, - password: password - }); +export async function login(userName, password) { + return request('/api/v1/login', METHOD.POST, { + userName, + password: md5(password).toString(), + }); } /** * 退出登录 */ export function logout() { - //清除所有保存的信息 - localStorage.removeItem(process.env.VUE_APP_ROUTES_KEY); - localStorage.removeItem(process.env.VUE_APP_PERMISSIONS_KEY); - localStorage.removeItem(process.env.VUE_APP_ROLES_KEY); - localStorage.removeItem(process.env.VUE_APP_USER_KEY); - removeAuthorization(); + //清除所有保存的信息 + localStorage.removeItem(process.env.VUE_APP_ROUTES_KEY); + localStorage.removeItem(process.env.VUE_APP_PERMISSIONS_KEY); + localStorage.removeItem(process.env.VUE_APP_ROLES_KEY); + localStorage.removeItem(process.env.VUE_APP_USER_KEY); } export default { - login, - logout, -} + login, + logout, +}; diff --git a/src/pages/frame/store/settingModule.js b/src/pages/frame/store/settingModule.js index 456e09099198cb453ce6ba2836eb61c321624909..c74b49fa5d96ada888b297f5c40b7d172cc2f28b 100644 --- a/src/pages/frame/store/settingModule.js +++ b/src/pages/frame/store/settingModule.js @@ -1,8 +1,9 @@ -import { globalConfig, settingConfig } from "@/config"; -import { formatFullPath } from "@/utils/i18nUtil"; -import { filterMenu } from "@/utils/authorityUtil"; -import { getLocalSetting } from "@/utils/themeUtil"; -import deepClone from "lodash.clonedeep"; +import { globalConfig, settingConfig } from '@/config'; +import { formatFullPath } from '@/utils/i18nUtil'; +import { filterMenu } from '@/utils/authorityUtil'; +import { getLocalSetting } from '@/utils/themeUtil'; +import { langUtil } from '@/utils'; +import deepClone from 'lodash.clonedeep'; const localSetting = getLocalSetting(true); const customTitlesStr = sessionStorage.getItem(process.env.VUE_APP_TBAS_TITLES_KEY); @@ -17,6 +18,7 @@ export default { pageMinHeight: 0, menuData: [], activatedFirst: undefined, + lang: '', customTitles, ...settingConfig, ...localSetting, @@ -34,7 +36,7 @@ export default { if (menuData.length > 0 && !menuData[0].fullPath) { formatFullPath(menuData); } - return menuData.map((item) => { + return menuData.map(item => { const menuItem = { ...item }; delete menuItem.children; return menuItem; @@ -45,7 +47,7 @@ export default { if (menuData.length > 0 && !menuData[0].fullPath) { formatFullPath(menuData); } - const current = menuData.find((menu) => menu.fullPath === activatedFirst); + const current = menuData.find(menu => menu.fullPath === activatedFirst); return (current && current.children) || []; }, }, @@ -73,6 +75,7 @@ export default { }, setLang(state, lang) { state.lang = lang; + langUtil.set(lang); }, setHideSetting(state, hideSetting) { state.hideSetting = hideSetting; @@ -97,13 +100,16 @@ export default { }, setCustomTitle(state, { path, title }) { if (title) { - const obj = state.customTitles.find((item) => item.path === path); + const obj = state.customTitles.find(item => item.path === path); if (obj) { obj.title = title; } else { state.customTitles.push({ path, title }); } - sessionStorage.setItem(process.env.VUE_APP_TBAS_TITLES_KEY, JSON.stringify(state.customTitles)); + sessionStorage.setItem( + process.env.VUE_APP_TBAS_TITLES_KEY, + JSON.stringify(state.customTitles), + ); } }, }, diff --git a/src/pages/frame/view/login/Login.vue b/src/pages/frame/view/login/Login.vue index 795983c8c6149f5a576c77d3468024549ca13230..c103e3a434cadb2723b1c106717c6cf99995caea 100644 --- a/src/pages/frame/view/login/Login.vue +++ b/src/pages/frame/view/login/Login.vue @@ -12,8 +12,12 @@ - + ]" + > - + ]" + > @@ -50,7 +61,14 @@ {{ $t('forgetPwdLink') }} - {{ $t('loginButton') }} + {{ $t('loginButton') }} @@ -60,13 +78,12 @@