180 lines
4.6 KiB
Vue
180 lines
4.6 KiB
Vue
|
|
<template>
|
||
|
|
<div class="myknwl">
|
||
|
|
<van-search v-model="value" placeholder="请输入文件名关键词" @search="search"/>
|
||
|
|
<van-tabs v-model="active" @click="onClick" line-width="25%" line-height="1" title-active-color="#378DEC">
|
||
|
|
<van-tab name="myknowledge" title="我的知识" :info="myKnowlageCount">
|
||
|
|
<my-knowledge ref="myknowledge" @func="changeCount"></my-knowledge>
|
||
|
|
</van-tab>
|
||
|
|
<van-tab name="mypublish" title="我发布的" :info="myPublicCount">
|
||
|
|
<my-publish ref="mypublish" @func="changeCount" :myPublicCount="myPublicCount"></my-publish>
|
||
|
|
</van-tab>
|
||
|
|
<van-tab name="myborrow" title="我借阅的" :info="myBorrowCount">
|
||
|
|
<my-borrow ref="myborrow" @func="changeCount" ></my-borrow>
|
||
|
|
</van-tab>
|
||
|
|
<template>
|
||
|
|
<span v-if="showFavorite">
|
||
|
|
<van-tab name="myfavorite" title="我的收藏" :info="myFavoriteCount">
|
||
|
|
<my-favorite ref="myfavorite" @func="changeCount"></my-favorite>
|
||
|
|
</van-tab>
|
||
|
|
</span>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
</van-tabs>
|
||
|
|
<tabbar/>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import tabbar from '../components/tabbar'
|
||
|
|
import myKnowledge from '../pages/myKnowledge'
|
||
|
|
import myPublish from '../pages/myPublish'
|
||
|
|
import myBorrow from '../pages/myBorrow'
|
||
|
|
import myFavorite from '../pages/myFavorite'
|
||
|
|
import awsuiAxios from "../awsuiAxios";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: 'myknwl',
|
||
|
|
components: {
|
||
|
|
tabbar,
|
||
|
|
myKnowledge,
|
||
|
|
myPublish,
|
||
|
|
myBorrow,
|
||
|
|
myFavorite
|
||
|
|
},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
showFavorite:false,//是否显示收藏
|
||
|
|
value: '',
|
||
|
|
active: 'myknowledge',
|
||
|
|
myFavoriteCount:"",
|
||
|
|
myKnowlageCount:"",
|
||
|
|
myBorrowCount:"",
|
||
|
|
myPublicCount:"",
|
||
|
|
rowpage:23
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
search(){
|
||
|
|
if(this.active=='myknowledge'){
|
||
|
|
this.$refs.myknowledge.searchMobileList(this.value,"search");
|
||
|
|
}else if(this.active=='mypublish'){
|
||
|
|
this.$refs.mypublish.searchMobileList(this.value,"search");
|
||
|
|
}else if(this.active=='myborrow'){
|
||
|
|
this.$refs.myborrow.searchMobileList(this.value,"search");
|
||
|
|
}else if(this.active=='myfavorite'){
|
||
|
|
this.$refs.myfavorite.loadData(this.value,"search");
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onClick(name, title) {
|
||
|
|
this.value = "";
|
||
|
|
localStorage.setItem("activeTab",name);
|
||
|
|
this.$nextTick(() => {
|
||
|
|
this.$refs[name].refreshList()
|
||
|
|
})
|
||
|
|
},
|
||
|
|
getfavoriteData(){
|
||
|
|
let that = this;
|
||
|
|
// 获取知识列表数据
|
||
|
|
awsuiAxios.post({
|
||
|
|
url: "jd",
|
||
|
|
async:false,
|
||
|
|
data: {
|
||
|
|
cmd: "com.actionsoft.apps.favorite_load_category_names"
|
||
|
|
},
|
||
|
|
}).then(function (r) {
|
||
|
|
if (r.result == "error") {
|
||
|
|
console.log(r.msg);
|
||
|
|
} else {
|
||
|
|
let data = r.data.categoryNames;
|
||
|
|
let countTmp = 0;
|
||
|
|
for(let i in data){
|
||
|
|
if(data[i]['categoryName']=='KMS'){
|
||
|
|
countTmp = (data[i]['amount'] == undefined) ? 0 : data[i]['amount'];
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
that.myFavoriteCount = countTmp==0?'':countTmp;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
},
|
||
|
|
changeCount(count,type){
|
||
|
|
if(type=='favorite'){
|
||
|
|
this.myFavoriteCount = count>0?count:"";
|
||
|
|
}else if(type=='knowledge'){
|
||
|
|
if(count==-1){
|
||
|
|
count = parseInt(this.myKnowlageCount)-1;
|
||
|
|
}
|
||
|
|
this.myKnowlageCount=count>0?count:"";
|
||
|
|
}else if(type=='borrow'){
|
||
|
|
this.myBorrowCount=count>0?count:"";
|
||
|
|
}else if(type=='publish'){
|
||
|
|
this.myPublicCount=count>0?count:"";
|
||
|
|
}
|
||
|
|
this.getfavoriteData();
|
||
|
|
},
|
||
|
|
initCount(){
|
||
|
|
let that = this;
|
||
|
|
awsuiAxios.post({
|
||
|
|
url: "jd",
|
||
|
|
data: {
|
||
|
|
cmd: "com.actionsoft.apps.kms_knwl_mobile_center_knowladge_count"
|
||
|
|
},
|
||
|
|
}).then(function (r) {
|
||
|
|
that.loading = false;
|
||
|
|
if (r.result == "error") {
|
||
|
|
alert(r.msg);
|
||
|
|
} else {
|
||
|
|
let data = r.data;
|
||
|
|
that.myKnowlageCount = data.meCount==0?"":data.meCount;
|
||
|
|
that.myBorrowCount = data.borrowCount==0?"":data.borrowCount;
|
||
|
|
that.myPublicCount = data.publishCount==0?"":data.publishCount;
|
||
|
|
that.showFavorite = data.showFavorite;
|
||
|
|
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
},
|
||
|
|
watch:{
|
||
|
|
value:function () {
|
||
|
|
this.search();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
created(){
|
||
|
|
let activel = localStorage.getItem("activeTab");
|
||
|
|
if(activel=='myfavorite'){
|
||
|
|
this.showFavorite = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mounted(){
|
||
|
|
let activel = localStorage.getItem("activeTab");
|
||
|
|
if(activel!=undefined&&activel!=''){
|
||
|
|
this.active=activel;
|
||
|
|
}
|
||
|
|
this.initCount();
|
||
|
|
this.getfavoriteData();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.myknwl {
|
||
|
|
height: 100%;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
<style>
|
||
|
|
.myknwl .van-tab {
|
||
|
|
border-top: 0.33px solid #e9e9e9;
|
||
|
|
border-bottom: 0.33px solid #e9e9e9;
|
||
|
|
}
|
||
|
|
|
||
|
|
.myknwl .van-tabs__nav .van-tabs__line {
|
||
|
|
height: 2px !important;
|
||
|
|
background-color:#378DEC !important;
|
||
|
|
}
|
||
|
|
.van-info{
|
||
|
|
top: -3px;
|
||
|
|
right: 0px;
|
||
|
|
}
|
||
|
|
</style>
|