|
@@ -28,7 +28,6 @@
|
|
|
<image :src="props.board.ansUrl" alt="" />
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
@@ -71,7 +70,7 @@
|
|
|
<movable-view
|
|
|
v-for="item in buttons"
|
|
|
:key="item.id"
|
|
|
- :disabled="state.disabled"
|
|
|
+ :disabled="item.disabled"
|
|
|
:x="item.x"
|
|
|
:y="item.y"
|
|
|
damping="100"
|
|
@@ -121,6 +120,7 @@ interface Buttons {
|
|
|
index: number,
|
|
|
zIndex: number,
|
|
|
ans: API.Color | null
|
|
|
+ disabled: boolean
|
|
|
}
|
|
|
|
|
|
interface IProps {
|
|
@@ -210,12 +210,12 @@ const getX = (index: number) => index * VSpace + Math.floor(windowWidth / 375 *
|
|
|
|
|
|
// 注意一下四钮 用哪几个颜色的按钮
|
|
|
let buttons = reactive<Buttons[]>([
|
|
|
- {id: 0, ans: null, x: getX(0), y: Y * rate, 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, 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, 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, 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, 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, initX: getX(5), initY: Y * rate, zIndex: 0, index: -1, url: staticImg.purple, color: 'purple' },
|
|
|
+ {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' },
|
|
|
])
|
|
|
|
|
|
buttons.splice(props.cardType == 1 ? buttons.length : buttons.length - 2, buttons.length)
|
|
@@ -246,7 +246,7 @@ const touchStart = (item: Buttons) => {
|
|
|
// 按钮脱手
|
|
|
const touchend = (ev: TouchEvent, item: Buttons) => {
|
|
|
|
|
|
- if (state.disabled) return
|
|
|
+ if (item.disabled) return
|
|
|
|
|
|
const { x: itemX, y: itemY } = TPos(ev.changedTouches[0].pageX, ev.changedTouches[0].pageY)
|
|
|
|
|
@@ -262,7 +262,7 @@ const touchend = (ev: TouchEvent, item: Buttons) => {
|
|
|
|
|
|
// 直接点击答案区的按钮,答案区按钮回到初始位置
|
|
|
if (item.x == targetX && item.y == targetY) {
|
|
|
- disPatchButtonGoInitPos(item.id)
|
|
|
+ // disPatchButtonGoInitPos(item.id)
|
|
|
} else {
|
|
|
|
|
|
// 两个按钮都在答案区, 直接进行按钮之间的交换
|
|
@@ -271,14 +271,14 @@ const touchend = (ev: TouchEvent, item: Buttons) => {
|
|
|
if (isHasIndex >= 0) { // 答案区的目标区域存在按钮
|
|
|
|
|
|
if (item.index == -1) { // 答案区的目标区域存在按钮 操作按钮是从待操作区域移过来的 目标按钮回到原位
|
|
|
- disPatchButtonGoInitPos(isHasIndex)
|
|
|
+ // disPatchButtonGoInitPos(isHasIndex)
|
|
|
} else { // 答案区的目标区域存在按钮 操作按钮是和目标按钮互换位置
|
|
|
- useSchedulerOnce(() => {
|
|
|
- const oldPos = getButtonPosByIndex(item.index)
|
|
|
- buttons[isHasIndex].x = oldPos.x
|
|
|
- buttons[isHasIndex].y = oldPos.y
|
|
|
- buttons[isHasIndex].index = item.index
|
|
|
- })
|
|
|
+ // useSchedulerOnce(() => {
|
|
|
+ // const oldPos = getButtonPosByIndex(item.index)
|
|
|
+ // buttons[isHasIndex].x = oldPos.x
|
|
|
+ // buttons[isHasIndex].y = oldPos.y
|
|
|
+ // buttons[isHasIndex].index = item.index
|
|
|
+ // })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -303,8 +303,12 @@ const checkAns = (index: number, itemData: Buttons) => {
|
|
|
// 移动到了正确位置
|
|
|
if (targetData[index].ans === itemData.color) {
|
|
|
itemData.ans = targetData[index].color
|
|
|
+
|
|
|
calcQuantityStore.correctQuantity++
|
|
|
+
|
|
|
AudioController.playCorrect()
|
|
|
+ itemData.disabled = true
|
|
|
+
|
|
|
} else { // 移动到了錯誤位置
|
|
|
|
|
|
AudioController.playWrong()
|
|
@@ -316,8 +320,6 @@ const checkAns = (index: number, itemData: Buttons) => {
|
|
|
|
|
|
rockNode?.classList.add('rock-button-ani')
|
|
|
|
|
|
- state.disabled = true
|
|
|
-
|
|
|
useSchedulerOnce(() => {
|
|
|
disPatchButtonGoInitPos(itemData.id)
|
|
|
|