Commit 8ff52221 by 前端

fixed

1 parent 8bf1e74c
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
" "
@click="optionsHandle(item, index)" @click="optionsHandle(item, index)"
> >
<div class="options-box">{{ item }}</div> <div class="options-box">{{ spiltString(item) }}</div>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
}, },
watch: { watch: {
"answerData.body.timeLimit"(val) { "answerData.body.timeLimit"(val) {
// if (val == 0) this.handleCountdown(); if (val == 0) this.answerData.body.answerType == 1 && this.valideAnswer();
}, },
}, },
inject: ["countdown"], inject: ["countdown"],
...@@ -141,6 +141,21 @@ export default { ...@@ -141,6 +141,21 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
spiltString(val) {
return val.replace(/^[ABCD]、{0,1}/, "");
},
valideAnswer() {
if (
this.selectResult &&
this.selectResult.join("") === this.answerData.body.answer
) {
let correctNum = this.$store.state.correctNum;
correctNum++;
this.$store.commit("setCorrectNum", correctNum);
}
// console.log(this.$parent);
this.$parent.$parent.backGame();
},
cursorEven(index) { cursorEven(index) {
this.$emit("cursorEven", index); this.$emit("cursorEven", index);
}, },
...@@ -154,15 +169,23 @@ export default { ...@@ -154,15 +169,23 @@ export default {
}, 1000); }, 1000);
}, },
handleNext() { handleNext() {
if (this.isSuccess || this.isError) return; if (
this.handleCountdown(); !(this.isSuccess || this.isError) &&
this.$emit("answerGame"); this.answerData.body.timeLimit >= 1
) {
this.$emit("answerGame");
}
if (this.answerData.body.timeLimit >= 2) this.handleCountdown();
}, },
optionsHandle(item, index) { optionsHandle(item, index) {
this.selectItem = item; this.selectItem = item;
this.selectNum = index; this.selectNum = index;
this.$emit("optionsHandle", item, index, this.countdown); this.$emit("optionsHandle", item, index, this.countdown);
if (this.answerData.body.answerType != 0) return; if (
this.answerData.body.answerType != 0 ||
this.answerData.body.timeLimit < 2
)
return;
this.isMade = true; this.isMade = true;
this.timeLimit = this.countdown; this.timeLimit = this.countdown;
this.downTimer = setInterval(() => { this.downTimer = setInterval(() => {
...@@ -316,15 +339,15 @@ export default { ...@@ -316,15 +339,15 @@ export default {
width: 192px; width: 192px;
height: 80px; height: 80px;
background-size: 100% 100%; background-size: 100% 100%;
margin: 10vh auto 0px; margin: 6vh auto 0px;
font-size: 20px; font-size: 20px;
color: #2155a3; color: #2155a3;
text-align: center; text-align: center;
&.next-btn-a { &.next-btn-a {
margin: 8vh auto 0px; margin: 6vh auto 0px;
} }
.next-end { .next-end {
padding-top: 6px; padding-top: 10px;
&.next-text { &.next-text {
padding-top: 16px; padding-top: 16px;
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
<div <div
class="question-time" class="question-time"
:class="{ 'question-time-red': answerData.body.timeLimit < 5 }" :class="{ 'question-time-red': answerData.body.timeLimit < 6 }"
> >
{{ answerData.body.timeLimit }}s {{ answerData.body.timeLimit }}s
</div> </div>
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
/> />
</div> </div>
</div> </div>
<!-- <van-loading /> -->
</div> </div>
</template> </template>
<script> <script>
...@@ -150,10 +151,10 @@ export default { ...@@ -150,10 +151,10 @@ export default {
async taskRewards() { async taskRewards() {
const { allow, rewardId } = this.$parent.$parent; const { allow, rewardId } = this.$parent.$parent;
const { id, merchantId, merchantName } = this.$route.query; const { id, merchantId, merchantName } = this.$route.query;
const { phone, accountId, nickName, openid } = util.getUserInfo(); const { accountId, nickName, openid } = util.getUserInfo();
const params = { const params = {
taskId: id, taskId: id,
phone: openid, openId: openid,
merchantId, merchantId,
merchantName, merchantName,
nickName, nickName,
...@@ -175,14 +176,17 @@ export default { ...@@ -175,14 +176,17 @@ export default {
}); });
}, },
jumpDetail() { jumpDetail() {
const { brandName, goodId, productName, appearance } = this.couponDetail; const { brandName, goodId, goodsName, appearance, goodsLogo } =
const params = Object.assign( this.couponDetail;
{ const params = Object.assign({
brandName, brandName,
id: goodId, id: goodId,
}, supplier: "HW",
productName });
); if (appearance == 2) {
params.productName = goodsName;
params.icon = goodsLogo;
}
const params_code = encodeURIComponent(JSON.stringify(params)); const params_code = encodeURIComponent(JSON.stringify(params));
const path = const path =
appearance == 1 ? "detail/detail" : "chargeDetail/chargeDetail"; appearance == 1 ? "detail/detail" : "chargeDetail/chargeDetail";
...@@ -227,8 +231,15 @@ export default { ...@@ -227,8 +231,15 @@ export default {
.popup-prize { .popup-prize {
width: 375px; width: 375px;
height: 372px; height: 372px;
margin: 130px auto 10px; margin: 130px 0px 10px;
position: relative; position: relative;
img {
width: 375px;
height: 372px;
position: absolute;
top: 0px;
left: 0px;
}
.prize-content { .prize-content {
position: absolute; position: absolute;
left: 68px; left: 68px;
......
/* /*
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-01-31 15:41:18 * @Date: 2023-01-31 15:41:18
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: yangming qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-16 14:54:42 * @LastEditTime: 2023-02-21 16:04:57
* @FilePath: \h5Demo\src\mixins\analysis.js * @FilePath: \h5Demo\src\mixins\analysis.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -60,10 +60,16 @@ export default { ...@@ -60,10 +60,16 @@ export default {
}, },
// 游戏结束,并初始化数据 // 游戏结束,并初始化数据
end: () => { end: () => {
clearInterval(this.timer);
this.isEnd = true; this.isEnd = true;
// this.$store.commit("setGameType", ""); // this.$store.commit("setGameType", "");
}, },
}); });
}, },
}, },
methods: {
clearTimeLimit() {
clearInterval(this.timer);
},
},
}; };
...@@ -45,17 +45,15 @@ export default { ...@@ -45,17 +45,15 @@ export default {
}, },
// 游戏答案消息 // 游戏答案消息
getAnswer: (res) => { getAnswer: (res) => {
console.log(res); // if (!this.isSuccess) {
if (!this.isSuccess) { // this.isSuccess = true;
this.isSuccess = true; // this.selectResult = res.body.answer.split("");
this.selectResult = res.body.answer.split(""); // }
}
}, },
// // 答题消息 // // 答题消息
answerInfo: (res, isMe) => { answerInfo: (res, isMe) => {
console.log(res.isRight, isMe);
// 非本人消息时不处理 // 非本人消息时不处理
// if (!isMe) return; clearInterval(this.timer);
if (res.isRight == 1) { if (res.isRight == 1) {
//正确 //正确
this.isSuccess = true; this.isSuccess = true;
...@@ -65,7 +63,6 @@ export default { ...@@ -65,7 +63,6 @@ export default {
this.$store.commit("setCorrectNum", correctNum); this.$store.commit("setCorrectNum", correctNum);
if (this.finishNum == correctNum) { if (this.finishNum == correctNum) {
this.isFinish = true; this.isFinish = true;
clearInterval(this.timer);
GPJSSDK.Game.endGame(); GPJSSDK.Game.endGame();
} }
} else if (res.isRight == 2) { } else if (res.isRight == 2) {
...@@ -144,6 +141,13 @@ export default { ...@@ -144,6 +141,13 @@ export default {
// 发送答案 // 发送答案
let str = this.selectResult.join(""); let str = this.selectResult.join("");
GPJSSDK.Game.answerGame(str, this.answerData.body.currentSize); GPJSSDK.Game.answerGame(str, this.answerData.body.currentSize);
this.backGame();
},
backGame() {
if (!this.isSuccess) {
this.isSuccess = true;
this.selectResult = this.answerData.body.answer.split("");
}
}, },
}, },
}; };
...@@ -193,15 +193,14 @@ export default new Vuex.Store({ ...@@ -193,15 +193,14 @@ export default new Vuex.Store({
}, },
taskInsert({ dispatch }, event) { taskInsert({ dispatch }, event) {
//click 1浏览 play 1参与 //click 1浏览 play 1参与
const { logo, nickName, openid, phone } = util.getUserInfo(); const { logo, nickName, openid } = util.getUserInfo();
const { id, merchantId, merchantName } = util.getLocalStorage( const { id, merchantId, merchantName } = util.getLocalStorage(
"wx_scrm_link_params" "wx_scrm_link_params"
); );
const params = { const params = {
taskId: id, taskId: id,
merchantId, merchantId,
openId: phone, openId: openid,
phone: openid,
nickName, nickName,
headImgUrl: logo, headImgUrl: logo,
merchantName, merchantName,
......
...@@ -200,13 +200,12 @@ export default { ...@@ -200,13 +200,12 @@ export default {
//行为上报 //行为上报
taskInsert(click, play) { taskInsert(click, play) {
//click 1浏览 play 1参与 //click 1浏览 play 1参与
const { logo, nickName, openid, phone } = this.getUserInfo(); const { logo, nickName, openid } = this.getUserInfo();
const { id, merchantId, merchantName } = this.$route.query; const { id, merchantId, merchantName } = this.$route.query;
const params = { const params = {
taskId: id, taskId: id,
merchantId, merchantId,
openId: phone, openId: openid,
phone: openid,
nickName, nickName,
headImgUrl: logo, headImgUrl: logo,
merchantName, merchantName,
...@@ -288,18 +287,18 @@ export default { ...@@ -288,18 +287,18 @@ export default {
}, },
async mounted() { async mounted() {
this.getHiddle(); this.getHiddle();
const { phone, openid } = this.getUserInfo(); const { openid } = this.getUserInfo();
const { id, merchantId } = this.$route.query; const { id, merchantId } = this.$route.query;
const taskCheck = await GAME.taskCheck({ id, merchantId, phone: openid }); const taskCheck = await GAME.taskCheck({ id, merchantId, openId: openid });
await this.getTaskDetail(); await this.getTaskDetail();
this.allow = taskCheck.data.allow; this.allow = !taskCheck.data.allow;
if (!this.allow) { if (!this.allow) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.gameRef.isFinish = true; this.$refs.gameRef.isFinish = true;
}); });
return; return;
} }
const gameToken = await GAME.gameToken({ phone: openid }); const gameToken = await GAME.gameToken({ openId: openid });
this.accountSecToken = gameToken.data.accountSecToken; this.accountSecToken = gameToken.data.accountSecToken;
this.joinGame(); this.joinGame();
setTimeout(() => { setTimeout(() => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!