Commit 9e65f492 authored by haiyoucuv's avatar haiyoucuv

整理一下代码

parent 93619f7c
......@@ -2,10 +2,10 @@ import { showPanel, showToast } from "../Module/UIFast";
import { sendWebNetWithToken, WebNetName } from "./Utils/WebNet/WebNet";
import { SHARE_TYPE } from "./const";
import ShareCenter from "./ShareCenter";
import { appJump } from "./Utils/appFn";
import PosterPanel from "./Panels/PosterPanel";
import BrowseImgPanel from "./Panels/BrowseImgPanel";
import store from "../store/store";
import { appJump } from "../AppTool";
const levelToast = {
3: "恭喜您今日运势极佳,可领取3次挑战次数",
......
/**
* 获取cookie的值
* @param {*} cookieName
*/
function getCookie(cookieName) {
const strCookie = document.cookie;
const arrCookie = strCookie.split("; ");
for (let i = 0; i < arrCookie.length; i++) {
const arr = arrCookie[i].split("=");
if (cookieName == arr[0]) {
return arr[1];
}
}
return "";
}
// 跳转苏银豆商城
export const onToAppMall = () => {
appJump("jfsc");
};
// 行方跳转
export function appJump(url, needlogin = "1") {
console.info('appJump url===> ', url);
if (!!!url) return;
cookieSetInSession();
const ThirdApp = window["ThirdApp"];
if (url.slice(0, 4) == "http") {
// http开头
ThirdApp && ThirdApp.loadUrlNewJSMB(url, "1", "1", "", needlogin, "1");
} else if (url.slice(0, 4) == "page") {
// 客户端
ThirdApp && ThirdApp.loadUrlNewJSMB(url, "1", "1", "", needlogin, "0");
} else {
// 第三方
ThirdApp && ThirdApp.loadUrlNewJSMB(url, "3", "1", "", needlogin, "0");
}
cookieSetBack();
window.setTimeout(() => {
cookieSetBack();
}, 1000);
}
export function cookieSetInSession() {
if (getCookie("tokenId") != "") {
console.info("cooke保存有tokenid");
console.info(document.cookie, "cookie");
const ThirdApp = window["ThirdApp"];
ThirdApp &&
ThirdApp.setSession("final", {
tokenId: getCookie("tokenId"),
wdata3: getCookie("wdata3"),
wdata4: getCookie("wdata4"),
createdAtToday: getCookie("createdAtToday"),
isNotLoginUser: getCookie("isNotLoginUser"),
dcustom: getCookie("dcustom"),
});
}
}
export function cookieSetBack() {
return new Promise((resolve, reject) => {
const ThirdApp = window["ThirdApp"];
ThirdApp && ThirdApp.getSession("final", function (data) {
console.info("getsessionFinal", data);
Object.keys(data).forEach((key) => {
document.cookie = String(key) + "=" + data[key];
});
resolve(data);
});
setTimeout(() => {
resolve({});
}, 5000);
});
}
/**
* @description 把图片保存到相册<br>
* @param {string}
* data 图片base64
*
*/
export function saveDCPic(data) {
// console.info('saveDCPic data', data)
const ThirdApp = window["ThirdApp"];
try {
var cfg = {
base64: data,
};
ThirdApp && ThirdApp._callHandler("saveDCPic", JSON.stringify(cfg));
} catch (e) {
console.info("saveDCPic error", e);
ThirdApp && ThirdApp.alertinfo("把图片保存到相册异常", "saveDCPic:" + e);
}
}
// 分享海报
export function wxShareImg(url) {
......
......@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>cocos-template-3d</title>
<title>财富游园会</title>
<!--http://www.html5rocks.com/en/mobile/mobifying/-->
<meta name="viewport"
......@@ -39,7 +39,7 @@
<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/1719215045905/style.css"/>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215987595/style.css"/>
<style>
.sui-captcha {
......@@ -94,17 +94,17 @@
</div>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215045905/src/polyfills.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215987595/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215045905/src/system.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215987595/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215045905/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215987595/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215045905/index.js').catch(function (err) {
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1719215987595/index.js').catch(function (err) {
console.error(err);
})
</script>
......
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