You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
5.2 KiB
179 lines
5.2 KiB
var domino, window, document, location, Vue, VueRouter, navigator, axios, Promise, GoUseCall, GoUse, GoUseRegistered,
|
|
govueId, useRoute, goUseCallCache, $, jQuery, GoParam;
|
|
navigator = {
|
|
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
|
|
};
|
|
|
|
var wx = {
|
|
request: function (c) {
|
|
var url = c["url"];
|
|
var data = c["data"];
|
|
var header = c["header"];
|
|
var method = c["method"];
|
|
var dataType = c["dataType"];
|
|
var responseType = c["responseType"];
|
|
var success = c["success"];
|
|
var fail = c["fail"];
|
|
var complete = c["complete"];
|
|
// console.log("request");
|
|
// console.log(url);
|
|
var isHost = url.indexOf("http://") > -1 || url.indexOf("https://") > -1;
|
|
var isAbs = (url[0] == '/');
|
|
if (!isHost) {
|
|
if (!isAbs) {
|
|
url = location.pathname + "/" + url
|
|
}
|
|
url = location.host + "/" + url;
|
|
|
|
for (; url.indexOf("//") > -1;) {
|
|
url = url.replace("//", "/")
|
|
}
|
|
url = location.protocol + "//" + url
|
|
|
|
}
|
|
// console.log("url",url);
|
|
var result = GoRequest({
|
|
url: url,
|
|
data: data,
|
|
method: method,
|
|
});
|
|
|
|
|
|
result = JSON.parse(result);
|
|
var statusCode = result["statusCode"];
|
|
var data = result["data"];
|
|
if (dataType == "json") {
|
|
data = JSON.parse(data)
|
|
}
|
|
|
|
success({
|
|
data: data,
|
|
statusCode: statusCode,
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
/**
|
|
* 获取页面Id
|
|
* @return {string}
|
|
*/
|
|
function GetGoVueId() {
|
|
var id = "";
|
|
if (document.getElementsByTagName("html").length > 0) {
|
|
id = document.getElementsByTagName("html")[0].getAttribute("gv-id")
|
|
}
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* 执行内联的javascript
|
|
*/
|
|
function RunInlineCode() {
|
|
var jsInline = document.getElementsByTagName("script");
|
|
var jsInlineFiles = [];
|
|
for (var i = jsInline.length - 1; i >= 0; i--) {
|
|
var isGoVueSrc = jsInline[i].hasAttribute("gv-src");
|
|
var isGoVueCommon = jsInline[i].hasAttribute("gv-common");
|
|
if (isGoVueSrc) {
|
|
var res = {};
|
|
var file = jsInline[i].getAttribute("src");
|
|
if (jsInline[i].hasAttribute("src") && file != "") {
|
|
res["file"] = file
|
|
}
|
|
if (jsInline[i].text && jsInline[i].text != "") {
|
|
res["src"] = jsInline[i].text;
|
|
}
|
|
if (res["file"] || res["src"]) {
|
|
jsInlineFiles.unshift(res);
|
|
}
|
|
|
|
if (isGoVueCommon){
|
|
jsInline[i].removeAttribute("gv-src");
|
|
jsInline[i].removeAttribute("gv-common");
|
|
}else{
|
|
jsInline[i].remove();
|
|
}
|
|
}
|
|
}
|
|
for (var i in jsInlineFiles) {
|
|
if (jsInlineFiles[i]["file"]) {
|
|
GoRunCodeByFile(jsInlineFiles[i]["file"]);
|
|
}
|
|
if (jsInlineFiles[i]["src"]) {
|
|
eval(jsInlineFiles[i]["src"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 载入页面传入的参数
|
|
*/
|
|
function LoadGoParam() {
|
|
GoParam = jQuery.deparam(GoQuery);
|
|
}
|
|
|
|
|
|
/**
|
|
* 忽略标签操作
|
|
*/
|
|
var GoVueIgnore = function () {
|
|
|
|
var gv_ignore_tag_map = {};
|
|
var gv_ignore_class_map = {};
|
|
var gv_ignore_len = 0;
|
|
var gv_ignore_class_len = 0;
|
|
|
|
|
|
|
|
/**
|
|
* 忽略前置
|
|
*/
|
|
this.ignore = function () {
|
|
var gv_ignore = document.getElementsByTagName("gv-ignore");
|
|
gv_ignore_len = gv_ignore.length;
|
|
for (var i = gv_ignore_len - 1; i >= 0; i--) {
|
|
gv_ignore_tag_map[i] = gv_ignore[i].innerHTML;
|
|
gv_ignore[i].outerHTML = "<gv-ignore-" + i + "></gv-ignore-" + i + ">";
|
|
}
|
|
var gv_ignore_class = document.getElementsByClassName("gv-ignore");
|
|
gv_ignore_class_len = gv_ignore_class.length;
|
|
|
|
for (var i = 0; i < gv_ignore_class_len; i++) {
|
|
if (!gv_ignore_class_map[i]) {
|
|
gv_ignore_class_map[i] = {};
|
|
}
|
|
var a = gv_ignore_class[i].attributes;
|
|
var len = gv_ignore_class[i].attributes.length;
|
|
for (var k = len - 1; k >= 0; k--) {
|
|
gv_ignore_class_map[i][a.item(k).name] = a.item(k).value;
|
|
gv_ignore_class[i].removeAttribute(a.item(k).name);
|
|
}
|
|
gv_ignore_class[i].setAttribute("class", "gv-ignore-" + i)
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 恢复忽略内容等待渲染
|
|
*/
|
|
this.restore = function () {
|
|
var gv_restore, i, k, j;
|
|
|
|
for (i = 0; i < gv_ignore_len; i++) {
|
|
gv_restore = document.getElementsByTagName("gv-ignore-" + i);
|
|
for (k = 0; k < gv_restore.length; k++) {
|
|
gv_restore[k].innerHTML = gv_ignore_tag_map[i];
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < gv_ignore_class_len; i++) {
|
|
gv_restore = document.getElementsByClassName("gv-ignore-" + i);
|
|
for (k = 0; k < gv_restore.length; k++) {
|
|
for (j in gv_ignore_class_map[i]) {
|
|
gv_restore[k].setAttribute(j, gv_ignore_class_map[i][j]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|