118 lines
2.7 KiB
Vue
118 lines
2.7 KiB
Vue
|
|
<template>
|
||
|
|
<div class="myknowledge" :style="hstyle">
|
||
|
|
<van-loading v-if="initLoad" size="24" style="text-align: center;height: 300px;line-height: 300px;"/>
|
||
|
|
<list v-else @changeSizeInfo="changeSizeInfo" @downLoadMore="downLoadMore" :pageSetting="{'loading':loading,'finished':finished}" type="knowl" :list="lists"></list>
|
||
|
|
<van-button round type="info" class="createBtn" @click="onNewKnowl">
|
||
|
|
<i class="awsui-iconfont"></i>
|
||
|
|
</van-button>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import list from '../components/list'
|
||
|
|
import awsuiAxios from "../awsuiAxios";
|
||
|
|
export default {
|
||
|
|
name: 'myknowledge',
|
||
|
|
components: {list},
|
||
|
|
props:{
|
||
|
|
},
|
||
|
|
data () {
|
||
|
|
return {
|
||
|
|
hstyle:"",
|
||
|
|
initLoad:true,
|
||
|
|
isLoadingData:false,//防止重复加载数据
|
||
|
|
loading:false,
|
||
|
|
finished:false,
|
||
|
|
curPage:0,
|
||
|
|
keyWord:"",
|
||
|
|
lists: [
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
downLoadMore(){
|
||
|
|
this.searchMobileList("");
|
||
|
|
},
|
||
|
|
refreshList () {
|
||
|
|
console.log('myknowledge:refreshList')
|
||
|
|
},
|
||
|
|
onNewKnowl() {
|
||
|
|
this.$router.push({
|
||
|
|
name:'new-knowledge',
|
||
|
|
params:{
|
||
|
|
type:"create",
|
||
|
|
cardId:""
|
||
|
|
}
|
||
|
|
|
||
|
|
})
|
||
|
|
},
|
||
|
|
searchMobileList(key,type){
|
||
|
|
if(this.isLoadingData){
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let that = this;
|
||
|
|
if(type=='search'){
|
||
|
|
this.keyWord = key;
|
||
|
|
this.curPage =0;
|
||
|
|
this.finished = false;
|
||
|
|
}
|
||
|
|
this.isLoadingData = true;
|
||
|
|
// 获取知识列表数据
|
||
|
|
awsuiAxios.post({
|
||
|
|
url: "jd",
|
||
|
|
data: {
|
||
|
|
cmd: "com.actionsoft.apps.kms_knwl_center_me_card_list_json",
|
||
|
|
sortIndx:"createTime",
|
||
|
|
sortDir: "down",
|
||
|
|
rowsPerPage:0,
|
||
|
|
curPage:this.curPage<=0?1:this.curPage+1,
|
||
|
|
filter: encodeURIComponent(this.keyWord)
|
||
|
|
},
|
||
|
|
}).then(function (r) {
|
||
|
|
that.initLoad = false;
|
||
|
|
that.isLoadingData = false;
|
||
|
|
that.loading = false;
|
||
|
|
if (r.result == "error") {
|
||
|
|
alert(r.msg);
|
||
|
|
} else {
|
||
|
|
let rowsPerPage = r.data.rowsPerPage;
|
||
|
|
if(that.curPage==0){
|
||
|
|
that.lists = r.data.data;
|
||
|
|
}else{
|
||
|
|
that.lists =that.lists.concat( r.data.data);
|
||
|
|
}
|
||
|
|
that.loading = false;
|
||
|
|
that.curPage = r.data.curPage;
|
||
|
|
let totalRecords = r.data.totalRecords;
|
||
|
|
if(that.curPage*rowsPerPage>=totalRecords){
|
||
|
|
that.finished = true;
|
||
|
|
}
|
||
|
|
if(!that.finished&&that.curPage>=2&&that.lists.length<8){
|
||
|
|
that.searchMobileList("");
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
changeSizeInfo(){
|
||
|
|
this.$emit("func",-1,"knowledge");
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mounted(){
|
||
|
|
this.hstyle ="height:"+ (window.innerHeight-44-54-51)+"px";
|
||
|
|
this.searchMobileList("");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.createBtn {
|
||
|
|
border: 0 !important;
|
||
|
|
background-color:#378DEC !important;
|
||
|
|
position: fixed;
|
||
|
|
bottom: 80px;
|
||
|
|
right: 30px;
|
||
|
|
box-shadow:0px 4px 9px 1px #cfe1f5;
|
||
|
|
}
|
||
|
|
</style>
|