From 2fe3ae7ee45d727488dc8384a58c106446b38d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B2=A9?= Date: Mon, 21 Jul 2025 14:18:04 +0800 Subject: [PATCH] 2 --- src/api/request.js | 1 - src/pages/course/components/touchBtn.vue | 1 + src/pages/mascot/mascot_select_list.vue | 67 +++++++++++++++--------- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index 97a9fb43..f39a6453 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -8,7 +8,6 @@ const ENV = import.meta.env export const get_base_url = url => { if (ENV.MODE === 'development') { // 开发环境 - return ENV.VITE_APP_BASE_API_Url // H5必须用非https,手机端必须用https // #ifdef H5 const baseUrl = ENV.VITE_APP_BASE_API_Url diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 3765cae2..9e44f27c 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -115,6 +115,7 @@ const initRecord = () => { let _recordPerm = uni.getAppAuthorizeSetting() let _state = _recordPerm.microphoneAuthorized if(_state === 'authorized'){ + console.log('大大大大大'); showTalkingModel.value = true } }) diff --git a/src/pages/mascot/mascot_select_list.vue b/src/pages/mascot/mascot_select_list.vue index 09e0bdc3..42d714ca 100644 --- a/src/pages/mascot/mascot_select_list.vue +++ b/src/pages/mascot/mascot_select_list.vue @@ -49,9 +49,9 @@ - - @@ -82,27 +82,36 @@ const mascotList = reactive([]) const windowsInfo = uni.getWindowInfo() const nowWidth = ref(0); + + let initialIndex = 0; // 总轮播项数量 const swiperCount = 4; // 总轮播项数量 const TRANSITION_RATIO = 0.3; + + const aa = computed(() => Math.floor(nowWidth.value / windowsInfo.screenWidth )); + + // 计算过渡起点(像素值,取整):屏幕宽度的20%位置 - const TRANSITION_SUM = computed(() => Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO)); - const TRANSITION_START = computed(() => Math.floor(windowsInfo.screenWidth * (1 - TRANSITION_RATIO))); + const TRANSITION_SUM = windowsInfo.screenWidth + + const TRANSITION_START = Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO) // 计算过渡终点(像素值,取整):屏幕宽度的80%位置 - const TRANSITION_END = computed(() => Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO)); + const TRANSITION_END = Math.floor(windowsInfo.screenWidth * (1 - TRANSITION_RATIO)) + // 第一张图透明度(0、2索引显示) + console.log(TRANSITION_SUM, TRANSITION_START, TRANSITION_END); const btn1Opacity = computed(() => { - - if (initialIndex % 2 === 1) { // 淡入 - console.log('111我淡入淡入'); + return 0; + + if (initialIndex % 2 === 0) { // 淡入 if (nowWidth.value <= TRANSITION_START.value) { return 0; } else { return Math.min(1, (nowWidth.value - TRANSITION_START.value) / TRANSITION_SUM.value); } } else { // 淡出 - console.log('111我淡出'); - if (nowWidth.value >= TRANSITION_END.value) { - return 1; + // console.log('111我淡出'); + if (nowWidth.value >= TRANSITION_END) { + return 0; } else { return Math.max(0, 1 - (TRANSITION_END.value - nowWidth.value) / TRANSITION_SUM.value); } @@ -110,22 +119,29 @@ }); const btn2Opacity = computed(() => { - return 0; - const initialIndex = swiperIndex.value; - if (initialIndex % 2 === 0) { // 淡入 - console.log('222我淡入'); - if (nowWidth.value <= TRANSITION_START.value) { + const aa = initialIndex + if (nowWidth.value === windowsInfo.screenWidth) { + initialIndex++ + console.log('嘻嘻切换。initialIndex'); + } + if (aa % 2 === 1) { // 淡入 + // if (nowWidth.value <= TRANSITION_START) { + // console.log(1); + // return 1; + // } else { + // console.log(Math.max(0, 1 - (TRANSITION_END - nowWidth.value) / TRANSITION_SUM)); + // return Math.max(0, 1 - (TRANSITION_END - nowWidth.value) / TRANSITION_SUM); + + // } + } else { // 淡出 + // console.log('222我淡出'); + if (nowWidth.value >= TRANSITION_END) { + console.log('淡入1', nowWidth.value, TRANSITION_END); return 1; } else { - return Math.max(0, 1 - (TRANSITION_END.value - nowWidth.value) / TRANSITION_SUM.value); - - } - } else { // 淡出 - console.log('222我淡出'); - if (nowWidth.value >= TRANSITION_END.value) { - return 0; - } else { - return Math.min(1, (nowWidth.value - TRANSITION_START.value) / TRANSITION_SUM.value); + console.log('淡入2', nowWidth.value / TRANSITION_SUM); + console.log('淡入2', Math.min(1, nowWidth.value / TRANSITION_SUM)); + return Math.min(0, nowWidth.value / TRANSITION_SUM); } } }); @@ -152,6 +168,7 @@ detail }) => { nowWidth.value = Math.abs(detail.dx) + console.log('宽度', nowWidth.value); } const select_it = () => {