li-guang
2021-01-05 01b55d7e82c3b13554a412e9c5be0fc96a4906a3
hive-app/pages/mine/knowledge.vue
@@ -1,23 +1,29 @@
<template>
   <!-- 知识库 -->
   <view class="container flex">
      <scroll-view class="list-left" scroll-y>
         <view v-for="(item,index) in list" class="list-left-row" @click="active(index)" :class="activeIndex==index?'active':''">
            <text class="font-14 gray"  @click="show(item)">{{item.primaryTitle}}</text>
            <!-- <view v-for="(sub,index) in item.subTitle" v-show="item.isShow" class="list-left-row-item" @click="selectItem(index)" :class="index==select?'select-item':''">
               {{sub}}
            </view> -->
   <!-- 当前客户 -->
   <view class="container">
      <view class="list">
         <scroll-view class="list-left" scroll-y="true">
            <view class="list-left-row"
               v-for="(item,index) in typeList"
               :class="index==selectIndex?'active':''"
               @click="changeType(item.id, index)">
                  <text>{{item.name}}</text>
         </view>
      </scroll-view>
      <scroll-view class="list-right" scroll-y>
         <view class="flex align-center list-right-row">
            <image class="list-right-img ml-10" mode="aspectFit" src="../../static/images/default-avatar.png"></image>
            <view class="flex flex-v ml-10">
               <text class="overflow-nowrap font-14">我是文章的标题</text>
               <text class="overflow-omit font-14">我是文章的内容我是文章的内容我是文章的内容我是文章的内容</text>
         <scroll-view class="list-right" scroll-y="true">
            <navigator :url="'../productDetail/index?id='+item.id" hover-class="none" v-for="item in list">
               <view class="list-right-row">
                  <image class="product-img" :src="item.img?item.img:'../../../static/images/no-img.png'"></image>
                  <view class="flex-1">
                     <text>{{item.name}}</text>
                     <view class="flex justify-between mt-15">
                        <text class="price">¥{{item.price}}</text>
            </view>
         </view>
               </view>
            </navigator>
      </scroll-view>
      </view>
   </view>
</template>
@@ -25,32 +31,27 @@
   export default{
      data(){
         return{
            list:[
               {
                  primaryTitle:'院装产品',
                  subTitle:['水果','蔬菜'],
                  isShow:false,
            typeList: [{
               name: '312',
               id: 2
            }],
            list: [{
               name: '312',
               id: 2
            }],
            selectIndex: 0
         }
               },
               {
                  primaryTitle:'美容套餐',
                  subTitle:['水果','蔬菜'],
                  isShow:false
               }
            ],
            select:'0',
            activeIndex:'0'
         }
      onLoad(options) {
         this.loadTypeList()
      },
      methods:{
         show(item){
            item.isShow=!item.isShow
            this.select=0
         },
         selectItem(index){
            this.select=index
         },
         active(index){
            this.activeIndex=index
         loadTypeList(){
            this.$httpUtils.request('/api/know/findKnowledgeType').then((res) => {
               if(res.status == 200){
                  this.typeList = res.rows;
               }
            })
         }
      }
   }
@@ -61,67 +62,47 @@
      height: 100%;
   }
   .container{
      display: flex;
      flex-direction: column;
      height: 100%;
      padding: 10px 0 0;
      box-sizing: border-box;
   }
   .list{
      flex: 1;
      display: flex;
      overflow: hidden;
   }
   .list-left{
      width: 30%;
      height: 100%;
      text-align: center;
      width: 170rpx;
      background: #F6F6F8;
      border-radius: 4px;
   }
   .list-right{
      flex: 1;
   }
   .list-left-row{
      padding: 10px 10px;
      font-size: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 10px;
      color: #8c9fad;
      font-size: 13px;
   }
   .list-left-row-item{
      width: 80px;
      margin-top: 8px;
      font-size: 14px;
      color: ;
   }
   .select-item{
      background: red;
      border-radius: 20px;
      color: #FFFFFF;
   }
   .active{
   .list-left-row.active{
      background: #FFFFFF;
      color: #000000;
   }
   .list-right{
      width: 70%;
      text-align: center;
      padding: 0px 10px;
   }
   .list-right-row{
      display: flex;
      align-items: center;
      padding: 10px;
      margin: 0 10px 10px;
      border: 1px solid #EDEAF4;
      box-shadow:0 6px 6px rgba(237,234,244,0.5);
      border-radius: 4px;
      padding: 10px;
      font-size: 13px;
   }
   .list-right-img{
      width: 150px;
      height: 80px;
   }
   /* 超过两行显示省略号 */
   .overflow-omit{
      text-overflow: -o-ellipsis-lastline;
       overflow: hidden;
       text-overflow: ellipsis;
       display: -webkit-box;
       -webkit-line-clamp: 2;
       -webkit-box-orient: vertical;
   }
   /* 只能一行,超出显示省略号 */
   .overflow-nowrap{
      white-space:nowrap;
   .list-right-row .product-img{
      width: 66px;
      height: 66px;
      margin-right: 5px;
   }
</style>