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 b4c6655a
authored
Feb 20, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
e4ae7a34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
45 deletions
src/components/Popups/index.vue
src/store/index.js
src/views/KnowledgeSports/page.vue
src/components/Popups/index.vue
View file @
b4c6655
...
@@ -82,7 +82,6 @@
...
@@ -82,7 +82,6 @@
</div>
</div>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
GAME
from
"@/api/gameApi"
;
import
GAME
from
"@/api/gameApi"
;
import
util
from
"@/util/util"
;
import
util
from
"@/util/util"
;
...
@@ -150,11 +149,11 @@ export default {
...
@@ -150,11 +149,11 @@ export default {
methods
:
{
methods
:
{
async
taskRewards
()
{
async
taskRewards
()
{
const
{
allow
,
rewardId
}
=
this
.
$parent
.
$parent
;
const
{
allow
,
rewardId
}
=
this
.
$parent
.
$parent
;
const
{
id
,
merchantId
,
merchantName
,
phone
,
accountId
,
nickName
}
=
const
{
id
,
merchantId
,
merchantName
}
=
this
.
$route
.
query
;
this
.
$route
.
query
;
const
{
phone
,
accountId
,
nickName
,
openid
}
=
util
.
getUserInfo
()
;
const
params
=
{
const
params
=
{
taskId
:
id
,
taskId
:
id
,
phone
,
phone
:
openid
,
merchantId
,
merchantId
,
merchantName
,
merchantName
,
nickName
,
nickName
,
...
@@ -207,7 +206,6 @@ export default {
...
@@ -207,7 +206,6 @@ export default {
},
},
};
};
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
@keyframes
drop_in
{
@keyframes
drop_in
{
0
%
{
0
%
{
...
...
src/store/index.js
View file @
b4c6655
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @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: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-
19 21:08:35
* @LastEditTime: 2023-02-
20 10:28:30
* @FilePath: \h5Demo\src\store\index.js
* @FilePath: \h5Demo\src\store\index.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
*/
*/
...
@@ -153,7 +153,6 @@ export default new Vuex.Store({
...
@@ -153,7 +153,6 @@ export default new Vuex.Store({
userInfo
=
{};
userInfo
=
{};
userInfo
=
data
;
userInfo
=
data
;
sessionId
=
data
.
sessionId
;
sessionId
=
data
.
sessionId
;
util
.
setUserInfo
(
userInfo
);
util
.
setUserInfo
(
userInfo
);
util
.
setSessionId
(
sessionId
);
util
.
setSessionId
(
sessionId
);
dispatch
(
"registerHttp"
,
sessionId
);
dispatch
(
"registerHttp"
,
sessionId
);
...
@@ -178,12 +177,12 @@ export default new Vuex.Store({
...
@@ -178,12 +177,12 @@ export default new Vuex.Store({
let
params
=
util
.
getPageQuery
();
//从链接获取
let
params
=
util
.
getPageQuery
();
//从链接获取
if
(
Object
.
keys
(
params
).
length
&&
params
.
id
)
if
(
Object
.
keys
(
params
).
length
&&
params
.
id
)
util
.
setLocalStorage
(
"wx_scrm_link_params"
,
params
);
util
.
setLocalStorage
(
"wx_scrm_link_params"
,
params
);
dispatch
(
"registerHttp"
,
params
.
sessionId
);
dispatch
(
"registerHttp"
);
//
const storage_sessionId = util.getSessionId();
const
storage_sessionId
=
util
.
getSessionId
();
//
if (storage_sessionId) {
if
(
storage_sessionId
)
{
//
dispatch("registerHttp", storage_sessionId);
dispatch
(
"registerHttp"
,
storage_sessionId
);
//
return;
return
;
//
} else dispatch("login");
}
else
dispatch
(
"login"
);
},
},
registerHttp
({
dispatch
},
sessionId
=
""
)
{
registerHttp
({
dispatch
},
sessionId
=
""
)
{
window
.
$HTTP
=
new
Http
({
window
.
$HTTP
=
new
Http
({
...
@@ -194,22 +193,17 @@ export default new Vuex.Store({
...
@@ -194,22 +193,17 @@ export default new Vuex.Store({
},
},
taskInsert
({
dispatch
},
event
)
{
taskInsert
({
dispatch
},
event
)
{
//click 1浏览 play 1参与
//click 1浏览 play 1参与
const
{
const
{
logo
,
nickName
,
openid
,
phone
}
=
util
.
getUserInfo
();
id
,
const
{
id
,
merchantId
,
merchantName
}
=
util
.
getLocalStorage
(
merchantId
,
"wx_scrm_link_params"
merchantName
,
);
headImgUrl
,
nickName
,
openid
,
phone
,
}
=
util
.
getLocalStorage
(
"wx_scrm_link_params"
);
const
params
=
{
const
params
=
{
taskId
:
id
,
taskId
:
id
,
merchantId
,
merchantId
,
openId
:
openid
,
openId
:
phone
,
phone
:
phone
,
phone
:
openid
,
nickName
,
nickName
,
headImgUrl
,
headImgUrl
:
logo
,
merchantName
,
merchantName
,
...
event
,
...
event
,
};
};
...
...
src/views/KnowledgeSports/page.vue
View file @
b4c6655
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
></components>
></components>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
"../../components/KnowledgeSports"
;
import
"../../components/KnowledgeSports"
;
import
GAME
from
"@/api/gameApi"
;
import
GAME
from
"@/api/gameApi"
;
...
@@ -200,22 +199,15 @@ export default {
...
@@ -200,22 +199,15 @@ export default {
//行为上报
//行为上报
taskInsert
(
click
,
play
)
{
taskInsert
(
click
,
play
)
{
//click 1浏览 play 1参与
//click 1浏览 play 1参与
const
{
const
{
logo
,
nickName
,
openid
,
phone
}
=
this
.
getUserInfo
();
headImgUrl
,
const
{
id
,
merchantId
,
merchantName
}
=
this
.
$route
.
query
;
nickName
,
openid
,
phone
,
id
,
merchantId
,
merchantName
,
}
=
this
.
getUserInfo
();
const
params
=
{
const
params
=
{
taskId
:
id
,
taskId
:
id
,
merchantId
,
merchantId
,
openId
:
openid
,
openId
:
phone
,
phone
:
phone
,
phone
:
openid
,
nickName
,
nickName
,
headImgUrl
,
headImgUrl
:
logo
,
merchantName
,
merchantName
,
click
,
click
,
play
,
play
,
...
@@ -225,7 +217,7 @@ export default {
...
@@ -225,7 +217,7 @@ export default {
});
});
},
},
getUserInfo
()
{
getUserInfo
()
{
const
userInfo
=
util
.
get
LocalStorage
(
"wx_scrm_link_params"
)
||
{};
const
userInfo
=
util
.
get
UserInfo
(
)
||
{};
return
userInfo
;
return
userInfo
;
},
},
//任务详情
//任务详情
...
@@ -266,6 +258,7 @@ export default {
...
@@ -266,6 +258,7 @@ export default {
function
handleVisibilityChange
()
{
function
handleVisibilityChange
()
{
if
(
document
[
hidden
])
{
if
(
document
[
hidden
])
{
_this
.
handleEnd
();
_this
.
handleEnd
();
// util.clearSessionId();
}
else
{
}
else
{
_this
.
hanldStart
();
_this
.
hanldStart
();
}
}
...
@@ -289,10 +282,10 @@ export default {
...
@@ -289,10 +282,10 @@ export default {
},
},
},
},
async
mounted
()
{
async
mounted
()
{
//
this.getHiddle();
this
.
getHiddle
();
window
.
addEventListener
(
"beforeunload"
,
(
e
)
=>
this
.
handleEnd
());
//监听页面刷新触发事件
const
{
phone
,
openid
}
=
this
.
getUserInfo
();
const
{
phone
,
openid
,
id
,
merchantId
}
=
this
.
getUserInfo
()
;
const
{
id
,
merchantId
}
=
this
.
$route
.
query
;
const
taskCheck
=
await
GAME
.
taskCheck
({
id
,
merchantId
,
phone
});
const
taskCheck
=
await
GAME
.
taskCheck
({
id
,
merchantId
,
phone
:
openid
});
await
this
.
getTaskDetail
();
await
this
.
getTaskDetail
();
this
.
allow
=
taskCheck
.
data
.
allow
;
this
.
allow
=
taskCheck
.
data
.
allow
;
if
(
!
this
.
allow
)
{
if
(
!
this
.
allow
)
{
...
@@ -301,7 +294,7 @@ export default {
...
@@ -301,7 +294,7 @@ export default {
});
});
return
;
return
;
}
}
const
gameToken
=
await
GAME
.
gameToken
({
phone
});
const
gameToken
=
await
GAME
.
gameToken
({
phone
:
openid
});
this
.
accountSecToken
=
gameToken
.
data
.
accountSecToken
;
this
.
accountSecToken
=
gameToken
.
data
.
accountSecToken
;
this
.
joinGame
();
this
.
joinGame
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -322,6 +315,7 @@ export default {
...
@@ -322,6 +315,7 @@ export default {
});
});
},
},
beforeDestroy
()
{
beforeDestroy
()
{
util
.
clearSessionId
();
window
.
removeEventListener
(
"beforeunload"
,
(
e
)
=>
this
.
handleEnd
());
window
.
removeEventListener
(
"beforeunload"
,
(
e
)
=>
this
.
handleEnd
());
this
.
handleEnd
();
this
.
handleEnd
();
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
...
@@ -329,7 +323,6 @@ export default {
...
@@ -329,7 +323,6 @@ export default {
},
},
};
};
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.Page
{
.Page
{
height
:
100vh
;
height
:
100vh
;
...
...
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