创作者微信小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

383 lines
7.6 KiB

<template>
<view class="container">
<view class="top">
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="banner" :current="current" :mode="mode"
field="bannerName">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex" :autoplay="autoplay"
:interval="interval" :duration="duration" circular>
<swiper-item v-for="(item, index) in banner" :key="index">
<view class="swiper-item" :class="'swiper-item' + index">
<!-- <text style="color: #fff; font-size: 32px;">{{index+1}}</text> -->
<image class="img" @click="linkTo(item)" :src="item.bannerImg"></image>
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</view>
<view class="middle">
<uni-row class="middle-uni-row" gutter="40">
<uni-col :span="12" class="middle-uni-col" v-for="(val, i) in funcList" :index="i" :key="i">
<view class="grid-item-box">
<!-- <uni-icons type="image" :size="30" color="#777" /> -->
<text class="text uni-white">{{ val.title }}</text>
<image :src="val.icon" class="iconImage" mode="aspectFill" />
</view>
</uni-col>
</uni-row>
</view>
<view class="foot">
<uni-row class="foot-uni-row" gutter="88">
<uni-col :span="8" class="foot-uni-col" v-for="(params, v) in list" :index="v" :key="v">
<view class="grid-item-box uni-white">
<!-- <uni-icons type="image" :size="30" color="#777" /> -->
<view class="icom-div">
<image :src="params.icon" class="listIconImage" mode="aspectFill" />
</view>
<text class="text">{{ params.text }}</text>
<text class="text">{{ params.num }}</text>
</view>
</uni-col>
</uni-row>
</view>
</view>
</template>
<script>
import {
queryCreatorTypeImgNum,
listBanner
} from '@/api/index.js'
export default {
data() {
return {
userInfo:{},
banner:[
{
bannerImg: "/static/material.png"
}
],
current: 0,
mode: 'nav',
swiperDotIndex: 0,
autoplay: true,
interval: 5000,
duration: 500,
pageUrl:'',
funcList: [{
title: '素材管理',
url: '/pages/index/material/material',
icon: '/static/material.png'
}, {
title: '上传素材',
url: '/pages/index/upload/upload',
icon: '/static/upload.png'
}],
list: [{
typeId: 1,
text: '头像',
num: '10',
icon: '/static/headBack.png'
},
{
typeId: 2,
text: 'Gif动图',
num: '10',
icon: '/static/gifBack.png'
},
{
typeId: 3,
text: '手机壁纸',
num: '20',
icon: '/static/phoneBack.png'
},
{
typeId: 4,
text: '朋友圈',
num: '10',
icon: '/static/friendBack.png'
},
{
typeId: 5,
text: '表情包',
num: '15',
icon: '/static/emoBack.png'
},
{
typeId: 6,
text: 'iwatch',
num: '3',
icon: '/static/iwatchBack.png'
}
]
};
},
created(){
const userInfo = uni.getStorageSync('userInfo')
if (!userInfo) {
console.log('havent userInfo')
uni.showModal({
content: '艺术家账户过期,请重新登录!',
showCancel: false,
success() {
//没有缓存则跳转登录页面
// uni.reLaunch({
// url: '/pages/login/login'
// });
}
});
} else {
this.userInfo = userInfo;
console.log('have userInfo')
}
},
onLoad(){
this.queryCreatorTypeImgNum();
this.getBanner();
},
methods: {
changeSwiper(e){
this.current = e.detail.current;
},
change(e) {
this.pageUrl = this.funcList[e.detail.index].url
console.log('this.pageUrl',this.pageUrl)
/** 跳转指定页面*/
uni.navigateTo({
url: this.pageUrl
});
},
clickItem(e) {
this.swiperDotIndex = e
console.log('this.swiperDotIndex', this.swiperDotIndex)
},
// 跳转banner详情页
linkTo(item) {
if (item.id) {
uni.navigateTo({
url: '../index/banner'
});
}
},
// 获取banner列表
async getBanner() {
let that = this;
const res = await listBanner()
if (res.data.code === 200) {
that.banner = res.data.data
console.log('banner',that.banner)
} else {
uni.showModal({
content: 'banner加载失败!',
showCancel: false
});
}
},
// 查询艺术家图片分类数量
async queryCreatorTypeImgNum() {
let that = this;
const res = await queryCreatorTypeImgNum(that.userInfo.id)
console.log('res',res)
if (res.data.code === 200) {
that.list[0].num = res.data.data.headNum
that.list[1].num = res.data.data.gifNum
that.list[2].num = res.data.data.backNum
that.list[3].num = res.data.data.friendNum
that.list[4].num = res.data.data.emoNum
that.list[5].num = res.data.data.watchNum
//console.log('list',that.list)
} else {
uni.showModal({
content: '图片分页数量加载失败!',
showCancel: false
});
}
},
}
}
</script>
<style lang="scss">
.container{
font-family:Franklin Gothic Medium, Arial Narrow, Arial, sans-serif;
}
.img {
position: absolute;
width: 100%;
height: 100%;
}
.grid-item-box {
flex: 1;
// position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10rpx 0;
}
.grid-item-box-row {
flex: 1;
// position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
padding: 10rpx 0;
}
.swiper-box {
height: 260rpx;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
height: 290rpx;
color: #fff;
}
.swiper-item0 {
background-color: #cee1fd;
}
.swiper-item1 {
background-color: #b2cef7;
}
.swiper-item2 {
background-color: #cee1fd;
}
.image {
width: 750rpx;
}
/* #ifndef APP-NVUE */
::v-deep .image img {
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}
/* #endif */
@media screen and (min-width: 500rpx) {
.uni-swiper-dot-box {
width: 100%;
height: 100%;
// margin: 0 auto;
// margin-top: 8rpx;
}
.image {
width: 100%;
}
}
.uni-bg-blue {
background-color: #007aff;
}
.iconImage{
width:90rpx;
height:90rpx;
}
.listIconImage{
width:60rpx;
height:60rpx;
}
</style>
<style scoped lang="scss">
.container {
min-height: 100vh;
background: #FFC542;
border-top: 2rpx solid #FFC542;
.top {
width: 638rpx;
// height: 272rpx;
margin: 40rpx auto;
border-radius: 50rpx;
overflow: hidden;
}
.middle {
width: 638rpx;
margin: 0 auto;
.grid-item-box {
height: 360rpx;
background: rgb(62, 213, 152);
border-radius: 25px;
position: relative;
.text {
font-size: 48rpx;
position: absolute;
top: 84rpx;
left: auto;
right: auto;
}
.iconImage {
position: absolute;
bottom: 0;
left: auto;
right: auto;
width: 158rpx;
height: 186rpx;
}
}
}
.foot {
margin-top: 40rpx;
padding: 56rpx;
background: #2A3C44;
border-radius: 80rpx 0px 0px 0px;
.grid-item-box {
margin-bottom: 14rpx;
.icom-div {
background: #30444E;
border-radius: 24rpx;
.listIconImage {
height: 130rpx;
width: 130rpx;
}
}
.text {
text-align: center;
font-size: 24rpx;
line-height: 30rpx;
margin-top: 10rpx;
}
}
}
}
</style>