123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <view class="max-empty" :style="{backgroundColor: backgroundColor}">
- <view v-if="type==='cart'" class="cart column center">
- <image class="icon" :src="static+'/empty/cart.png'"></image>
- <text class="title">空空如也</text>
- <text class="text">别忘了买点什么犒赏一下自己哦</text>
- <view class="btn center" @click="jump">
- <text>随便逛逛</text>
- </view>
- </view>
- <view v-else-if="type==='address'" class="address column center">
- <image class="icon" :src="static+'/empty/address.png'"></image>
- <text class="text">您还没有收货地址哦~</text>
- <view class="btn center" @click="jump">
- <text>添加地址</text>
- </view>
- </view>
- <view v-else-if="type==='favorite'" class="favorite column center">
- <image class="icon" :src="static+'/empty/favorite.png'"></image>
- <text class="text">收藏夹空空的,先去逛逛吧~</text>
- <view class="btn center" @click="jump">
- <text>随便逛逛</text>
- </view>
- </view>
- <view v-else-if="type==='order'" class="order column center">
- <image class="icon" :src="static+'/empty/order.png'"></image>
- <text class="text">加载订单失败,请稍后在试</text>
- <view class="btn center" @click="jump">
- <text>返回</text>
- </view>
- </view>
- <view v-else-if="type==='service'" class="service column center">
- <image class="icon" :src="static+'/empty/service.png'"></image>
- <text class="text">请求出错,请稍在试</text>
- <view class="btn center" @click="jump">
- <text>{{ btnText }}</text>
- </view>
- </view>
- <view v-else class="default column center">
- <image class="icon" :src="static+'/empty/default.png'"></image>
- <text class="text" @click="jump">{{ text }}</text>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- props: {
- text: {
- type: String,
- default: '暂时没有数据'
- },
- btnText: {
- type: String,
- default: '刷新'
- },
- type: {
- type: String,
- default: ''
- },
- backgroundColor: {
- type: String,
- default: 'rgba(0,0,0,0)'
- }
- },
- data(){
- return {
- static: ""
- };
- },
- mounted() {
- this.static = this.$static;
- },
- methods: {
- jump(){
- this.$emit("onEvents",{});
- },
- onCartBtnClick(){
- uni.switchTab({
- url: '/pages/index/index'
- })
- },
- switchTab(url){
- uni.switchTab({
- url
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .column{
-
- display:flex;
-
- flex-direction: column;
- }
- .center{
-
- display:flex;
-
- align-items: center;
- justify-content: center;
- }
- .max-empty{
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- animation: show .5s 1;
- }
- @keyframes show{
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
- }
- .default{
- padding-top: 26vh;
-
- padding-top: 30vh;
-
-
- .icon{
- width: 350rpx;
- height: 350rpx;
- }
- .text{
- margin-top: 10rpx;
- font-size: 28rpx;
- color: #999;
- }
- }
- .cart{
- padding-top: 14vh;
-
- padding-top: 18vh;
-
-
- .icon{
- width: 350rpx;
- height: 350rpx;
- }
- .title{
- margin: 50rpx 0 26rpx;
- font-size: 34rpx;
- color: #333;
- }
- .text{
- font-size: 28rpx;
- color: #aaa;
- }
- .btn{
- width: 320rpx;
- height: 80rpx;
- margin-top: 80rpx;
- text-indent: 2rpx;
- letter-spacing: 2rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 100rpx;
- background: linear-gradient(to bottom right, #1b43c4, #1b43c4);
- }
- }
- .address{
- padding-top: 6vh;
-
- padding-top: 10vh;
-
-
- .icon{
- width: 350rpx;
- height: 350rpx;
- }
- .text{
- width: 400rpx;
- margin-top: 40rpx;
- font-size: 30rpx;
- color: #999;
- text-align: center;
- line-height: 1.6;
- }
- .btn{
- width: 320rpx;
- height: 80rpx;
- margin-top: 80rpx;
- text-indent: 2rpx;
- letter-spacing: 2rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 100rpx;
- background: linear-gradient(to bottom right, #1b43c4, #1b43c4);
- }
- }
- .favorite{
- padding-top: 6vh;
-
- padding-top: 10vh;
-
-
- .icon{
- width: 360rpx;
- height: 360rpx;
- }
- .text{
- width: 400rpx;
- margin-top: 40rpx;
- font-size: 30rpx;
- color: #999;
- text-align: center;
- line-height: 1.6;
- }
- .btn{
- width: 320rpx;
- height: 80rpx;
- margin-top: 80rpx;
- text-indent: 2rpx;
- letter-spacing: 2rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 100rpx;
- background: linear-gradient(to bottom right, #1b43c4, #1b43c4);
- }
- }
- .order{
- padding-top: 6vh;
-
- padding-top: 10vh;
-
-
- .icon{
- width: 360rpx;
- height: 360rpx;
- }
- .text{
- width: 400rpx;
- margin-top: 40rpx;
- font-size: 30rpx;
- color: #999;
- text-align: center;
- line-height: 1.6;
- }
- .btn{
- width: 320rpx;
- height: 80rpx;
- margin-top: 80rpx;
- text-indent: 2rpx;
- letter-spacing: 2rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 100rpx;
- background: linear-gradient(to bottom right, #1b43c4, #1b43c4);
- }
- }
- .service{
- padding-top: 6vh;
-
- padding-top: 10vh;
-
-
- .icon{
- width: 360rpx;
- height: 360rpx;
- }
- .text{
- width: 400rpx;
- margin-top: 40rpx;
- font-size: 30rpx;
- color: #999;
- text-align: center;
- line-height: 1.6;
- }
- .btn{
- width: 320rpx;
- height: 80rpx;
- margin-top: 80rpx;
- text-indent: 2rpx;
- letter-spacing: 2rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 100rpx;
- background: linear-gradient(to bottom right, #1b43c4, #1b43c4);
- }
- }
- </style>
|