Commit e18b63989384c5900627da00d0d9f448221d610b

Authored by sqy
1 parent 3443f055

'oem暂存'

@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <!-- TODO: appLogo --> 5 <!-- TODO: appLogo -->
6 <template> 6 <template>
7 <div class="anticon" :class="getAppLogoClass" @click="goHome"> 7 <div class="anticon" :class="getAppLogoClass" @click="goHome">
8 - <img :src="getLogoUrl" /> 8 + <img src="../../../assets/images/logo.png" />
9 <div class="ml-2 md:opacity-100" :class="getTitleClass" v-show="showTitle"> 9 <div class="ml-2 md:opacity-100" :class="getTitleClass" v-show="showTitle">
10 {{ title }} 10 {{ title }}
11 </div> 11 </div>
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 import { useDesign } from '/@/hooks/web/useDesign'; 19 import { useDesign } from '/@/hooks/web/useDesign';
20 import { PageEnum } from '/@/enums/pageEnum'; 20 import { PageEnum } from '/@/enums/pageEnum';
21 import { useUserStore } from '/@/store/modules/user'; 21 import { useUserStore } from '/@/store/modules/user';
22 - import { createLocalStorage } from '/@/utils/cache/index';  
23 const props = defineProps({ 22 const props = defineProps({
24 /** 23 /**
25 * The theme of the current parent component 24 * The theme of the current parent component
@@ -46,15 +45,6 @@ @@ -46,15 +45,6 @@
46 props.theme, 45 props.theme,
47 { 'collapsed-show-title': unref(getCollapsedShowTitle) }, 46 { 'collapsed-show-title': unref(getCollapsedShowTitle) },
48 ]); 47 ]);
49 -  
50 - const storage = createLocalStorage();  
51 - // 获取AppLogo  
52 - const getLogoUrl = computed(() => {  
53 - return storage.get('platformInfo')  
54 - ? storage.get('platformInfo').logo  
55 - : '/src/assets/images/logo.png';  
56 - });  
57 -  
58 const getTitleClass = computed(() => [ 48 const getTitleClass = computed(() => [
59 `${prefixCls}__title`, 49 `${prefixCls}__title`,
60 { 50 {
@@ -27,6 +27,7 @@ import { RouteRecordRaw } from 'vue-router'; @@ -27,6 +27,7 @@ import { RouteRecordRaw } from 'vue-router';
27 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; 27 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
28 28
29 interface UserState { 29 interface UserState {
  30 + platInfo: any;
30 userInfo: Nullable<UserInfo>; 31 userInfo: Nullable<UserInfo>;
31 token?: string; 32 token?: string;
32 roleList: RoleEnum[]; 33 roleList: RoleEnum[];
@@ -39,6 +40,8 @@ interface UserState { @@ -39,6 +40,8 @@ interface UserState {
39 export const useUserStore = defineStore({ 40 export const useUserStore = defineStore({
40 id: 'app-user', 41 id: 'app-user',
41 state: (): UserState => ({ 42 state: (): UserState => ({
  43 + //平台信息
  44 + platInfo: null,
42 // user info 45 // user info
43 userInfo: null, 46 userInfo: null,
44 // token 47 // token
@@ -52,7 +55,11 @@ export const useUserStore = defineStore({ @@ -52,7 +55,11 @@ export const useUserStore = defineStore({
52 // Last fetch time 55 // Last fetch time
53 lastUpdateTime: 0, 56 lastUpdateTime: 0,
54 }), 57 }),
  58 +
55 getters: { 59 getters: {
  60 + getPlatInfo(): any {
  61 + return this.platInfo;
  62 + },
56 getUserInfo(): UserInfo { 63 getUserInfo(): UserInfo {
57 return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {}; 64 return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
58 }, 65 },
@@ -73,6 +80,9 @@ export const useUserStore = defineStore({ @@ -73,6 +80,9 @@ export const useUserStore = defineStore({
73 }, 80 },
74 }, 81 },
75 actions: { 82 actions: {
  83 + setPlatInfo(platInfo: any) {
  84 + this.platInfo = platInfo;
  85 + },
76 storeToken(jwtToken: string, refreshToken: string) { 86 storeToken(jwtToken: string, refreshToken: string) {
77 this.jwtToken = jwtToken; 87 this.jwtToken = jwtToken;
78 this.refreshToken = refreshToken; 88 this.refreshToken = refreshToken;
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 <script lang="ts" setup> 60 <script lang="ts" setup>
61 import { reactive, ref, toRaw, unref, computed } from 'vue'; 61 import { reactive, ref, toRaw, unref, computed } from 'vue';
62 62
63 - import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'; 63 + import { Form, Input, Row, Col, Button } from 'ant-design-vue';
64 import LoginFormTitle from './LoginFormTitle.vue'; 64 import LoginFormTitle from './LoginFormTitle.vue';
65 65
66 import { useI18n } from '/@/hooks/web/useI18n'; 66 import { useI18n } from '/@/hooks/web/useI18n';
@@ -69,7 +69,8 @@ @@ -69,7 +69,8 @@
69 import { useUserStore } from '/@/store/modules/user'; 69 import { useUserStore } from '/@/store/modules/user';
70 import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; 70 import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
71 import { useDesign } from '/@/hooks/web/useDesign'; 71 import { useDesign } from '/@/hooks/web/useDesign';
72 - //import { onKeyStroke } from '@vueuse/core'; 72 + import { getPlatForm } from '/@/api/oem/index';
  73 + import { createLocalStorage } from '/@/utils/cache/index';
73 74
74 const ACol = Col; 75 const ACol = Col;
75 const ARow = Row; 76 const ARow = Row;
@@ -85,7 +86,6 @@ @@ -85,7 +86,6 @@
85 86
86 const formRef = ref(); 87 const formRef = ref();
87 const loading = ref(false); 88 const loading = ref(false);
88 - const rememberMe = ref(false);  
89 89
90 const formData = reactive({ 90 const formData = reactive({
91 account: 'sysadmin', 91 account: 'sysadmin',
@@ -116,8 +116,11 @@ @@ -116,8 +116,11 @@
116 description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`, 116 description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
117 duration: 3, 117 duration: 3,
118 }); 118 });
  119 + const res = await getPlatForm();
  120 + const storage = createLocalStorage();
  121 + storage.set('platformInfo', res);
119 } 122 }
120 - } catch (error) { 123 + } catch (error: any) {
121 createErrorModal({ 124 createErrorModal({
122 title: t('sys.api.loginFailed'), 125 title: t('sys.api.loginFailed'),
123 content: 126 content:
@@ -96,6 +96,7 @@ @@ -96,6 +96,7 @@
96 import { logoUpload, iconUpload, bgUpload, getPlatForm, updatePlatForm } from '/@/api/oem/index'; 96 import { logoUpload, iconUpload, bgUpload, getPlatForm, updatePlatForm } from '/@/api/oem/index';
97 import { PlusOutlined } from '@ant-design/icons-vue'; 97 import { PlusOutlined } from '@ant-design/icons-vue';
98 import { createLocalStorage } from '/@/utils/cache/index'; 98 import { createLocalStorage } from '/@/utils/cache/index';
  99 +
99 export default defineComponent({ 100 export default defineComponent({
100 components: { 101 components: {
101 BasicForm, 102 BasicForm,
@@ -208,7 +209,15 @@ @@ -208,7 +209,15 @@
208 209
209 // 保存一份数据到本地缓存中. 210 // 保存一份数据到本地缓存中.
210 const storage = createLocalStorage(); 211 const storage = createLocalStorage();
211 - storage.set('PlatformInfo', fieldValue); 212 + storage.set('platformInfo', fieldValue);
  213 + //保存到store
  214 + // 设置icon
  215 + let link = (document.querySelector("link[rel*='icon']") ||
  216 + document.createElement('link')) as HTMLLinkElement;
  217 + link.type = 'image/x-icon';
  218 + link.rel = 'shortcut icon';
  219 + link.href = fieldValue.icon;
  220 + document.getElementsByTagName('head')[0].appendChild(link);
212 } catch (e) { 221 } catch (e) {
213 createMessage.error('保存信息失败'); 222 createMessage.error('保存信息失败');
214 } 223 }
@@ -61,6 +61,7 @@ @@ -61,6 +61,7 @@
61 } 61 }
62 }; 62 };
63 63
  64 + // 地区显示回显和数据联动
64 async function updateCityData(codeProv: string, codeCity: string, codeCoun: string) { 65 async function updateCityData(codeProv: string, codeCity: string, codeCoun: string) {
65 const nameCity = await getTownChild('codeProv', codeProv); 66 const nameCity = await getTownChild('codeProv', codeProv);
66 const nameCoun = await getTownChild('codeCity', codeCity); 67 const nameCoun = await getTownChild('codeCity', codeCity);
@@ -100,7 +101,6 @@ @@ -100,7 +101,6 @@
100 }); 101 });
101 } 102 }
102 let nameTown = await getTownChild('codeCoun', value); 103 let nameTown = await getTownChild('codeCoun', value);
103 - console.log(111);  
104 nameTown.forEach((item) => { 104 nameTown.forEach((item) => {
105 item.label = item.nameTown; 105 item.label = item.nameTown;
106 item.value = item.codeTown; 106 item.value = item.codeTown;