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.

81 lines
1.8 KiB

<template>
<view class="m-2">
<u-card :show-foot="false" :show-head="false" :style="{ height: isShrink ? '96rpx' : '300rpx' }" border-radius="25" margin="0">
<view slot="body">
<scroll-view :scrollY="true" :style="{ height: isShrink ? '40rpx' : '240rpx' }">
<view class="p-0 u-col-between">
<view class="grid grid-cols-3 gap-2 h-36" v-if="plugins.length">
<Plugin
:pluginId="pluginId"
:styleType="styleType"
v-for="(plugin, pluginIndex) in plugins"
:key="pluginIndex"
:class="getClass(plugin.col, plugin.row)"
/>
</view>
</view>
</scroll-view>
</view>
</u-card>
</view>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'Global',
data() {
return {
loading: true,
pluginId: 0,
styleType: 0,
task: null,
plugins: [],
};
},
async created() {
const permanent = await this.$u.api.getPermanent({ roleId: 0 });
const res = await this.$u.api.getGlobal({
roleId: 0,
timeNode: new Date().getTime(),
timeUnit: 7,
});
for (let item of res.plugins) {
this.plugins.push(...item);
}
this.task = res;
console.log('permanent', permanent);
},
mounted() {
setTimeout(() => (this.loading = false), 5000);
},
computed: mapState('home', ['isShrink']),
methods: {
getClass(col, row) {
return [`row-span-${row}`, `col-span-${col}`];
},
},
};
</script>
<style scoped lang="scss">
.u-card-wrap {
background-color: $u-bg-color;
padding: 1px;
}
.u-body-item {
font-size: 32rpx;
color: #333;
padding: 20rpx 10rpx;
}
.u-body-item image {
width: 120rpx;
flex: 0 0 120rpx;
height: 120rpx;
border-radius: 8rpx;
margin-left: 12rpx;
}
</style>