Commit 9cc2138a by 前端

fixed

1 parent 46f0e2d6
......@@ -150,11 +150,11 @@ export default {
methods: {
async taskRewards() {
const { allow, rewardId } = this.$parent.$parent;
const { id, merchantId, merchantName } = this.$route.query;
const { phone, accountId, nickName, openid } = util.getUserInfo();
const { id, merchantId, merchantName, phone, accountId, nickName } =
this.$route.query;
const params = {
taskId: id,
phone: openid,
phone,
merchantId,
merchantName,
nickName,
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-01-31 15:41:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-17 10:33:24
* @LastEditTime: 2023-02-19 21:08:35
* @FilePath: \h5Demo\src\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -178,12 +178,12 @@ export default new Vuex.Store({
let params = util.getPageQuery(); //从链接获取
if (Object.keys(params).length && params.id)
util.setLocalStorage("wx_scrm_link_params", params);
dispatch("registerHttp");
const storage_sessionId = util.getSessionId();
if (storage_sessionId) {
dispatch("registerHttp", storage_sessionId);
return;
} else dispatch("login");
dispatch("registerHttp", params.sessionId);
// const storage_sessionId = util.getSessionId();
// if (storage_sessionId) {
// dispatch("registerHttp", storage_sessionId);
// return;
// } else dispatch("login");
},
registerHttp({ dispatch }, sessionId = "") {
window.$HTTP = new Http({
......@@ -194,17 +194,22 @@ export default new Vuex.Store({
},
taskInsert({ dispatch }, event) {
//click 1浏览 play 1参与
const { logo, nickName, openid, phone } = util.getUserInfo();
const { id, merchantId, merchantName } = util.getLocalStorage(
"wx_scrm_link_params"
);
const {
id,
merchantId,
merchantName,
headImgUrl,
nickName,
openid,
phone,
} = util.getLocalStorage("wx_scrm_link_params");
const params = {
taskId: id,
merchantId,
openId: phone,
phone: openid,
openId: openid,
phone: phone,
nickName,
headImgUrl: logo,
headImgUrl,
merchantName,
...event,
};
......
......@@ -200,15 +200,22 @@ export default {
//行为上报
taskInsert(click, play) {
//click 1浏览 play 1参与
const { logo, nickName, openid, phone } = this.getUserInfo();
const { id, merchantId, merchantName } = this.$route.query;
const {
headImgUrl,
nickName,
openid,
phone,
id,
merchantId,
merchantName,
} = this.getUserInfo();
const params = {
taskId: id,
merchantId,
openId: phone,
phone: openid,
openId: openid,
phone: phone,
nickName,
headImgUrl: logo,
headImgUrl,
merchantName,
click,
play,
......@@ -218,7 +225,7 @@ export default {
});
},
getUserInfo() {
const userInfo = util.getUserInfo() || {};
const userInfo = util.getLocalStorage("wx_scrm_link_params") || {};
return userInfo;
},
//任务详情
......@@ -241,21 +248,60 @@ export default {
});
});
},
getHiddle() {
// 设置隐藏属性和改变可见属性的事件的名称
var hidden, visibilityChange;
if (typeof document.hidden !== "undefined") {
// Opera 12.10 and Firefox 18 and later support
hidden = "hidden";
visibilityChange = "visibilitychange";
} else if (typeof document.msHidden !== "undefined") {
hidden = "msHidden";
visibilityChange = "msvisibilitychange";
} else if (typeof document.webkitHidden !== "undefined") {
hidden = "webkitHidden";
visibilityChange = "webkitvisibilitychange";
}
const _this = this;
function handleVisibilityChange() {
if (document[hidden]) {
_this.handleEnd();
} else {
_this.hanldStart();
}
}
// 如果浏览器不支持addEventListener 或 Page Visibility API 给出警告
if (
typeof document.addEventListener === "undefined" ||
typeof document[hidden] === "undefined"
) {
console.log(
"This demo requires a browser, such as Google Chrome or Firefox, that supports the Page Visibility API."
);
} else {
// 处理页面可见属性的改变
document.addEventListener(
visibilityChange,
handleVisibilityChange,
false
);
}
},
},
async mounted() {
// this.getHiddle();
window.addEventListener("beforeunload", (e) => this.handleEnd()); //监听页面刷新触发事件
const { phone, openid } = this.getUserInfo();
const { id, merchantId } = this.$route.query;
const taskCheck = await GAME.taskCheck({ id, merchantId, phone: openid });
const { phone, openid, id, merchantId } = this.getUserInfo();
const taskCheck = await GAME.taskCheck({ id, merchantId, phone });
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({ phone });
this.accountSecToken = gameToken.data.accountSecToken;
this.joinGame();
setTimeout(() => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!