跳转逻辑
(function () {
function GetQueryValue(queryName) {
var reg = new RegExp("(^|&)" + queryName + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURI(r[2]);
} else {
return null;
}
}
var jump = function () {
const appid = "xxx";
const token = GetQueryValue("id");
const type = GetQueryValue("type");
const batch = GetQueryValue("batch");
const bookId = GetQueryValue("bookId");
const versionId = GetQueryValue("versionId");
let query = {};
let queryStr = "";
let href = "";
let path = "";
if (type == "answer") {
/* query = {
batch: batch,
} */
path = "page/words/print-details";
queryStr = `batch=${batch}`;
href = `weixin://dl/business/?appid=${appid}&path=${path}&query=${encodeURIComponent(
queryStr
)}&env_version=release`;
} else if (type == "learning") {
/* query = {
id: token,
type: "learning",
status: "all",
learningMode: 1,
source: "scan",
}; */
path = "page/words/start";
queryStr = `id=${token}&type=learning&status=all&learningMode=1&source=scan`;
href = `weixin://dl/business/?appid=${appid}&path=${path}&query=${encodeURIComponent(
queryStr
)}&env_version=release&source=scan`;
} else if (type == "listening") {
/* query = {
bookId: bookId,
versionId: versionId,
type: "listening",
source: "scan",
}; */
path = "page/listening/list";
queryStr = `bookId=${bookId}&versionId=${versionId}&type=listening&source=scan`;
href = `weixin://dl/business/?appid=${appid}&path=${path}&query=${encodeURIComponent(
queryStr
)}&env_version=release&source=scan`;
} else if (type == "dictation") {
/* query = {
batch: batch,
type: "dictation",
}; */
path = "page/dictation/print-details";
queryStr = `batch=${batch}&type=dictation`;
href = `weixin://dl/business/?appid=${appid}&path=${path}&query=${encodeURIComponent(
queryStr
)}&env_version=release&source=scan`;
}
window.location.href = href;
};
document.getElementById("button").onclick = function () {
jump();
};
jump();
})();