Commit 0f3123c57d8ffc3539fe73c2eed560be513f265b

Authored by 王强
1 parent 1322b93e

达人动态列表页,达人动态组件,开发中~

src/components/darenListCom/darenListCom.less 0 → 100644
  1 +@charset "UTF-8";
  2 +
  3 +.daren-list-box {
  4 + .daren-list-com {
  5 +
  6 + }
  7 +}
src/components/darenListCom/darenListCom.vue 0 → 100644
  1 +<template>
  2 + <div class="daren-list-com">
  3 +
  4 + <!-- 标题slot -->
  5 + <slot name="title-box"></slot>
  6 +
  7 + <div class="box">
  8 + <div class="top-box">
  9 +
  10 + <!-- 用户头像/昵称 -->
  11 + <user-avatar class="top-left" @jump="userJump"
  12 + >
  13 + </user-avatar>
  14 +
  15 + <!-- 发布时间 -->
  16 + <div class="top-right">
  17 +
  18 + </div>
  19 + </div>
  20 +
  21 + <!-- 动态简介 -->
  22 + <div class="intro"></div>
  23 +
  24 + <!-- 中间图片部分 -->
  25 + <div class="center-box">
  26 +
  27 + <!-- 达人图片展示(单独组建处理,宫格形式) -->
  28 +
  29 +
  30 +
  31 +
  32 +
  33 + </div>
  34 +
  35 + <!-- 底部部分 -->
  36 + <div class="bottom-box">
  37 +
  38 + <!-- 附加信息slot -->
  39 + <slot name="Add-info"></slot>
  40 +
  41 + <!-- 商品标签组建 -->
  42 +
  43 +
  44 +
  45 +
  46 +
  47 +
  48 + <!-- 评论/点赞/查看按钮 -->
  49 + <div class="comment-like-view-box">
  50 + <div class="left">
  51 +
  52 +
  53 +
  54 +
  55 +
  56 + </div>
  57 + <div class="right">
  58 +
  59 + </div>
  60 + </div>
  61 + </div>
  62 +
  63 + </div>
  64 + </div>
  65 +</template>
  66 +
  67 +<script>
  68 +
  69 + // 引入组件
  70 + import userAvatar from "@/components/userAvatarBox/userAvatarBox";
  71 +
  72 +
  73 +
  74 +
  75 + export default {
  76 + name: "darenListCom",
  77 + data() {
  78 + return {
  79 +
  80 + }
  81 + },
  82 + props: ["lists"],
  83 + components: {
  84 + userAvatar,
  85 +
  86 +
  87 +
  88 +
  89 +
  90 + },
  91 + methods: {
  92 +
  93 + /**
  94 + * 点击跳转
  95 + * @param {object} item [数据对象]
  96 + */
  97 + jump(item) {
  98 + this.$emit("jump", item);
  99 + },
  100 +
  101 + /**
  102 + * 用户头像/昵称,点击跳转
  103 + * @param {object} item [数据对象]
  104 + */
  105 + userJump(item) {
  106 + this.$emit("userJump", item);
  107 + }
  108 + }
  109 + }
  110 +</script>
  111 +
  112 +<!-- Add "scoped" attribute to limit CSS to this component only -->
  113 +<style rel="stylesheet/less" lang="less" scoped>
  114 + @import './darenListCom';
  115 +</style>
src/components/horizList/horizList.vue
@@ -54,13 +54,16 @@ @@ -54,13 +54,16 @@
54 </template> 54 </template>
55 55
56 <script> 56 <script>
  57 +
57 // 引入组件 58 // 引入组件
58 import goodsItem1 from "@/components/goodsItem_1/goodsItem_1"; 59 import goodsItem1 from "@/components/goodsItem_1/goodsItem_1";
59 import goodsItem2 from "@/components/goodsItem_2/goodsItem_2"; 60 import goodsItem2 from "@/components/goodsItem_2/goodsItem_2";
60 import goodsItem3 from "@/components/goodsItem_3/goodsItem_3"; 61 import goodsItem3 from "@/components/goodsItem_3/goodsItem_3";
61 - import swiperItem from "@/components/swiperItem/swiperItem"; 62 + import swiperItem from "@/components/swiperItem/swiperItem";
  63 +
62 export default { 64 export default {
63 - data: function () { 65 + name: "horizList",
  66 + data() {
64 return { 67 return {
65 basicWidth: 100, 68 basicWidth: 100,
66 scrollItemBox: 100 69 scrollItemBox: 100
src/components/userAvatarBox/userAvatarBox.less 0 → 100644
  1 +@charset "UTF-8";
  2 +
  3 +.user-avatar-box {
  4 + display: inline-block;
  5 + background-color: transparent;
  6 + width: 100%;
  7 + height: auto;
  8 + .box {
  9 + position: relative;
  10 + display: flex;
  11 + justify-content: flex-start;
  12 + align-items: center;
  13 + width: auto;
  14 + height: 100%;
  15 + .avatar-box {
  16 + width: 100px;
  17 + height: 100px;
  18 + .avatar-img {
  19 + display: block;
  20 + width: 100px;
  21 + height: 100px;
  22 + }
  23 + }
  24 + .nickname {
  25 + margin-left: 20px;
  26 + color: #333333;
  27 + font-size: 28px;
  28 + }
  29 + }
  30 +}
src/components/userAvatarBox/userAvatarBox.vue 0 → 100644
  1 +<template>
  2 + <div class="user-avatar-box" v-if="users" @click="jump(users)">
  3 + <div class="box">
  4 + <div class="avatar-box">
  5 + <img v-lazy="users.avatar" class="avatar-img" />
  6 + </div>
  7 + <div class="nickname">
  8 + {{users.nickname}}
  9 + </div>
  10 + </div>
  11 + </div>
  12 +</template>f
  13 +
  14 +<script>
  15 + export default {
  16 + data: function () {
  17 + return {
  18 +
  19 + }
  20 + },
  21 + props: ["users"],
  22 + methods: {
  23 +
  24 + /**
  25 + * 点击跳转事件绑定
  26 + */
  27 + jump(item) {
  28 + this.$emit("jump", item);
  29 + }
  30 + }
  31 + }
  32 +</script>
  33 +
  34 +<!-- Add "scoped" attribute to limit CSS to this component only -->
  35 +<style rel="stylesheet/less" lang="less">
  36 + @import './userAvatarBox';
  37 +</style>
0 \ No newline at end of file 38 \ No newline at end of file
src/pages/darenList/darenList.less 0 → 100644
  1 +@charset "UTF-8";
  2 +
  3 +.daren-list-com {
  4 + .title-box + .box {
  5 + margin-top: 30px;
  6 + }
  7 + > .box {
  8 +
  9 + }
  10 +}
0 \ No newline at end of file 11 \ No newline at end of file
src/pages/darenList/darenList.vue 0 → 100644
  1 +<template>
  2 + <div class="daren-list-box">
  3 +
  4 + <!-- 达人动态列表 -->
  5 + <daren-list-com class="daren-list-com" @userJump="userJump" @jump="jump"
  6 + :lists="{}">
  7 +
  8 + <!-- 最新动态标题 -->
  9 + <text-title-box slot="title-box"
  10 + :titles="{
  11 + title: '最新动态',
  12 + more: true
  13 + }">
  14 + </text-title-box>
  15 + </daren-list-com>
  16 +
  17 +
  18 +
  19 +
  20 +
  21 +
  22 +
  23 +
  24 + </div>
  25 +</template>
  26 +
  27 +<script>
  28 +
  29 + // 引入组件
  30 + import { Toast, Indicator } from "mint-ui";
  31 + import darenListCom from "@/components/darenListCom/darenListCom";
  32 + import textTitleBox from "@/components/textTitleBox/textTitleBox";
  33 +
  34 +
  35 +
  36 + export default {
  37 + name: "darenList",
  38 + data() {
  39 + return {
  40 + title: "", // 标题
  41 +
  42 +
  43 +
  44 +
  45 + }
  46 + },
  47 + components:{
  48 + darenListCom,
  49 + textTitleBox,
  50 +
  51 +
  52 +
  53 +
  54 +
  55 + },
  56 + created() {
  57 +
  58 + // 获取优选库精选活动
  59 + // this.activityAd();
  60 + },
  61 + methods: {
  62 +
  63 + // 下拉刷新
  64 + // onRefresh() {
  65 +
  66 + // // 下拉刷新中
  67 + // this.$set(this, "isLoading", true);
  68 +
  69 + // // 获取优选库精选活动
  70 + // this.activityAd();
  71 + // },
  72 +
  73 + /**
  74 + * 获取优选库精选活动
  75 + */
  76 + activityAd() {
  77 + // 加载中提示
  78 + Indicator.open("加载中...");
  79 +
  80 + // 获取证书请求接口
  81 + this.http("/Api/" + this.getApiVersion().index + "/activityAd", {
  82 + id: this.$route.query.id
  83 + }, this.activityAdCallback, {
  84 + method: "post"
  85 + }
  86 + );
  87 + },
  88 +
  89 + /**
  90 + * 获取优选库精选活动回调
  91 + * @param {object} res [服务器返回数据]
  92 + * @param {object} ext [扩展参数]
  93 + */
  94 + activityAdCallback(res, ext) {
  95 +
  96 + // 加载完成
  97 + Indicator.close();
  98 +
  99 + // 下拉刷新结束
  100 + this.$set(this, "isLoading", false);
  101 +
  102 + // 返回处理
  103 + if (res.code == 200) {
  104 +
  105 + // 解构数据
  106 + let { data: datas } = res;
  107 +
  108 + /* 获取优选库精选活动数据 开始 */
  109 +
  110 + // 设置标题
  111 + this.$set(this, "title", datas.title);
  112 +
  113 + // 设置banner数据
  114 + if (datas.banner && datas.banner.length) {
  115 + this.$set(this, "banner", datas.banner);
  116 + }
  117 +
  118 + // 设置navs数据
  119 + if (datas.navs && datas.navs.length) {
  120 + this.$set(this, "navs", datas.navs);
  121 + }
  122 +
  123 + // 设置ads数据
  124 + if (datas.ads && datas.ads.length) {
  125 + this.$set(this, "ads", datas.ads);
  126 + }
  127 +
  128 + /* 获取优选库精选活动数据 结束 */
  129 +
  130 + } else if (res.code == 400) {
  131 +
  132 + // 获取优选库精选活动失败
  133 + Toast(res.message);
  134 + } else {
  135 +
  136 + // 获取优选库精选活动失败
  137 + Toast("获取优选库精选活动失败");
  138 + }
  139 + },
  140 +
  141 + /**
  142 + * 调用通用跳转
  143 + * @param {object} item [通用跳转对象]
  144 + */
  145 + toDetail(item) {
  146 +
  147 + // 判断是否有通用跳转函数
  148 + if (typeof this.$parent.gotoDetail === "function") {
  149 +
  150 + // 调用通用跳转
  151 + this.$parent.gotoDetail(item);
  152 + }
  153 + },
  154 +
  155 + /**
  156 + * 跳转达人动态详情
  157 + * @param {object} item [数据对象]
  158 + */
  159 + jump(item) {
  160 +
  161 +
  162 + console.log("jump", item);
  163 +
  164 +
  165 + // 判断并调用通用跳转
  166 + if (typeof this.$parent.gotoDetail === "function") {
  167 + this.$parent.gotoDetail(item);
  168 + }
  169 + },
  170 +
  171 + /**
  172 + * 用户头像/昵称,点击跳转
  173 + * @param {object} item [数据对象]
  174 + */
  175 + userJump(item) {
  176 +
  177 +
  178 +
  179 + console.log("userJump", item);
  180 +
  181 +
  182 +
  183 +
  184 + }
  185 + },
  186 + head: {
  187 + title () {
  188 + return {
  189 + inner: this.title
  190 + }
  191 + }
  192 + },
  193 + watch: {
  194 +
  195 + // 设置页面标题
  196 + title(newVal) {
  197 + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
  198 + this.$iFrame.insertIFrame(newVal);
  199 + } else {
  200 + this.$emit("updateHead");
  201 + }
  202 + }
  203 + }
  204 + }
  205 +</script>
  206 +
  207 +<!-- Add "scoped" attribute to limit CSS to this component only -->
  208 +<style rel="stylesheet/less" lang="less" scoped>
  209 + @import "darenList";
  210 +</style>
src/router/index.js
@@ -81,6 +81,17 @@ const router = new Router({ @@ -81,6 +81,17 @@ const router = new Router({
81 meta: { 81 meta: {
82 requireAuth: false 82 requireAuth: false
83 } 83 }
  84 + },
  85 + {
  86 + // 优选库环球优物更多列表页
  87 + path: "/darenList",
  88 + name: "darenList",
  89 + component: resolve => {
  90 + require(["@/pages/darenList/darenList"], resolve);
  91 + },
  92 + meta: {
  93 + requireAuth: false
  94 + }
84 } 95 }
85 ] 96 ]
86 }, 97 },