index copy.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <mobile v-if="!isPC && this.vipList.length>0" :com="com" :dev="dev" :pre="pre" :vipDetail="vipDetail"></mobile>
  3. <div v-else></div>
  4. </template>
  5. <script>
  6. import {mapState} from "vuex";
  7. import pc from "@/components/type/vip/pc";
  8. import mobile from "@/components/type/vip/mobile";
  9. import getDeviceType from "@/mixins/getDeviceType";
  10. export default {
  11. head: {
  12. title: "会员中心页 - 程序员客栈"
  13. },
  14. components: {
  15. pc,
  16. mobile
  17. },
  18. mixins: [getDeviceType],
  19. data() {
  20. return {
  21. vipList: [],
  22. vipDetail: {}
  23. };
  24. },
  25. computed: {
  26. ...mapState(["isPC"]),
  27. com() {
  28. return this.vipList[0];
  29. },
  30. dev() {
  31. return this.vipList[1];
  32. },
  33. pre() {
  34. return this.vipList[2];
  35. }
  36. },
  37. async mounted() {
  38. await this.getList();
  39. await this.getVipDetail();
  40. },
  41. methods: {
  42. async getList() {
  43. let extraHeaders = {};
  44. if (this.deviceType === "ios") {
  45. extraHeaders = this.getSign();
  46. }
  47. let res = await this.$axios.$post(`/api/vip/getList`, extraHeaders);
  48. this.vipList = res && res.data ? res.data : [];
  49. },
  50. async getVipDetail() {
  51. let res = await this.$axios.$post("/api/vip/getVipUserDetail");
  52. this.vipDetail = res && res.data ? res.data : {};
  53. }
  54. }
  55. };
  56. </script>
  57. <style>
  58. </style>