Commit 4083d56a authored by haiyoucuv's avatar haiyoucuv

整理一下代码

parent 7bc53877
import { showToast } from "./Module/UIFast"; import { showToast } from "./Module/UIFast";
import { sendWebNet } from "./Scripts/Utils/WebNet/WebNet"; import { sendWebNet, setCookieId } from "./Scripts/Utils/WebNet/WebNet";
import { ajax } from "./Scripts/Utils/WebNet/web/ajax"; import { ajax } from "./Scripts/Utils/WebNet/web/ajax";
...@@ -43,14 +43,14 @@ export function isLogin() { ...@@ -43,14 +43,14 @@ export function isLogin() {
} }
export function appJump(url, hideNavbar = false, data = {}) { export function appJump(url, hideNavbar = false, data = {}) {
console.info('22222')
sendWebNet("/autoLogin/tempSaveCookie", null, null, true) sendWebNet("/autoLogin/tempSaveCookie", null, null, true)
.then((res) => { .then((res) => {
console.info('3333') if (res?.data) {
res?.data && localStorage.setItem("db_zheshang_cookie", res.data); // localStorage.setItem("db_zheshang_cookie", res.data);
setCookieId(res.data);
}
}) })
.finally(() => { .finally(() => {
console.info('44444')
window["MarsJSBridge"].invoke("pushPage", { window["MarsJSBridge"].invoke("pushPage", {
uri: url, uri: url,
data, data,
...@@ -61,6 +61,18 @@ export function appJump(url, hideNavbar = false, data = {}) { ...@@ -61,6 +61,18 @@ export function appJump(url, hideNavbar = false, data = {}) {
}) })
} }
export function appJumpToMini(username, path, type = "0") {
window['MarsJSBridge'].invoke('jsToWakeWXinMiniProgram', {
username,
path,
type
}, (res) => {
console.log('jsToWakeWXinMiniProgram', res)
if (res.code === '1') {
showToast('请您先下载微信app再使用本服务');
}
})
}
export function resetBackCookie(duibaTempCookieId) { export function resetBackCookie(duibaTempCookieId) {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
......
...@@ -5,7 +5,7 @@ import ShareCenter from "./ShareCenter"; ...@@ -5,7 +5,7 @@ import ShareCenter from "./ShareCenter";
import PosterPanel from "./Panels/PosterPanel"; import PosterPanel from "./Panels/PosterPanel";
import BrowseImgPanel from "./Panels/BrowseImgPanel"; import BrowseImgPanel from "./Panels/BrowseImgPanel";
import store from "../store/store"; import store from "../store/store";
import { appJump } from "../AppTool"; import { appJump, appJumpToMini } from "../AppTool";
import { getQueryParamValue, getUrlParam } from "./Utils/Utils"; import { getQueryParamValue, getUrlParam } from "./Utils/Utils";
const levelToast = { const levelToast = {
...@@ -20,14 +20,14 @@ const beforeDoComplete = (item: any, func: Function) => { ...@@ -20,14 +20,14 @@ const beforeDoComplete = (item: any, func: Function) => {
if (hasBtnText) { if (hasBtnText) {
showToast(item?.buttonText); showToast(item?.buttonText);
} }
setTimeout(() => { setTimeout(() => {
!!func && func(); !!func && func();
}, time); }, time);
} }
export default class TaskCenter { export default class TaskCenter {
static async doCompleted(taskCode: string) { static async doCompleted(taskCode: string) {
const {success, data} = await sendWebNetWithToken(WebNetName.doCompleted, {taskCode: taskCode}); const {success, data} = await sendWebNetWithToken(WebNetName.doCompleted, {taskCode: taskCode});
if (!success) return; if (!success) return;
store.updateTask(); store.updateTask();
...@@ -53,11 +53,20 @@ export default class TaskCenter { ...@@ -53,11 +53,20 @@ export default class TaskCenter {
// bank_1406:开通生物识别登录方式--(待定-不确认) // bank_1406:开通生物识别登录方式--(待定-不确认)
// 这个任务也有跳转链接,但是任务已完成,不确认 // 这个任务也有跳转链接,但是任务已完成,不确认
// 基金 财富诊断 亲子专区返回的时候是回到手机银行首页的
/** 任务处理中心 */ /** 任务处理中心 */
static async handleClickTask(item: any = {}) { static async handleClickTask(item: any = {}) {
const {code, jumpUrl, id} = item; const {code, jumpUrl, id} = item;
const needNav = false;
// const needNav = [
// "bank_1401", "bt_2", "bt_3",
// "bt_4", "bt_5", "bt_7",
// "bt_8", "bt_9", "bt_10",
// ].indexOf(code) > -1;
/** 邀请任务 */ /** 邀请任务 */
if (code?.startsWith("it")) { if (code?.startsWith("it")) {
beforeDoComplete(item, () => { beforeDoComplete(item, () => {
...@@ -100,16 +109,20 @@ export default class TaskCenter { ...@@ -100,16 +109,20 @@ export default class TaskCenter {
); );
// location.href = jumpUrl; // location.href = jumpUrl;
//获取跳转方式 //获取跳转方式
let type = getQueryParamValue(jumpUrl,"type"); let type = getQueryParamValue(jumpUrl, "type");
console.info("跳转方式type",type ) console.info("跳转方式type", type)
if(type == "1"){ //跳转方式1
(jumpUrl && jumpUrl != '/' ) && appJump(jumpUrl); if (type == "1") { //跳转方式1
}else if(type == "2"){//跳转方式2 (jumpUrl && jumpUrl != '/') && appJump(jumpUrl, needNav);
} else if (type == "2") {//跳转方式2
appJumpToMini(
"username",
jumpUrl,
);
} else { //不拼方式不跳了,害怕跳错了
}else{ //不拼方式不跳了,害怕跳错了 }
}
}); });
} }
} }
...@@ -125,13 +138,13 @@ export default class TaskCenter { ...@@ -125,13 +138,13 @@ export default class TaskCenter {
// } // }
// const type = code.split("_")[1]; // const type = code.split("_")[1];
// if (type == "t") { // 行方交易任务 // if (type == "t") { // 行方交易任务
// appJump(jumpUrl) // appJump(jumpUrl, needNav)
// } else if (type == "s") { // 行方签约任务 // } else if (type == "s") { // 行方签约任务
// appJump(ju mpUrl) // appJump(ju mpUrl, needNav)
// } // }
// location.href = jumpUrl; // location.href = jumpUrl;
console.info('jumpUrl', jumpUrl); console.info('jumpUrl', jumpUrl);
(jumpUrl && jumpUrl != '/' ) && appJump(jumpUrl); (jumpUrl && jumpUrl != '/') && appJump(jumpUrl, needNav);
}) })
} }
/** 会员等级达标任务 */ /** 会员等级达标任务 */
...@@ -139,7 +152,7 @@ export default class TaskCenter { ...@@ -139,7 +152,7 @@ export default class TaskCenter {
// 能给链接跳转 就配置正常配置jumpUrl // 能给链接跳转 就配置正常配置jumpUrl
// 不能跳转 jumpUrl配置$$$ 需要toast提示就配置buttonText // 不能跳转 jumpUrl配置$$$ 需要toast提示就配置buttonText
beforeDoComplete(item, () => { beforeDoComplete(item, () => {
(jumpUrl && jumpUrl != '/' ) && appJump(jumpUrl); (jumpUrl && jumpUrl != '/') && appJump(jumpUrl, needNav);
}); });
} }
} }
......
...@@ -162,6 +162,12 @@ export const ERR_MESSAGE = { ...@@ -162,6 +162,12 @@ export const ERR_MESSAGE = {
// "300003": "今日复活次数已经达到上限\n明天再来吧!", // "300003": "今日复活次数已经达到上限\n明天再来吧!",
} }
let tempCookieId = "";
export function setCookieId(cookieId) {
tempCookieId = cookieId;
}
//返回数据类型 //返回数据类型
interface dataOut { interface dataOut {
...@@ -251,9 +257,13 @@ export function sendWebNet( ...@@ -251,9 +257,13 @@ export function sendWebNet(
return; return;
} }
const duibaTempCookieId = localStorage.getItem("db_zheshang_cookie"); // const duibaTempCookieId = localStorage.getItem("db_zheshang_cookie");
const duibaTempCookieId = tempCookieId;
if (duibaTempCookieId) { if (duibaTempCookieId) {
localStorage.removeItem("db_zheshang_cookie"); // localStorage.removeItem("db_zheshang_cookie");
tempCookieId = "";
const res = await sendWebNet("userLogin.check") const res = await sendWebNet("userLogin.check")
.catch(async () => { .catch(async () => {
await resetBackCookie(duibaTempCookieId); await resetBackCookie(duibaTempCookieId);
......
...@@ -16,7 +16,8 @@ import { UIMgr } from "../Module/UIMgr"; ...@@ -16,7 +16,8 @@ import { UIMgr } from "../Module/UIMgr";
import { changeScene, showToast } from "db://assets/Module/UIFast"; import { changeScene, showToast } from "db://assets/Module/UIFast";
import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene"; import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene";
import store from "../store/store"; import store from "../store/store";
import { appRequest, disableGestureReturn } from "../AppTool"; import { appRequest, disableGestureReturn, resetBackCookie } from "../AppTool";
import { sendWebNet } from "../Scripts/Utils/WebNet/WebNet";
const {ccclass, property} = _decorator; const {ccclass, property} = _decorator;
...@@ -54,6 +55,23 @@ export class Start extends Component { ...@@ -54,6 +55,23 @@ export class Start extends Component {
this.keepLive(); this.keepLive();
}, 1000 * 60 * 5); }, 1000 * 60 * 5);
setInterval(() => {
this.tempSaveCookie();
}, 10 * 1000);
}
tempCookie = null;
tempSaveCookie() {
sendWebNet("/autoLogin/tempSaveCookie", null, null, true)
.then((res) => {
if (!res?.data) {
resetBackCookie(this.tempCookie);
return;
}
this.tempCookie = res.data;
});
} }
onDestroy() { onDestroy() {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"6c48a": { "6c48a": {
"importer": "texture", "importer": "texture",
"uuid": "2ff03921-0804-417d-849d-93bf9a90c21e@6c48a", "uuid": "2ff03921-0804-417d-849d-93bf9a90c21e@6c48a",
"displayName": "Bg", "displayName": "bg",
"id": "6c48a", "id": "6c48a",
"name": "texture", "name": "texture",
"userData": { "userData": {
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"f9941": { "f9941": {
"importer": "sprite-frame", "importer": "sprite-frame",
"uuid": "2ff03921-0804-417d-849d-93bf9a90c21e@f9941", "uuid": "2ff03921-0804-417d-849d-93bf9a90c21e@f9941",
"displayName": "Bg", "displayName": "bg",
"id": "f9941", "id": "f9941",
"name": "spriteFrame", "name": "spriteFrame",
"userData": { "userData": {
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>套圈挑战赛</title>
<script id="monitorjs" src="//yun.duiba.com.cn/woodpecker/sdk/0.0.36/woodpecker_outer.js" ></script>
<script id="registerMonitor">
// 烽火台注入前端监控脚本,请勿修改
try {
woodpecker.setConfig({
projectId: "p7bdf2f84",
developer: [
"fa17c4667c62b5ba014f382c0802a462"
],
});
} catch (e) {
console.error(e);
}
</script>
<!--http://www.html5rocks.com/en/mobile/mobifying/-->
<meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1,minimum-scale=1,maximum-scale=1,minimal-ui=true"/>
<!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="format-detection" content="telephone=no">
<!-- force webkit on 360 -->
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<!-- force edge on IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="msapplication-tap-highlight" content="no">
<!-- force full screen on some browser -->
<meta name="full-screen" content="yes"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<!--fix fireball/issues/3568 -->
<!--<meta name="browsermode" content="application">-->
<meta name="x5-page-mode" content="app">
<!--<link rel="apple-touch-icon" href=".png" />-->
<!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
<script src="//yun.duiba.com.cn/h5/lib/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/polaris/declare-process.edbd0793356569c4e3aa91ec7d0aebf5a7bd7364.js" crossorigin="anonymous"></script>
<script src="//yun.duiba.com.cn/polaris/SVGA.Lite.v2.1.1.d3a67cbc13c591c53c6f87ab34c57ce387010374.js" crossorigin="anonymous"></script>
<script src="//yun.duiba.com.cn/aurora/assets/2403d1edf2acd15b179306b6ddaa5f0967d78a8f.js"></script>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1721183925253/style.css"/>
<style>
.sui-captcha {
visibility: hidden;
position: fixed;
z-index: 10000;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.7);
/*.neCaptcha-dialog::after {
position: absolute;
content: '加载中…';
width: 100%;
height: 30px;
top: -40px;
left: 0;
text-align: center;
line-height: 30px;
font-size: 16px;
color: #ffff00;
}*/
}
.neCaptcha-dialog {
visibility: hidden;
background-color: #fff;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.35);
-webkit-box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.35);
position: absolute;
left: 50%;
top: 45%;
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
padding: 10px;
min-width: 100px;
border-radius: 10px;
width: 80%;
}
</style>
<script id="sparkVConsoleJS">
var script = document.createElement('script');
script.src = "//yun.duiba.com.cn/webapp/js/duiba-vconsole-1.0.0.js"
document.head.append(script);
</script></head>
<body>
<div id="GameDiv" cc_exact_fit_screen="true">
<div id="Cocos3dGameContainer">
<canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="99"></canvas>
</div>
</div>
<script>
window.voucherPackUrl = "https://mobapp.czbank.com/life/voucherPack.html";
</script>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1721183925253/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1721183925253/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1721183925253/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1721183925253/index.js').catch(function (err) {
console.error(err);
})
</script>
</body>
</html>
{ {
"__version__": "3.0.7", "__version__": "3.0.7",
"game": { "game": {
"name": "UNKNOW GAME", "name": "未知游戏",
"app_id": "UNKNOW", "app_id": "UNKNOW",
"c_id": "0" "c_id": "0"
}, },
......
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
"customSplash": { "customSplash": {
"id": "customSplash", "id": "customSplash",
"label": "customSplash", "label": "customSplash",
"enable": false, "enable": true,
"customSplash": { "customSplash": {
"complete": false, "complete": true,
"form": "https://creator-api.cocos.com/api/form/show?" "form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
} }
}, },
"removeSplash": { "removeSplash": {
"id": "removeSplash", "id": "removeSplash",
"label": "removeSplash", "label": "removeSplash",
"enable": false, "enable": true,
"removeSplash": { "removeSplash": {
"complete": false, "complete": true,
"form": "https://creator-api.cocos.com/api/form/show?" "form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment