Browse Source

更新需求

shaogen1995 3 năm trước cách đây
mục cha
commit
d4b2cfe033

+ 5 - 4
web/src/config/api.js

@@ -284,11 +284,11 @@ export function getNewsDetail(data, cb=()=>{}) {
   });
 }
 
-// 获取精品典藏tab列表
-export const getTabList = () => {
+// 获取精品典藏tab列表和学习园地
+export const getTabList = (type) => {
   return axios({
     method: 'post',
-    url: 'api/web/goods/module/list',
+    url: `api/web/goods/module/list/${type}`,
   })
 }
 
@@ -340,4 +340,5 @@ export const webMesCheck = () => {
     method: 'get',
     url: '/cms/web/manage/check/message',
   })
-}
+}
+

+ 2 - 2
web/src/config/http.js

@@ -2,9 +2,9 @@ import axios from 'axios'
 
 var isProduction = process.env.NODE_ENV === 'production'
 // 线上打包
-const serverName = isProduction ? '/' : 'http://192.168.0.245:8003/'
+// const serverName = isProduction ? '/' : 'http://192.168.0.245:8003/'
 // 线下调试
-// const serverName = isProduction ? "/" : "http://192.168.0.135:8003/"
+const serverName = isProduction ? "/" : "http://192.168.0.135:8003/"
 
 const orginLink = window.location.origin
 

+ 16 - 10
web/src/views/collection/Collection.vue

@@ -4,15 +4,15 @@
       <ul>
         <li
           class="collectionHover"
-          @mouseenter="moveLike=i"
-          @mouseleave="moveLike=null"
+          @mouseenter="moveLike = i"
+          @mouseleave="moveLike = null"
           @click="clickItem($event, item)"
           v-for="(item, i) in tableData"
           :key="i"
         >
           <div>
             <!-- 点赞和投票 -->
-            <i class="like" v-show="moveLike===i">
+            <i class="like" v-show="moveLike === i">
               <img
                 v-if="item.isLike"
                 v-show="likeOFF.isLike"
@@ -78,7 +78,12 @@
 <script>
 import "element-ui/lib/theme-chalk/index.css";
 import { Notification } from "element-ui";
-import { goodsLikeApi, goodsLikeDelApi, goodsVoteApi,goodsVoteDelApi } from "@/config/api";
+import {
+  goodsLikeApi,
+  goodsLikeDelApi,
+  goodsVoteApi,
+  goodsVoteDelApi,
+} from "@/config/api";
 import Paging from "@/components/Paging";
 
 export default {
@@ -96,7 +101,7 @@ export default {
   },
   data() {
     return {
-      moveLike:null
+      moveLike: null,
     };
   },
   mounted() {},
@@ -108,6 +113,7 @@ export default {
         (e.path[0].className === "like_img" || e.path[0].className === "like")
       )
         return;
+      if (item.link) return window.open(item.link);
       this.$showBroadcast({
         item,
         zhuti: this.theme,
@@ -121,7 +127,7 @@ export default {
       });
       if (res.code === 0) {
         this.infoTitle("点赞成功", "success");
-        this.$emit('upLike')
+        this.$emit("upLike");
       }
     },
     //点击取消点赞
@@ -129,7 +135,7 @@ export default {
       let res = await goodsLikeDelApi(id);
       if (res.code === 0) {
         this.infoTitle("取消点赞成功", "success");
-        this.$emit('upLike')
+        this.$emit("upLike");
       }
     },
     // 点击投票
@@ -140,15 +146,15 @@ export default {
       });
       if (res.code === 0) {
         this.infoTitle("投票成功", "success");
-        this.$emit('upLike')
+        this.$emit("upLike");
       }
     },
     // 点击取消投票
-   async voteNo(id) {
+    async voteNo(id) {
       let res = await goodsVoteDelApi(id);
       if (res.code === 0) {
         this.infoTitle("取消投票成功", "success");
-        this.$emit('upLike')
+        this.$emit("upLike");
       }
     },
     // 封装消息提示信息

+ 1 - 1
web/src/views/collection/index.vue

@@ -108,7 +108,7 @@ export default {
       }, 100);
     })
     // 获取经典检查tab栏列表
-    let res = await getTabList();
+    let res = await getTabList('goods');
     // console.log(998,res);
     this.type = res.data;
   },

+ 5 - 0
web/src/views/dynamic/detail.vue

@@ -58,6 +58,9 @@ export default {
     };
   },
   computed: {
+    goodsModuleId(){
+      return this.$route.params.goodsModuleId;
+    },
     activeId() {
       return this.$route.params.type;
     },
@@ -67,6 +70,7 @@ export default {
   },
   mounted() {
     this.getData();
+    console.log('-------',this.$route.params);
   },
   watch: {
     id(newVal) {
@@ -96,6 +100,7 @@ export default {
         pageSize: 1000,
         searchKey: this.searchKey,
         type: this.activeId,
+        goodsModuleId:this.goodsModuleId
       };
       getList("news", params, (res) => {
         res.data.list.forEach((item) => {

+ 26 - 19
web/src/views/dynamic/list.vue

@@ -5,7 +5,7 @@
         <li
           v-for="(item, i) in aside"
           @click="handleItem(item)"
-          :class="{ active: activeId == item.id }"
+          :class="{ active: activeInd == item.id }"
           class="liparimary"
           :key="i"
         >
@@ -32,7 +32,7 @@
 </template>
 
 <script>
-import { getList, getNewsDetail } from "@/config/api";
+import { getList, getNewsDetail,getTabList } from "@/config/api";
 import {title} from './data'
 
 import lrLayout from '@/components/lrLayout'
@@ -41,16 +41,18 @@ export default {
   components:{lrLayout},
   data() {
     return {
-      aside: [
-        {
-          name: "知识阅览",
-          id: "info",
-        },
-        {
-          name: "知识共享",
-          id: "share",
-        },
-      ],
+      aside:[],
+      activeInd:4,
+      // aside: [
+      //   {
+      //     name: "知识阅览",
+      //     id: "info",
+      //   },
+      //   {
+      //     name: "知识共享",
+      //     id: "share",
+      //   },
+      // ],
       title,
       list:[],
       searchKey:''
@@ -61,11 +63,13 @@ export default {
       return this.$route.params.type;
     },
   },
-  mounted() {
+async  mounted() {
     this.getData()
+    let res = await getTabList('news');
+    this.aside=res.data
   },
   watch: {
-    activeId(){
+    activeInd(){
       this.getData()
     }
   },
@@ -78,7 +82,8 @@ export default {
       getNewsDetail({id})
     },
     handleItem(item) {
-      this.$router.push({ params: { type: item.id } });
+      this.activeInd = item.id
+      this.$router.push({ params: { type: item.type,goodsModuleId:item.id } });
     },
     handleLi(item){
       console.log(item);
@@ -88,7 +93,7 @@ export default {
         window.open(url,'_blank')
       }
       else{
-        this.$router.push({ params: {key:'detail', id: item.id } });
+        this.$router.push({ params: {key:'detail', id: item.id,goodsModuleId:item.goodsModuleId } });
       }
     },
     pageChange(data) {
@@ -99,7 +104,8 @@ export default {
         pageNum: 1,
         pageSize: 1000,
         searchKey: this.searchKey,
-        type: this.activeId,
+        goodsModuleId:this.activeInd
+        // type: this.activeId,
       };
       getList("news", params, (res) => {
         res.data.list.forEach(item => {
@@ -116,7 +122,8 @@ export default {
   .content {
     background: #fff;
     width: 100%;
-    padding: 56px 0;
+    max-height: 480px;
+    overflow-y: auto;
     > li {
       height: 80px;
       line-height: 80px;
@@ -144,7 +151,7 @@ export default {
         display: inline-block;
         position: relative;
         color: #999;
-        font-size: 20px;
+        font-size: 18px;
         &::before {
           position: absolute;
           top: 50%;