panda 1 سال پیش
والد
کامیت
e8750bad6a
2فایلهای تغییر یافته به همراه164 افزوده شده و 0 حذف شده
  1. 5 0
      application/index/controller/Index.php
  2. 159 0
      application/index/view/index/pay.html

+ 5 - 0
application/index/controller/Index.php

@@ -34,6 +34,11 @@ class Index extends Frontend
         ]);
     }
 
+    public function pay()
+    {
+        return $this->view->fetch();
+    }
+
     public function index()
     {
         $code = input('code', '', 'trim'); //邀请码

+ 159 - 0
application/index/view/index/pay.html

@@ -0,0 +1,159 @@
+<html><head>
+    <title>打开小程序</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
+    <!-- <script>
+      window.onerror = e => {
+        console.error(e)
+        alert('发生错误' + e)
+      }
+    </script> -->
+    <!-- weui 样式 -->
+    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css">
+    <style>
+      .hidden {
+        display: none;
+      }
+
+      .full {
+        position: absolute;
+        top: 0;
+        bottom: 0;
+        left: 0;
+        right: 0;
+      }
+
+      .public-web-container {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+      }
+	  .tips-wrap{
+		  position: absolute;
+		  top: 60%;
+		   width: 100%;
+		   display: flex;
+		  justify-content: center;
+		  align-items: center;
+		  flex-direction: row;
+		  padding: 0 15px;
+		  height: 60px;
+		  width: 400px;
+	  }
+	  .tips-wrap .txt{
+		  color: #333;
+		  font-size: 14px;
+		  text-align: center;
+	  }
+	  .tips-wrap .btn{
+		  margin-right: 0;
+		  margin-left: 12px;
+		  background-color: #333;
+		  color:#fff;
+		  border-radius: 6px;
+		  height: 30px;
+		  line-height: 30px;
+		  text-align: center;
+		  font-size: 14px;
+		  width: 50px;
+		  border: none;
+	  }
+
+      .public-web-container p {
+        position: absolute;
+        top: 40%;
+      }
+
+      .public-web-container a {
+        position: absolute;
+        top: 50%;
+      }
+
+      .wechat-web-container {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+      }
+
+      .wechat-web-container p {
+        position: absolute;
+        top: 40%;
+      }
+
+      .wechat-web-container wx-open-launch-weapp {
+        position: absolute;
+        /* bottom: 40%; */
+		top:50%;
+        left: 0;
+        right: 0;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+      }
+
+      .desktop-web-container {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+      }
+
+      .desktop-web-container p {
+        position: absolute;
+        top: 40%;
+      }
+	  
+	  .logo{
+		 width: 80px;
+		 height: 120px;
+		 position: absolute;
+		 left: 50%;
+		 top: 10%;
+		 transform: translateX(-50%);
+	  }
+	  .paybtn{
+		  background-color: #FF60B3 !important;
+          border-radius: 100px;
+	  }
+    </style>
+  </head>
+  <body>
+    <div class="page full">
+	  <!-- <img src="./log_logo.png" class="logo"> -->
+      <div id="public-web-container" class="full public-web-container">
+       <p class="">正在打开支付页面...</p> 
+        <a id="public-web-jump-button" href="javascript:;" class="weui-btn weui-btn_primary paybtn" onclick="openWeapp()">
+            <span id="public-web-jump-button-loading" class="weui-primary-loading weui-primary-loading_transparent hidden">
+			  <i class="weui-primary-loading__dot"></i>
+		    </span>
+            去支付
+        </a>
+		<!-- <div class="tips-wrap">
+			<span class="txt">如您已支付完成,可点击返回首页</span>
+			<span class="btn" onclick="back()">返回</span>
+		</div> -->
+      </div>
+    </div>
+  
+</body></html>
+<script>
+    function getUrlCode (name) {
+        return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
+    }
+    function downloadFunc(href) {
+        if (href) {
+            let a = document.createElement('a')
+            a.href = href //  URL对象
+            a.click() // 模拟点击
+            URL.revokeObjectURL(a.href) // 释放URL 对象
+        }
+    }
+    let href = getUrlCode('url');
+    // console.log('href---',href);
+    if(href){
+        downloadFunc(href);
+    }
+    
+    function openWeapp(){
+        location.href = href;
+    }
+</script>