shop_app/pages/vip/intro/index.vue

67 lines
1.4 KiB
Vue

<template>
<view class="whole" @click="toVipPage">
<image v-for="item in imgList" :src="item" mode="widthFix" class="img"></image>
</view>
</template>
<script>
import { ref, reactive, toRefs } from 'vue'
import { get, post } from '@/api/request.js'
import { whetherLogin } from '@/components/common.js'
export default {
setup() {
const data = reactive({
imgList: []
})
// 会员信息
const getVipInfo = () => {
get('/api/app/shop').then((res) => {
if(uni.getStorageSync('vip_detail_on') === 0 || res.data.vip_detail_image.length === 0) {
if(whetherLogin()) {
uni.redirectTo({ url: '/pages/vip/mine/index' })
} else {
uni.redirectTo({ url: '/pages/user/login' })
}
return
}
data.share_image = res.data.vip_detail_share_image
data.share_title = res.data.vip_detail_share_title
data.imgList = res.data.vip_detail_image
})
}
const toVipPage = () => {
if(whetherLogin()) {
uni.navigateTo({ url: '/pages/vip/mine/index' })
} else {
uni.navigateTo({ url: '/pages/user/login' })
}
}
return {
whetherLogin,
...toRefs(data),
getVipInfo,
toVipPage
}
},
async onLoad(options) {
// await this.$onLaunched
await this.getVipInfo()
}
}
</script>
<style lang="scss" scoped>
.whole {
width: 100%;
overflow: auto;
.img{
width: 100%;
height: auto;
vertical-align: bottom;
}
}
</style>