style
This commit is contained in:
parent
b054ddaa31
commit
0ede1c3919
@ -1,7 +1,6 @@
|
|||||||
var getDateDaysBefore = function (daysAgo) {
|
var getDateDaysBefore = function (daysAgo) {
|
||||||
var dateStr = new Date().toISOString().substring(0, 10);
|
var dateStr = new Date().toISOString().substring(0, 10);
|
||||||
var ret = new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000;
|
return new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000;
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let primaryColor = "#2E324C";
|
let primaryColor = "#2E324C";
|
||||||
@ -38,8 +37,7 @@ var initVue = function () {
|
|||||||
console.log("importkey trigged");
|
console.log("importkey trigged");
|
||||||
try {
|
try {
|
||||||
var sm2Key = JSON.parse(this.sm2KeyStr);
|
var sm2Key = JSON.parse(this.sm2KeyStr);
|
||||||
if (sm2Key.publicKey == undefined
|
if (!sm2Key.publicKey || !sm2Key.privateKey) {
|
||||||
|| sm2Key.privateKey == undefined) {
|
|
||||||
this.sm2KeyStr = (JSON.stringify(global.sm2Key));
|
this.sm2KeyStr = (JSON.stringify(global.sm2Key));
|
||||||
} else {
|
} else {
|
||||||
global.sm2Key = sm2Key;
|
global.sm2Key = sm2Key;
|
||||||
@ -97,9 +95,10 @@ var initVue = function () {
|
|||||||
console.log("applyRole, " + role);
|
console.log("applyRole, " + role);
|
||||||
applyRole(role.title);
|
applyRole(role.title);
|
||||||
|
|
||||||
}, changeSM2Key: function (event) {
|
},
|
||||||
|
changeSM2Key: function (event) {
|
||||||
var order = event.target.value; // 获取option对应的value值
|
var order = event.target.value; // 获取option对应的value值
|
||||||
if (order == undefined)
|
if (!order)
|
||||||
return;
|
return;
|
||||||
console.log("changeSM2Key, -->" + order);
|
console.log("changeSM2Key, -->" + order);
|
||||||
headerVue.shortName = this.sm2KeyList[order].title;
|
headerVue.shortName = this.sm2KeyList[order].title;
|
||||||
@ -108,10 +107,11 @@ var initVue = function () {
|
|||||||
global.sm2Key = JSON.parse(this.sm2KeyStr);
|
global.sm2Key = JSON.parse(this.sm2KeyStr);
|
||||||
localStorage.setItem("PrivKey", this.sm2KeyStr);
|
localStorage.setItem("PrivKey", this.sm2KeyStr);
|
||||||
getSession();
|
getSession();
|
||||||
}, deletePubkey: function (event) {
|
},
|
||||||
|
deletePubkey: function (event) {
|
||||||
var order = this.selectedSM2Key;
|
var order = this.selectedSM2Key;
|
||||||
var obj = this.sm2KeyList[order];
|
var obj = this.sm2KeyList[order];
|
||||||
if (this.sm2KeyList.length == 1) {
|
if (this.sm2KeyList.length === 1) {
|
||||||
alert("最后一对密钥不可以删除");
|
alert("最后一对密钥不可以删除");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -119,11 +119,9 @@ var initVue = function () {
|
|||||||
for (var i = 0; i < order; i++) {
|
for (var i = 0; i < order; i++) {
|
||||||
newList.push(this.sm2KeyList[i]);
|
newList.push(this.sm2KeyList[i]);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
for (var i = order / 1 + 1; i < this.sm2KeyList.length; i++) {
|
for (var i = order / 1 + 1; i < this.sm2KeyList.length; i++) {
|
||||||
newList.push(this.sm2KeyList[i]);
|
newList.push(this.sm2KeyList[i]);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
this.sm2KeyList = newList;
|
this.sm2KeyList = newList;
|
||||||
for (var i = 0; i < newList.length; i++) {
|
for (var i = 0; i < newList.length; i++) {
|
||||||
newList[i].id = i;
|
newList[i].id = i;
|
||||||
@ -139,7 +137,8 @@ var initVue = function () {
|
|||||||
global.sm2Key = JSON.parse(this.sm2KeyStr);
|
global.sm2Key = JSON.parse(this.sm2KeyStr);
|
||||||
localStorage.setItem("PrivKey", this.sm2KeyStr);
|
localStorage.setItem("PrivKey", this.sm2KeyStr);
|
||||||
getSession();
|
getSession();
|
||||||
}, exportPubkey: function (event) {
|
},
|
||||||
|
exportPubkey: function (event) {
|
||||||
var uri = "data:text/html,";
|
var uri = "data:text/html,";
|
||||||
uri += localStorage.getItem("PrivKeyList");
|
uri += localStorage.getItem("PrivKeyList");
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
@ -182,9 +181,10 @@ var initVue = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ======Vue done
|
// ======Vue done
|
||||||
|
|
||||||
var initGlobal = function (urlParams) {
|
function initGlobal(urlParams) {
|
||||||
if (!window.global) {
|
if (!window.global) {
|
||||||
window.global = {};
|
window.global = {};
|
||||||
}
|
}
|
||||||
@ -193,11 +193,11 @@ var initGlobal = function (urlParams) {
|
|||||||
global.isBaaS = true
|
global.isBaaS = true
|
||||||
primaryColor = '#08263a'
|
primaryColor = '#08263a'
|
||||||
}
|
}
|
||||||
if (urlParams){
|
if (urlParams) {
|
||||||
global.urlparam = urlParams;
|
global.urlparam = urlParams;
|
||||||
}
|
}
|
||||||
if (urlParams && urlParams.keys) {
|
if (urlParams && urlParams.keys) {
|
||||||
global.sm2Key = urlParams.keys;
|
global.sm2Key = urlParams.keys;
|
||||||
} else {
|
} else {
|
||||||
global.sm2Key = localStorage.getItem("PrivKey");
|
global.sm2Key = localStorage.getItem("PrivKey");
|
||||||
if (!global.sm2Key || global.sm2Key.length < 100) {
|
if (!global.sm2Key || global.sm2Key.length < 100) {
|
||||||
@ -209,9 +209,9 @@ var initGlobal = function (urlParams) {
|
|||||||
headerVue.shortName = global.sm2Key.publicKey.substr(0, 5);
|
headerVue.shortName = global.sm2Key.publicKey.substr(0, 5);
|
||||||
pubkeyDialogVue.sm2KeyStr = JSON.stringify(global.sm2Key);
|
pubkeyDialogVue.sm2KeyStr = JSON.stringify(global.sm2Key);
|
||||||
mainVue.pubDialogVue = pubkeyDialogVue;
|
mainVue.pubDialogVue = pubkeyDialogVue;
|
||||||
var keyListStr = localStorage.getItem("PrivKeyList");
|
const keyListStr = localStorage.getItem("PrivKeyList");
|
||||||
if (keyListStr == undefined) {
|
const keyObj = {};
|
||||||
var keyObj = {};
|
if (!keyListStr) {
|
||||||
keyObj.id = 0;
|
keyObj.id = 0;
|
||||||
keyObj.title = headerVue.shortName;
|
keyObj.title = headerVue.shortName;
|
||||||
keyObj.sm2Key = pubkeyDialogVue.sm2KeyStr;
|
keyObj.sm2Key = pubkeyDialogVue.sm2KeyStr;
|
||||||
@ -223,16 +223,15 @@ var initGlobal = function (urlParams) {
|
|||||||
} else {
|
} else {
|
||||||
pubkeyDialogVue.sm2KeyList = JSON.parse(keyListStr);
|
pubkeyDialogVue.sm2KeyList = JSON.parse(keyListStr);
|
||||||
pubkeyDialogVue.selectedSM2Key = -1;
|
pubkeyDialogVue.selectedSM2Key = -1;
|
||||||
for (var i = 0; i < pubkeyDialogVue.sm2KeyList.length; i++) {
|
for (let i = 0; i < pubkeyDialogVue.sm2KeyList.length; i++) {
|
||||||
var obj = pubkeyDialogVue.sm2KeyList[i];
|
const obj = pubkeyDialogVue.sm2KeyList[i];
|
||||||
if (obj.sm2Key == pubkeyDialogVue.sm2KeyStr) {
|
if (obj.sm2Key === pubkeyDialogVue.sm2KeyStr) {
|
||||||
pubkeyDialogVue.selectedSM2Key = i;
|
pubkeyDialogVue.selectedSM2Key = i;
|
||||||
// mainVue.sm2KeyList = pubkeyDialogVue.sm2KeyList;
|
// mainVue.sm2KeyList = pubkeyDialogVue.sm2KeyList;
|
||||||
// mainVue.selectedSM2Key = pubkeyDialogVue.selectedSM2Key;
|
// mainVue.selectedSM2Key = pubkeyDialogVue.selectedSM2Key;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var keyObj = {};
|
|
||||||
keyObj.id = pubkeyDialogVue.sm2KeyList.length;
|
keyObj.id = pubkeyDialogVue.sm2KeyList.length;
|
||||||
keyObj.title = headerVue.shortName;
|
keyObj.title = headerVue.shortName;
|
||||||
keyObj.sm2Key = pubkeyDialogVue.sm2KeyStr;
|
keyObj.sm2Key = pubkeyDialogVue.sm2KeyStr;
|
||||||
|
Loading…
Reference in New Issue
Block a user