123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- html {
- overflow: hidden;
- resize: none;
- font-size: 16px;
- }
- body {
- font-size: 16px;
- margin: 0;
- padding: 0;
- background-color: rgba(255, 255, 255, 0.8);
- position: relative;
- background-color: #fff;
- background-clip: padding-box;
- border: 0;
- border-radius: 2px;
- box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014,
- 0 9px 28px 8px #0000000d;
- pointer-events: auto;
- height: 100vh;
- }
- #message {
- padding: 10px 16px;
- background: #fff;
- border-radius: 2px;
- pointer-events: all;
- text-align: center;
- color: rgba(0, 0, 0, 0.85);
- font-size: 14px;
- font-variant: tabular-nums;
- line-height: 1.5715rem;
- list-style: none;
- font-feature-settings: 'tnum';
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
- 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
- -webkit-text-size-adjust: 100%;
- word-break: break-all;
- flex-grow: 1;
- text-align: start;
- display: flex;
- }
- #message .anticon {
- position: relative;
- top: -1px;
- margin-right: 8px;
- font-size: 1.57rem;
- /* margin-top: -8px; */
- }
- .message-success .anticon {
- color: #52c41a;
- }
- .message-warning .anticon {
- color: #faad14;
- }
- .message-error .anticon {
- color: #ff4d4f;
- }
- .container {
- /* padding: 24px; */
- font-size: 14px;
- line-height: 1.5715;
- word-wrap: break-word;
- height: 100vh;
- }
- .btn {
- line-height: 1.5715;
- position: relative;
- display: inline-block;
- font-weight: 400;
- white-space: nowrap;
- text-align: center;
- background-image: none;
- border: 1px solid transparent;
- box-shadow: 0 2px #00000004;
- cursor: pointer;
- transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- touch-action: manipulation;
- height: 32px;
- padding: 4px 15px;
- font-size: 14px;
- border-radius: 2px;
- color: #000000d9;
- background: #fff;
- border-color: #d9d9d9;
- }
- .btn:hover,
- .btn:focus,
- .btn:active {
- text-decoration: none;
- background: #fff;
- }
- .btn:hover,
- .btn:focus {
- color: #40a9ff;
- background: #fff;
- border-color: #40a9ff;
- }
- .btn:before {
- position: absolute;
- top: -1px;
- right: -1px;
- bottom: -1px;
- left: -1px;
- z-index: 1;
- display: none;
- background: #fff;
- border-radius: inherit;
- opacity: 0.35;
- transition: opacity 0.2s;
- content: '';
- pointer-events: none;
- }
- .btn-primary {
- color: #fff;
- background: #1890ff;
- border-color: #1890ff;
- text-shadow: 0 -1px 0 rgb(0 0 0 / 12%);
- box-shadow: 0 2px #0000000b;
- }
- .btn-primary:hover,
- .btn-primary:focus {
- color: #fff;
- background: #40a9ff;
- border-color: #40a9ff;
- }
- .btn-danger {
- color: #ff4d4f;
- background-color: #fff;
- border-color: #ff4d4f;
- }
- .btn-danger:hover,
- .btn-danger:focus {
- color: #ff4d4f;
- background-color: #fff;
- border-color: #ff4d4f;
- }
- .btn + .btn {
- margin-bottom: 0;
- margin-left: 8px;
- }
- .btn > span {
- display: inline-block;
- }
- .anticon {
- display: inline-block;
- color: inherit;
- font-style: normal;
- line-height: 0;
- text-align: center;
- text-transform: none;
- vertical-align: -0.125em;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- .container {
- display: flex;
- flex-direction: column;
- }
- #message {
- flex-shrink: 2;
- }
- .header {
- padding: 8px;
- border-bottom: 1px solid #efefef;
- font-size: 1.2rem;
- font-weight: bolder;
- text-align: center;
- }
- .noheader #message {
- margin-top: 32px;
- }
- .flooter {
- padding: 8px;
- border-top: 1px solid #efefef;
- display: flex;
- justify-content: flex-end;
- }
- </style>
- <meta charset="utf-8" />
- <script src="../js/path.js"></script>
- <script src="../js/encode.js"></script>
- <script src="base.js"></script>
- <script src="../js/eventBus.js"></script>
- <script type="text/javascript">
- function createIcon(type) {
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
- svg.setAttribute('viewBox', '64 64 896 896')
- svg.setAttribute('width', '1em')
- svg.setAttribute('height', '1em')
- svg.setAttribute('fill', 'currentColor')
- var path = document.createElementNS(
- 'http://www.w3.org/2000/svg',
- 'path'
- )
- switch (type) {
- case 'success':
- path.setAttribute(
- 'd',
- 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z'
- )
- break
- case 'error':
- path.setAttribute(
- 'd',
- 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z'
- )
- break
- case 'warning':
- path.setAttribute(
- 'd',
- 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z'
- )
- break
- }
- svg.appendChild(path)
- return svg
- }
- function writemessage() {
- var params = getQueryParams()
- window.instid = params.instid
- var container = document.getElementById('message')
- if (!!params.type && params.type !== 'default') {
- var span = document.createElement('span')
- span.className = 'anticon'
- span.appendChild(createIcon(params.type))
- container.className = container.className + ' message-' + params.type
- container.appendChild(span)
- }
- const msg = document.createElement('span')
- msg.innerText = params.message
- container.appendChild(msg)
- if (params.title) {
- document.querySelector('.header>span').innerText = params.title
- } else {
- document.querySelector('.header').style.display = 'none'
- var c = document.querySelector('.container')
- c.classList.add('noheader')
- }
- if (params.btns) {
- var bc = document.createDocumentFragment()
- var btns = JSON.parse(params.btns)
- for (const item of btns) {
- var bt = document.createElement('button')
- var sp = document.createElement('span')
- sp.innerText = item.text
- bt.className = 'btn'
- if (!!item.primary) {
- bt.classList.add('btn-primary')
- }
- if (!!item.danger) {
- bt.classList.add('btn-danger')
- }
- bt.appendChild(sp)
- bt.dataset.key = item.key
- bt.dataset.close = item.close
- bt.addEventListener('click', onclick)
- bc.appendChild(bt)
- }
- document.querySelector('.flooter').appendChild(bc)
- }
- }
- function onclick(event) {
- var ds = event.currentTarget.dataset
- EventBus.Publish(`confirm$${instid}$${ds.key}`)
- if (!!ds.close) window.close()
- }
- function init() {
- StopEscKeyKown()
- writemessage()
- }
- </script>
- </head>
- <body onload="init()">
- <div class="container">
- <div class="header">
- <span>提醒</span>
- </div>
- <div id="message"></div>
- <div class="flooter"></div>
- </div>
- </body>
- </html>
|