feat: 初始化
This commit is contained in:
202
static/html/livechat.html
Normal file
202
static/html/livechat.html
Normal file
@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
||||
<style type="text/css">
|
||||
html,
|
||||
body {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
#chat-widget-minimized {
|
||||
opacity: 0;
|
||||
}
|
||||
.spinWrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
|
||||
.spin {
|
||||
position: relative;
|
||||
top: -10px;
|
||||
left: -10px;
|
||||
}
|
||||
.spinItem:nth-child(1) {
|
||||
top: 25px;
|
||||
left: 0;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.12s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.12s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(2) {
|
||||
top: 17.04545px;
|
||||
left: 17.04545px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.24s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.24s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(3) {
|
||||
top: 0;
|
||||
left: 25px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.36s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.36s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(4) {
|
||||
top: -17.04545px;
|
||||
left: 17.04545px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.48s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.48s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(5) {
|
||||
top: -25px;
|
||||
left: 0;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.6s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.6s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(6) {
|
||||
top: -17.04545px;
|
||||
left: -17.04545px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.72s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.72s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(7) {
|
||||
top: 0;
|
||||
left: -25px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.84s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.84s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem:nth-child(8) {
|
||||
top: 17.04545px;
|
||||
left: -17.04545px;
|
||||
-webkit-animation: ball-spin-fade-loader 1s -0.96s infinite linear;
|
||||
animation: ball-spin-fade-loader 1s -0.96s infinite linear;
|
||||
}
|
||||
|
||||
.spinItem {
|
||||
background-color: currentColor;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 100%;
|
||||
margin: 2px;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
@-webkit-keyframes ball-spin-fade-loader {
|
||||
50% {
|
||||
opacity: 0.3;
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes ball-spin-fade-loader {
|
||||
50% {
|
||||
opacity: 0.3;
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="spinWrapper" id="spinWrapper">
|
||||
<div class="spin" style="color: #0E3673">
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
<div class="spinItem"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<!-- uni 的 SDK -->
|
||||
<!-- 需要把 uni.webview.1.5.6.js 下载到自己的服务器 -->
|
||||
<script type="text/javascript" src="./uni.webview.1.5.6.js"></script>
|
||||
<script type="text/javascript">
|
||||
function initLiveChat() {
|
||||
window.__lc = window.__lc || {};
|
||||
window.__lc.license = 15504243;
|
||||
(function(n, t, c) {
|
||||
function i(n) {
|
||||
return e._h ? e._h.apply(null, n) : e._q.push(n);
|
||||
}
|
||||
var e = {
|
||||
_q: [],
|
||||
_h: null,
|
||||
_v: '2.0',
|
||||
on: function() {
|
||||
i(['on', c.call(arguments)]);
|
||||
},
|
||||
once: function() {
|
||||
i(['once', c.call(arguments)]);
|
||||
},
|
||||
off: function() {
|
||||
i(['off', c.call(arguments)]);
|
||||
},
|
||||
get: function() {
|
||||
if (!e._h) throw new Error("[LiveChatWidget] You can't use getters before load.");
|
||||
return i(['get', c.call(arguments)]);
|
||||
},
|
||||
call: function() {
|
||||
i(['call', c.call(arguments)]);
|
||||
},
|
||||
init: function() {
|
||||
var n = t.createElement('script');
|
||||
(n.async = !0), (n.type = 'text/javascript'), (n.src =
|
||||
'https://cdn.livechatinc.com/tracking.js'), t.head.appendChild(n);
|
||||
}
|
||||
};
|
||||
e.on('ready', (data) => {
|
||||
|
||||
e.call("maximize");
|
||||
});
|
||||
e.on('visibility_changed', (data) => {
|
||||
switch (data.visibility) {
|
||||
case "maximized":
|
||||
break;
|
||||
case "minimized":
|
||||
case "hidden":
|
||||
uni.navigateBack()
|
||||
break;
|
||||
}
|
||||
});
|
||||
!n.__lc.asyncInit && e.init(), (n.LiveChatWidget = n.LiveChatWidget || e);
|
||||
})(window, document, [].slice);
|
||||
}
|
||||
// 待触发 `UniAppJSBridgeReady` 事件后,即可调用 uni 的 API。
|
||||
document.addEventListener('UniAppJSBridgeReady', function() {
|
||||
uni.getEnv(function(res) {
|
||||
console.log('当前环境:' + JSON.stringify(res));
|
||||
});
|
||||
initLiveChat()
|
||||
});
|
||||
</script>
|
||||
</html>
|
Reference in New Issue
Block a user