code refactor

This commit is contained in:
MaysWind
2023-07-09 11:12:39 +08:00
parent 386aa0adc1
commit c5c9ed24c3
4 changed files with 15 additions and 1 deletions
+2
View File
@@ -1,4 +1,5 @@
const baseApiUrlPath = '/api';
const baseQrcodePath = '/qrcode';
const baseProxyUrlPath = '/proxy';
const baseAmapApiProxyUrlPath = '/_AMapService';
const googleMapJavascriptUrl = 'https://maps.googleapis.com/maps/api/js';
@@ -7,6 +8,7 @@ const amapJavascriptUrl = 'https://webapi.amap.com/maps?v=2.0';
export default {
baseApiUrlPath: baseApiUrlPath,
baseQrcodePath: baseQrcodePath,
baseProxyUrlPath: baseProxyUrlPath,
baseAmapApiProxyUrlPath: baseAmapApiProxyUrlPath,
googleMapJavascriptUrl: googleMapJavascriptUrl,
+5
View File
@@ -0,0 +1,5 @@
import services from '@/lib/services.js';
export function getMobileUrlQrCodePath() {
return services.generateQrCodeUrl('mobile_url');
}
+3
View File
@@ -400,6 +400,9 @@ export default {
ignoreError: !!ignoreError
});
},
generateQrCodeUrl: (qrCodeName) => {
return `${api.baseQrcodePath}/${qrCodeName}.png`;
},
generateMapProxyTileImageUrl: (mapProvider, language) => {
const token = userState.getToken();
let url = `${api.baseProxyUrlPath}/map/tile/{z}/{x}/{y}.png?provider=${mapProvider}&token=${token}`;
+5 -1
View File
@@ -172,7 +172,7 @@
<p>{{ $t('You can scan the below QR code on your mobile device.') }}</p>
</v-card-text>
<v-card-text class="pa-4 w-100 d-flex justify-center">
<img alt="qrcode" class="img-url-qrcode" src="/qrcode/mobile_url.png" />
<img alt="qrcode" class="img-url-qrcode" :src="mobileUrlQrCodePath" />
</v-card-text>
<v-card-actions>
<v-btn :href="mobileVersionPath">{{$t('Switch to Mobile Version') }}</v-btn>
@@ -200,6 +200,7 @@ import { useSettingsStore } from '@/stores/setting.js';
import { useUserStore } from '@/stores/user.js';
import { getSystemTheme } from '@/lib/ui.js';
import { getMobileUrlQrCodePath } from '@/lib/qrcode.js';
import { getMobileVersionPath } from '@/lib/version.js';
import {
@@ -257,6 +258,9 @@ export default {
const { mdAndDown } = useDisplay();
return mdAndDown.value;
},
mobileUrlQrCodePath() {
return getMobileUrlQrCodePath();
},
mobileVersionPath() {
return getMobileVersionPath();
},