提交 654fa60e 编写于 作者: ibizdev's avatar ibizdev

lxm1993 发布系统代码 [TrainSys,网页端]

上级 33377ed6
var BaseUrl = '';
if (window.Environment && window.Environment.BaseUrl) {
BaseUrl = window.Environment.BaseUrl;
}
function getQueryVariable(variable) {
var query = location.search.substring(1);
var vars = query.split('&');
......@@ -13,20 +9,6 @@ function getQueryVariable(variable) {
}
return false;
}
function getRequest(method, url, params) {
var config = { credentials: 'include' };
config.method = method;
if (params) {
if (method === 'POST') {
config.headers = { Accept: 'application/json', 'Content-Type': 'application/json;charset=utf-8' };
config.body = JSON.stringify(params);
}
}
return new Request(url, config);
}
function post(url, params) {
return fetch(this.getRequest('POST', url, params));
}
function setCookie(name, value, day, isDomain, path) {
if (day == null) {
day = 0;
......@@ -41,7 +23,8 @@ function setCookie(name, value, day, isDomain, path) {
// 设置cookie到主域下
if (isDomain) {
// 是否为ip正则
const regExpr = /^(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)$/;
const regExpr =
/^(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)$/;
// 为ip时忽略
if (!regExpr.test(location.hostname)) {
const host = location.hostname;
......@@ -54,7 +37,15 @@ function setCookie(name, value, day, isDomain, path) {
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
const expires = day * 24 * 60 * 60 * 1000;
const date = new Date(new Date().getTime() + expires);
document.cookie = name + '=' + escape(value) + ';path=' + path + ';expires=' + date.toUTCString() + domain;
document.cookie =
name +
'=' +
escape(value) +
';path=' +
path +
';expires=' +
date.toUTCString() +
domain;
} else {
document.cookie = name + '=' + escape(value) + ';path=' + path + domain;
}
......@@ -62,71 +53,31 @@ function setCookie(name, value, day, isDomain, path) {
function clearCookie(cookieName, isDomain) {
this.setCookie(cookieName, '', -1, isDomain);
}
window.onload = function() {
window.onload = function () {
var infoEl = document.getElementById('redirect-info');
var errInfoEl = document.getElementById('redirect-error');
// 显示错误信息
var showError = function(info) {
var showError = function (info) {
errInfoEl.textContent = info;
infoEl.style.display = 'none';
errInfoEl.style.display = 'block';
};
var load = function() {
try {
var ticket = getQueryVariable('ticket');
if (!ticket) {
showError('「ticket」信息获取失败,请稍后重试!');
var load = function () {
var token = getQueryVariable('token');
if (!token) {
showError('「token」信息获取失败,请稍后重试!');
return;
}
var ru = getQueryVariable('RU');
if (ru) {
ru = decodeURIComponent(ru);
}
post(BaseUrl+'/v7/login', {
password: ticket,
loginname: location.origin + location.pathname + location.hash + '?RU=' + encodeURIComponent(ru),
})
.then(function(res) {
return new Promise(resolve => {
res.json().then(data =>
resolve({
ok: res.ok,
status: res.status,
data,
}),
);
});
})
.then(function(res) {
var data = res.data;
if (res.ok) {
var token = data.token;
if (token == null || token == '') {
showError('token信息获取失败,请稍后重试!');
return;
}
clearCookie('access_token', true);
setCookie('access_token', token, 0, true);
window.location.href = ru;
} else {
if (data.message) {
showError('登录失败,' + data.message);
} else {
showError('登录失败, 发生未知错误请稍后重试!');
}
}
})
.catch(function(err) {
showError('登录失败请稍后重试!');
console.error(err);
});
} catch (err) {
showError('登录失败请稍后重试!');
console.error(err);
}
};
var redirectInfoActionEl = document.getElementById('redirect-info-action');
redirectInfoActionEl.onclick = function() {
redirectInfoActionEl.onclick = function () {
load();
};
load();
......
......@@ -57,7 +57,11 @@
"pluginCode" : "PubViewTest",
"pluginType" : "VIEW_CUSTOM",
"refMode" : "APPVIEW",
"refTag" : "DEDATAVIEW"
"refTag" : "DEDATAVIEW",
"templCode" : "const a = 111",
"templCode2" : "const b = 222",
"templCode3" : "const c = 333",
"templCode4" : "const d = 444"
}, {
"name" : "界面行为插件",
"getPSSysPFPlugin" : {
......
......@@ -10,7 +10,11 @@
"pluginCode" : "PubViewTest",
"pluginType" : "VIEW_CUSTOM",
"refMode" : "APPVIEW",
"refTag" : "DEDATAVIEW"
"refTag" : "DEDATAVIEW",
"templCode" : "const a = 111",
"templCode2" : "const b = 222",
"templCode3" : "const c = 333",
"templCode4" : "const d = 444"
}, {
"name" : "界面行为插件",
"getPSSysPFPlugin" : {
......
......@@ -37,6 +37,23 @@
}
} ],
"getPSDEFormItemVRs" : [ {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFormItemName" : "Name",
"getPSSysValueRule" : {
"codeName" : "ValueRule14",
"dynaModelFilePath" : "PSSYSVALUERULES/ValueRule14.json",
"mOSFilePath" : "pssysvaluerules/ValueRule14",
"name" : "由26个英文字母组成的字符串",
"rTMOSFilePath" : "pssysvaluerules/ValueRule14",
"regExCode" : "[A-Za-z]+",
"ruleInfo" : "内容必须为26个英文字母组成的字符串",
"ruleType" : "REG",
"enableBackend" : true,
"enableFront" : true
},
"valueRuleType" : "SYSVALUERULE"
}, {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFValueRule" : {
......@@ -68,23 +85,6 @@
},
"getPSDEFormItemName" : "StuNo",
"valueRuleType" : "DEFVALUERULE"
}, {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFormItemName" : "Name",
"getPSSysValueRule" : {
"codeName" : "ValueRule14",
"dynaModelFilePath" : "PSSYSVALUERULES/ValueRule14.json",
"mOSFilePath" : "pssysvaluerules/ValueRule14",
"name" : "由26个英文字母组成的字符串",
"rTMOSFilePath" : "pssysvaluerules/ValueRule14",
"regExCode" : "[A-Za-z]+",
"ruleInfo" : "内容必须为26个英文字母组成的字符串",
"ruleType" : "REG",
"enableBackend" : true,
"enableFront" : true
},
"valueRuleType" : "SYSVALUERULE"
} ],
"getPSDEFormItems" : [ {
"id" : "srfupdatedate",
......
......@@ -1109,6 +1109,23 @@
"id" : "FORM"
},
"getPSDEFormItemVRs" : [ {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFormItemName" : "Name",
"getPSSysValueRule" : {
"codeName" : "ValueRule14",
"dynaModelFilePath" : "PSSYSVALUERULES/ValueRule14.json",
"mOSFilePath" : "pssysvaluerules/ValueRule14",
"name" : "由26个英文字母组成的字符串",
"rTMOSFilePath" : "pssysvaluerules/ValueRule14",
"regExCode" : "[A-Za-z]+",
"ruleInfo" : "内容必须为26个英文字母组成的字符串",
"ruleType" : "REG",
"enableBackend" : true,
"enableFront" : true
},
"valueRuleType" : "SYSVALUERULE"
}, {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFValueRule" : {
......@@ -1140,23 +1157,6 @@
},
"getPSDEFormItemName" : "StuNo",
"valueRuleType" : "DEFVALUERULE"
}, {
"checkMode" : 3,
"name" : "表单项值规则",
"getPSDEFormItemName" : "Name",
"getPSSysValueRule" : {
"codeName" : "ValueRule14",
"dynaModelFilePath" : "PSSYSVALUERULES/ValueRule14.json",
"mOSFilePath" : "pssysvaluerules/ValueRule14",
"name" : "由26个英文字母组成的字符串",
"rTMOSFilePath" : "pssysvaluerules/ValueRule14",
"regExCode" : "[A-Za-z]+",
"ruleInfo" : "内容必须为26个英文字母组成的字符串",
"ruleType" : "REG",
"enableBackend" : true,
"enableFront" : true
},
"valueRuleType" : "SYSVALUERULE"
} ],
"getPSDEFormItems" : [ {
"id" : "srfupdatedate",
......
......@@ -1349,7 +1349,9 @@
"pluginCode" : "bujian",
"pluginType" : "CUSTOM",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\r\n <button class='xx' @click='add'>xxx</button>\r\n </template>\r\n <script>\r\n export default {\r\n methods:{\r\n add(){\r\n alert('add')\r\n }\r\n }\r\n }\r\n </script>\r\n <style>\r\n .xx{\r\n color:red;\r\n }\r\n </style>\r\n",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c(\\\"div\\\")}\\n}\",\"script\":\"\",\"style\":\"\"}"
}, {
"name" : "代码表表格列绘制插件",
"getPSSysPFPlugin" : {
......@@ -1405,7 +1407,9 @@
"pluginCode" : "runtime_widget_not_out",
"pluginType" : "CUSTOM",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\n <div class='messagecolor'>{{message}}</div>\n</template>\n<script>\nexport default {\n data() {\n return {\n message:'示例-未出来'\n }\n },\n}\n</script>\n<style>\n.messagecolor{\n color:red;\n}\n</style>",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c('div',{staticClass:\\\"messagecolor\\\"},[_v(_s(message))])}\\n}\",\"script\":\"\\nexport default {\\n data() {\\n return {\\n message:'示例-未chulai'\\n }\\n },\\n}\\n\",\"style\":\"\\n.messagecolor{\\n color:red;\\n}\\n\"}"
}, {
"name" : "远程视图插件测试",
"getPSSysPFPlugin" : {
......@@ -1415,7 +1419,8 @@
"pluginCode" : "remoteView",
"pluginType" : "VIEW_CUSTOM",
"refMode" : "APPVIEW",
"refTag" : "DEGRIDVIEW"
"refTag" : "DEGRIDVIEW",
"templCode" : "http://l.zhr.icu:20002/static/index.system.min.js"
}, {
"name" : "部件运行时插件测试(编辑表单)",
"getPSSysPFPlugin" : {
......@@ -1425,7 +1430,9 @@
"pluginCode" : "RuntimeWidget",
"pluginType" : "EDITFORM_RENDER",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\r\n<div class='plugin'>插件</div>\r\n</template>\r\n<script>\r\nexport default {\r\n\r\n}\r\n</script>\r\n<style>\r\n.plugin {\r\n color: red;\r\n}\r\n</style>",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c('div',{staticClass:\\\"plugin\\\"},[_v(\\\"插件\\\")])}\\n}\",\"script\":\"\\r\\nexport default {\\r\\n\\r\\n}\\r\\n\",\"style\":\"\\r\\n.plugin {\\r\\n color: red;\\r\\n}\\r\\n\"}"
} ],
"getAllPSAppPkgs" : [ {
"codeName" : "xxx",
......@@ -10,7 +10,9 @@
"pluginCode" : "bujian",
"pluginType" : "CUSTOM",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\r\n <button class='xx' @click='add'>xxx</button>\r\n </template>\r\n <script>\r\n export default {\r\n methods:{\r\n add(){\r\n alert('add')\r\n }\r\n }\r\n }\r\n </script>\r\n <style>\r\n .xx{\r\n color:red;\r\n }\r\n </style>\r\n",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c(\\\"div\\\")}\\n}\",\"script\":\"\",\"style\":\"\"}"
}, {
"name" : "代码表表格列绘制插件",
"getPSSysPFPlugin" : {
......@@ -66,7 +68,9 @@
"pluginCode" : "runtime_widget_not_out",
"pluginType" : "CUSTOM",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\n <div class='messagecolor'>{{message}}</div>\n</template>\n<script>\nexport default {\n data() {\n return {\n message:'示例-未出来'\n }\n },\n}\n</script>\n<style>\n.messagecolor{\n color:red;\n}\n</style>",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c('div',{staticClass:\\\"messagecolor\\\"},[_v(_s(message))])}\\n}\",\"script\":\"\\nexport default {\\n data() {\\n return {\\n message:'示例-未chulai'\\n }\\n },\\n}\\n\",\"style\":\"\\n.messagecolor{\\n color:red;\\n}\\n\"}"
}, {
"name" : "远程视图插件测试",
"getPSSysPFPlugin" : {
......@@ -76,7 +80,8 @@
"pluginCode" : "remoteView",
"pluginType" : "VIEW_CUSTOM",
"refMode" : "APPVIEW",
"refTag" : "DEGRIDVIEW"
"refTag" : "DEGRIDVIEW",
"templCode" : "http://l.zhr.icu:20002/static/index.system.min.js"
}, {
"name" : "部件运行时插件测试(编辑表单)",
"getPSSysPFPlugin" : {
......@@ -86,7 +91,9 @@
"pluginCode" : "RuntimeWidget",
"pluginType" : "EDITFORM_RENDER",
"refMode" : "CONTROL",
"refTag" : "FORM"
"refTag" : "FORM",
"templCode" : "<template>\r\n<div class='plugin'>插件</div>\r\n</template>\r\n<script>\r\nexport default {\r\n\r\n}\r\n</script>\r\n<style>\r\n.plugin {\r\n color: red;\r\n}\r\n</style>",
"templCode2" : "{\"template\":\"function anonymous(\\n) {\\nwith(this){return _c('div',{staticClass:\\\"plugin\\\"},[_v(\\\"插件\\\")])}\\n}\",\"script\":\"\\r\\nexport default {\\r\\n\\r\\n}\\r\\n\",\"style\":\"\\r\\n.plugin {\\r\\n color: red;\\r\\n}\\r\\n\"}"
} ],
"cache" : {
"getPSAppViews" : [ ]
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册