index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>朗读小咖秀</title>
  7. </head>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. #container {
  14. overflow: hidden;
  15. width: 100%;
  16. height: 51.1733rem;
  17. margin-bottom: 1.8667rem;
  18. background: url('http://reader-wx.ai160.com/images/reader/v3/bg.jpg') no-repeat;
  19. background-size: 100% 100%;
  20. }
  21. .commoditys {
  22. display: flex;
  23. align-items: center;
  24. justify-content: space-between;
  25. margin: 5.2267rem auto;
  26. width: 9.0133rem;
  27. height: 3.4667rem;
  28. padding: 14px 10px;
  29. box-sizing: border-box;
  30. border-radius: 20px;
  31. }
  32. .commodity {
  33. position: relative;
  34. width: 97px;
  35. height: 97px;
  36. border-radius: 6px;
  37. border: 2px solid white;
  38. }
  39. .active {
  40. position: absolute;
  41. width: 27px;
  42. height: 18px;
  43. right: 0;
  44. bottom: 0;
  45. }
  46. .aborder {
  47. border-color: #ff935e;
  48. }
  49. .c-1 {
  50. background: url('http://reader-wx.ai160.com/images/reader/v3/299.png');
  51. background-size: contain;
  52. }
  53. .c-2 {
  54. background: url('http://reader-wx.ai160.com/images/reader/v3/99.png');
  55. background-size: contain;
  56. }
  57. .c-3 {
  58. background: url('http://reader-wx.ai160.com/images/reader/v3/15.png');
  59. background-size: contain;
  60. }
  61. .payBox {
  62. position: fixed;
  63. display: flex;
  64. align-items: center;
  65. justify-content: space-between;
  66. box-sizing: border-box;
  67. left: 0;
  68. bottom: 0;
  69. width: 100%;
  70. padding: 15px 18px;
  71. background: white;
  72. }
  73. .payBox .left {
  74. font-size: 0.48rem;
  75. }
  76. .price {
  77. color: #ff9108;
  78. font-size: 0.64rem;
  79. font-weight: bold;
  80. }
  81. .pay {
  82. padding: 0.1867rem 0.6933rem;
  83. background: #ff9108;
  84. color: white;
  85. font-weight: 500;
  86. border-radius: 0.6133rem;
  87. font-size: 0.48rem;
  88. }
  89. </style>
  90. <body>
  91. <div id="container">
  92. <div class="commoditys" v-if="products.length>0">
  93. <div :class="['commodity c-1', active==products[0].id?'aborder':'']" @click="selected(products[0])">
  94. <img src="http://reader-wx.ai160.com/images/reader/v3/active.png" class="active" v-show="active==products[0].id" />
  95. </div>
  96. <div :class="['commodity c-2', active==products[2].id?'aborder':'']" @click="selected(products[2])">
  97. <img src="http://reader-wx.ai160.com/images/reader/v3/active.png" class="active" v-show="active==products[2].id" />
  98. </div>
  99. <div :class="['commodity c-3', active==products[1].id?'aborder':'']" @click="selected(products[1])">
  100. <img src="http://reader-wx.ai160.com/images/reader/v3/active.png" class="active" v-show="active==products[1].id" />
  101. </div>
  102. </div>
  103. <div class="payBox">
  104. <div class="left">
  105. 终身会员
  106. <span class="price">{{product.price/100}}</span>
  107. </div>
  108. <div class="pay" @click="pay">立即支付</div>
  109. </div>
  110. </div>
  111. </body>
  112. <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
  113. <script src="https://g.tbcdn.cn/mtb/lib-flexible/0.3.2/??flexible_css.js,flexible.js"></script>
  114. <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.min.js"></script>
  115. <script>
  116. let xhr = new XMLHttpRequest()
  117. let app = new Vue({
  118. el: '#container',
  119. data: {
  120. products: [],
  121. product: {},
  122. active: ''
  123. },
  124. mounted() {
  125. axios({
  126. method: 'get',
  127. url: 'https://reader-api.efunbox.cn/wx/v3/product/learn',
  128. headers: {
  129. uid: 'd83d947655f6455a96f4197d31afa6d4',
  130. channelCode: '3001'
  131. }
  132. }).then(res => {
  133. this.products = res.data.data.productList
  134. console.log(this.products)
  135. this.active = res.data.data.productList[0].id
  136. this.product = res.data.data.productList[0]
  137. })
  138. },
  139. methods: {
  140. selected(e) {
  141. this.active = e.id
  142. this.product = e
  143. },
  144. pay() {
  145. axios({
  146. method: 'post',
  147. url: 'https://reader-api.efunbox.cn/order/create',
  148. headers: {
  149. uid: 'd83d947655f6455a96f4197d31afa6d4',
  150. channelCode: '3001'
  151. },
  152. data: {
  153. productId: this.active
  154. }
  155. }).then(res => {
  156. console.log(res)
  157. axios({
  158. method: 'post',
  159. url: 'https://reader-api.efunbox.cn/wx/pay/efun',
  160. headers: {
  161. uid: 'd83d947655f6455a96f4197d31afa6d4',
  162. channelCode: '3001'
  163. },
  164. data: {
  165. payType: 'WXPAY',
  166. orderId: res.data.data
  167. }
  168. }).then(res => {})
  169. /* WeixinJSBridge.invoke(
  170. 'getBrandWCPayRequest',
  171. {
  172. appId: res.appId, //公众号ID,由商户传入2
  173. timeStamp: res.timeStamp, //时间戳,自1970年以来的秒数
  174. nonceStr: res.nonceStr, //随机串
  175. package: res.package,
  176. signType: res.signType, //微信签名方式:
  177. paySign: res.paySign //微信签名
  178. },
  179. async res => {
  180. if (res.err_msg == 'get_brand_wcpay_request:ok') {
  181. payIsSuccess()
  182. }
  183. }
  184. ) */
  185. })
  186. },
  187. getWxCode() {
  188. const appId = 'wx35303262fa755a18'
  189. const redirect_uri = encodeURIComponent('https://zxtx-web.efunbox.cn/login')
  190. const url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appId + '&redirect_uri=' + redirect_uri + '&response_type=code&scope=snsapi_base#wechat_redirect'
  191. location.href = url
  192. }
  193. }
  194. })
  195. </script>
  196. </html>