index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <mobile v-if="!isPC" :com="com" :dev="dev" :pre="pre" :vipDetail="vipDetail" :isCom="isCom"></mobile>
  3. </template>
  4. <script>
  5. import {mapState} from "vuex";
  6. import pc from "@/components/type/vip/pc";
  7. import mobile from "@/components/type/vip/mobile";
  8. import getDeviceType from "@/mixins/getDeviceType";
  9. import qs from "qs";
  10. export default {
  11. head() {
  12. return {
  13. title: "会员中心"
  14. }
  15. },
  16. components: {
  17. pc,
  18. mobile
  19. },
  20. mixins: [getDeviceType],
  21. data() {
  22. return {
  23. vipList: [],
  24. vipDetail: {}
  25. };
  26. },
  27. computed: {
  28. ...mapState(["isPC"]),
  29. com() {
  30. return this.vipList[0];
  31. },
  32. dev() {
  33. return this.vipList[1];
  34. },
  35. pre() {
  36. return this.vipList[2];
  37. },
  38. isCom() {
  39. if (this.$route.query.isCom) return true;
  40. return this.vipDetail.vip_type_id !== "2";
  41. }
  42. },
  43. async mounted() {
  44. await this.getList();
  45. this.getVipDetail();
  46. if (this.isPC) {
  47. location.href = "/#vip";
  48. }
  49. },
  50. methods: {
  51. async getList() {
  52. let extraHeaders = {};
  53. if (this.deviceType === "ios") {
  54. extraHeaders = this.getSign();
  55. }
  56. let res = await this.$axios.$post(`/api/vip/getList`, extraHeaders);
  57. if (Number(res.status) === 1) {
  58. this.vipList = res.data;
  59. }
  60. },
  61. async getVipDetail() {
  62. let res = await this.$axios.$post("/api/vip/getVipUserDetail");
  63. // if (!res || !res.data) return
  64. this.vipDetail = res && res.data ? res.data : {};
  65. if (this.isCom) this.currentCom = true;
  66. }
  67. }
  68. };
  69. </script>
  70. <style>
  71. </style>