index.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>活动</title>
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!--引入 element-ui 的样式,-->
  9. <link rel="stylesheet"
  10. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  11. <!-- 必须先引入vue, 后使用element-ui -->
  12. <script
  13. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  14. <!-- 引入element 的组件库-->
  15. <script
  16. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  17. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  18. <!-- <script src="js/vconsole.min.js"></script>
  19. <script>
  20. var vConsole = new window.VConsole();
  21. </script> -->
  22. </head>
  23. <style>
  24. body {
  25. margin: 0;
  26. padding: 0;
  27. }
  28. #box {
  29. width: 100vw;
  30. height: 100vh;
  31. box-sizing: border-box;
  32. }
  33. </style>
  34. <body>
  35. <div id="box">
  36. </div>
  37. <script>
  38. new Vue({
  39. el: '#box',
  40. data () {
  41. return {
  42. env: '',
  43. httpUrl: '',
  44. h5Type: null,
  45. bId: null,
  46. }
  47. },
  48. created () {
  49. this.bId = this.getQueryParam('bId')
  50. this.env = this.getQueryParam('env')
  51. this.h5Type = this.getQueryParam('h5Type')
  52. if (!this.env || this.env === 'prod') {
  53. this.httpUrl = 'https://wlapi.wefanbot.com'
  54. } else {
  55. this.httpUrl = 'http://test.wefanbot.com:18993'
  56. }
  57. localStorage.removeItem('openId')
  58. this.ifH5Type()
  59. },
  60. methods: {
  61. // 公众号授权,获取code
  62. getAuth () {
  63. // 获取url上的code
  64. let code = this.getQueryParam('code')
  65. if (code) {
  66. // 判断业务id是否生产环境业务id
  67. fetch(this.httpUrl + `/p/insuite/p/isProdId?id=${this.bId}`)
  68. .then(res => {
  69. return res.json()
  70. }).then(result => {
  71. let { data, msg } = result
  72. if (typeof data === 'boolean' && data) {
  73. this.httpUrl = 'https://wlapi.wefanbot.com'
  74. } else {
  75. this.httpUrl = 'http://test.wefanbot.com:18993'
  76. }
  77. this.getInfoByh5Code(this.getQueryParam('code'))
  78. })
  79. } else {
  80. let redirect_uri = window.location.href
  81. // code 不存在,走微信网页授权逻辑
  82. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
  83. window.location.replace(url)
  84. }
  85. },
  86. getInfoByh5Code (code) {
  87. fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
  88. .then(res => {
  89. return res.json()
  90. }).then(result => {
  91. let { data, code, msg } = result
  92. if (code === 1) {
  93. this.h5Type = data.h5Type
  94. localStorage.setItem('openId', data.openId)
  95. this.ifH5Type();
  96. }
  97. })
  98. },
  99. ifH5Type () {
  100. if (this.h5Type == 19 || this.h5Type == 30) {
  101. // 抽奖
  102. var currentQueryParams = window.location.search;
  103. window.location.replace('lottery.html' + currentQueryParams)
  104. } else if (this.h5Type == 20) {
  105. // 宝骏云海送祝福
  106. var currentQueryParams = window.location.search;
  107. window.location.replace('h5Type-20.html' + currentQueryParams)
  108. } else if (this.h5Type == 21) {
  109. // 活码
  110. var currentQueryParams = window.location.search;
  111. window.location.replace('live_code.html' + currentQueryParams)
  112. } else if (this.h5Type == 22) {
  113. // 红包兑换
  114. var currentQueryParams = window.location.search;
  115. window.location.replace('receiveMoney.html' + currentQueryParams)
  116. } else if (this.h5Type == 23) {
  117. // 会话列表
  118. var currentQueryParams = window.location.search;
  119. window.location.replace('sessionList.html' + currentQueryParams)
  120. } else if (this.h5Type == 24) {
  121. // 客户SOP提醒
  122. var currentQueryParams = window.location.search;
  123. window.location.replace('clientSopTip.html' + currentQueryParams)
  124. } else if (this.h5Type == 25) {
  125. // 客户SOP内容
  126. var currentQueryParams = window.location.search;
  127. window.location.replace('clientSop.html' + currentQueryParams)
  128. } else if (this.h5Type == 26) {
  129. // 群SOP提醒
  130. var currentQueryParams = window.location.search;
  131. window.location.replace('groupSopTip.html' + currentQueryParams)
  132. } else if (this.h5Type == 27) {
  133. // 群SOP内容
  134. var currentQueryParams = window.location.search;
  135. window.location.replace('groupSop.html' + currentQueryParams)
  136. } else if (this.h5Type == 28) {
  137. // 点亮五菱
  138. var currentQueryParams = window.location.search;
  139. window.location.replace('lightUpWl.html' + currentQueryParams)
  140. } else if (this.h5Type == 29) {
  141. // 车主筛选,试驾筛选,预约试驾
  142. var currentQueryParams = window.location.search;
  143. window.location.replace('carOwnerScreening.html' + currentQueryParams)
  144. } else if (this.h5Type == 31) {
  145. // 活动报名
  146. var currentQueryParams = window.location.search;
  147. window.location.replace('registrationActivity.html' + currentQueryParams)
  148. } else if (this.h5Type == 32) {
  149. // 核销
  150. var currentQueryParams = window.location.search;
  151. window.location.replace('signUp.html' + currentQueryParams)
  152. } else if (this.h5Type == 33) {
  153. // 跟进列表
  154. var currentQueryParams = window.location.search;
  155. window.location.replace('followUpList.html' + currentQueryParams)
  156. } else if (this.h5Type == 34) {
  157. // 客户画像
  158. var currentQueryParams = window.location.search;
  159. window.location.replace('userProfile.html' + currentQueryParams)
  160. } else if (this.h5Type == 35) {
  161. // 客户画像
  162. var currentQueryParams = window.location.search;
  163. window.location.replace('onePersonOneCode.html' + currentQueryParams)
  164. } else if (!this.h5Type) {
  165. this.getAuth()
  166. }
  167. },
  168. // 截取url中的数据
  169. getQueryParam (paramName) {
  170. // 获取当前URL的查询字符串部分
  171. const queryString = window.location.search;
  172. // 创建一个URLSearchParams对象
  173. const urlParams = new URLSearchParams(queryString);
  174. // 返回指定参数的值,如果不存在则返回null
  175. return urlParams.get(paramName);
  176. },
  177. }
  178. })
  179. </script>
  180. </body>
  181. </html>