index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="main">
  3. <!-- pc -->
  4. <div v-if="device == 'chrome' || device == 'no-chrome'" class="content">
  5. <v-logo></v-logo>
  6. <div class="tool-cover">
  7. <img :src="detail.postBizData.convertUrl" alt="">
  8. </div>
  9. <!-- 非chrome -->
  10. <div v-if="device == 'no-chrome'">
  11. <div class="txt">Use chrome browser to access Subway Surfers</div>
  12. <install-chrome></install-chrome>
  13. </div>
  14. <!-- chrome -->
  15. <div v-if="device == 'chrome'">
  16. <div class="txt">Use chrome browser to access Subway Surfers</div>
  17. <install-extension :extensionsInstallUrl="config.extensionsInstallUrl"></install-extension>
  18. </div>
  19. </div>
  20. <!-- 移动端 -->
  21. <div v-if="device == 'ios' || device == '安卓'" class="mobile">
  22. <div class="mobile-content">
  23. <img :src="detail.postBizData.convertUrl" alt="">
  24. <div class="title">Open link on PC to use Subway Surfers</div>
  25. </div>
  26. <div class="area-button">
  27. <div class="btn1" @click="clickExtension">
  28. Install Chrome Extension
  29. </div>
  30. <div class="btn2" @click="clickCopy" :data-clipboard-text="copy_link">
  31. Copy Link
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import VLogo from '@/components/logo.vue'
  39. import InstallChrome from '@/components/InstallChrome.vue'
  40. import InstallExtension from '@/components/InstallExtension.vue'
  41. import { getBrowserType, baseURL, appVersionCode, jumpUrl } from '@/utils/help.js'
  42. import axios from 'axios'
  43. import { Toast } from 'vant';
  44. var ClipboardJS = require('clipboard')
  45. export default {
  46. name: 'tool_box',
  47. data() {
  48. return {
  49. config: {},
  50. copy_link: '',
  51. title: 'Install DeNet Plugin to Participate',
  52. metaTitle: 'Install DeNet Plugin to Participate',
  53. device: '',
  54. detail: {}
  55. }
  56. },
  57. head() {
  58. return {
  59. type: '',
  60. title: this.title,
  61. appVersionCode: appVersionCode,
  62. meta: [
  63. // facebook
  64. {
  65. name: 'og:url',
  66. content: jumpUrl + 'toolbox/' + this.$route.params.id
  67. },
  68. {
  69. name: 'og:title',
  70. content: this.metaTitle
  71. },
  72. {
  73. name: 'og:image',
  74. content: this.detail.postBizData.convertUrl || ''
  75. },
  76. // twitter
  77. {
  78. name: 'twitter:card',
  79. content: 'summary_large_image'
  80. },
  81. {
  82. name: 'twitter:url',
  83. content: jumpUrl + 'toolbox/' + this.$route.params.id
  84. },
  85. {
  86. name: 'twitter:title',
  87. content: this.metaTitle
  88. },
  89. {
  90. name: 'twitter:image',
  91. content: this.detail.postBizData.convertUrl || ''
  92. }
  93. ]
  94. }
  95. },
  96. components: {
  97. VLogo,
  98. InstallChrome,
  99. InstallExtension
  100. },
  101. async asyncData(params) {
  102. let { route } = params;
  103. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  104. baseInfo: {
  105. appVersionCode: appVersionCode,
  106. mid: '00000000-0000-0000-0000-000000000000',
  107. },
  108. params: {
  109. postId: route.params.id || ''
  110. }
  111. })
  112. if (data.code == 0) {
  113. if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
  114. data.data.postBizData = JSON.parse(data.data.postBizData)
  115. }
  116. if (data.data.postBizData === null) {
  117. data.data.postBizData = {
  118. postUserInfo: {}
  119. }
  120. }
  121. console.log('detail', data.data)
  122. return {
  123. detail: data.data,
  124. }
  125. }
  126. },
  127. mounted() {
  128. this.copy_link = window.location.href
  129. this.device = getBrowserType()
  130. this.getConfig()
  131. console.log('device',this.device)
  132. },
  133. methods: {
  134. async getConfig() {
  135. let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
  136. baseInfo: {
  137. appVersionCode: this.appVersionCode,
  138. mid: this.mid
  139. },
  140. params: {
  141. }
  142. })
  143. if (data.code == 0) {
  144. this.config = data.data;
  145. }
  146. },
  147. clickCopy() {
  148. // 复制链接
  149. var clipboard = new ClipboardJS('.btn2');
  150. clipboard.on('success', function (e) {
  151. Toast('copy success');
  152. e.clearSelection();
  153. });
  154. clipboard.on('error', function (e) {
  155. Toast('copy error');
  156. });
  157. },
  158. clickExtension() {
  159. window.open(this.config.extensionsInstallUrl)
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" >
  165. html,
  166. body,
  167. #__nuxt,
  168. #__layout {
  169. margin: 0;
  170. padding: 0;
  171. width: 100%;
  172. height: 100%;
  173. background: #F5FAFF;
  174. }
  175. .main {
  176. width: 100%;
  177. height: 100%;
  178. .tool-cover {
  179. min-width: 400px;
  180. margin-right: 90px;
  181. img {
  182. max-height: 270px;
  183. }
  184. }
  185. .content {
  186. width: 100%;
  187. height: 100%;
  188. display: flex;
  189. justify-content: center;
  190. align-items: center;
  191. padding-bottom: 70px;
  192. .txt {
  193. width: 400px;
  194. font-weight: 700;
  195. font-size: 36px;
  196. line-height: 44px;
  197. /* or 122% */
  198. letter-spacing: 0.3px;
  199. color: #323232;
  200. margin-bottom: 40px;
  201. }
  202. }
  203. .mobile {
  204. .mobile-content {
  205. padding: 36px 16px 0 16px;
  206. img {
  207. width: 100%;
  208. margin-bottom: 25px;
  209. border-radius: 5px;
  210. }
  211. .title {
  212. font-weight: 700;
  213. font-size: 22px;
  214. line-height: 26px;
  215. text-align: center;
  216. letter-spacing: 0.3px;
  217. color: #000000;
  218. width: 240px;
  219. margin: 0 auto;
  220. }
  221. }
  222. .area-button {
  223. position: fixed;
  224. width: 100%;
  225. padding: 27px 16px 25px 16px;
  226. bottom: 0;
  227. height: 170px;
  228. .btn1 {
  229. height: 50px;
  230. line-height: 50px;
  231. background: #1D9BF0;
  232. border-radius: 100px;
  233. width: 100%;
  234. font-weight: 600;
  235. font-size: 18px;
  236. text-align: center;
  237. letter-spacing: 0.3px;
  238. color: #FFFFFF;
  239. margin-bottom: 16px;
  240. }
  241. .btn2 {
  242. height: 50px;
  243. line-height: 50px;
  244. background: rgba(29, 155, 240, 0.01);
  245. border: 1px solid #1D9BF0;
  246. border-radius: 100px;
  247. width: 100%;
  248. font-weight: 600;
  249. font-size: 18px;
  250. text-align: center;
  251. letter-spacing: 0.3px;
  252. color: #1D9BF0;
  253. }
  254. }
  255. }
  256. }
  257. </style>