| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <mobile v-if="!isPC" :com="com" :dev="dev" :vipDetail="vipDetail" :isCom="isCom"></mobile>
- </template>
- <script>
- import { mapState } from "vuex";
- // import http from '@/plugins/http'
- import pc from "@/components/type/vip/pc";
- import mobile from "@/components/type/vip/mobile";
- import getDeviceType from "@/mixins/getDeviceType";
- import qs from "qs";
- export default {
- // async asyncData({ $axios, params }) {
- // let res = await $axios.$get(`/api/vip/getList`)
- // console.log('init', res)
- // },
- head: {
- title: "会员中心页 - 程序员客栈"
- },
- components: {
- pc,
- mobile
- },
- mixins: [getDeviceType],
- data() {
- return {
- vipList: [],
- vipDetail: {}
- };
- },
- computed: {
- ...mapState(["isPC"]),
- com() {
- return this.vipList[0];
- },
- dev() {
- return this.vipList[1];
- },
- isCom() {
- if (this.$route.query.isCom) return true;
- return this.vipDetail.vip_type_id !== "2";
- }
- },
- async mounted() {
- await this.getList();
- this.getVipDetail();
- if (this.isPC){
- location.href="/#vip";
- }
- },
- methods: {
- async getList() {
- let extraHeaders = {};
- if (this.deviceType === "ios") {
- extraHeaders = this.getSign();
- }
- let res = await this.$axios.$post(`/api/vip/getList`, extraHeaders);
- if (res) {
- this.vipList = res.data;
- }
- },
- async getVipDetail() {
- let res = await this.$axios.$post("/api/vip/getVipUserDetail");
- // if (!res || !res.data) return
- this.vipDetail = res && res.data ? res.data : {};
- if (this.isCom) this.currentCom = true;
- }
- }
- };
- </script>
- <style>
- </style>
|