merge: merge changes in BaaS
This commit is contained in:
parent
4379b1745e
commit
43b79ffffc
173
BaaSClient.html
Normal file
173
BaaSClient.html
Normal file
@ -0,0 +1,173 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Cache-Control" content="no-cache" />
|
||||
<title>数瑞客户端</title>
|
||||
|
||||
<script src="./js/createWS.js"></script>
|
||||
<script src="./js/cryptico.js"></script>
|
||||
<script src="./js/jquery-2.1.4.js"></script>
|
||||
<script src="./js/bootstrap.min.js"></script>
|
||||
<script src="./js/commonutil.js"></script>
|
||||
|
||||
<link href="./css/common.css" rel="stylesheet">
|
||||
<link href="./css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="./js/vue.js"></script>
|
||||
<script src="./js/bdwareclient.js"></script>
|
||||
<script src="./js/sm2.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header
|
||||
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
||||
<div class="col-10">
|
||||
<div class="input-group">
|
||||
<a class="navbar-brand" href="#"> <img alt="Brand"
|
||||
src="./img/logo-1.png" style="height: 30px">
|
||||
</a><a class="navbar-brand">数瑞浏览器 </a> <input id="urlInput"
|
||||
type="text" class="form-control" placeholder="输入地址" style="display: none;">
|
||||
|
||||
<button class="btn btn-outline-secondary" type="button"
|
||||
onclick="connectNode()" style="display: none;">GO</button>
|
||||
<button class="btn btn-outline-secondary" id="switchRenderBtn" type="button"
|
||||
onclick="changeRender()" style="height: 80%; margin-top: 0.4%;">不加载界面</button>
|
||||
<span> </span>
|
||||
<div class="input-group-append" style="display: none;">
|
||||
<select id="selectContract" class="custom-select"
|
||||
style="-webkit-appearance: none" onchange="changeApp()">
|
||||
<option selected>选择合约</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class=" nav navbar-right userName" data-toggle="modal"
|
||||
data-target="#pubkeyDialog">欢迎, {{shortName}}</div>
|
||||
</header>
|
||||
|
||||
<div id="main">
|
||||
<div class="row h-100" id="mainDiv"></div>
|
||||
</div>
|
||||
<!-- 用于配置sm2密钥的对话框 -->
|
||||
<div class="modal fade" id="pubkeyDialog" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">用户信息</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text" for="localKeyList">本地公钥</label>
|
||||
</div>
|
||||
|
||||
<select class="custom-select"
|
||||
aria-label="Example select with button addon"
|
||||
style="appearance: none" v-model="selectedSM2Key"
|
||||
@change="changeSM2Key($event)">
|
||||
<option v-for="(item,index) in sm2KeyList" :key="index"
|
||||
:value='item.id'>{{item.title}}</option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" for="localKeyList"
|
||||
v-on:click="exportPubkey">导出公钥</button>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-danger" for="localKeyList"
|
||||
v-on:click="deletePubkey">删除公钥</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
|
||||
<div class="input-group mb-1">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text" for="localKeyList">当前SM2密钥</label>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="(请复制并妥善保存)"
|
||||
disabled="disabled" aria-label=""
|
||||
aria-describedby="basic-addon1">
|
||||
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
id="generatePubkeyBtn" v-on:click="generatePubkey">生成新公钥</button>
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
data-dismiss="modal" id="importPubkeyBtn"
|
||||
v-on:click="importPubkey">导入公钥</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="form-control mb-3" title="复制密钥,并妥善保存"
|
||||
id="sm2KeyTextarea" v-model="sm2KeyStr"
|
||||
style="width: 100%; min-height: 150px" rows="" cols="">
|
||||
</textarea>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px;">
|
||||
|
||||
</div>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
<span>我的权限:{{myRole}}</span>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select id="inputGroupSelect04" v-model="test"
|
||||
class="custom-select" style="appearance: none"
|
||||
@change="changeProduct($event)">
|
||||
<option v-for="(item,index) in productList" :key="index"
|
||||
:value='item.id'>{{item.title}}</option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" type="button"
|
||||
v-on:click="applyRole">角色认证</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="dialog" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="dialogTitleH5">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="dialogBodyDiv">...</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
data-dismiss="modal">关闭
|
||||
</button>
|
||||
<button type="button" id="dialogConfimBtn"
|
||||
class="btn btn-outline-primary" data-dismiss="modal">确定
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var h = document.body.clientHeight
|
||||
- $("header").css("height").replace("px", "")
|
||||
|
||||
$("#main").css("height", h + "px");
|
||||
init();
|
||||
|
||||
//initWSocket();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -723,10 +723,9 @@ function killAllContract() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
const urlParams = getRequestParameters();
|
||||
initVue();
|
||||
|
||||
initGlobal();
|
||||
global.urlparam = getRequestParameters();
|
||||
initGlobal(urlParams);
|
||||
|
||||
if (global.urlparam["noRender"] === "true") {
|
||||
switchRenderBtn.innerHTML = "加载界面";
|
||||
@ -763,6 +762,29 @@ function connectNode() {
|
||||
}
|
||||
|
||||
function getRequestParameters() {
|
||||
if (location.href.indexOf("BaaSClient") !== -1) {
|
||||
let params = location.href.replace(/[^#]*(#(\/)?|\?)/, '')
|
||||
let url = location.href.replace(params, '')
|
||||
while (!params) {
|
||||
url = url.replace(/(#(\/)?|\?)$/, '')
|
||||
params = url.replace(/[^#]*(#(\/)?|\?)/, '')
|
||||
url = url.replace(params, '')
|
||||
}
|
||||
if (url.endsWith('#') || url.endsWith('#\/')) {
|
||||
let sKey = Math.random().toString()
|
||||
localStorage.setItem(sKey, params)
|
||||
location.href = url.replace(/#(\/)?/, '?' + sKey)
|
||||
} else {
|
||||
let json = atob(localStorage.getItem(params))
|
||||
try {
|
||||
return JSON.parse(json);
|
||||
} catch (e) {
|
||||
localStorage.removeItem(params)
|
||||
alert('链接失效!')
|
||||
location.href = location.origin
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const arr = (location.search || "").replace(/^\?/, '').split("&");
|
||||
const params = {};
|
||||
for (const a of arr) {
|
||||
@ -773,6 +795,7 @@ function getRequestParameters() {
|
||||
}
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
||||
function changeRender() {
|
||||
if (global.urlparam["noRender"] === "true") {
|
||||
|
@ -3,7 +3,8 @@ var getDateDaysBefore = function(daysAgo) {
|
||||
var ret = new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000;
|
||||
return ret;
|
||||
};
|
||||
var primaryColor = "#2E324C";
|
||||
|
||||
let primaryColor = "#2E324C";
|
||||
|
||||
// ======Vue start
|
||||
var headerVue = "";
|
||||
@ -26,7 +27,10 @@ var initVue = function() {
|
||||
myRole: "匿名用户",
|
||||
test: "0",
|
||||
selectedSM2Key: "0",
|
||||
productList:[{id:0,title:"ContractProvider"},{id:1,title:"ContractUser"},{id:2,title:"ContractInstanceManager"}],
|
||||
productList: [{id: 0, title: "ContractProvider"}, {id: 1, title: "ContractUser"}, {
|
||||
id: 2,
|
||||
title: "ContractInstanceManager"
|
||||
}],
|
||||
sm2KeyList: []
|
||||
},
|
||||
methods: {
|
||||
@ -114,10 +118,12 @@ var initVue = function() {
|
||||
var newList = [];
|
||||
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;
|
||||
@ -178,18 +184,26 @@ var initVue = function() {
|
||||
};
|
||||
// ======Vue done
|
||||
|
||||
var initGlobal = function() {
|
||||
if (window.global==undefined){
|
||||
var initGlobal = function (urlParams) {
|
||||
if (!window.global) {
|
||||
window.global = {};
|
||||
}
|
||||
global.sm2Key = localStorage.getItem("PrivKey");
|
||||
global.result = "";
|
||||
if (global.sm2Key == undefined || global.sm2Key == null
|
||||
|| global.sm2Key.length < 100) {
|
||||
if (location.href.indexOf("BaaSClient") !== -1) {
|
||||
global.isBaaS = true
|
||||
primaryColor = '#08263a'
|
||||
}
|
||||
if (urlParams && urlParams.keys) {
|
||||
global.urlparam = urlParams;
|
||||
global.sm2Key = urlParams.keys
|
||||
} else {
|
||||
global.sm2Key = localStorage.getItem("PrivKey");
|
||||
if (!global.sm2Key || global.sm2Key.length < 100) {
|
||||
generate();
|
||||
} else {
|
||||
global.sm2Key = JSON.parse(global.sm2Key);
|
||||
}
|
||||
}
|
||||
headerVue.shortName = global.sm2Key.publicKey.substr(0, 5);
|
||||
pubkeyDialogVue.sm2KeyStr = JSON.stringify(global.sm2Key);
|
||||
mainVue.pubDialogVue = pubkeyDialogVue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user