Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-game
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8ff52221
authored
Feb 22, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
8bf1e74c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
41 deletions
src/components/AnswerType/index.vue
src/components/Popups/index.vue
src/mixins/analysis.js
src/mixins/fill.js
src/store/index.js
src/views/KnowledgeSports/page.vue
src/components/AnswerType/index.vue
View file @
8ff5222
...
...
@@ -18,7 +18,7 @@
"
@
click=
"optionsHandle(item, index)"
>
<div
class=
"options-box"
>
{{
item
}}
</div>
<div
class=
"options-box"
>
{{
spiltString
(
item
)
}}
</div>
</li>
</ul>
</div>
...
...
@@ -125,7 +125,7 @@ export default {
},
watch
:
{
"answerData.body.timeLimit"
(
val
)
{
// if (val == 0) this.handleCountdown
();
if
(
val
==
0
)
this
.
answerData
.
body
.
answerType
==
1
&&
this
.
valideAnswer
();
},
},
inject
:
[
"countdown"
],
...
...
@@ -141,6 +141,21 @@ export default {
},
created
()
{},
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
)
{
this
.
$emit
(
"cursorEven"
,
index
);
},
...
...
@@ -154,15 +169,23 @@ export default {
},
1000
);
},
handleNext
()
{
if
(
this
.
isSuccess
||
this
.
isError
)
return
;
this
.
handleCountdown
();
this
.
$emit
(
"answerGame"
);
if
(
!
(
this
.
isSuccess
||
this
.
isError
)
&&
this
.
answerData
.
body
.
timeLimit
>=
1
)
{
this
.
$emit
(
"answerGame"
);
}
if
(
this
.
answerData
.
body
.
timeLimit
>=
2
)
this
.
handleCountdown
();
},
optionsHandle
(
item
,
index
)
{
this
.
selectItem
=
item
;
this
.
selectNum
=
index
;
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
.
timeLimit
=
this
.
countdown
;
this
.
downTimer
=
setInterval
(()
=>
{
...
...
@@ -316,15 +339,15 @@ export default {
width
:
192px
;
height
:
80px
;
background-size
:
100%
100%
;
margin
:
10
vh
auto
0px
;
margin
:
6
vh
auto
0px
;
font-size
:
20px
;
color
:
#2155a3
;
text-align
:
center
;
&.next-btn-a
{
margin
:
8
vh
auto
0px
;
margin
:
6
vh
auto
0px
;
}
.next-end
{
padding-top
:
6
px
;
padding-top
:
10
px
;
&.next-text
{
padding-top
:
16px
;
}
...
...
src/components/Popups/index.vue
View file @
8ff5222
...
...
@@ -20,7 +20,7 @@
</div>
<div
class=
"question-time"
:class=
"
{ 'question-time-red': answerData.body.timeLimit
<
5
}"
:class=
"
{ 'question-time-red': answerData.body.timeLimit
<
6
}"
>
{{
answerData
.
body
.
timeLimit
}}
s
</div>
...
...
@@ -80,6 +80,7 @@
/>
</div>
</div>
<!-- <van-loading /> -->
</div>
</template>
<
script
>
...
...
@@ -150,10 +151,10 @@ export default {
async
taskRewards
()
{
const
{
allow
,
rewardId
}
=
this
.
$parent
.
$parent
;
const
{
id
,
merchantId
,
merchantName
}
=
this
.
$route
.
query
;
const
{
phone
,
accountId
,
nickName
,
openid
}
=
util
.
getUserInfo
();
const
{
accountId
,
nickName
,
openid
}
=
util
.
getUserInfo
();
const
params
=
{
taskId
:
id
,
phone
:
openid
,
openId
:
openid
,
merchantId
,
merchantName
,
nickName
,
...
...
@@ -175,14 +176,17 @@ export default {
});
},
jumpDetail
()
{
const
{
brandName
,
goodId
,
productName
,
appearance
}
=
this
.
couponDetail
;
const
params
=
Object
.
assign
(
{
brandName
,
id
:
goodId
,
},
productName
);
const
{
brandName
,
goodId
,
goodsName
,
appearance
,
goodsLogo
}
=
this
.
couponDetail
;
const
params
=
Object
.
assign
({
brandName
,
id
:
goodId
,
supplier
:
"HW"
,
});
if
(
appearance
==
2
)
{
params
.
productName
=
goodsName
;
params
.
icon
=
goodsLogo
;
}
const
params_code
=
encodeURIComponent
(
JSON
.
stringify
(
params
));
const
path
=
appearance
==
1
?
"detail/detail"
:
"chargeDetail/chargeDetail"
;
...
...
@@ -227,8 +231,15 @@ export default {
.popup-prize
{
width
:
375px
;
height
:
372px
;
margin
:
130px
auto
10px
;
margin
:
130px
0px
10px
;
position
:
relative
;
img
{
width
:
375px
;
height
:
372px
;
position
:
absolute
;
top
:
0px
;
left
:
0px
;
}
.prize-content
{
position
:
absolute
;
left
:
68px
;
...
...
src/mixins/analysis.js
View file @
8ff5222
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-01-31 15:41:18
* @LastEditors:
前端
qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-
16 14:54:42
* @LastEditors:
yangming
qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-
21 16:04:57
* @FilePath: \h5Demo\src\mixins\analysis.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -60,10 +60,16 @@ export default {
},
// 游戏结束,并初始化数据
end
:
()
=>
{
clearInterval
(
this
.
timer
);
this
.
isEnd
=
true
;
// this.$store.commit("setGameType", "");
},
});
},
},
methods
:
{
clearTimeLimit
()
{
clearInterval
(
this
.
timer
);
},
},
};
src/mixins/fill.js
View file @
8ff5222
...
...
@@ -45,17 +45,15 @@ export default {
},
// 游戏答案消息
getAnswer
:
(
res
)
=>
{
console
.
log
(
res
);
if
(
!
this
.
isSuccess
)
{
this
.
isSuccess
=
true
;
this
.
selectResult
=
res
.
body
.
answer
.
split
(
""
);
}
// if (!this.isSuccess) {
// this.isSuccess = true;
// this.selectResult = res.body.answer.split("");
// }
},
// // 答题消息
answerInfo
:
(
res
,
isMe
)
=>
{
console
.
log
(
res
.
isRight
,
isMe
);
// 非本人消息时不处理
// if (!isMe) return
;
clearInterval
(
this
.
timer
)
;
if
(
res
.
isRight
==
1
)
{
//正确
this
.
isSuccess
=
true
;
...
...
@@ -65,7 +63,6 @@ export default {
this
.
$store
.
commit
(
"setCorrectNum"
,
correctNum
);
if
(
this
.
finishNum
==
correctNum
)
{
this
.
isFinish
=
true
;
clearInterval
(
this
.
timer
);
GPJSSDK
.
Game
.
endGame
();
}
}
else
if
(
res
.
isRight
==
2
)
{
...
...
@@ -144,6 +141,13 @@ export default {
// 发送答案
let
str
=
this
.
selectResult
.
join
(
""
);
GPJSSDK
.
Game
.
answerGame
(
str
,
this
.
answerData
.
body
.
currentSize
);
this
.
backGame
();
},
backGame
()
{
if
(
!
this
.
isSuccess
)
{
this
.
isSuccess
=
true
;
this
.
selectResult
=
this
.
answerData
.
body
.
answer
.
split
(
""
);
}
},
},
};
src/store/index.js
View file @
8ff5222
...
...
@@ -193,15 +193,14 @@ export default new Vuex.Store({
},
taskInsert
({
dispatch
},
event
)
{
//click 1浏览 play 1参与
const
{
logo
,
nickName
,
openid
,
phone
}
=
util
.
getUserInfo
();
const
{
logo
,
nickName
,
openid
}
=
util
.
getUserInfo
();
const
{
id
,
merchantId
,
merchantName
}
=
util
.
getLocalStorage
(
"wx_scrm_link_params"
);
const
params
=
{
taskId
:
id
,
merchantId
,
openId
:
phone
,
phone
:
openid
,
openId
:
openid
,
nickName
,
headImgUrl
:
logo
,
merchantName
,
...
...
src/views/KnowledgeSports/page.vue
View file @
8ff5222
...
...
@@ -200,13 +200,12 @@ export default {
//行为上报
taskInsert
(
click
,
play
)
{
//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
params
=
{
taskId
:
id
,
merchantId
,
openId
:
phone
,
phone
:
openid
,
openId
:
openid
,
nickName
,
headImgUrl
:
logo
,
merchantName
,
...
...
@@ -288,18 +287,18 @@ export default {
},
async
mounted
()
{
this
.
getHiddle
();
const
{
phone
,
openid
}
=
this
.
getUserInfo
();
const
{
openid
}
=
this
.
getUserInfo
();
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
();
this
.
allow
=
taskCheck
.
data
.
allow
;
this
.
allow
=
!
taskCheck
.
data
.
allow
;
if
(
!
this
.
allow
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
gameRef
.
isFinish
=
true
;
});
return
;
}
const
gameToken
=
await
GAME
.
gameToken
({
phone
:
openid
});
const
gameToken
=
await
GAME
.
gameToken
({
openId
:
openid
});
this
.
accountSecToken
=
gameToken
.
data
.
accountSecToken
;
this
.
joinGame
();
setTimeout
(()
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment