darenList.vue 5.13 KB
<template>
    <div class="daren-list-box">

        <!-- 达人动态列表 -->
        <daren-list-com class="daren-list-com" @userJump="userJump" @jump="jump"
            :lists="{}">

            <!-- 最新动态标题 -->
            <text-title-box slot="title-box"
                :titles="{
                    title: '最新动态',
                    more: true
                }">
            </text-title-box>
        </daren-list-com>








    </div>
</template>

<script>

    // 引入组件
    import { Toast, Indicator } from "mint-ui";
	import darenListCom from "@/components/darenListCom/darenListCom";
	import textTitleBox from "@/components/textTitleBox/textTitleBox";
	
    

    export default {
        name: "darenList",
        data() {
            return {
                title: "",              // 标题
                



            }
        },
        components:{
            darenListCom,
            textTitleBox,





        },
        created() {

            // 获取优选库精选活动
            // this.activityAd();
        },
        methods: {

            // 下拉刷新
            // onRefresh() {

            //     // 下拉刷新中
            //     this.$set(this, "isLoading", true);

            //     // 获取优选库精选活动
            //     this.activityAd();
            // },

            /**
             * 获取优选库精选活动
             */
            activityAd() {
                // 加载中提示
                Indicator.open("加载中...");

                // 获取证书请求接口
                this.http("/Api/" + this.getApiVersion().index + "/activityAd", {
                        id: this.$route.query.id
                    }, this.activityAdCallback, {
                        method: "post"
                    }
                );
            },

            /**
             * 获取优选库精选活动回调
             * @param {object} res [服务器返回数据]
             * @param {object} ext [扩展参数]
             */
            activityAdCallback(res, ext) {

                // 加载完成
                Indicator.close();

                // 下拉刷新结束
                this.$set(this, "isLoading", false);

                // 返回处理
                if (res.code == 200) {

                    // 解构数据
                    let { data: datas } = res;

                    /* 获取优选库精选活动数据 开始 */

                    // 设置标题
                    this.$set(this, "title", datas.title);

                    // 设置banner数据
                    if (datas.banner && datas.banner.length) {
                        this.$set(this, "banner", datas.banner);
                    }

                    // 设置navs数据
                    if (datas.navs && datas.navs.length) {
                        this.$set(this, "navs", datas.navs);
                    }

                    // 设置ads数据
                    if (datas.ads && datas.ads.length) {
                        this.$set(this, "ads", datas.ads);
                    }

                    /* 获取优选库精选活动数据 结束 */

                } else if (res.code == 400) {

                    // 获取优选库精选活动失败
                    Toast(res.message);
                } else {

                    // 获取优选库精选活动失败
                    Toast("获取优选库精选活动失败");
                }
            },

            /**
             * 调用通用跳转
             * @param {object} item [通用跳转对象]
             */
            toDetail(item) {

                // 判断是否有通用跳转函数
                if (typeof this.$parent.gotoDetail === "function") {

                    // 调用通用跳转
                    this.$parent.gotoDetail(item);
                }
            },

            /**
             * 跳转达人动态详情
             * @param {object} item [数据对象]
             */
            jump(item) {


                console.log("jump", item);


                // 判断并调用通用跳转
                if (typeof this.$parent.gotoDetail === "function") {
                    this.$parent.gotoDetail(item);
                }
            },

			/**
			 * 用户头像/昵称,点击跳转
			 * @param {object} item [数据对象]
			 */
			userJump(item) {
                
                

                console.log("userJump", item);
                



			}
        },
        head: {
            title () {
                return {
                    inner: this.title
                }
            }
        },
        watch: {

            // 设置页面标题
            title(newVal) {
                if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
                    this.$iFrame.insertIFrame(newVal);
                } else {
                    this.$emit("updateHead");
                }
            }
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less" scoped>
    @import "darenList";
</style>