mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-17 16:05:53 +08:00
commit message
This commit is contained in:
123
hybrid/html/advertise/advertise.html
Normal file
123
hybrid/html/advertise/advertise.html
Normal file
@@ -0,0 +1,123 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>广告启动页</title>
|
||||
<link rel="stylesheet" href="../css/advertise.css">
|
||||
<!-- uni 的 SDK -->
|
||||
<script type="text/javascript" src="../js/webView.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="con">
|
||||
<img id="img" src="../imgs/domain.jpeg">
|
||||
</div>
|
||||
<div class="btn" id="timer">
|
||||
<div id="info">跳过</div>
|
||||
<div class="circleProgress_wrapper btn">
|
||||
<div class="wrapper right">
|
||||
<div class="circleProgress rightcircle"></div>
|
||||
</div>
|
||||
<div class="wrapper left">
|
||||
<div class="circleProgress leftcircle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
||||
// var currentAd = {
|
||||
// operation_type: 'NONE'
|
||||
// };
|
||||
|
||||
|
||||
// function getRandom(start, end, fixed = 0) {
|
||||
// let differ = end - start
|
||||
// let random = Math.random()
|
||||
// return (start + differ * random).toFixed(fixed)
|
||||
// }
|
||||
|
||||
// document.addEventListener('plusready', function () {
|
||||
// var xhr = new plus.net.XMLHttpRequest();
|
||||
// xhr.onreadystatechange = function () {
|
||||
// switch (xhr.readyState) {
|
||||
// case 0:
|
||||
// break;
|
||||
// case 1:
|
||||
// break;
|
||||
// case 2:
|
||||
// break;
|
||||
// case 3:
|
||||
// break;
|
||||
// case 4:
|
||||
// if (xhr.status == 200) {
|
||||
// let res = JSON.parse(xhr.responseText);
|
||||
// if (res.length > 0) {
|
||||
// currentAd = res[getRandom(0, res.length - 1)];
|
||||
// document.getElementById("img").src = currentAd.pic_url;
|
||||
// } else {
|
||||
// plus.webview.currentWebview().close();
|
||||
// }
|
||||
// //alert("xhr请求成功:" + xhr.responseText);
|
||||
// } else {
|
||||
// plus.webview.currentWebview().close();
|
||||
// //alert("xhr请求失败:" + xhr.readyState);
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// // xhr.open("GET", "https://api-buyer-app.yinbei.cn/advertisement");
|
||||
// xhr.send();
|
||||
// }, false);
|
||||
|
||||
|
||||
// document.addEventListener('UniAppJSBridgeReady', function () {
|
||||
// document.querySelector('.con').addEventListener('click', function (e) {
|
||||
// if (e.isTrusted) {
|
||||
// plus.webview.currentWebview().close();
|
||||
// switch (currentAd.operation_type) {
|
||||
// // 链接地址
|
||||
// case 'URL':
|
||||
// plus.webview.open(currentAd.operation_url)
|
||||
// break;
|
||||
// // 商品
|
||||
// case 'GOODS':
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/product/goods?id=` + currentAd.operation_param
|
||||
// });
|
||||
// break;
|
||||
// // 关键字
|
||||
// case 'KEYWORD':
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/recommend/recommend' + currentAd.operation_param
|
||||
// });
|
||||
// break;
|
||||
// // 店铺
|
||||
// case 'store':
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/product/shopPage?id=` + currentAd.operation_param
|
||||
// });
|
||||
// break;
|
||||
// // 分类
|
||||
// case 'CATEGORY':
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/category/category'
|
||||
// });
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// document.querySelector('.btn').addEventListener('click', function (e) {
|
||||
// if (e.isTrusted) {
|
||||
// plus.webview.currentWebview().close();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
</html>
|
||||
149
hybrid/html/css/advertise.css
Normal file
149
hybrid/html/css/advertise.css
Normal file
@@ -0,0 +1,149 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content .con {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#timer {
|
||||
display: inline-block;
|
||||
position: fixed;
|
||||
top: 40px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
#info {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.circleProgress_wrapper {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 18px;
|
||||
height: 36px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.circleProgress {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 2px solid #FFFFFF;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.rightcircle {
|
||||
border-top: 2px solid #03A9F4;
|
||||
border-right: 2px solid #03A9F4;
|
||||
right: 0;
|
||||
-webkit-animation: circleProgressLoad_right 4s linear;
|
||||
/*动画停留在最后一帧*/
|
||||
animation-fill-mode: forwards;
|
||||
-moz-animation-fill-mode: forwards;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
-o-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
.leftcircle {
|
||||
border-bottom: 2px solid #03A9F4;
|
||||
border-left: 2px solid #03A9F4;
|
||||
left: 0;
|
||||
-webkit-animation: circleProgressLoad_left 4s linear;
|
||||
/*动画停留在最后一帧*/
|
||||
animation-fill-mode: forwards;
|
||||
-moz-animation-fill-mode: forwards;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
-o-animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@-webkit-keyframes circleProgressLoad_right {
|
||||
0% {
|
||||
border-top: 2px solid #03A9F4;
|
||||
border-right: 2px solid #03A9F4;
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
|
||||
50% {
|
||||
border-top: 2px solid #03A9F4;
|
||||
border-right: 2px solid #03A9F4;
|
||||
border-left: 2px solid #FFFFFF;
|
||||
border-bottom: 2px solid #FFFFFF;
|
||||
-webkit-transform: rotate(225deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
border-left: 2px solid #FFFFFF;
|
||||
border-bottom: 2px solid #FFFFFF;
|
||||
-webkit-transform: rotate(225deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes circleProgressLoad_left {
|
||||
0% {
|
||||
border-bottom: 2px solid #03A9F4;
|
||||
border-left: 2px solid #03A9F4;
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
|
||||
50% {
|
||||
border-bottom: 2px solid #03A9F4;
|
||||
border-left: 2px solid #03A9F4;
|
||||
border-top: 2px solid #FFFFFF;
|
||||
border-right: 2px solid #FFFFFF;
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
border-top: 2px solid #FFFFFF;
|
||||
border-right: 2px solid #FFFFFF;
|
||||
-webkit-transform: rotate(225deg);
|
||||
}
|
||||
}
|
||||
94
hybrid/html/error.html
Normal file
94
hybrid/html/error.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>服务器异常</title>
|
||||
|
||||
<script type="text/javascript" src="./js/webView.js"></script>
|
||||
<script type="text/javascript">
|
||||
// H5 plus事件处理
|
||||
var ws = null;
|
||||
|
||||
function plusReady() {
|
||||
// Android处理返回键
|
||||
plus.key.addEventListener('backbutton', function() {
|
||||
(history.length == 1) && ws.close();
|
||||
var c = setTimeout(function() {
|
||||
ws.close();
|
||||
}, 1000);
|
||||
window.onbeforeunload = function() {
|
||||
clearTimeout(c);
|
||||
}
|
||||
history.go(-2);
|
||||
}, false);
|
||||
ws = plus.webview.currentWebview();
|
||||
}
|
||||
if (window.plus) {
|
||||
plusReady();
|
||||
} else {
|
||||
document.addEventListener('plusready', plusReady, false);
|
||||
}
|
||||
document.addEventListener('touchstart', function() {
|
||||
return false;
|
||||
}, true);
|
||||
// 禁止选择
|
||||
document.oncontextmenu = function() {
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 80px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 14px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 150px;
|
||||
height: 130px;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 1px solid #1ABC9C;
|
||||
border-radius: 2px;
|
||||
background-color: #FFFFFF;
|
||||
color: #1ABC9C;
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
margin-bottom: 30px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.go-index {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="text">服务器异常</div>
|
||||
<button onclick="if(history.length == 1){ws.close();}else{ws.back();ws.back();}">点击刷新</button>
|
||||
<button onclick="ws.close()">点击关闭</button>
|
||||
<button onclick="plus.runtime.restart()">点击重启</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
hybrid/html/imgs/domain.jpeg
Normal file
BIN
hybrid/html/imgs/domain.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
1
hybrid/html/js/webView.js
Normal file
1
hybrid/html/js/webView.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E}));
|
||||
Reference in New Issue
Block a user