moreDynamic.vue 5.83 KB
<template>
    <div class="item_box">
        <div
            infinite-scroll-immediate-check="true"
            v-infinite-scroll="getNewDynamicList"
            infinite-scroll-disabled="loading"
            :infinite-scroll-distance="50">
            <daren-list-box class="daren-list" @userJump="userJump" @jump="jump" @goodsJump="goodsJump" @goodsPrimary="goodsPrimary"
                            :lists="recommendedDarenMore">
            </daren-list-box>
        </div>
    </div>
</template>

<script>
    import { Toast, Indicator } from "mint-ui";
    import darenListBox from "@/components/darenListBox/darenListBox";
    export default {
        name: 'recommendedDaren',
        data () {
            return {
                loading: false, // 加载
                pages:0, // 分页
                recommendedDarenMore:null
            }
        },
        components:{
            darenListBox
        },
        created(){

            // 设置标题
            this.$set(this, "title", "已关注达人动态");
            // 已关注达人更多动态
            this.getNewDynamicList();
        },
        methods: {
            /**
             * 达人最新动态
             */
            getNewDynamicList() {
                this.loading = true;
                this.pages++
                // 加载中提示
                Indicator.open("加载中...");

                // 获取证书请求接口
                this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", {
                        uid: this.$route.query.uid,
                        page: this.pages,
                        type: 2
                    }, this.getNewDynamicListCallback, {
                        method: "post"
                    }
                );
            },

            /**
             * 达人最新动态回调
             * @param {object} res [服务器返回数据]
             * @param {object} ext [扩展参数]
             */
            getNewDynamicListCallback(res, ext) {

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

                // 返回处理
                if (res.code == 200) {
                    // 解构数据
                    let { data: datas } = res;
                    // 设置shopFnsDynamic达人动态数据

                    if (datas.list && datas.list.length) {
                        // 隐藏加载圈
                        this.loading = false;
                        this.$set(this, "recommendedDarenMore", datas.list);
                    }
                    /* 获取达人动态数据 结束 */

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

                    // 获取达人动态失败
                    Toast(res.message);
                } else {

                    // 获取优选库精选活动失败
                    Toast("获取达人动态失败");
                }
            },
            /**
             * 用户头像/昵称,点击跳转
             * @param {object} item [数据对象]
             */
            userJump(item) {

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

                    // 临时,设置跳转达人个人主页用户数据
                    Object.assign(item, {
                        type: "5",
                        to: (this.mode == "prod") ? "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + item.id : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect"+ "&id=" + item.id,
                        shop_type: ""
                    });


                    console.log("userJump", item);




                    this.$parent.gotoDetail(item);
                }
            },

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

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


                    // 临时,设置跳转参数,跳转达人动态详情页面
                    Object.assign(item, {
                        type: "25",
                        to: "265",
                        shop_type: ""
                    });


                    console.log("jump", item);


                    this.$parent.gotoDetail(item);
                }
            },
            /**
             * 点击跳转商品
             * @param {object} item [数据对象]
             */
            goodsJump(item) {

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

                    // 临时,设置跳转商品详情参数
                    Object.assign(item, {
                        type: "2",
                        to: "9525393",
                        shop_type: "1"
                    });


                    console.log("goodsJump", item);



                    this.$parent.gotoDetail(item);
                }
            },

            /**
             * 点击跳转商品购买
             * @param {object} item [数据对象]
             */
            goodsPrimary(item) {

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

                    // 临时,设置跳转商品详情参数
                    Object.assign(item, {
                        type: "2",
                        to: "9525393",
                        shop_type: "1"
                    });


                    console.log("goodsPrimary", item);



                    this.$parent.gotoDetail(item);
                }
            }
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>