123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <view class="main">
- <view class="one">
- <swiper class="swiper" circular :indicator-dots="true" indicator-color="#F5F5F5"
- indicator-active-color="#ffffff" :autoplay="false" :interval="3000" :duration="1000">
- <swiper-item class="list" v-for="(item,index) in advertList" :key="index">
- <image class="image" :src="item.image&&item.image.length>0?item.image[0].url:''" mode=""></image>
- </swiper-item>
- </swiper>
- </view>
- <view class="two">
- <uni-collapse>
- <uni-collapse-item title="群组" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
- <view class="content">
- <view class="list" v-for="(item, index) in groupList" :key="index" @tap="toInfo(item)">
- 1111
- </view>
- <view class="is_bottom" v-if="is_bottom">
- <text>{{config.bottom_title||'到底了!'}}</text>
- </view>
- </view>
- </uni-collapse-item>
- <uni-collapse-item title="好友" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
- <view class="content">
- <view class="list" v-for="(item, index) in friendList" :key="index" @tap="toInfo(item)">
- 1111
- </view>
- <view class="is_bottom" v-if="is_bottom">
- <text>{{config.bottom_title||'到底了!'}}</text>
- </view>
- </view>
- </uni-collapse-item>
- </uni-collapse>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: {},
- config: {},
- // 广告
- advertList: [],
- // 群组
- groupList: [],
- // 好友
- friendList: []
- }
- },
- onShow: async function() {
- const that = this;
- await that.searchToken();
- await that.searchConfig();
- await that.search();
- },
- onPullDownRefresh: async function() {
- const that = this;
- await that.search();
- uni.stopPullDownRefresh();
- },
- methods: {
- // 用户信息
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) that.$set(that, `user`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) that.$set(that, `config`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- // 查询
- async search() {
- const that = this;
- // 广告
- const res = await that.$api(`/adv`, 'GET', {
- is_use: '0'
- })
- if (res.errcode == '0') {
- that.$set(that, `advertList`, res.data)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- padding: 0 0 2vw 0;
- .swiper {
- height: 60vw;
- .list {
- .image {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- }
- </style>
|