解决书签便签之间切换,数据显示状态等问题

This commit is contained in:
WangHao 2020-10-17 18:57:15 +08:00
parent 20da1d10a0
commit bbcf39bfc6
6 changed files with 158 additions and 70 deletions

View File

@ -38,3 +38,18 @@ https://www.jianshu.com/p/c1ee7e4247bf
@Synchronized : 同步方法安全的转化 @Synchronized : 同步方法安全的转化
@Getter(lazy=true) : @Getter(lazy=true) :
@Log : 支持各种logger对象使用时用对应的注解@Log4j @Log : 支持各种logger对象使用时用对应的注解@Log4j
beforCreate创建之前
Created创建之后
beforMount载入之前
Mounted载入之后
beforUpdate更新之前
Updated更新之后
beforDestroy销毁之前
Destroyed销毁之后
activatekeep-alive组件激活时调用
deactivatedkeep-alive组件停用时调用
errorCaptured这个组件的作用是接受子孙组件报错是调用三个参数 错误对象、错误的组件、错误信息)

View File

@ -83,6 +83,8 @@ public class NmNoteServiceImpl implements INmNoteService {
nmNote.setCreateTime(DateUtils.getNowDate()); nmNote.setCreateTime(DateUtils.getNowDate());
nmNote.setTitle(DateUtil.now()); nmNote.setTitle(DateUtil.now());
nmNote.setTiymceUeditor(defaultUidGenerator.getUID()); nmNote.setTiymceUeditor(defaultUidGenerator.getUID());
//创建文章>>mongodb
redisCache.setCacheObject(Constants.NM_NOTE_CONTENT+nmNote.getTiymceUeditor(),"请开始你的创作!");
return nmNoteMapper.insertSelective(nmNote); return nmNoteMapper.insertSelective(nmNote);
} }

View File

@ -42,6 +42,7 @@
components: {format}, components: {format},
props: { props: {
bookmarkList: Array, bookmarkList: Array,
property: null,
}, },
data: function () { data: function () {
return { return {
@ -49,25 +50,19 @@
noteTime:true, noteTime:true,
isBookmarkIcon:false, isBookmarkIcon:false,
Ueditor:undefined, Ueditor:undefined,
} }
}, },
mounted(){
this.showView(this.property);
},
updated(){
this.showView(this.property);
},
created() { created() {
var that=this; var that=this;
//便ID //便ID
that.Ueditor = that.$route.query.Ueditor; that.Ueditor = that.$route.query.Ueditor;
var a=2;
if(a==2){
//便
this.isdescription=false;
this.noteTime=true;
this.isBookmarkIcon=false;
}else {
this.isdescription=true;
this.noteTime=false;
this.isBookmarkIcon=true;
}
}, },
filters: { filters: {
//timeago.js //timeago.js
@ -83,6 +78,27 @@
this.$emit('on-windowurl', noteId, tiymceueditor,bookmarkId,url); this.$emit('on-windowurl', noteId, tiymceueditor,bookmarkId,url);
} }
,
showView(e) {
var that=this;
switch (e) {
case 0:
//
that.isdescription = true;
that.noteTime = false;
that.isBookmarkIcon = true;
break;
case 1:
//便
that.isdescription = true;
that.noteTime = true;
that.isBookmarkIcon = false;
break;
default:
}
}
} }
} }

View File

@ -10,6 +10,6 @@ const getters = {
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes permission_routes: state => state.permission.routes,
} }
export default getters export default getters

View File

@ -2,7 +2,7 @@
<div> <div>
<el-container class="isbookmarkContainer"> <el-container class="isbookmarkContainer">
<el-aside class="isBookmarkAside" > <el-aside class="isBookmarkAside" :style="asideHeight">
<el-header class="header-sousou"> <el-header class="header-sousou">
<div class="sousou-left"> <div class="sousou-left">
<div class="sousouleft-switch" @click="drawer = true"><i class="el-icon-s-unfold"/></div> <div class="sousouleft-switch" @click="drawer = true"><i class="el-icon-s-unfold"/></div>
@ -199,7 +199,7 @@
<div class="bookmarklist" :style="datalist" infinite-scroll-distance="10" v-loading="loading" v-if="showbookmark" <div class="bookmarklist" :style="datalist" infinite-scroll-distance="10" v-loading="loading" v-if="showbookmark"
v-infinite-scroll="load" v-infinite-scroll="load"
infinite-scroll-disabled="disabled" style="overflow:auto;" infinite-scroll-immediate="false"> infinite-scroll-disabled="disabled" style="overflow:auto;" infinite-scroll-immediate="false">
<BookmarkOne @on-windowurl="windowurl" :listloading="listloading" :loading="loading" :bookmarkList="bookmarkList"></BookmarkOne> <BookmarkOne @on-windowurl="windowurl" :property="property" :listloading="listloading" :loading="loading" :bookmarkList="bookmarkList"></BookmarkOne>
<p v-if="listloading" class="listhint"><i class="el-icon-loading"></i>加载中...</p> <p v-if="listloading" class="listhint"><i class="el-icon-loading"></i>加载中...</p>
<p v-if="listnoMore" class="listhint">没有更多了</p> <p v-if="listnoMore" class="listhint">没有更多了</p>
@ -279,10 +279,10 @@
</el-dialog> </el-dialog>
</el-aside> </el-aside>
<el-main class="isBookmarkMain"> <el-main class="isBookmarkMain" v-if="isMain">
<el-header class="mianUrl-top" style="height: 50px"> <el-header class="mianUrl-top" style="height: 50px">
<div class="mianUrl-top-left"> <div class="mianUrl-top-left">
<i class="el-icon-folder-delete"></i> <i class="el-icon-folder-delete" @click="closeIsMain"></i>
<i class="el-icon-rank" ></i> <i class="el-icon-rank" ></i>
</div> </div>
<div class="mianUrl-top-right"> <div class="mianUrl-top-right">
@ -307,6 +307,7 @@
</template> </template>
<script> <script>
import {listMenuByUserId} from "@/api/bookmark/menu"; import {listMenuByUserId} from "@/api/bookmark/menu";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import BookmarkOne from "../../../components/BookmarkList"; import BookmarkOne from "../../../components/BookmarkList";
@ -428,6 +429,13 @@
createUserName: undefined, createUserName: undefined,
tiymceUeditor:undefined tiymceUeditor:undefined
}, },
asideHeight: {
// width: "100%!important",
width: "400px!important",
},
isMain:true,
menuId:undefined,//
} }
}, },
@ -455,17 +463,25 @@
var that = this; var that = this;
var routedata = that.$route.query.menuId; var routedata = that.$route.query.menuId;
var sousuo = that.$route.query.sousuo; var sousuo = that.$route.query.sousuo;
var property = that.$route.query.property;
if (routedata == undefined) { if (routedata == undefined) {
// that.queryParams.menuId = 1; // that.queryParams.menuId = 1;
} else { } else {
that.queryParams.menuId = routedata; that.queryParams.menuId = routedata;
that.noteParams.menuId = routedata; that.noteParams.menuId = routedata;
} }
console.log("当前状态:"+that.property)
if (property != null && property != undefined && property != ''){
that.property =property;
}
// //
if (sousuo != null && sousuo != undefined && sousuo != '') { if (sousuo != null && sousuo != undefined && sousuo != '') {
this.queryParams.sousuo = sousuo; this.queryParams.sousuo = sousuo;
} }
if (routedata == 'BOOKMARK') { if (routedata == 'BOOKMARK') {
// //
this.getBookmarkList(); this.getBookmarkList();
@ -476,7 +492,7 @@
} else { } else {
//menuId //menuId
this.getList(); this.getBypropertyList(that.property);
} }
// //
@ -488,6 +504,14 @@
}, },
methods: { methods: {
closeIsMain(){
this.asideHeight.width="100%!important"
this.isMain=false;
},
openIsMain(){
this.asideHeight.width="400px!important"
this.isMain=true;
},
/**自动获取高度**/ /**自动获取高度**/
@ -512,7 +536,7 @@
that.$set(that.noteParams, 'pageNum', m) that.$set(that.noteParams, 'pageNum', m)
// console.log("this.queryParams.pageNum:" + that.queryParams.pageNum) // console.log("this.queryParams.pageNum:" + that.queryParams.pageNum)
var listcount = Math.ceil(that.total / 15); var listcount = Math.ceil(that.total / 15);
console.log("该目录共有页数:" + listcount)
if (i > listcount||m > listcount) { if (i > listcount||m > listcount) {
// //
@ -536,30 +560,22 @@
} }
}, 1000); }, 1000);
} }
}, },
/**切换显示 全部 网页 文本 其他**/ /**切换显示 全部 网页 文本 其他**/
showopen(e) { showopen(e) {
var that=this; var that=this;
that.property=e; that.property=e;
console.log("queryParams"+this.queryParams.pageNum); //
console.log("noteParams"+this.noteParams.pageNum); that.$store.state.property=e;
this.showimg=false;
console.log("缓存property:"+that.$store.state.property)
// console.log("property:"+store.state.property)
// //
this.queryParams.pageNum=1; this.queryParams.pageNum=1;
this.noteParams.pageNum=1; this.noteParams.pageNum=1;
switch(e) { this.bookmarkList=[];
case 0: this.getBypropertyList(e);
this.getList();
break;
case 1:
this.getNoteList();
break;
default:
this.bookmarkList=null;
}
}, },
/** 转换书签菜单数据结构 */ /** 转换书签菜单数据结构 */
@ -751,11 +767,9 @@
} }
}); });
}, },
/**根据条件查询*/
/**切换排序规则**/ getBypropertyList(e){
handleCommand(command) { switch(e) {
this.queryParams.sort = command;
switch(this.property) {
case 0: case 0:
this.getList(); this.getList();
break; break;
@ -763,9 +777,24 @@
this.getNoteList(); this.getNoteList();
break; break;
default: default:
this.getList(); this.loading = true;
}
//
setTimeout(()=>{
this.loading = false;
this.bookmarkList=[]
setTimeout(()=>{
this.showimg = true;
},80)
},200)
}
},
/**切换排序规则**/
handleCommand(command) {
this.queryParams.sort = command;
this.getBypropertyList(this.property);
}, },
/**添加遍签**/ /**添加遍签**/
@ -784,12 +813,15 @@
getList() { getList() {
this.loading = true; this.loading = true;
selectBymenuIdUserID(this.queryParams).then(response => { selectBymenuIdUserID(this.queryParams).then(response => {
if (response.total != 0 && response.code == 200) { if (response.code == 200) {
this.bookmarkList = response.rows; this.bookmarkList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
if (this.total>0){ // if (this.total>0){
this.gourl=this.bookmarkList[0].url; // this.gourl=this.bookmarkList[0].url;
// }
if (this.bookmarkList==null||this.bookmarkList.length==0) {
this.showimg=true;
} }
} else { } else {
this.showbookmark = false; this.showbookmark = false;
@ -801,7 +833,7 @@
getListConcat(){ getListConcat(){
this.loading = true; this.loading = true;
selectBymenuIdUserID(this.queryParams).then(response => { selectBymenuIdUserID(this.queryParams).then(response => {
if (response.total != 0 && response.code == 200) { if (response.code == 200) {
console.log("response.rows" + response.rows) console.log("response.rows" + response.rows)
this.bookmarkList = this.bookmarkList.concat(response.rows); this.bookmarkList = this.bookmarkList.concat(response.rows);
this.total = response.total; this.total = response.total;
@ -824,13 +856,16 @@
this.bookmarkList = response.rows; this.bookmarkList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
if (this.bookmarkList==null||this.bookmarkList.length==0) {
this.showimg=true;
}
}); });
}, },
/**查询便签 滚动加载分页拼接*/ /**查询便签 滚动加载分页拼接*/
getNoteListConcat(){ getNoteListConcat(){
this.loading = true; this.loading = true;
selectBymenuNote(this.noteParams).then(response => { selectBymenuNote(this.noteParams).then(response => {
if (response.total != 0 && response.code == 200) { if (response.code == 200) {
this.bookmarkList = this.bookmarkList.concat(response.rows); this.bookmarkList = this.bookmarkList.concat(response.rows);
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -841,6 +876,7 @@
this.noMore = true; this.noMore = true;
this.listloading = false this.listloading = false
this.loading = false; this.loading = false;
this.showimg=true;
} }
}); });
}, },
@ -854,21 +890,34 @@
// that.iframeLoading=false; // that.iframeLoading=false;
// },1000); // },1000);
// }, // },
/**网站内打开*/ /**网站内便签打开 网页*/
windowurl(noteId, tiymceueditor,bookmarkId,url) { windowurl(noteId, tiymceueditor,bookmarkId,url) {
var that=this; var that=this;
console.log("noteId:"+noteId) console.log("noteId:"+noteId)
console.log("tiymceueditor:"+tiymceueditor) console.log("tiymceueditor:"+tiymceueditor)
this.openIsMain();
switch (that.property) {
case 0:
/**网页新窗口打开*/
window.open(url);
break;
case 1:
/**编辑器内部打开*/
that.$router.push({ that.$router.push({
path: "/NqEdit", path: "/NqEdit",
query: { query: {
Ueditor: tiymceueditor, Ueditor: tiymceueditor,
noteId:noteId, noteId:noteId,
// menuId:that.noteParams.menuId,
property:that.property,
t:Date.now(), t:Date.now(),
} }
}) })
break;
default:
}
}, },
/**新窗口打开*/ /**新窗口打开*/
windowurlOpen() { windowurlOpen() {
@ -1453,6 +1502,7 @@
padding: 0px; padding: 0px;
background-color: #ffffff; background-color: #ffffff;
width: 400px!important; width: 400px!important;
/*width: 100%!important;*/
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
} }
.isBookmarkMain{ .isBookmarkMain{

View File

@ -1168,10 +1168,15 @@
// //
OnClickzTree: function (event, treeId, treeNode) { OnClickzTree: function (event, treeId, treeNode) {
var that = this; var that = this;
var property=that.$store.state.property;
if (property==null||property==''||property==undefined){
property=0;
}
that.$router.push({ that.$router.push({
path: "/content", path: "/content",
query: { query: {
menuId: treeNode.menuId, menuId: treeNode.menuId,
property:property,
t:Date.now(), t:Date.now(),
} }
}) })