list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="bg101010">
  3. <van-skeleton :row="4" :loading="isLoading" avatar-shape="square" />
  4. <div v-for="item in list" :key="item.id" class="m15">
  5. <div style="display: flex;align-items: center;">
  6. <div class="wh60">
  7. <img class="wh56" :src="iconURL(item.giftBagFileKey)" alt="" />
  8. </div>
  9. <div class="ml12">
  10. <div class="txt1">{{item.giftBagName.length > 8 ? item.giftBagName.slice(0, 8) + '...' : item.giftBagName}}</div>
  11. <div class="txt2">{{item.giftBagDetailed}}</div>
  12. </div>
  13. </div>
  14. <div :class="item.availableStatus === 1 ? 'gift-btn disabled' : 'gift-btn'" @click="receive(item)">{{['领取', '已领完', '查看'][item.availableStatus]}}</div>
  15. </div>
  16. <img class="w80h67" src="~/assets/image/activity/welfare-community/return.png" alt="" @click="returnUp">
  17. <van-popup v-model="showVideoSuccess" style="background: transparent;color: #999;" closeable close-icon-position="top-right" :close-on-click-overlay="false">
  18. <div class="w290h215 dialog-view">
  19. <div class="txt3">恭喜您获得礼包</div>
  20. <div class="txt4">请在游戏中兑换<br />激活码为:{{gameActivationCode}}。<span class="c3B86FF">复制</span></div>
  21. <div class="buy-btn">购买云机</div>
  22. </div>
  23. </van-popup>
  24. <van-popup v-model="showAd" style="background: transparent;color: #999;" :close-on-click-overlay="false">
  25. <div v-for="(item, index) in adlist" :key="item.id">
  26. <div v-if="index === 0" class="fwc">
  27. <div v-if="time" class="countdown">{{time}}s后关闭广告</div>
  28. <video ref="videoPlayer" class="w290h330" src="https://file.phone.androidscloud.com:8121/document/newFile/download/0//d1cb3a61add6434b8954?fileKey=LowLevelMultipartUpload_23670475553534361666" :controls="false" :autoplay="false" :muted="true" :loop="false" @ended="ended" />
  29. <van-icon name="close" color="#999999" size="34" style="margin:15px auto 0;" @click="showAd=false;getAppGameGiftActivityDetailsList()" />
  30. </div>
  31. </div>
  32. </van-popup>
  33. <van-popup v-model="showBuy" style="background: transparent;color: #999;" closeable close-icon-position="top-right" :close-on-click-overlay="false">
  34. <div class="w290h276 dialog-view">
  35. <div class="txt3">平台内下1单,立得惊喜礼包</div>
  36. <img class="w100h107" src="~/assets/image/activity/welfare-community/gift.png" alt="">
  37. <div class="buy-btn" style="margin:15px auto 0;" @click="order">下单得惊喜礼包</div>
  38. </div>
  39. </van-popup>
  40. <van-popup v-model="showBuySuccess" style="background: transparent;color: #999;" closeable close-icon-position="top-right" :close-on-click-overlay="false">
  41. <div class="w290h233 dialog-view">
  42. <div class="txt3">恭喜您获得礼包</div>
  43. <div class="txt4">请在游戏中兑换<br />激活码为:{{gameActivationCode}}。<span class="c3B86FF">复制</span></div>
  44. <div class="fsc mt20">
  45. <div class="fcc">
  46. <img class="wh40" src="~/assets/image/activity/welfare-community/icon_iphone@2x.png" alt="" />
  47. <span class="txt5">进入云机</span>
  48. </div>
  49. <img class="w12h10 ml10 mt15" src="~/assets/image/activity/welfare-community/arrow@2x.png" alt="">
  50. <div class="fcc">
  51. <img class="wh40" src="~/assets/image/activity/welfare-community/icon_yingyongshichang@2x.png" alt="">
  52. <span class="txt5">打开应用市场</span>
  53. </div>
  54. <img class="w12h10 mt15" src="~/assets/image/activity/welfare-community/arrow@2x.png" alt="">
  55. <div class="fcc">
  56. <img class="wh40" src="~/assets/image/activity/welfare-community/icon_xiazai@2x.png" alt="">
  57. <span class="txt5">下载{{gameName}}游戏</span>
  58. </div>
  59. </div>
  60. </div>
  61. </van-popup>
  62. <van-popup v-model="showLogin" style="background: transparent;color: #999;" closeable close-icon-position="top-right" :close-on-click-overlay="false" @click-close-icon="returnUp">
  63. <div class="w290h215 dialog-view">
  64. <div class="txt3">领取礼包,请先<br />绑定手机号</div>
  65. <div class="buy-btn" style="margin:30px auto 0;">立即绑定</div>
  66. </div>
  67. </van-popup>
  68. </div>
  69. </template>
  70. <script>
  71. import { Toast } from 'vant';
  72. import { fileKeyToUrl } from '@/plugins/file-center.js';
  73. export default {
  74. auth: false,
  75. data() {
  76. return {
  77. showVideoSuccess: false,
  78. showAd: false,
  79. showBuy: false,
  80. showBuySuccess: false,
  81. showLogin: false,
  82. list: [],
  83. isLoading: false,
  84. id: '',
  85. token: '',
  86. giftBagId: '',
  87. gameActivationCode: '',
  88. adlist: [],
  89. time: 30
  90. }
  91. },
  92. fetch() {
  93. this.token = this.$route.query.token;
  94. this.id = this.$route.query.id;
  95. this.user = this.$route.query.user;
  96. this.gameName = this.$route.query.gameName;
  97. this.getAppGameGiftActivityDetailsList();
  98. },
  99. head: {
  100. title: '福利社区',
  101. },
  102. computed: {
  103. iconURL() {
  104. return (key) => {
  105. return fileKeyToUrl(key)
  106. }
  107. }
  108. },
  109. methods: {
  110. order() {
  111. if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  112. window.webkit.messageHandlers.order.postMessage({});
  113. }
  114. },
  115. ended() {
  116. this.showAd = false
  117. this.getAppGameGiftActivityDetailsList();
  118. },
  119. returnUp() {
  120. this.$router.push({ path: '/welfare-community', query: { token: this.$route.query.token, user: this.user } })
  121. },
  122. async receive(item) {
  123. if (item.availableStatus === 2) {
  124. this.buySuccess(item);
  125. return
  126. }
  127. if (item.availableStatus === 1) {
  128. return
  129. }
  130. this.giftBagId = item.id;
  131. if (this.$route.query.user === '1') {
  132. if (item.taskType === 2) {
  133. this.showBuy = true
  134. }
  135. if (item.taskType === 1) {
  136. this.adlist = await this.$axios.$post('/publics/v5/advertising/getAdInfoByAdPlace', { id: 1, adPlace: 2008, os: 1 }, { headers: { Authorization: this.token } });
  137. this.showAd = true
  138. this.$nextTick(() => {
  139. this.$refs.videoPlayer.play();
  140. this.time = 30
  141. const timer = setInterval(
  142. () => --this.time <= 0 && clearInterval(timer),
  143. 1000);
  144. })
  145. }
  146. } else {
  147. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  148. this.showLogin = true
  149. }
  150. if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  151. window.webkit.messageHandlers.showLogin.postMessage({});
  152. }
  153. }
  154. },
  155. async getAppGameGiftActivityDetailsList() {
  156. try {
  157. this.isLoading = true;
  158. const res = await this.$axios.$get('/activity/game/giftActivity/getAppGameGiftActivityDetailsList?giftActivityId=' + this.id, { headers: { Authorization: this.token } });
  159. this.list = res.data;
  160. } finally {
  161. this.isLoading = false;
  162. }
  163. },
  164. async buySuccess(item) {
  165. this.showBuy = false;
  166. try {
  167. const res = await this.$axios.$get('/activity/game/giftActivity/receiveGameGift?giftBagId=' + item.id, { headers: { Authorization: this.token } });
  168. this.gameActivationCode = res.data.gameActivationCode;
  169. if (item.taskType === 1) {
  170. this.showVideoSuccess = true;
  171. }
  172. if (item.taskType === 2) {
  173. this.showBuySuccess = true;
  174. }
  175. } catch (err) {
  176. Toast({
  177. message: err.message,
  178. duration: 3000
  179. });
  180. }
  181. }
  182. }
  183. }
  184. </script>
  185. <style scoped>
  186. .w80h67 {
  187. width: 80px;
  188. height: 67px;
  189. position: absolute;
  190. left: 0;
  191. bottom: 0;
  192. }
  193. .disabled {
  194. background: #2B3C5C !important;
  195. color: #999999 !important;
  196. }
  197. .wh40 {
  198. width: 40px;
  199. height: 40px;
  200. }
  201. .mt20 {
  202. margin-top: 20px;
  203. }
  204. .fsc {
  205. display: flex;
  206. align-items: flex-start;
  207. justify-content: center;
  208. }
  209. .ml10 {
  210. margin-left: 10px;
  211. }
  212. .w12h10 {
  213. width: 12px;
  214. height: 10px;
  215. }
  216. .txt5 {
  217. font-size: 12px;
  218. color: #666666;
  219. margin-top: 3px;
  220. }
  221. .fcc {
  222. display: flex;
  223. flex-direction: column;
  224. justify-content: center;
  225. align-items: center;
  226. }
  227. .w100h107 {
  228. width: 100px;
  229. height: 107px;
  230. display: block;
  231. margin: 17px auto 0;
  232. }
  233. .w290h233 {
  234. width: 290px;
  235. height: 233px;
  236. }
  237. .w290h276 {
  238. width: 290px;
  239. height: 276px;
  240. }
  241. .dialog-view {
  242. background: linear-gradient(360deg, #FFFFFF 0%, #DFEFFF 100%);
  243. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.5);
  244. border-radius: 8px;
  245. position: relative;
  246. overflow: hidden;
  247. }
  248. .countdown {
  249. width: 92px;
  250. height: 25px;
  251. background: rgba(6, 6, 6, 0.5);
  252. border-radius: 13px;
  253. position: absolute;
  254. top: 10px;
  255. right: 10px;
  256. font-size: 11px;
  257. text-align: center;
  258. line-height: 25px;
  259. color: #cccccc;
  260. }
  261. .mt15 {
  262. margin-top: 15px;
  263. }
  264. .fwc {
  265. display: flex;
  266. flex-direction: column;
  267. justify-content: center;
  268. position: relative;
  269. }
  270. .w290h330 {
  271. width: 290px;
  272. height: 330px;
  273. }
  274. .buy-btn {
  275. width: 207px;
  276. height: 40px;
  277. background: linear-gradient(90deg, #38AEFC 0%, #3B7FFF 100%);
  278. border-radius: 20px;
  279. line-height: 40px;
  280. text-align: center;
  281. font-weight: 500;
  282. color: #ffffff;
  283. font-size: 16px;
  284. margin: 20px auto 0;
  285. }
  286. .c3B86FF {
  287. color: #3b86ff;
  288. }
  289. .txt4 {
  290. width: 290px;
  291. font-size: 14px;
  292. color: #666666;
  293. line-height: 20px;
  294. margin-top: 12px;
  295. text-align: center;
  296. }
  297. .txt3 {
  298. width: 290px;
  299. font-size: 18px;
  300. font-weight: 500;
  301. color: #363636;
  302. line-height: 25px;
  303. text-align: center;
  304. margin-top: 47px;
  305. }
  306. .w290h215 {
  307. width: 290px;
  308. height: 215px;
  309. }
  310. .gift-btn {
  311. width: 78px;
  312. height: 28px;
  313. background: #3B7FFF;
  314. border-radius: 4px;
  315. font-size: 14px;
  316. color: #ffffff;
  317. line-height: 28px;
  318. text-align: center;
  319. justify-self: end;
  320. }
  321. .ml12 {
  322. margin-left: 12px;
  323. }
  324. .txt2 {
  325. font-size: 14px;
  326. color: #CFD1D4;
  327. line-height: 20px;
  328. margin-top: 5px;
  329. }
  330. .txt1 {
  331. font-size: 18px;
  332. font-weight: 500;
  333. color: #CFD1D4;
  334. line-height: 25px;
  335. }
  336. .wh60 {
  337. width: 60px;
  338. height: 60px;
  339. border: 1px solid #eaeaea;
  340. border-radius: 50%;
  341. padding: 2px;
  342. box-sizing: border-box;
  343. }
  344. .wh56 {
  345. width: 56px;
  346. height: 56px;
  347. border-radius: 50%;
  348. }
  349. .bg101010 {
  350. background: #101010;
  351. min-height: 100vh;
  352. overflow: hidden;
  353. }
  354. .m15 {
  355. margin: 15px;
  356. height: 83px;
  357. background: #1E2022;
  358. box-shadow: 0px 3px 7px 0px #1E2022;
  359. border-radius: 8px;
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. padding: 12px 15px 12px;
  364. box-sizing: border-box;
  365. }
  366. </style>