|
@@ -1,12 +1,27 @@
|
|
|
<template>
|
|
|
<ul class="treeList">
|
|
|
- <li v-for="(item,index) in data" :key="index">
|
|
|
- <p class="parent-node"><span class="number">{{index+1}}</span><b class="title">{{item.chn_name}}</b></p>
|
|
|
- <ul v-if="item.arts&&item.arts.length>0">
|
|
|
- <li :class="[isBuy||index===0?'children-buy':'children-no','children']" v-for="(items,indexs) in item.arts" :key="indexs" @click="handleLink(items,isBuy||index===0,index)">
|
|
|
- <p class="children-node"><span class="number">{{indexs+1}}</span><b class="title">{{items.art_title}}</b><i class="el-icon-lock" v-if="!(isBuy||index===0)"></i></p>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <li v-for="(item, index) in data" :key="index">
|
|
|
+ <p class="parent-node">
|
|
|
+ <span class="number">{{ index + 1 }}</span
|
|
|
+ ><b class="title">{{ item.chn_name }}</b>
|
|
|
+ </p>
|
|
|
+ <ul v-if="item.arts && item.arts.length > 0">
|
|
|
+ <li
|
|
|
+ :class="[
|
|
|
+ isBuy || index === 0 ? 'children-buy' : 'children-no',
|
|
|
+ 'children',
|
|
|
+ ]"
|
|
|
+ v-for="(items, indexs) in item.arts"
|
|
|
+ :key="indexs"
|
|
|
+ @click="handleLink(items, isBuy || index === 0, index)"
|
|
|
+ >
|
|
|
+ <p class="children-node">
|
|
|
+ <span class="number">{{ indexs + 1 }}</span
|
|
|
+ ><b class="title">{{ items.art_title }}</b
|
|
|
+ ><i class="el-icon-lock" v-if="!(isBuy || index === 0)"></i>
|
|
|
+ </p>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</template>
|
|
@@ -17,187 +32,195 @@
|
|
|
import { getLogin } from "@/api/ajax";
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
|
- components: { },
|
|
|
- props: ["data", "isBuy","LoginNavIndex","userBg","headerBorder","headerBg","cardType"],
|
|
|
+ components: {},
|
|
|
+ props: [
|
|
|
+ "data",
|
|
|
+ "isBuy",
|
|
|
+ "LoginNavIndex",
|
|
|
+ "userBg",
|
|
|
+ "headerBorder",
|
|
|
+ "headerBg",
|
|
|
+ "cardType",
|
|
|
+ ],
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
- return {
|
|
|
-
|
|
|
- }
|
|
|
+ return {};
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
|
computed: {},
|
|
|
//监控data中数据变化
|
|
|
- watch: {
|
|
|
-
|
|
|
- },
|
|
|
+ watch: {},
|
|
|
//方法集合
|
|
|
methods: {
|
|
|
// 跳转
|
|
|
- async handleLink(item,flag,index){
|
|
|
- if(!flag){
|
|
|
- return
|
|
|
- }
|
|
|
- let url = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg
|
|
|
- if(this.cardType==='baozhi'){
|
|
|
- let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
|
|
|
- let data = {
|
|
|
- iss_id: this.$route.query.id,
|
|
|
- art_id: item.id
|
|
|
- }
|
|
|
- await getLogin(MethodName, data)
|
|
|
- .then((res) => {
|
|
|
- })
|
|
|
- this.$router.push({
|
|
|
- path: "/articleDetail",
|
|
|
- query: {
|
|
|
- headerConfig: encodeURIComponent(url),
|
|
|
- id: item.id,
|
|
|
- iss_id: this.$route.query.id
|
|
|
- },
|
|
|
-
|
|
|
- });
|
|
|
- }else{
|
|
|
- this.$router.push({
|
|
|
- path: "/magazineDetail",
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // if(index===0){
|
|
|
- // this.$router.push({
|
|
|
- // path: "/articleDetail",
|
|
|
- // type:index
|
|
|
- // });
|
|
|
- // }else if(index===1){
|
|
|
- // this.$router.push({
|
|
|
- // path: "/magazineDetail",
|
|
|
- // });
|
|
|
- // }else if(index===2){
|
|
|
- // this.$router.push({
|
|
|
- // path: "/videoDetail",
|
|
|
- // query: {
|
|
|
- // headerConfig: encodeURIComponent(url)
|
|
|
- // },
|
|
|
- // });
|
|
|
- // }else if(index===3){
|
|
|
- // this.$router.push({
|
|
|
- // path: "/courseDetail",
|
|
|
- // query: {
|
|
|
- // headerConfig: encodeURIComponent(url)
|
|
|
- // },
|
|
|
- // });
|
|
|
- // }
|
|
|
- // if(flag){
|
|
|
- // let url = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg
|
|
|
- // this.$router.push({
|
|
|
- // path: "/courseDetail",
|
|
|
- // query: {
|
|
|
- // headerConfig: encodeURIComponent(url)
|
|
|
- // },
|
|
|
- // });
|
|
|
- // }
|
|
|
- }
|
|
|
+ async handleLink(item, flag, index) {
|
|
|
+ if (!flag) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let url =
|
|
|
+ this.LoginNavIndex +
|
|
|
+ "&&&" +
|
|
|
+ this.userBg +
|
|
|
+ "&&&" +
|
|
|
+ this.headerBorder +
|
|
|
+ "&&&" +
|
|
|
+ this.headerBg;
|
|
|
+ if (this.cardType === "baozhi") {
|
|
|
+ let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
|
|
|
+ let data = {
|
|
|
+ iss_id: this.$route.query.id,
|
|
|
+ art_id: item.id,
|
|
|
+ };
|
|
|
+ await getLogin(MethodName, data).then((res) => {});
|
|
|
+ this.$router.push({
|
|
|
+ path: "/articleDetail",
|
|
|
+ query: {
|
|
|
+ headerConfig: encodeURIComponent(url),
|
|
|
+ id: item.id,
|
|
|
+ iss_id: this.$route.query.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/magazineDetail",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // if(index===0){
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/articleDetail",
|
|
|
+ // type:index
|
|
|
+ // });
|
|
|
+ // }else if(index===1){
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/magazineDetail",
|
|
|
+ // });
|
|
|
+ // }else if(index===2){
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/videoDetail",
|
|
|
+ // query: {
|
|
|
+ // headerConfig: encodeURIComponent(url)
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }else if(index===3){
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/courseDetail",
|
|
|
+ // query: {
|
|
|
+ // headerConfig: encodeURIComponent(url)
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // if(flag){
|
|
|
+ // let url = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/courseDetail",
|
|
|
+ // query: {
|
|
|
+ // headerConfig: encodeURIComponent(url)
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ },
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created() {
|
|
|
- },
|
|
|
+ created() {},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- mounted() {
|
|
|
-
|
|
|
- },
|
|
|
+ mounted() {},
|
|
|
//生命周期-创建之前
|
|
|
- beforeCreated() { },
|
|
|
+ beforeCreated() {},
|
|
|
//生命周期-挂载之前
|
|
|
- beforeMount() { },
|
|
|
+ beforeMount() {},
|
|
|
//生命周期-更新之前
|
|
|
- beforUpdate() { },
|
|
|
+ beforUpdate() {},
|
|
|
//生命周期-更新之后
|
|
|
- updated() { },
|
|
|
+ updated() {},
|
|
|
//生命周期-销毁之前
|
|
|
- beforeDestory() { },
|
|
|
+ beforeDestory() {},
|
|
|
//生命周期-销毁完成
|
|
|
- destoryed() { },
|
|
|
+ destoryed() {},
|
|
|
//如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
- activated() { }
|
|
|
-}
|
|
|
+ activated() {},
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
/* @import url(); 引入css类 */
|
|
|
-ul{
|
|
|
- list-style: none;
|
|
|
- padding: 0;
|
|
|
- margin: 0;
|
|
|
+ul {
|
|
|
+ list-style: none;
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
}
|
|
|
-p{
|
|
|
- margin: 0;
|
|
|
+p {
|
|
|
+ margin: 0;
|
|
|
}
|
|
|
-.treeList{
|
|
|
- .parent-node{
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: 16px;
|
|
|
- .number{
|
|
|
- width: 26px;
|
|
|
- font-weight: 500;
|
|
|
- font-size: 16px;
|
|
|
- line-height: 24px;
|
|
|
- color: #2F3742;
|
|
|
- }
|
|
|
- .title{
|
|
|
- font-weight: 500;
|
|
|
- font-size: 16px;
|
|
|
- line-height: 24px;
|
|
|
- color: #2F3742;
|
|
|
- }
|
|
|
+.treeList {
|
|
|
+ width: 100%;
|
|
|
+ .parent-node {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ .number {
|
|
|
+ width: 26px;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #2f3742;
|
|
|
}
|
|
|
- ul{
|
|
|
- margin-bottom: 16px;
|
|
|
- .children{
|
|
|
- padding: 0 32px;
|
|
|
- border-radius: 4px;
|
|
|
- height: 40px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: 4px;
|
|
|
- &-buy{
|
|
|
- .number,.title{
|
|
|
- color: #2F3742;
|
|
|
- }
|
|
|
- }
|
|
|
- &-no{
|
|
|
- .number,.title{
|
|
|
- color: #929CA8;
|
|
|
- }
|
|
|
- }
|
|
|
- &-buy:hover{
|
|
|
- background: #E5E6EB;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- &-node{
|
|
|
- display: flex;
|
|
|
- width: 100%;
|
|
|
- align-items: center;
|
|
|
- }
|
|
|
- .number{
|
|
|
- width: 24px;
|
|
|
- }
|
|
|
- .title{
|
|
|
- flex: 1;
|
|
|
- overflow: hidden;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- }
|
|
|
- .number,.title{
|
|
|
- font-weight: 400;
|
|
|
- font-size: 16px;
|
|
|
- line-height: 24px;
|
|
|
- }
|
|
|
- .el-icon-lock{
|
|
|
- height: 16px;
|
|
|
- color: #929CA8;
|
|
|
- }
|
|
|
+ .title {
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #2f3742;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ul {
|
|
|
+ margin-bottom: 16px;
|
|
|
+ .children {
|
|
|
+ padding: 0 32px;
|
|
|
+ border-radius: 4px;
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ &-buy {
|
|
|
+ .number,
|
|
|
+ .title {
|
|
|
+ color: #2f3742;
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+ &-no {
|
|
|
+ .number,
|
|
|
+ .title {
|
|
|
+ color: #929ca8;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &-buy:hover {
|
|
|
+ background: #e5e6eb;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ &-node {
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .number {
|
|
|
+ width: 24px;
|
|
|
+ }
|
|
|
+ .title {
|
|
|
+ flex: 1;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ .number,
|
|
|
+ .title {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ .el-icon-lock {
|
|
|
+ height: 16px;
|
|
|
+ color: #929ca8;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|