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