_id.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. console.log('route.params.id', route.params.id);
  25. const res = await $axios.$post('/resources/user/cloud/connect', { userCardId: route.params.id });
  26. const {
  27. userCardId,
  28. userName,
  29. room,
  30. buyVipType,
  31. sourceType,
  32. authPhone,
  33. validTime,
  34. id,
  35. } = res.data;
  36. const token = $auth.strategy.token.get();
  37. const url = `${location.origin}${base}${
  38. $userAgent.isIos ? 'screenIos' : 'screenAndroid'
  39. }/WXtrialInterface.html${qs.stringify(
  40. {
  41. userCardId,
  42. username: $auth.user.username,
  43. token,
  44. rm: room,
  45. mealType: buyVipType,
  46. sourceType,
  47. authPhone: authPhone ? 'huo' : 'none',
  48. validTime,
  49. record: id,
  50. },
  51. {
  52. addQueryPrefix: true,
  53. },
  54. )}`;
  55. redirect(url);
  56. },
  57. ],
  58. data() {
  59. return {
  60. userCardId: null,
  61. };
  62. },
  63. fetch() {
  64. this.userCardId = +this.$route.params.id;
  65. },
  66. methods: {},
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .disk-page {
  71. height: 100vh;
  72. position: relative;
  73. }
  74. </style>