_id.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="disk-page">
  3. <disk :user-card-id="userCardId"></disk>
  4. </div>
  5. </template>
  6. <script>
  7. import qs from 'qs';
  8. const isNew = false;
  9. export default {
  10. name: 'DiskPage',
  11. middleware: [
  12. async ({ base, route, $axios, $auth, redirect, $userAgent }) => {
  13. if (isNew) {
  14. return;
  15. }
  16. const res = await $axios.$get(
  17. '/resources/v5/client/disk/info/userCard/single',
  18. {
  19. params: {
  20. userCardId: route.params.id,
  21. },
  22. },
  23. );
  24. const {
  25. userCardId,
  26. userName,
  27. room,
  28. buyVipType,
  29. sourceType,
  30. authPhone,
  31. validTime,
  32. } = res.data;
  33. const token = $auth.strategy.token.get();
  34. const url = `${location.origin}${base}${
  35. $userAgent.isIos ? 'screenIos' : 'screenAndroid'
  36. }/WXtrialInterface.html${qs.stringify(
  37. {
  38. userCardId,
  39. username: $auth.user.username,
  40. token,
  41. rm: room,
  42. mealType: buyVipType,
  43. sourceType,
  44. authPhone: authPhone ? 'huo' : 'none',
  45. validTime,
  46. },
  47. {
  48. addQueryPrefix: true,
  49. },
  50. )}`;
  51. redirect(url);
  52. },
  53. ],
  54. data() {
  55. return {
  56. userCardId: null,
  57. };
  58. },
  59. fetch() {
  60. this.userCardId = +this.$route.params.id;
  61. },
  62. methods: {},
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. .disk-page {
  67. height: 100vh;
  68. position: relative;
  69. }
  70. </style>