|
|
@@ -49,159 +49,166 @@
|
|
|
let url = "https://sina.shuncheng.lu/demo.html"; // 要打开的 H5 页面的地址
|
|
|
let scheme = `sinaweibo://browser?url=` + encodeURIComponent(url);
|
|
|
window.location.href = `https://m.weibo.cn/feature/openapp?scheme=` + encodeURIComponent(scheme);
|
|
|
- }
|
|
|
- function getQueryString(name) {
|
|
|
- let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
|
- let r = window.location.search.substr(1).match(reg);
|
|
|
- if (r != null) return unescape(r[2]);
|
|
|
- return null;
|
|
|
- }
|
|
|
- $("#login").click(function () {
|
|
|
- getCode("1");
|
|
|
- // callNative('sendCode', '');
|
|
|
- });
|
|
|
- $("#copy").click(function () {
|
|
|
- document.getElementById("copyTest").val(new Date());
|
|
|
- document.getElementById("copyTest").select();
|
|
|
- if (document.execCommand("copy")) {
|
|
|
- document.execCommand("copy");
|
|
|
- alert("复制成功");
|
|
|
+ } else {
|
|
|
+ if (!$.cookie("SUB")) {
|
|
|
+ alert("未登录");
|
|
|
+ let url = "https://sina.shuncheng.lu/demo.html"; // 要打开的 H5 页面的地址
|
|
|
+ //未登录状态下跳转 scheme:
|
|
|
+ window.location.href = `sinaweibo://login?redirect_scheme` + encodeURIComponent(url);
|
|
|
}
|
|
|
- });
|
|
|
- // 判断平台
|
|
|
- var u = navigator.userAgent;
|
|
|
- var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
|
|
|
- var isiOS = !!u.match(/(iPhone|iPad|iPod)/gi); //ios终端
|
|
|
- var isWeChat = u.toLowerCase().match(/MicroMessenger/i) == "micromessenger"; //微信终端
|
|
|
- function getInfo(data) {
|
|
|
- // 暴露公用方法 ios 安卓调用H5
|
|
|
- dataDom.innerHTML = data;
|
|
|
- }
|
|
|
- var loginToken = "a0f18fa6b1f04232be549b6bb0186529";
|
|
|
- var gameID = "";
|
|
|
- var gameResult = {
|
|
|
- score: 301,
|
|
|
- list: [
|
|
|
- {
|
|
|
- clicktime: 1602222222,
|
|
|
- score: 301,
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
- var orderID = "";
|
|
|
- var mobile = "";
|
|
|
- var code = "";
|
|
|
- function getCode(data) {
|
|
|
- // 获取客户端传回来的code
|
|
|
- // 此处请求后端接口,将端给的code传给后端进行登录
|
|
|
+ function getQueryString(name) {
|
|
|
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
|
+ let r = window.location.search.substr(1).match(reg);
|
|
|
+ if (r != null) return unescape(r[2]);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ $("#login").click(function () {
|
|
|
+ getCode("1");
|
|
|
+ // callNative('sendCode', '');
|
|
|
+ });
|
|
|
+ $("#copy").click(function () {
|
|
|
+ document.getElementById("copyTest").val(new Date());
|
|
|
+ document.getElementById("copyTest").select();
|
|
|
+ if (document.execCommand("copy")) {
|
|
|
+ document.execCommand("copy");
|
|
|
+ alert("复制成功");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 判断平台
|
|
|
+ var u = navigator.userAgent;
|
|
|
+ var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
|
|
|
+ var isiOS = !!u.match(/(iPhone|iPad|iPod)/gi); //ios终端
|
|
|
+ var isWeChat = u.toLowerCase().match(/MicroMessenger/i) == "micromessenger"; //微信终端
|
|
|
+ function getInfo(data) {
|
|
|
+ // 暴露公用方法 ios 安卓调用H5
|
|
|
+ dataDom.innerHTML = data;
|
|
|
+ }
|
|
|
+ var loginToken = "a0f18fa6b1f04232be549b6bb0186529";
|
|
|
+ var gameID = "";
|
|
|
+ var gameResult = {
|
|
|
+ score: 301,
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ clicktime: 1602222222,
|
|
|
+ score: 301,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ var orderID = "";
|
|
|
+ var mobile = "";
|
|
|
+ var code = "";
|
|
|
+ function getCode(data) {
|
|
|
+ // 获取客户端传回来的code
|
|
|
+ // 此处请求后端接口,将端给的code传给后端进行登录
|
|
|
|
|
|
- let params = { token: loginToken };
|
|
|
+ let params = { token: loginToken };
|
|
|
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- url: "https://sina.shuncheng.lu/index/index/checkLogin",
|
|
|
- data: JSON.stringify({ cookie: document.cookie }),
|
|
|
- dataType: "json",
|
|
|
- xhrFields: {
|
|
|
- withCredentials: true, //允许跨域带Cookie
|
|
|
- },
|
|
|
- beforeSend: function (xhr) {
|
|
|
- xhr.withCredentials = true;
|
|
|
- },
|
|
|
- success: function (res) {
|
|
|
- console.log(res);
|
|
|
- loginToken = res.data.token;
|
|
|
- dataDom.innerHTML = res.data.token;
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- $("#config").click(function () {
|
|
|
- let params = { token: loginToken };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/login", params, function (res) {
|
|
|
- $("#configResult").html(res);
|
|
|
- let decrypted = Decrypt(res.data);
|
|
|
- $("#configResult").html(decrypted);
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "https://sina.shuncheng.lu/index/index/checkLogin",
|
|
|
+ data: JSON.stringify({ cookie: document.cookie }),
|
|
|
+ dataType: "json",
|
|
|
+ xhrFields: {
|
|
|
+ withCredentials: true, //允许跨域带Cookie
|
|
|
+ },
|
|
|
+ beforeSend: function (xhr) {
|
|
|
+ xhr.withCredentials = true;
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res);
|
|
|
+ loginToken = res.data.token;
|
|
|
+ dataDom.innerHTML = res.data.token;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $("#config").click(function () {
|
|
|
+ let params = { token: loginToken };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/login", params, function (res) {
|
|
|
+ $("#configResult").html(res);
|
|
|
+ let decrypted = Decrypt(res.data);
|
|
|
+ $("#configResult").html(decrypted);
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- $("#start").click(function () {
|
|
|
- let params = { token: loginToken };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/startGame", params, function (res) {
|
|
|
- $("#startResult").html(JSON.stringify(res));
|
|
|
- let decrypted = res.data;
|
|
|
- gameID = decrypted.gameID;
|
|
|
+ $("#start").click(function () {
|
|
|
+ let params = { token: loginToken };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/startGame", params, function (res) {
|
|
|
+ $("#startResult").html(JSON.stringify(res));
|
|
|
+ let decrypted = res.data;
|
|
|
+ gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- $("#topList").click(function () {
|
|
|
- let params = { token: loginToken };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/topList", params, function (res) {
|
|
|
- $("#topListResult").html(JSON.stringify(res));
|
|
|
- // let decrypted = (Decrypt(res.data));
|
|
|
- // $('#topListResult').html(decrypted);
|
|
|
- // decrypted = JSON.parse(decrypted);
|
|
|
- // gameID = decrypted.gameID;
|
|
|
+ $("#topList").click(function () {
|
|
|
+ let params = { token: loginToken };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/topList", params, function (res) {
|
|
|
+ $("#topListResult").html(JSON.stringify(res));
|
|
|
+ // let decrypted = (Decrypt(res.data));
|
|
|
+ // $('#topListResult').html(decrypted);
|
|
|
+ // decrypted = JSON.parse(decrypted);
|
|
|
+ // gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- $("#end").click(function () {
|
|
|
- let params = { token: loginToken, gameID: gameID, score: 300, gameData: gameResult };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/endGame", params, function (res) {
|
|
|
- $("#endResult").html(JSON.stringify(res));
|
|
|
- // let decrypted = (Decrypt(res.data));
|
|
|
- // $('#endResult').html(decrypted);
|
|
|
- // decrypted = JSON.parse(decrypted);
|
|
|
- // gameID = decrypted.gameID;
|
|
|
+ $("#end").click(function () {
|
|
|
+ let params = { token: loginToken, gameID: gameID, score: 300, gameData: gameResult };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/endGame", params, function (res) {
|
|
|
+ $("#endResult").html(JSON.stringify(res));
|
|
|
+ // let decrypted = (Decrypt(res.data));
|
|
|
+ // $('#endResult').html(decrypted);
|
|
|
+ // decrypted = JSON.parse(decrypted);
|
|
|
+ // gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- $("#reward").click(function () {
|
|
|
- let params = { token: loginToken, gameID: gameID };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/reward", params, function (res) {
|
|
|
- $("#rewardResult").html(JSON.stringify(res));
|
|
|
- orderID = res.data.orderID;
|
|
|
- // let decrypted = (Decrypt(res.data));
|
|
|
- // $('#endResult').html(decrypted);
|
|
|
- // decrypted = JSON.parse(decrypted);
|
|
|
- // gameID = decrypted.gameID;
|
|
|
+ $("#reward").click(function () {
|
|
|
+ let params = { token: loginToken, gameID: gameID };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/reward", params, function (res) {
|
|
|
+ $("#rewardResult").html(JSON.stringify(res));
|
|
|
+ orderID = res.data.orderID;
|
|
|
+ // let decrypted = (Decrypt(res.data));
|
|
|
+ // $('#endResult').html(decrypted);
|
|
|
+ // decrypted = JSON.parse(decrypted);
|
|
|
+ // gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- $("#sms").click(function () {
|
|
|
- mobile = $("#mobile").val();
|
|
|
- let params = { token: loginToken, mobile: mobile };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/sendSmsCode", params, function (res) {
|
|
|
- $("#smsResult").html(JSON.stringify(res));
|
|
|
- // orderID = res.data.orderID;
|
|
|
- // let decrypted = (Decrypt(res.data));
|
|
|
- // $('#endResult').html(decrypted);
|
|
|
- // decrypted = JSON.parse(decrypted);
|
|
|
- // gameID = decrypted.gameID;
|
|
|
+ $("#sms").click(function () {
|
|
|
+ mobile = $("#mobile").val();
|
|
|
+ let params = { token: loginToken, mobile: mobile };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/sendSmsCode", params, function (res) {
|
|
|
+ $("#smsResult").html(JSON.stringify(res));
|
|
|
+ // orderID = res.data.orderID;
|
|
|
+ // let decrypted = (Decrypt(res.data));
|
|
|
+ // $('#endResult').html(decrypted);
|
|
|
+ // decrypted = JSON.parse(decrypted);
|
|
|
+ // gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- $("#saveAddress").click(function () {
|
|
|
- code = $("#code").val();
|
|
|
- let params = {
|
|
|
- token: loginToken,
|
|
|
- orderID: orderID,
|
|
|
- isTopTen: false,
|
|
|
- name: "人人粉我",
|
|
|
- address: "上海东方明珠",
|
|
|
- mobile: mobile,
|
|
|
- code: code,
|
|
|
- };
|
|
|
- // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
- $.post("https://sina.shuncheng.lu/index/saveAddress", params, function (res) {
|
|
|
- $("#saveAddressResult").html(JSON.stringify(res));
|
|
|
- // orderID = res.data.orderID;
|
|
|
- // let decrypted = (Decrypt(res.data));
|
|
|
- // $('#endResult').html(decrypted);
|
|
|
- // decrypted = JSON.parse(decrypted);
|
|
|
- // gameID = decrypted.gameID;
|
|
|
+ $("#saveAddress").click(function () {
|
|
|
+ code = $("#code").val();
|
|
|
+ let params = {
|
|
|
+ token: loginToken,
|
|
|
+ orderID: orderID,
|
|
|
+ isTopTen: false,
|
|
|
+ name: "人人粉我",
|
|
|
+ address: "上海东方明珠",
|
|
|
+ mobile: mobile,
|
|
|
+ code: code,
|
|
|
+ };
|
|
|
+ // let encryptedData = Encrypt(JSON.stringify(params));
|
|
|
+ $.post("https://sina.shuncheng.lu/index/saveAddress", params, function (res) {
|
|
|
+ $("#saveAddressResult").html(JSON.stringify(res));
|
|
|
+ // orderID = res.data.orderID;
|
|
|
+ // let decrypted = (Decrypt(res.data));
|
|
|
+ // $('#endResult').html(decrypted);
|
|
|
+ // decrypted = JSON.parse(decrypted);
|
|
|
+ // gameID = decrypted.gameID;
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
// 触发方法
|
|
|
function callNative(name, value) {
|
|
|
dataDom.innerHTML = navigator.userAgent;
|