|
|
|
|
<template>
|
|
|
|
|
<view class="container">
|
|
|
|
|
<view class="top">
|
|
|
|
|
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="info" :current="current" :mode="mode"
|
|
|
|
|
field="content">
|
|
|
|
|
<swiper class="swiper-box" @change="change" :current="swiperDotIndex" :autoplay="autoplay"
|
|
|
|
|
:interval="interval" :duration="duration">
|
|
|
|
|
<swiper-item v-for="(item, index) in 3" :key="index">
|
|
|
|
|
<view class="swiper-item" :class="'swiper-item' + index">
|
|
|
|
|
<text style="color: #fff; font-size: 32px;">{{index+1}}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</swiper-item>
|
|
|
|
|
</swiper>
|
|
|
|
|
</uni-swiper-dot>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="middle">
|
|
|
|
|
<uni-group mode="card">
|
|
|
|
|
<uni-grid :column="2" :square="true" :highlight="false" @change="change" :showBorder="false">
|
|
|
|
|
<uni-grid-item v-for="(item, index) in funcList" :index="index" :key="index">
|
|
|
|
|
<view class="grid-item-box">
|
|
|
|
|
<!-- <image :src="item.url" class="image" mode="aspectFill" /> -->
|
|
|
|
|
<uni-icons type="image" :size="30" color="#777" />
|
|
|
|
|
<text class="text">{{ item.title }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</uni-grid-item>
|
|
|
|
|
</uni-grid>
|
|
|
|
|
</uni-group>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="foot">
|
|
|
|
|
<uni-group mode="card" title="素材数据" style="text-align:center;">
|
|
|
|
|
<uni-grid :column="3" :square="true" :highlight="false" @change="change">
|
|
|
|
|
<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
|
|
|
|
|
<view class="grid-item-box">
|
|
|
|
|
<!-- <image :src="item.url" class="image" mode="aspectFill" /> -->
|
|
|
|
|
<uni-icons type="image" :size="30" color="#777" />
|
|
|
|
|
<text class="text">{{ item.text }}</text>
|
|
|
|
|
<text class="text">{{ item.num }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</uni-grid-item>
|
|
|
|
|
</uni-grid>
|
|
|
|
|
</uni-group>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
info: [{
|
|
|
|
|
content: '内容 A'
|
|
|
|
|
}, {
|
|
|
|
|
content: '内容 B'
|
|
|
|
|
}, {
|
|
|
|
|
content: '内容 C'
|
|
|
|
|
}],
|
|
|
|
|
current: 0,
|
|
|
|
|
mode: 'nav',
|
|
|
|
|
swiperDotIndex: 0,
|
|
|
|
|
autoplay: true,
|
|
|
|
|
interval: 5000,
|
|
|
|
|
duration: 500,
|
|
|
|
|
pageUrl:'',
|
|
|
|
|
funcList: [{
|
|
|
|
|
title: '素材管理',
|
|
|
|
|
url: '/pages/index/material/material'
|
|
|
|
|
}, {
|
|
|
|
|
title: '上传素材',
|
|
|
|
|
url: '/pages/index/upload/upload'
|
|
|
|
|
}],
|
|
|
|
|
list: [{
|
|
|
|
|
url: '/static/c1.png',
|
|
|
|
|
text: '头像',
|
|
|
|
|
num: '16'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
url: '/static/c2.png',
|
|
|
|
|
text: '背景图',
|
|
|
|
|
num: '1'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
url: '/static/c3.png',
|
|
|
|
|
text: '手机壁纸',
|
|
|
|
|
num: '99'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
url: '/static/c4.png',
|
|
|
|
|
text: '动态壁纸',
|
|
|
|
|
num: '23',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
url: '/static/c5.png',
|
|
|
|
|
text: 'apple watch',
|
|
|
|
|
num: '15'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
url: '/static/c6.png',
|
|
|
|
|
text: '表情包',
|
|
|
|
|
num: '31'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
change(e) {
|
|
|
|
|
let {
|
|
|
|
|
index
|
|
|
|
|
} = e.detail
|
|
|
|
|
this.funcList[index].badge && this.funcList[index].badge++
|
|
|
|
|
this.pageUrl = this.funcList[index].url
|
|
|
|
|
console.log('this.pageUrl',this.pageUrl)
|
|
|
|
|
/** 跳转指定页面*/
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: this.pageUrl
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
clickItem(e) {
|
|
|
|
|
this.swiperDotIndex = e
|
|
|
|
|
console.log('this.swiperDotIndex', this.swiperDotIndex)
|
|
|
|
|
},
|
|
|
|
|
// 获取用户信息
|
|
|
|
|
getUserInfo() {
|
|
|
|
|
wx.login({
|
|
|
|
|
force: true,
|
|
|
|
|
success: res => {
|
|
|
|
|
wx.getUserInfo({
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
success: userInfo => {
|
|
|
|
|
const params = {
|
|
|
|
|
code: res.code,
|
|
|
|
|
encryptedData: userInfo.encryptedData,
|
|
|
|
|
iv: userInfo.iv
|
|
|
|
|
}
|
|
|
|
|
// 用户授权登录
|
|
|
|
|
console.log('params', params);
|
|
|
|
|
loginWx(params).then(res => {
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
key: 'userInfo',
|
|
|
|
|
data: res.data.data.userInfo,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch(res => {})
|
|
|
|
|
console.log(`getUserInfo 调用成功`, userInfo);
|
|
|
|
|
},
|
|
|
|
|
fail(userInfo) {
|
|
|
|
|
console.log(`getUserInfo 调用失败`);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
console.log(`login 调用失败`);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.container{
|
|
|
|
|
font-family:‘Franklin Gothic Medium’, ‘Arial Narrow’, Arial, sans-serif;
|
|
|
|
|
}
|
|
|
|
|
.grid-item-box {
|
|
|
|
|
flex: 1;
|
|
|
|
|
// position: relative;
|
|
|
|
|
/* #ifndef APP-NVUE */
|
|
|
|
|
display: flex;
|
|
|
|
|
/* #endif */
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
padding: 10px 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: 10px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.swiper-box {
|
|
|
|
|
height: 150px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.swiper-item {
|
|
|
|
|
/* #ifndef APP-NVUE */
|
|
|
|
|
display: flex;
|
|
|
|
|
/* #endif */
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
height: 200px;
|
|
|
|
|
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: 500px) {
|
|
|
|
|
.uni-swiper-dot-box {
|
|
|
|
|
width: 400px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.uni-bg-blue {
|
|
|
|
|
background-color: #007aff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active {
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-color: #007aff;
|
|
|
|
|
border-width: 1px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|