|
@@ -1,85 +1,132 @@
|
|
|
<template>
|
|
|
-<view class="luojigou-board" >
|
|
|
- <view class="board" :style="{ transform: `scale(${adaptatio})` ,transformOrigin: '50% 0%'}" >
|
|
|
+<view class="luojigou-board" :style="{width: widget.boardWidth + 'px', height: widget.boardHeight + 'px'}" >
|
|
|
+ <!-- transform: `scale(${adaptatio})` , -->
|
|
|
+ <!-- :style="{ transformOrigin: '50% 0%'}" -->
|
|
|
+ <view class="board" >
|
|
|
<image class="board-img" :src="boardUrl" />
|
|
|
- <view class="board-header" :style="{zIndex: viewZindex.headerView}" id="game-label" >
|
|
|
- <view class="trumpt" @click="emits('playAudio')">
|
|
|
- <!-- <image class="dog" :src="staticImg.trumptDog" /> -->
|
|
|
+ <view
|
|
|
+ class="board-header"
|
|
|
+ :style="{zIndex: viewZindex.headerView, transformOrigin: '0% 0%'}"
|
|
|
+ id="game-label"
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ class="trumpt"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.13 + 'px',
|
|
|
+ height: widget.boardWidth * 0.13 + 'px',
|
|
|
+ top: widget.boardHeight * 0.04 + 'px',
|
|
|
+ left: widget.boardWidth * 0.075 + 'px'
|
|
|
+ }"
|
|
|
+ @click="emits('playAudio')"
|
|
|
+ >
|
|
|
<image
|
|
|
class="trumpt-icon dog"
|
|
|
:src="props.playLoading ? staticImg.trumptGif : staticImg.trumptPng"
|
|
|
/>
|
|
|
</view>
|
|
|
- <view class="tip " :key="props.cardDesc">
|
|
|
- <!-- <scroll-view
|
|
|
- scroll-y
|
|
|
- style="height: 88rpx;"
|
|
|
- >
|
|
|
- {{props.cardDesc ? props.cardDesc : "加載中"}}
|
|
|
- {{props.cardDesc ? props.cardDesc : "加載中"}}
|
|
|
- </scroll-view> -->
|
|
|
+ <view
|
|
|
+ class="tip "
|
|
|
+ :key="props.cardDesc"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.68 + 'px',
|
|
|
+ height: widget.boardHeight * 0.070 + 'px',
|
|
|
+ top: widget.boardHeight * 0.045 + 'px',
|
|
|
+ left: widget.boardWidth * 0.25 + 'px'
|
|
|
+ }"
|
|
|
+ >
|
|
|
{{props.cardDesc ? props.cardDesc : "加載中"}}
|
|
|
</view>
|
|
|
<image
|
|
|
class="luojigou-dog"
|
|
|
:src="staticImg.luojigouDog"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.11 + 'px',
|
|
|
+ height: widget.boardWidth * 0.11 + 'px',
|
|
|
+ top: -widget.boardWidth * 0.067 + 'px',
|
|
|
+ right: widget.boardWidth * 0.067 + 'px',
|
|
|
+ }"
|
|
|
/>
|
|
|
</view>
|
|
|
- <view class="card" :style="{zIndex: viewZindex.quesView}" >
|
|
|
+ <view
|
|
|
+ class="card"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.64 + 'px',
|
|
|
+ height: widget.boardHeight * 0.62 + 'px',
|
|
|
+ zIndex: viewZindex.quesView,
|
|
|
+ top: widget.boardWidth * 0.30 + 'px',
|
|
|
+ left: widget.boardWidth * 0.035 + 'px'
|
|
|
+ }"
|
|
|
+ >
|
|
|
<view class="ques" id="quesRef" >
|
|
|
<image id="ques-url" :src="props.board.quesUrl" alt="" />
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="ans" id="ansRef" :style="{zIndex: viewZindex.quesView}">
|
|
|
+ <view
|
|
|
+ class="ans"
|
|
|
+ id="ansRef"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.21 + 'px',
|
|
|
+ height: widget.boardHeight * 0.62 + 'px',
|
|
|
+ zIndex: viewZindex.quesView,
|
|
|
+ left: widget.boardWidth * 0.675 + 'px',
|
|
|
+ top: widget.boardWidth * 0.30 + 'px'
|
|
|
+ }"
|
|
|
+ >
|
|
|
<image :src="props.board.ansUrl" alt="" />
|
|
|
</view>
|
|
|
<canvas
|
|
|
type="2d"
|
|
|
canvas-id="magnifier-canvas"
|
|
|
id="magnifier-canvas"
|
|
|
- :style="{width: 600 + 'rpx', height: 772 + 'rpx', zIndex: viewZindex.magnifierView}"
|
|
|
+ :style="{
|
|
|
+ width: widget.boardWidth * 0.85 + 'px',
|
|
|
+ height: widget.boardHeight * 0.62 + 'px',
|
|
|
+ zIndex: viewZindex.magnifierView,
|
|
|
+ top: widget.boardWidth * 0.30 + 'px',
|
|
|
+ left: widget.boardWidth * 0.035 + 'px'
|
|
|
+ }"
|
|
|
></canvas>
|
|
|
+
|
|
|
+ <!-- scale: 1 / adaptatio -->
|
|
|
<movable-area
|
|
|
v-if="props.cardType !== undefined"
|
|
|
class="movable-area"
|
|
|
id="movableAreaRef"
|
|
|
:style="{
|
|
|
- width: 357 * rate+ 'rpx',
|
|
|
- height: 466 * rate + 'rpx',
|
|
|
- top: 102 * rate / adaptatio + 'rpx',
|
|
|
- left: 50 + '%',
|
|
|
- transform: `translateX(-${50}%)`,
|
|
|
+ width: widget.boardWidth + 'px',
|
|
|
+ height: widget.boardHeight * 0.75 + 'px',
|
|
|
+ top: widget.boardWidth * 0.30 + 'px',
|
|
|
zIndex: viewZindex.moveView,
|
|
|
- scale: 1 / adaptatio
|
|
|
}"
|
|
|
>
|
|
|
<movable-view
|
|
|
v-for="item in buttons"
|
|
|
:key="item.id"
|
|
|
:disabled="item.disabled"
|
|
|
- :x="item.x "
|
|
|
+ :x="item.x"
|
|
|
:y="item.y"
|
|
|
damping="100"
|
|
|
direction="all"
|
|
|
class="movable-view"
|
|
|
:style="{
|
|
|
- zIndex: item.zIndex,
|
|
|
- width: 46 * rate + 'rpx',
|
|
|
- height: 46 * rate+ 'rpx',
|
|
|
+ zIndex: item.zIndex,
|
|
|
+ width: widget.boardWidth * 0.124 + 'px',
|
|
|
+ height: widget.boardWidth * 0.124 + 'px',
|
|
|
}"
|
|
|
@touchend="touchend($event, item)"
|
|
|
@touchstart="touchStart(item)"
|
|
|
>
|
|
|
<image
|
|
|
:id="`rock-id-${item.id}`"
|
|
|
- :class="`movable-image `"
|
|
|
- :style="{willChange: 'transform', transformOrigin: `center bottom`}"
|
|
|
- :src="item.url"
|
|
|
+ :class="`movable-image `"
|
|
|
+ :style="{willChange: 'transform', transformOrigin: `center bottom`}"
|
|
|
+ :src="item.url"
|
|
|
/>
|
|
|
|
|
|
<image
|
|
|
v-if="item.ans"
|
|
|
class="success-flag"
|
|
|
+ :style="{width: widget.boardWidth * 0.05 + 'px', height: widget.boardWidth * 0.036 + 'px' }"
|
|
|
:src="staticImg.successFlag"
|
|
|
/>
|
|
|
</movable-view>
|
|
@@ -168,7 +215,16 @@ const colorMap = new Map([
|
|
|
['orange', '#FF7F00'],
|
|
|
])
|
|
|
|
|
|
+const { windowWidth, windowHeight } = uni.getSystemInfoSync()
|
|
|
+
|
|
|
+console.log('windowWidth:', windowWidth);
|
|
|
|
|
|
+const navbarBarHeight = (window['statusBarHeight'] ? window['statusBarHeight'] * 2 : 33) + 140
|
|
|
+
|
|
|
+const widget = {
|
|
|
+ boardWidth: ( windowHeight - navbarBarHeight - 30) * 0.578,
|
|
|
+ boardHeight: windowHeight - navbarBarHeight - 30,
|
|
|
+}
|
|
|
|
|
|
const boardUrl = props.cardType == 1 ? staticImg.boardSix : staticImg.boardFour
|
|
|
|
|
@@ -184,8 +240,6 @@ const baseRatio = adaptatio
|
|
|
|
|
|
const rate = baseRatio * 2
|
|
|
|
|
|
-const { windowWidth, windowHeight } = uni.getSystemInfoSync()
|
|
|
-
|
|
|
const unit = windowWidth / windowHeight > 0.6 ? 1 : 0.5
|
|
|
|
|
|
// 几钮模板
|
|
@@ -193,11 +247,7 @@ const copies = props.cardType === 0 ? 4 : 6
|
|
|
|
|
|
const ansItemHeight = computed(() => Math.floor(ansRef.value?.height! / copies))
|
|
|
|
|
|
-const TPos = (x: number, y: number) => {
|
|
|
-
|
|
|
- return { x: x - movableAreaRef.value?.left! - 23 * rate * unit , y: y - movableAreaRef.value?.top! - 23 * rate * unit }
|
|
|
-
|
|
|
-}
|
|
|
+const TPos = (x: number, y: number) => ({ x: x - movableAreaRef.value?.left! - 23 * rate * unit , y: y - movableAreaRef.value?.top! - 23 * rate * unit })
|
|
|
|
|
|
const getButtonIndex = (_y: number) => Math.floor(_y / ansItemHeight.value)
|
|
|
|
|
@@ -205,27 +255,28 @@ const getButtonPosByIndex = (index: number) => {
|
|
|
|
|
|
const x = ansRef.value?.width! + quesRef.value?.width!
|
|
|
|
|
|
- const y = ansItemHeight.value * index + ansItemHeight.value / 2 - 23 * rate * unit
|
|
|
+ const y = ansItemHeight.value * index + ansItemHeight.value / 6
|
|
|
|
|
|
return { x, y }
|
|
|
}
|
|
|
|
|
|
-const buttonWidth = 46 * windowWidth / 375 * baseRatio
|
|
|
+const buttonWidth = widget.boardWidth * 0.124
|
|
|
|
|
|
-const VSpace = props.cardType === 0 ?Math.floor(windowWidth / 375 * 26) * baseRatio + buttonWidth : Math.floor(windowWidth / 375 * 8) * baseRatio + buttonWidth
|
|
|
+// 按钮之间的间隙
|
|
|
+const VSpace = props.cardType === 0 ? Math.floor(windowWidth / 375 * 26) * baseRatio + buttonWidth : widget.boardWidth * 0.168
|
|
|
|
|
|
-const Y = 435 * rate
|
|
|
-
|
|
|
-const getX = (index: number) => index * VSpace + Math.floor(windowWidth / 375 * 11) * baseRatio
|
|
|
+const Y = widget.boardHeight * 0.75
|
|
|
+
|
|
|
+const getX = (index: number) => ( index * buttonWidth + VSpace * (index + 0.5) ) / 2
|
|
|
|
|
|
// 注意一下四钮 用哪几个颜色的按钮
|
|
|
let buttons = reactive<Buttons[]>([
|
|
|
- {id: 0, ans: null, x: getX(0), y: Y * rate , disabled: false, initX: getX(0), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.red, color: 'red' },
|
|
|
- {id: 1, ans: null, x: getX(1), y: Y * rate , disabled: false, initX: getX(1), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.blue, color: 'blue' },
|
|
|
- {id: 2, ans: null, x: getX(2), y: Y * rate , disabled: false, initX: getX(2), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.green, color: 'green' },
|
|
|
- {id: 3, ans: null, x: getX(3), y: Y * rate , disabled: false, initX: getX(3), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.orange, color: 'orange' },
|
|
|
- {id: 4, ans: null, x: getX(4), y: Y * rate , disabled: false, initX: getX(4), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.yellow, color: "yellow" },
|
|
|
- {id: 5, ans: null, x: getX(5), y: Y * rate , disabled: false, initX: getX(5), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.purple, color: 'purple' },
|
|
|
+ {id: 0, ans: null, x: getX(0) , y: Y, disabled: false, initX: getX(0), initY: Y , zIndex: 0, index: -1, url: staticImg.red, color: 'red' },
|
|
|
+ {id: 1, ans: null, x: getX(1), y: Y , disabled: false, initX: getX(1), initY: Y , zIndex: 0, index: -1, url: staticImg.blue, color: 'blue' },
|
|
|
+ {id: 2, ans: null, x: getX(2), y: Y , disabled: false, initX: getX(2), initY: Y , zIndex: 0, index: -1, url: staticImg.green, color: 'green' },
|
|
|
+ {id: 3, ans: null, x: getX(3), y: Y , disabled: false, initX: getX(3), initY: Y , zIndex: 0, index: -1, url: staticImg.orange, color: 'orange' },
|
|
|
+ {id: 4, ans: null, x: getX(4), y: Y , disabled: false, initX: getX(4), initY: Y , zIndex: 0, index: -1, url: staticImg.yellow, color: "yellow" },
|
|
|
+ {id: 5, ans: null, x: getX(5), y: Y , disabled: false, initX: getX(5), initY: Y , zIndex: 0, index: -1, url: staticImg.purple, color: 'purple' },
|
|
|
])
|
|
|
|
|
|
buttons.splice(props.cardType == 1 ? buttons.length : buttons.length - 2, buttons.length)
|
|
@@ -483,14 +534,13 @@ onMounted(() => {
|
|
|
|
|
|
<style lang="less" scoped >
|
|
|
.luojigou-board {
|
|
|
- width: 714rpx;
|
|
|
- height: 1234rpx;
|
|
|
+ width: 1000rpx;
|
|
|
position: relative;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
.board {
|
|
|
- width: 714rpx;
|
|
|
- height: 1234rpx;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
position: relative;
|
|
|
.board-img {
|
|
|
width: 100%;
|
|
@@ -502,19 +552,17 @@ onMounted(() => {
|
|
|
}
|
|
|
.board-header {
|
|
|
width: 100%;
|
|
|
- height: 148rpx;
|
|
|
position: relative;
|
|
|
- top: 7rpx;
|
|
|
z-index: 32;
|
|
|
.trumpt {
|
|
|
- width: 96rpx;
|
|
|
- height: 96rpx;
|
|
|
+ // width: 96rpx;
|
|
|
+ // height: 96rpx;
|
|
|
position: relative;
|
|
|
- top: 44rpx;
|
|
|
- left: 54rpx;
|
|
|
+ // top: 34rpx;
|
|
|
+ // left: 54rpx;
|
|
|
.dog {
|
|
|
- width: 96rpx;
|
|
|
- height: 96rpx;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
position: absolute;
|
|
|
z-index: 1;
|
|
|
}
|
|
@@ -528,15 +576,11 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
.tip {
|
|
|
- width: 490rpx;
|
|
|
- height: 72rpx;
|
|
|
font-size: 24rpx;
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
font-weight: 500;
|
|
|
color: #ffffff;
|
|
|
position: absolute;
|
|
|
- top: 50rpx;
|
|
|
- left: 176rpx;
|
|
|
overflow: hidden;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
@@ -560,8 +604,8 @@ onMounted(() => {
|
|
|
border-bottom-left-radius: 40rpx;
|
|
|
}
|
|
|
.ques {
|
|
|
- width: 450rpx;
|
|
|
- height: 772rpx;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
border-right: 2rpx solid #006CAA;
|
|
|
border-top-left-radius: 40rpx;
|
|
|
border-bottom-left-radius: 40rpx;
|
|
@@ -573,8 +617,6 @@ onMounted(() => {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
display: block;
|
|
|
- // border-top-left-radius: 40rpx;
|
|
|
- // border-bottom-left-radius: 40rpx;
|
|
|
}
|
|
|
}
|
|
|
.ans {
|
|
@@ -587,7 +629,7 @@ onMounted(() => {
|
|
|
overflow: hidden;
|
|
|
background-color: #fff;
|
|
|
position: absolute;
|
|
|
- top: 206rpx;
|
|
|
+ // top: 206rpx;
|
|
|
left: 476rpx;
|
|
|
z-index: 2;
|
|
|
image {
|