diff --git a/config/index.js b/config/index.js index 5ab8995..4da1aa2 100644 --- a/config/index.js +++ b/config/index.js @@ -12,7 +12,7 @@ const envParam = { prod: 'production', } -const env = envParam['test'] +const env = envParam['dev'] // 全局配置 const config = { diff --git a/pages/components/SplashScreen.vue b/pages/components/SplashScreen.vue index 3fa5cb2..e7aaf20 100644 --- a/pages/components/SplashScreen.vue +++ b/pages/components/SplashScreen.vue @@ -6,6 +6,8 @@ :src="splashContent" mode="scaleToFill" class="splash-image" + @error="onImageError" + @load="onImageLoad" /> @@ -48,7 +50,24 @@ export default { }, computed: { image() { - return this.configParamContent('creen_image') || uni.getStorageSync('screen_image') + try { + // 優先從配置獲取 + const configImage = this.configParamContent && this.configParamContent('creen_image') + if (configImage && configImage !== 'undefined' && configImage !== '') { + return configImage + } + + // 備用方案:從本地存儲獲取 + const storageImage = uni.getStorageSync('screen_image') + if (storageImage && storageImage !== 'undefined' && storageImage !== '') { + return storageImage + } + + return '' + } catch (error) { + console.error('獲取開屏圖片失敗:', error) + return '' + } } }, mounted() { @@ -63,17 +82,38 @@ export default { // 初始化開動頁面 async initSplash() { try { - // 獲取富文本內容 - this.splashContent = this.image + // 等待一小段時間確保 store 數據加載完成 + await this.$nextTick() - // 如果有內容才顯示 - if (this.splashContent) { + // 獲取圖片URL,優先使用配置,然後使用本地存儲 + let imageUrl = '' + + // 嘗試從配置獲取 + if (this.$store.state.configList && this.$store.state.configList['creen_image']) { + imageUrl = this.configParamContent('creen_image') + } + + // 如果配置中沒有,嘗試從本地存儲獲取 + if (!imageUrl) { + imageUrl = uni.getStorageSync('screen_image') + } + + console.log('開屏圖片URL:', imageUrl) + + // 如果有圖片URL才顯示開屏 + if (imageUrl && imageUrl !== 'undefined' && imageUrl !== '') { + this.splashContent = imageUrl this.countdown = this.duration this.showSplash = true this.startCountdown() + } else { + console.log('沒有開屏圖片,跳過開屏動畫') + this.$emit('close') } } catch (error) { console.error('獲取開動頁面內容失敗:', error) + // 發生錯誤時直接關閉開屏 + this.$emit('close') } }, @@ -103,6 +143,18 @@ export default { clearInterval(this.timer) this.timer = null } + }, + + // 圖片加載成功 + onImageLoad() { + console.log('開屏圖片加載成功') + }, + + // 圖片加載失敗 + onImageError(e) { + console.error('開屏圖片加載失敗:', e) + // 圖片加載失敗時直接關閉開屏 + this.closeSplash() } } } diff --git a/subPages/home/AudioControls.vue b/subPages/home/AudioControls.vue index 012b774..23e2079 100644 --- a/subPages/home/AudioControls.vue +++ b/subPages/home/AudioControls.vue @@ -1,21 +1,35 @@