Commit c5dc98b21048858525c8b487fee956090cda0a40

Authored by fengwotao
1 parent ea3e3802

feat(packages/external): 修改天气静态图片引用地址

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { toRefs } from 'vue' 2 import { toRefs } from 'vue'
3 import SelectCity from './SelectCity.vue' 3 import SelectCity from './SelectCity.vue'
4 import { useUtils } from '../hooks/useUtils' 4 import { useUtils } from '../hooks/useUtils'
  5 +import weatherBg from '@/assets/external/weather/bg.png'
5 6
6 const props = defineProps({ 7 const props = defineProps({
7 data: { 8 data: {
@@ -27,7 +28,7 @@ const onHandleSelectValues = (values: any) => { @@ -27,7 +28,7 @@ const onHandleSelectValues = (values: any) => {
27 content: true, 28 content: true,
28 footer: 'soft' 29 footer: 'soft'
29 }" 30 }"
30 - :style="{ backgroundImage: `url('src/assets/external/weather/bg.png')` }" 31 + :style="{ backgroundImage: `url('${weatherBg}')` }"
31 class="n-card" 32 class="n-card"
32 > 33 >
33 <template #header> 34 <template #header>
@@ -3,6 +3,10 @@ import { CreateComponentType } from '@/packages/index.d' @@ -3,6 +3,10 @@ import { CreateComponentType } from '@/packages/index.d'
3 import { WeatherConfig } from './index' 3 import { WeatherConfig } from './index'
4 import cloneDeep from 'lodash/cloneDeep' 4 import cloneDeep from 'lodash/cloneDeep'
5 import { chartInitConfig } from '@/settings/designSetting' 5 import { chartInitConfig } from '@/settings/designSetting'
  6 +import clearDay from '@/assets/external/weather/clearDay.png'
  7 +import cloudy from '@/assets/external/weather/cloudy.png'
  8 +import cloudyDay from '@/assets/external/weather/cloudyDay.png'
  9 +import lightRain from '@/assets/external/weather/lightRain.png'
6 10
7 //第三方 天气接口key值和api配置(高德) 11 //第三方 天气接口key值和api配置(高德)
8 export class ThirdPartyWeatherConnfig { 12 export class ThirdPartyWeatherConnfig {
@@ -23,19 +27,19 @@ export const enum areaEnum { @@ -23,19 +27,19 @@ export const enum areaEnum {
23 export const weatherTextMapImg = [ 27 export const weatherTextMapImg = [
24 { 28 {
25 text: '晴', 29 text: '晴',
26 - img: 'src/assets/external/weather/clearDay.png' 30 + img: clearDay
27 }, 31 },
28 { 32 {
29 text: '多云', 33 text: '多云',
30 - img: 'src/assets/external/weather/cloudy.png' 34 + img: cloudy
31 }, 35 },
32 { 36 {
33 text: '阴', 37 text: '阴',
34 - img: 'src/assets/external/weather/cloudyDay.png' 38 + img: cloudyDay
35 }, 39 },
36 { 40 {
37 text: '小雨', 41 text: '小雨',
38 - img: 'src/assets/external/weather/lightRain.png' 42 + img: lightRain
39 } 43 }
40 ] 44 ]
41 45
1 import { weatherSpeedMapText, weatherTextMapImg } from '../config' 1 import { weatherSpeedMapText, weatherTextMapImg } from '../config'
  2 +import clearDay from '@/assets/external/weather/clearDay.png'
2 3
3 export const useUtils = () => { 4 export const useUtils = () => {
4 const loadWeatherImg = (text: string) => { 5 const loadWeatherImg = (text: string) => {
5 - return (  
6 - weatherTextMapImg.find((item: any) => item.text === text)?.img ||  
7 - '/src/assets/external/weather/clearDay.png'  
8 - ) 6 + return weatherTextMapImg.find((item: any) => item.text === text)?.img || clearDay
9 } 7 }
10 8
11 //风力等级 ≤3 3 9 //风力等级 ≤3 3