Commit b4c6655a by 前端

fixed

1 parent e4ae7a34
......@@ -82,7 +82,6 @@
</div>
</div>
</template>
<script>
import GAME from "@/api/gameApi";
import util from "@/util/util";
......@@ -150,11 +149,11 @@ export default {
methods: {
async taskRewards() {
const { allow, rewardId } = this.$parent.$parent;
const { id, merchantId, merchantName, phone, accountId, nickName } =
this.$route.query;
const { id, merchantId, merchantName } = this.$route.query;
const { phone, accountId, nickName, openid } = util.getUserInfo();
const params = {
taskId: id,
phone,
phone: openid,
merchantId,
merchantName,
nickName,
......@@ -207,7 +206,6 @@ export default {
},
};
</script>
<style lang="less" scoped>
@keyframes drop_in {
0% {
......
......@@ -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-19 21:08:35
* @LastEditTime: 2023-02-20 10:28:30
* @FilePath: \h5Demo\src\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -153,7 +153,6 @@ export default new Vuex.Store({
userInfo = {};
userInfo = data;
sessionId = data.sessionId;
util.setUserInfo(userInfo);
util.setSessionId(sessionId);
dispatch("registerHttp", sessionId);
......@@ -178,12 +177,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", params.sessionId);
// const storage_sessionId = util.getSessionId();
// if (storage_sessionId) {
// dispatch("registerHttp", storage_sessionId);
// return;
// } else dispatch("login");
dispatch("registerHttp");
const storage_sessionId = util.getSessionId();
if (storage_sessionId) {
dispatch("registerHttp", storage_sessionId);
return;
} else dispatch("login");
},
registerHttp({ dispatch }, sessionId = "") {
window.$HTTP = new Http({
......@@ -194,22 +193,17 @@ export default new Vuex.Store({
},
taskInsert({ dispatch }, event) {
//click 1浏览 play 1参与
const {
id,
merchantId,
merchantName,
headImgUrl,
nickName,
openid,
phone,
} = util.getLocalStorage("wx_scrm_link_params");
const { logo, nickName, openid, phone } = util.getUserInfo();
const { id, merchantId, merchantName } = util.getLocalStorage(
"wx_scrm_link_params"
);
const params = {
taskId: id,
merchantId,
openId: openid,
phone: phone,
openId: phone,
phone: openid,
nickName,
headImgUrl,
headImgUrl: logo,
merchantName,
...event,
};
......
......@@ -11,7 +11,6 @@
></components>
</div>
</template>
<script>
import "../../components/KnowledgeSports";
import GAME from "@/api/gameApi";
......@@ -200,22 +199,15 @@ export default {
//行为上报
taskInsert(click, play) {
//click 1浏览 play 1参与
const {
headImgUrl,
nickName,
openid,
phone,
id,
merchantId,
merchantName,
} = this.getUserInfo();
const { logo, nickName, openid, phone } = this.getUserInfo();
const { id, merchantId, merchantName } = this.$route.query;
const params = {
taskId: id,
merchantId,
openId: openid,
phone: phone,
openId: phone,
phone: openid,
nickName,
headImgUrl,
headImgUrl: logo,
merchantName,
click,
play,
......@@ -225,7 +217,7 @@ export default {
});
},
getUserInfo() {
const userInfo = util.getLocalStorage("wx_scrm_link_params") || {};
const userInfo = util.getUserInfo() || {};
return userInfo;
},
//任务详情
......@@ -266,6 +258,7 @@ export default {
function handleVisibilityChange() {
if (document[hidden]) {
_this.handleEnd();
// util.clearSessionId();
} else {
_this.hanldStart();
}
......@@ -289,10 +282,10 @@ export default {
},
},
async mounted() {
// this.getHiddle();
window.addEventListener("beforeunload", (e) => this.handleEnd()); //监听页面刷新触发事件
const { phone, openid, id, merchantId } = this.getUserInfo();
const taskCheck = await GAME.taskCheck({ id, merchantId, phone });
this.getHiddle();
const { phone, openid } = this.getUserInfo();
const { id, merchantId } = this.$route.query;
const taskCheck = await GAME.taskCheck({ id, merchantId, phone: openid });
await this.getTaskDetail();
this.allow = taskCheck.data.allow;
if (!this.allow) {
......@@ -301,7 +294,7 @@ export default {
});
return;
}
const gameToken = await GAME.gameToken({ phone });
const gameToken = await GAME.gameToken({ phone: openid });
this.accountSecToken = gameToken.data.accountSecToken;
this.joinGame();
setTimeout(() => {
......@@ -322,6 +315,7 @@ export default {
});
},
beforeDestroy() {
util.clearSessionId();
window.removeEventListener("beforeunload", (e) => this.handleEnd());
this.handleEnd();
clearInterval(this.timer);
......@@ -329,7 +323,6 @@ export default {
},
};
</script>
<style lang="less" scoped>
.Page {
height: 100vh;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!