lvkun996 2 лет назад
Родитель
Сommit
13c01f7698

+ 35 - 11
src/components/luojigou-board/luojigou-board.vue

@@ -29,16 +29,17 @@
           </view>
       </view>
     </view>
-
+<!-- 
+      v-show="props.tipsButton === 1" -->
     <view
       class="mark-button"
-      v-if="props.tipsButton === 1"
       :style="{
         width: 357 * rate + 'rpx', 
         height: 466 * rate + 'rpx',
         top: 102 * rate + 'rpx',
         left: '50%', 
-        transform: 'translateX(-50%)'
+        transform: 'translateX(-50%)',
+       
      }" 
     >
       <view
@@ -51,7 +52,8 @@
           height: 46 * rate + 'rpx',
           backgroundColor: colorMap.get(item.color),
           scale: 0.7,
-          borderRadius: '50%'
+          borderRadius: '50%',
+          opacity: props.tipsButton === 1 ? 1 : 0
         }"
       />
     </view>
@@ -104,7 +106,7 @@
 
 
 <script setup lang="ts" name="luojigou-board" >
-import { defineProps, reactive, ref, computed, getCurrentInstance, defineEmits } from 'vue'
+import { defineProps, reactive, ref, computed, getCurrentInstance, defineEmits,watch } from 'vue'
 import { useStaticImg, useSchedulerOnce, useQueryElInfo, useAdaptationIpadAndPhone } from '@/hooks/index'
 import type { CardModeEnum } from '@/enum/constant';
 import { useCalcQuantityStore } from '@/store/index';
@@ -167,8 +169,17 @@ const ansRef = ref<UniApp.NodeInfo>()
 const quesRef = ref<UniApp.NodeInfo>()
 const movableAreaRef = ref<UniApp.NodeInfo>()
 
-useQueryElInfo('#quesRef', (nodeInfo) => quesRef.value = nodeInfo as UniApp.NodeInfo, getCurrentInstance()!)
-useQueryElInfo('#ansRef', (nodeInfo) => ansRef.value = nodeInfo as UniApp.NodeInfo, getCurrentInstance()!)
+useQueryElInfo('#quesRef', (nodeInfo) => {
+  console.log('#quesRef:', nodeInfo);
+  
+  quesRef.value = nodeInfo as UniApp.NodeInfo
+  
+}, getCurrentInstance()!)
+useQueryElInfo('#ansRef', (nodeInfo) => {
+  console.log('ansRef.value:',nodeInfo );
+  
+  ansRef.value = nodeInfo as UniApp.NodeInfo
+}, getCurrentInstance()!)
 useQueryElInfo('#movableAreaRef', (nodeInfo) => movableAreaRef.value = nodeInfo as UniApp.NodeInfo, getCurrentInstance()!)
 
 const baseRatio = adaptatio
@@ -179,6 +190,9 @@ const { windowWidth, windowHeight } = uni.getSystemInfoSync()
 
 const unit = windowWidth / windowHeight > 0.6 ? 1 : 0.5
 
+// 几钮模板
+const copies = props.cardType === 0 ? 4 : 6
+
 const ansItemHeight = computed(() => Math.floor(ansRef.value?.height! / copies))
 
 const TPos = (x: number, y: number) => {
@@ -187,10 +201,17 @@ const TPos = (x: number, y: number) => {
   
 }
 
-const getButtonIndex = (_y: number) =>  Math.floor(_y / ansItemHeight.value)
+const getButtonIndex = (_y: number) =>  {
+  console.log(_y, ansItemHeight.value);
+  
+ return Math.floor(_y / ansItemHeight.value)
+}
 
 const getButtonPosByIndex = (index: number) => {
 
+  console.log("quesRef.value:", quesRef.value?.width);
+  console.log("ansRef.value:", ansRef.value.width);
+  
   const x = ansRef.value?.width! + quesRef.value?.width! 
  
   const y = ansItemHeight.value * index + ansItemHeight.value / 2 - 23 * rate * unit
@@ -199,8 +220,7 @@ const getButtonPosByIndex = (index: number) => {
 }
 
 
-// 几钮模板
-const copies = props.cardType === 0 ? 4 : 6
+
 
 const buttonWidth = 46 * windowWidth / 375 * baseRatio
 
@@ -252,13 +272,17 @@ const touchend = (ev: TouchEvent, item: Buttons) => {
 
   const { x: itemX, y: itemY } = TPos(ev.changedTouches[0].pageX, ev.changedTouches[0].pageY)
 
+  console.log("itemY:", itemY);
+  
+
   // 返回原点 (没有放在答案区, 按钮回到初始位置)
   if (itemX < quesRef.value?.width! || itemY > ansRef.value?.height! ) {
     disPatchButtonGoInitPos(item.id)
   } else  {
   
     const index = getButtonIndex(itemY <= 0 ? 0 : itemY)
-
+    console.log('index:', index);
+    
     const { x: targetX, y: targetY } = getButtonPosByIndex(index)
     console.log(item.x , targetX , item.y, targetY);
     

+ 1 - 1
src/components/rive-ani/rive-ani.vue

@@ -47,7 +47,7 @@ enum AniEnum {
  */
 interface State {
   rive: Rive,
-  animation: any, 
+  animation: any,
   visible: boolean,
   heartbeatAni: any,
   cointCount: number,

+ 2 - 0
src/hooks/index.ts

@@ -129,6 +129,8 @@ export const useQueryElInfo = (
     query.select(id).boundingClientRect(data => cb(data)).exec();
   }
 
+  // onMounted(() => queryNode())
+
   immediate ? onMounted(() => queryNode()) : queryNode()
 }
 

+ 1 - 1
src/main.ts

@@ -5,7 +5,7 @@ import staticImg from '@/utils/static'
 import VConsole from "vconsole"
 
 
-new VConsole()
+// new VConsole()
 
 
 export function createApp() {

+ 5 - 5
src/pages/GameView/index.vue

@@ -86,10 +86,10 @@ onLoad(query => {
     options = state.queryParams.data
   } else {
     console.log(query);
-    state.queryParams = base64.decode<API.P>(query!.p)
-    state.opraMode = state.queryParams.data.opraMode
-    options = state.queryParams.data
-    // options = query!
+    // state.queryParams = base64.decode<API.P>(query!.p)
+    // state.opraMode = state.queryParams.data.opraMode
+    // options = state.queryParams.data
+    options = query!
   }
   console.log(state.queryParams);
   
@@ -208,7 +208,7 @@ const gameCompleted = async () => {
   opraRecordStore.clear()
   // 如果opraMode 的是learn 则跳转到app-web页面
   if (state.opraMode == OpraModeEnum.LEARN) {
-    // window.location.href = `https://nginx.test.luojigou.vip/app_web/learn-plan.html#/?from='exercise'`
+    window.location.href = `https://nginx.test.luojigou.vip/app_web/learn-plan.html#/?from='exercise'`
   }
   
 }

+ 1 - 1
src/service/index.ts

@@ -11,7 +11,7 @@ interface Params {
 }
 
 // const BASEURL = import.meta.env.MODE === 'development' ? 'http://local.luojigou.vip:8888' : 'https://open.api.luojigou.vip'
-const BASEURL = import.meta.env.MODE === 'development' ? 'http://local.luojigou.vip:8888' : 'https://open.test.luojigou.vip'
+const BASEURL = import.meta.env.MODE !== 'development' ? 'http://local.luojigou.vip:8888' : 'https://open.api.luojigou.vip'
 //  'https://open.test.luojigou.vip'
 // window.location.href.split('#')[0] + 'zd-api'
 // https://open.test.luojigou.vip