Commit 3378ef5b7553b833c6187893a93fff0471f1a531
Merge branch 'f-dev' into 'main'
fix:修改记住我无效问题 See merge request huang/yun-teng-iot-front!322
Showing
7 changed files
with
71 additions
and
71 deletions
@@ -12,17 +12,17 @@ | @@ -12,17 +12,17 @@ | ||
12 | overlayClassName="app-locale-picker-overlay" | 12 | overlayClassName="app-locale-picker-overlay" |
13 | > | 13 | > |
14 | <span class="cursor-pointer flex items-center" :style="{ color: color }"> | 14 | <span class="cursor-pointer flex items-center" :style="{ color: color }"> |
15 | - <Icon icon="ion:language" /> | ||
16 | - <span v-if="showText" class="ml-1">{{ getLocaleText }}</span> | 15 | + <!-- <Icon icon="ion:language" /> --> |
16 | + <!-- <span v-if="showText" class="ml-1">{{ getLocaleText }}</span> --> | ||
17 | </span> | 17 | </span> |
18 | </Dropdown> | 18 | </Dropdown> |
19 | </template> | 19 | </template> |
20 | <script lang="ts" setup> | 20 | <script lang="ts" setup> |
21 | import type { LocaleType } from '/#/config'; | 21 | import type { LocaleType } from '/#/config'; |
22 | import type { DropMenu } from '/@/components/Dropdown'; | 22 | import type { DropMenu } from '/@/components/Dropdown'; |
23 | - import { ref, watchEffect, unref, computed } from 'vue'; | 23 | + import { ref, watchEffect, unref } from 'vue'; |
24 | import { Dropdown } from '/@/components/Dropdown'; | 24 | import { Dropdown } from '/@/components/Dropdown'; |
25 | - import { Icon } from '/@/components/Icon'; | 25 | + // import { Icon } from '/@/components/Icon'; |
26 | import { useLocale } from '/@/locales/useLocale'; | 26 | import { useLocale } from '/@/locales/useLocale'; |
27 | import { localeList } from '/@/settings/localeSetting'; | 27 | import { localeList } from '/@/settings/localeSetting'; |
28 | 28 | ||
@@ -45,13 +45,13 @@ | @@ -45,13 +45,13 @@ | ||
45 | 45 | ||
46 | const { changeLocale, getLocale } = useLocale(); | 46 | const { changeLocale, getLocale } = useLocale(); |
47 | 47 | ||
48 | - const getLocaleText = computed(() => { | ||
49 | - const key = selectedKeys.value[0]; | ||
50 | - if (!key) { | ||
51 | - return ''; | ||
52 | - } | ||
53 | - return localeList.find((item) => item.event === key)?.text; | ||
54 | - }); | 48 | + // const getLocaleText = computed(() => { |
49 | + // const key = selectedKeys.value[0]; | ||
50 | + // if (!key) { | ||
51 | + // return ''; | ||
52 | + // } | ||
53 | + // return localeList.find((item) => item.event === key)?.text; | ||
54 | + // }); | ||
55 | 55 | ||
56 | watchEffect(() => { | 56 | watchEffect(() => { |
57 | selectedKeys.value = [unref(getLocale)]; | 57 | selectedKeys.value = [unref(getLocale)]; |
@@ -37,8 +37,8 @@ | @@ -37,8 +37,8 @@ | ||
37 | > | 37 | > |
38 | <img | 38 | <img |
39 | style="border-radius: 50%; height: 8.75rem; width: 10rem" | 39 | style="border-radius: 50%; height: 8.75rem; width: 10rem" |
40 | - v-if="peresonalPic" | ||
41 | - :src="peresonalPic" | 40 | + v-if="peresonalPic || headerImg" |
41 | + :src="peresonalPic || headerImg" | ||
42 | alt="avatar" | 42 | alt="avatar" |
43 | /> | 43 | /> |
44 | <div v-else> | 44 | <div v-else> |
@@ -93,6 +93,7 @@ | @@ -93,6 +93,7 @@ | ||
93 | import { useUserStore } from '/@/store/modules/user'; | 93 | import { useUserStore } from '/@/store/modules/user'; |
94 | import type { FileItem } from '/@/components/Upload/src/typing'; | 94 | import type { FileItem } from '/@/components/Upload/src/typing'; |
95 | import { LoadingOutlined } from '@ant-design/icons-vue'; | 95 | import { LoadingOutlined } from '@ant-design/icons-vue'; |
96 | + import headerImg from '/@/assets/images/logo.png'; | ||
96 | 97 | ||
97 | const schema: DescItem[] = [ | 98 | const schema: DescItem[] = [ |
98 | { | 99 | { |
@@ -247,7 +248,8 @@ | @@ -247,7 +248,8 @@ | ||
247 | registerModal, | 248 | registerModal, |
248 | registerForm, | 249 | registerForm, |
249 | loading, | 250 | loading, |
250 | - mockData | 251 | + mockData, |
252 | + headerImg, | ||
251 | }; | 253 | }; |
252 | }, | 254 | }, |
253 | }); | 255 | }); |
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | import { useI18n } from '/@/hooks/web/useI18n'; | 67 | import { useI18n } from '/@/hooks/web/useI18n'; |
68 | import { useDesign } from '/@/hooks/web/useDesign'; | 68 | import { useDesign } from '/@/hooks/web/useDesign'; |
69 | import { useModal } from '/@/components/Modal'; | 69 | import { useModal } from '/@/components/Modal'; |
70 | - import headerImg from '/@/assets/images/header.jpg'; | 70 | + import headerImg from '/@/assets/images/logo.png'; |
71 | import { propTypes } from '/@/utils/propTypes'; | 71 | import { propTypes } from '/@/utils/propTypes'; |
72 | import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | 72 | import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; |
73 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 73 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | import moment from 'moment'; | 74 | import moment from 'moment'; |
75 | // 导入一些静态图片,避免打包时不能正确解析 | 75 | // 导入一些静态图片,避免打包时不能正确解析 |
76 | import djx from '/@/assets/images/djx.png'; | 76 | import djx from '/@/assets/images/djx.png'; |
77 | - import locationJx from '/@/assets/images/location.png'; | 77 | + // import locationJx from '/@/assets/images/location.png'; |
78 | import zx from '/@/assets/images/zx.png'; | 78 | import zx from '/@/assets/images/zx.png'; |
79 | import lx from '/@/assets/images/lx.png'; | 79 | import lx from '/@/assets/images/lx.png'; |
80 | import djh from '/@/assets/images/djh.png'; | 80 | import djh from '/@/assets/images/djh.png'; |
@@ -142,26 +142,15 @@ | @@ -142,26 +142,15 @@ | ||
142 | const BMap = (window as any).BMap; | 142 | const BMap = (window as any).BMap; |
143 | if (!wrapEl) return; | 143 | if (!wrapEl) return; |
144 | const map = new BMap.Map(wrapEl); | 144 | const map = new BMap.Map(wrapEl); |
145 | - | ||
146 | - const getLocation = new BMap.Geolocation(); | ||
147 | - getLocation.getCurrentPosition((position) => { | ||
148 | - if (position) { | ||
149 | - let preMarker = null; | ||
150 | - const point = new BMap.Point(position.point.lng, position.point.lat); | ||
151 | - let mapIcon = new BMap.Icon(locationJx, new BMap.Size(50, 80)); | ||
152 | - let marker = new BMap.Marker(point, { icon: mapIcon }); | ||
153 | - if (marker) { | ||
154 | - map.removeOverlay(preMarker); | ||
155 | - } | ||
156 | - map.addOverlay(marker); | ||
157 | - map.centerAndZoom(point, 15); | ||
158 | - map.enableScrollWheelZoom(true); | ||
159 | - } else { | ||
160 | - const point = new BMap.Point(104.04666605565338, 30.543516387560476); | ||
161 | - map.centerAndZoom(point, 15); | ||
162 | - map.enableScrollWheelZoom(true); | ||
163 | - } | ||
164 | - }); | 145 | + function myFun(result) { |
146 | + let mk = new BMap.Marker(result.center); | ||
147 | + map.addOverlay(mk); | ||
148 | + map.panTo(result.center); | ||
149 | + map.centerAndZoom(result.center, 15); | ||
150 | + map.enableScrollWheelZoom(true); | ||
151 | + } | ||
152 | + let myCity = new BMap.LocalCity(); | ||
153 | + myCity.get(myFun); | ||
165 | } | 154 | } |
166 | // 点击表格某一行触发 | 155 | // 点击表格某一行触发 |
167 | const deviceRowClick = async (record) => { | 156 | const deviceRowClick = async (record) => { |
@@ -192,7 +181,7 @@ | @@ -192,7 +181,7 @@ | ||
192 | // 创建信息窗口对象 | 181 | // 创建信息窗口对象 |
193 | const res = await getDeviceActiveTime(entityId); | 182 | const res = await getDeviceActiveTime(entityId); |
194 | 183 | ||
195 | - let { value: activeStatus, lastUpdateTs } = res[0]; | 184 | + let { lastUpdateTs } = res[0]; |
196 | lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss'); | 185 | lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss'); |
197 | let infoWindow = new BMap.InfoWindow( | 186 | let infoWindow = new BMap.InfoWindow( |
198 | ` | 187 | ` |
@@ -10,7 +10,9 @@ | @@ -10,7 +10,9 @@ | ||
10 | <BasicForm @register="registerForm" /> | 10 | <BasicForm @register="registerForm" /> |
11 | <template #footer> | 11 | <template #footer> |
12 | <a-button @click="handleCancel">取消</a-button> | 12 | <a-button @click="handleCancel">取消</a-button> |
13 | - <a-button :disabled="draftDisable" @click="handleSaveDraft">保存草稿</a-button> | 13 | + <Authority value="api:yt:notice:save:post"> |
14 | + <a-button :disabled="draftDisable" @click="handleSaveDraft">保存草稿</a-button> | ||
15 | + </Authority> | ||
14 | <a-button :disabled="sendDisable" type="primary" @click="handleSend">发布通知</a-button> | 16 | <a-button :disabled="sendDisable" type="primary" @click="handleSend">发布通知</a-button> |
15 | </template> | 17 | </template> |
16 | </BasicDrawer> | 18 | </BasicDrawer> |
@@ -26,9 +28,11 @@ | @@ -26,9 +28,11 @@ | ||
26 | notifyAddLeaseApi, | 28 | notifyAddLeaseApi, |
27 | } from '/@/api/stationnotification/stationnotifyApi'; | 29 | } from '/@/api/stationnotification/stationnotifyApi'; |
28 | import { useMessage } from '/@/hooks/web/useMessage'; | 30 | import { useMessage } from '/@/hooks/web/useMessage'; |
31 | + import { Authority } from '/@/components/Authority'; | ||
32 | + | ||
29 | export default defineComponent({ | 33 | export default defineComponent({ |
30 | name: 'ConfigDrawer', | 34 | name: 'ConfigDrawer', |
31 | - components: { BasicDrawer, BasicForm }, | 35 | + components: { BasicDrawer, BasicForm,Authority }, |
32 | emits: ['success', 'register'], | 36 | emits: ['success', 'register'], |
33 | setup(_, { emit }) { | 37 | setup(_, { emit }) { |
34 | const draftDisable = ref(false); | 38 | const draftDisable = ref(false); |
@@ -21,11 +21,7 @@ | @@ -21,11 +21,7 @@ | ||
21 | <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> | 21 | <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> |
22 | <!-- <AppLogo class="-enter-x" /> --> | 22 | <!-- <AppLogo class="-enter-x" /> --> |
23 | <div style="display: flex; margin-top: 10px"> | 23 | <div style="display: flex; margin-top: 10px"> |
24 | - <img | ||
25 | - v-if="defaultLogo || getLogo" | ||
26 | - :src="defaultLogo || getLogo" | ||
27 | - style="width: 48px; height: 48px" | ||
28 | - /> | 24 | + <img v-if="defaultLogo" :src="defaultLogo" style="width: 48px; height: 48px" /> |
29 | <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" /> | 25 | <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" /> |
30 | <div | 26 | <div |
31 | class="ml-2 truncate md:opacity-100" | 27 | class="ml-2 truncate md:opacity-100" |
@@ -37,7 +33,7 @@ | @@ -37,7 +33,7 @@ | ||
37 | font-weight: 700; | 33 | font-weight: 700; |
38 | " | 34 | " |
39 | > | 35 | > |
40 | - {{ defaultTitle || getTitle }} | 36 | + {{ defaultTitle }} |
41 | </div> | 37 | </div> |
42 | </div> | 38 | </div> |
43 | <div v-if="ifCustom" class="my-auto"> | 39 | <div v-if="ifCustom" class="my-auto"> |
@@ -70,7 +66,7 @@ | @@ -70,7 +66,7 @@ | ||
70 | </div> | 66 | </div> |
71 | </template> | 67 | </template> |
72 | <script lang="ts" setup> | 68 | <script lang="ts" setup> |
73 | - import { computed, ref, onMounted } from 'vue'; | 69 | + import { ref, onMounted } from 'vue'; |
74 | // import { AppLogo } from '/@/components/Application'; | 70 | // import { AppLogo } from '/@/components/Application'; |
75 | import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; | 71 | import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; |
76 | import LoginForm from './LoginForm.vue'; | 72 | import LoginForm from './LoginForm.vue'; |
@@ -81,7 +77,7 @@ | @@ -81,7 +77,7 @@ | ||
81 | import { useI18n } from '/@/hooks/web/useI18n'; | 77 | import { useI18n } from '/@/hooks/web/useI18n'; |
82 | import { useDesign } from '/@/hooks/web/useDesign'; | 78 | import { useDesign } from '/@/hooks/web/useDesign'; |
83 | import { useLocaleStore } from '/@/store/modules/locale'; | 79 | import { useLocaleStore } from '/@/store/modules/locale'; |
84 | - import { useUserStore } from '/@/store/modules/user'; | 80 | + // import { useUserStore } from '/@/store/modules/user'; |
85 | import { getPlatForm } from '/@/api/oem/index'; | 81 | import { getPlatForm } from '/@/api/oem/index'; |
86 | import defaultShowLogoImg from '/@/assets/svg/login-bg.svg'; | 82 | import defaultShowLogoImg from '/@/assets/svg/login-bg.svg'; |
87 | 83 | ||
@@ -90,14 +86,21 @@ | @@ -90,14 +86,21 @@ | ||
90 | type: Boolean, | 86 | type: Boolean, |
91 | }, | 87 | }, |
92 | }); | 88 | }); |
89 | + const { title } = useGlobSetting(); | ||
93 | const defaultTitle = ref(''); | 90 | const defaultTitle = ref(''); |
94 | const defaultLogo = ref(''); | 91 | const defaultLogo = ref(''); |
95 | const logoUrl = ref(''); | 92 | const logoUrl = ref(''); |
96 | onMounted(async () => { | 93 | onMounted(async () => { |
97 | const res = await getPlatForm(); | 94 | const res = await getPlatForm(); |
98 | logoUrl.value = res?.background; | 95 | logoUrl.value = res?.background; |
99 | - defaultTitle.value = res?.name; | 96 | + defaultTitle.value = res?.name || title; |
100 | defaultLogo.value = res?.logo; | 97 | defaultLogo.value = res?.logo; |
98 | + let link = (document.querySelector("link[rel*='icon']") || | ||
99 | + document.createElement('link')) as HTMLLinkElement; | ||
100 | + link.type = 'image/x-icon'; | ||
101 | + link.rel = 'shortcut icon'; | ||
102 | + link.href = res.icon ?? '/favicon.ico'; | ||
103 | + document.getElementsByTagName('head')[0].appendChild(link); | ||
101 | if (logoUrl.value !== undefined) { | 104 | if (logoUrl.value !== undefined) { |
102 | ifCustom.value = false; | 105 | ifCustom.value = false; |
103 | } else { | 106 | } else { |
@@ -105,29 +108,28 @@ | @@ -105,29 +108,28 @@ | ||
105 | } | 108 | } |
106 | }); | 109 | }); |
107 | 110 | ||
108 | - const userStore = useUserStore(); | 111 | + // const userStore = useUserStore(); |
109 | 112 | ||
110 | const ifCustom = ref(true); | 113 | const ifCustom = ref(true); |
111 | - const getLogo = computed(() => { | ||
112 | - return userStore.platInfo?.logo; | ||
113 | - }); | ||
114 | - const { title } = useGlobSetting(); | ||
115 | - const getTitle = computed(() => { | ||
116 | - // 设置icon | ||
117 | - let link = (document.querySelector("link[rel*='icon']") || | ||
118 | - document.createElement('link')) as HTMLLinkElement; | ||
119 | - link.type = 'image/x-icon'; | ||
120 | - link.rel = 'shortcut icon'; | ||
121 | - link.href = userStore.platInfo?.icon ?? '/favicon.ico'; | ||
122 | - document.getElementsByTagName('head')[0].appendChild(link); | ||
123 | - // logoUrl.value = userStore.platInfo?.background; | ||
124 | - // if (logoUrl.value !== undefined) { | ||
125 | - // ifCustom.value = false; | ||
126 | - // } else { | ||
127 | - // logoUrl.value = 'url(' + defaultShowLogoImg + ')'; | ||
128 | - // } | ||
129 | - return userStore.platInfo?.name ?? title; | ||
130 | - }); | 114 | + // const getLogo = computed(() => { |
115 | + // return userStore.platInfo?.logo; | ||
116 | + // }); | ||
117 | + // const getTitle = computed(() => { | ||
118 | + // // 设置icon | ||
119 | + // let link = (document.querySelector("link[rel*='icon']") || | ||
120 | + // document.createElement('link')) as HTMLLinkElement; | ||
121 | + // link.type = 'image/x-icon'; | ||
122 | + // link.rel = 'shortcut icon'; | ||
123 | + // link.href = userStore.platInfo?.icon ?? '/favicon.ico'; | ||
124 | + // document.getElementsByTagName('head')[0].appendChild(link); | ||
125 | + // // logoUrl.value = userStore.platInfo?.background; | ||
126 | + // // if (logoUrl.value !== undefined) { | ||
127 | + // // ifCustom.value = false; | ||
128 | + // // } else { | ||
129 | + // // logoUrl.value = 'url(' + defaultShowLogoImg + ')'; | ||
130 | + // // } | ||
131 | + // return userStore.platInfo?.name ?? title; | ||
132 | + // }); | ||
131 | // const globSetting = useGlobSetting(); | 133 | // const globSetting = useGlobSetting(); |
132 | const { prefixCls } = useDesign('login'); | 134 | const { prefixCls } = useDesign('login'); |
133 | const { t } = useI18n(); | 135 | const { t } = useI18n(); |
@@ -73,7 +73,7 @@ | @@ -73,7 +73,7 @@ | ||
73 | import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; | 73 | import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; |
74 | import { useDesign } from '/@/hooks/web/useDesign'; | 74 | import { useDesign } from '/@/hooks/web/useDesign'; |
75 | import { getPlatForm } from '/@/api/oem'; | 75 | import { getPlatForm } from '/@/api/oem'; |
76 | - import { createLocalStorage } from '/@/utils/cache'; | 76 | + import { createLocalStorage, createSessionStorage } from '/@/utils/cache'; |
77 | 77 | ||
78 | const ACol = Col; | 78 | const ACol = Col; |
79 | const ARow = Row; | 79 | const ARow = Row; |
@@ -87,10 +87,11 @@ | @@ -87,10 +87,11 @@ | ||
87 | const { setLoginState, getLoginState } = useLoginState(); | 87 | const { setLoginState, getLoginState } = useLoginState(); |
88 | const { getFormRules } = useFormRules(); | 88 | const { getFormRules } = useFormRules(); |
89 | const storage = createLocalStorage(); | 89 | const storage = createLocalStorage(); |
90 | + const sStorage = createSessionStorage(); | ||
90 | const formRef = ref(); | 91 | const formRef = ref(); |
91 | const loading = ref(false); | 92 | const loading = ref(false); |
92 | const rememberMe = ref(false); | 93 | const rememberMe = ref(false); |
93 | - const userInfo = storage.get('userInfo'); | 94 | + const userInfo = storage.get('userInfo') || sStorage.get('userInfo'); |
94 | const formData = reactive({ | 95 | const formData = reactive({ |
95 | account: userInfo?.account ?? '', | 96 | account: userInfo?.account ?? '', |
96 | password: userInfo?.password ?? '', | 97 | password: userInfo?.password ?? '', |
@@ -105,8 +106,10 @@ | @@ -105,8 +106,10 @@ | ||
105 | if (!data) return; | 106 | if (!data) return; |
106 | if (unref(rememberMe)) { | 107 | if (unref(rememberMe)) { |
107 | storage.set('userInfo', formData); | 108 | storage.set('userInfo', formData); |
109 | + sStorage.set('userInfo', formData); | ||
108 | } else { | 110 | } else { |
109 | storage.set('userInfo', null); | 111 | storage.set('userInfo', null); |
112 | + sStorage.set('userInfo', null); | ||
110 | } | 113 | } |
111 | loading.value = true; | 114 | loading.value = true; |
112 | const userInfo = await userStore | 115 | const userInfo = await userStore |