Commit 3378ef5b7553b833c6187893a93fff0471f1a531

Authored by xp.Huang
2 parents 49687882 c1c9ea5f

Merge branch 'f-dev' into 'main'

fix:修改记住我无效问题

See merge request huang/yun-teng-iot-front!322
... ... @@ -12,17 +12,17 @@
12 12 overlayClassName="app-locale-picker-overlay"
13 13 >
14 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 17 </span>
18 18 </Dropdown>
19 19 </template>
20 20 <script lang="ts" setup>
21 21 import type { LocaleType } from '/#/config';
22 22 import type { DropMenu } from '/@/components/Dropdown';
23   - import { ref, watchEffect, unref, computed } from 'vue';
  23 + import { ref, watchEffect, unref } from 'vue';
24 24 import { Dropdown } from '/@/components/Dropdown';
25   - import { Icon } from '/@/components/Icon';
  25 + // import { Icon } from '/@/components/Icon';
26 26 import { useLocale } from '/@/locales/useLocale';
27 27 import { localeList } from '/@/settings/localeSetting';
28 28
... ... @@ -45,13 +45,13 @@
45 45
46 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 56 watchEffect(() => {
57 57 selectedKeys.value = [unref(getLocale)];
... ...
... ... @@ -37,8 +37,8 @@
37 37 >
38 38 <img
39 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 42 alt="avatar"
43 43 />
44 44 <div v-else>
... ... @@ -93,6 +93,7 @@
93 93 import { useUserStore } from '/@/store/modules/user';
94 94 import type { FileItem } from '/@/components/Upload/src/typing';
95 95 import { LoadingOutlined } from '@ant-design/icons-vue';
  96 + import headerImg from '/@/assets/images/logo.png';
96 97
97 98 const schema: DescItem[] = [
98 99 {
... ... @@ -247,7 +248,8 @@
247 248 registerModal,
248 249 registerForm,
249 250 loading,
250   - mockData
  251 + mockData,
  252 + headerImg,
251 253 };
252 254 },
253 255 });
... ...
... ... @@ -67,7 +67,7 @@
67 67 import { useI18n } from '/@/hooks/web/useI18n';
68 68 import { useDesign } from '/@/hooks/web/useDesign';
69 69 import { useModal } from '/@/components/Modal';
70   - import headerImg from '/@/assets/images/header.jpg';
  70 + import headerImg from '/@/assets/images/logo.png';
71 71 import { propTypes } from '/@/utils/propTypes';
72 72 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
73 73 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
... ...
... ... @@ -74,7 +74,7 @@
74 74 import moment from 'moment';
75 75 // 导入一些静态图片,避免打包时不能正确解析
76 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 78 import zx from '/@/assets/images/zx.png';
79 79 import lx from '/@/assets/images/lx.png';
80 80 import djh from '/@/assets/images/djh.png';
... ... @@ -142,26 +142,15 @@
142 142 const BMap = (window as any).BMap;
143 143 if (!wrapEl) return;
144 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 156 const deviceRowClick = async (record) => {
... ... @@ -192,7 +181,7 @@
192 181 // 创建信息窗口对象
193 182 const res = await getDeviceActiveTime(entityId);
194 183
195   - let { value: activeStatus, lastUpdateTs } = res[0];
  184 + let { lastUpdateTs } = res[0];
196 185 lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss');
197 186 let infoWindow = new BMap.InfoWindow(
198 187 `
... ...
... ... @@ -10,7 +10,9 @@
10 10 <BasicForm @register="registerForm" />
11 11 <template #footer>
12 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 16 <a-button :disabled="sendDisable" type="primary" @click="handleSend">发布通知</a-button>
15 17 </template>
16 18 </BasicDrawer>
... ... @@ -26,9 +28,11 @@
26 28 notifyAddLeaseApi,
27 29 } from '/@/api/stationnotification/stationnotifyApi';
28 30 import { useMessage } from '/@/hooks/web/useMessage';
  31 + import { Authority } from '/@/components/Authority';
  32 +
29 33 export default defineComponent({
30 34 name: 'ConfigDrawer',
31   - components: { BasicDrawer, BasicForm },
  35 + components: { BasicDrawer, BasicForm,Authority },
32 36 emits: ['success', 'register'],
33 37 setup(_, { emit }) {
34 38 const draftDisable = ref(false);
... ...
... ... @@ -21,11 +21,7 @@
21 21 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12">
22 22 <!-- <AppLogo class="-enter-x" /> -->
23 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 25 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" />
30 26 <div
31 27 class="ml-2 truncate md:opacity-100"
... ... @@ -37,7 +33,7 @@
37 33 font-weight: 700;
38 34 "
39 35 >
40   - {{ defaultTitle || getTitle }}
  36 + {{ defaultTitle }}
41 37 </div>
42 38 </div>
43 39 <div v-if="ifCustom" class="my-auto">
... ... @@ -70,7 +66,7 @@
70 66 </div>
71 67 </template>
72 68 <script lang="ts" setup>
73   - import { computed, ref, onMounted } from 'vue';
  69 + import { ref, onMounted } from 'vue';
74 70 // import { AppLogo } from '/@/components/Application';
75 71 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
76 72 import LoginForm from './LoginForm.vue';
... ... @@ -81,7 +77,7 @@
81 77 import { useI18n } from '/@/hooks/web/useI18n';
82 78 import { useDesign } from '/@/hooks/web/useDesign';
83 79 import { useLocaleStore } from '/@/store/modules/locale';
84   - import { useUserStore } from '/@/store/modules/user';
  80 + // import { useUserStore } from '/@/store/modules/user';
85 81 import { getPlatForm } from '/@/api/oem/index';
86 82 import defaultShowLogoImg from '/@/assets/svg/login-bg.svg';
87 83
... ... @@ -90,14 +86,21 @@
90 86 type: Boolean,
91 87 },
92 88 });
  89 + const { title } = useGlobSetting();
93 90 const defaultTitle = ref('');
94 91 const defaultLogo = ref('');
95 92 const logoUrl = ref('');
96 93 onMounted(async () => {
97 94 const res = await getPlatForm();
98 95 logoUrl.value = res?.background;
99   - defaultTitle.value = res?.name;
  96 + defaultTitle.value = res?.name || title;
100 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 104 if (logoUrl.value !== undefined) {
102 105 ifCustom.value = false;
103 106 } else {
... ... @@ -105,29 +108,28 @@
105 108 }
106 109 });
107 110
108   - const userStore = useUserStore();
  111 + // const userStore = useUserStore();
109 112
110 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 133 // const globSetting = useGlobSetting();
132 134 const { prefixCls } = useDesign('login');
133 135 const { t } = useI18n();
... ...
... ... @@ -73,7 +73,7 @@
73 73 import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
74 74 import { useDesign } from '/@/hooks/web/useDesign';
75 75 import { getPlatForm } from '/@/api/oem';
76   - import { createLocalStorage } from '/@/utils/cache';
  76 + import { createLocalStorage, createSessionStorage } from '/@/utils/cache';
77 77
78 78 const ACol = Col;
79 79 const ARow = Row;
... ... @@ -87,10 +87,11 @@
87 87 const { setLoginState, getLoginState } = useLoginState();
88 88 const { getFormRules } = useFormRules();
89 89 const storage = createLocalStorage();
  90 + const sStorage = createSessionStorage();
90 91 const formRef = ref();
91 92 const loading = ref(false);
92 93 const rememberMe = ref(false);
93   - const userInfo = storage.get('userInfo');
  94 + const userInfo = storage.get('userInfo') || sStorage.get('userInfo');
94 95 const formData = reactive({
95 96 account: userInfo?.account ?? '',
96 97 password: userInfo?.password ?? '',
... ... @@ -105,8 +106,10 @@
105 106 if (!data) return;
106 107 if (unref(rememberMe)) {
107 108 storage.set('userInfo', formData);
  109 + sStorage.set('userInfo', formData);
108 110 } else {
109 111 storage.set('userInfo', null);
  112 + sStorage.set('userInfo', null);
110 113 }
111 114 loading.value = true;
112 115 const userInfo = await userStore
... ...