const ArticleListVerify = {template: `
  • 分類
  • 標題
  • 時間
  • 狀態
  • 操作

暫無數據

全選
`, props: { verifyStatus: String, }, data () { return { itemListSelectStatus: false, itemList: [], searchData: '', verifyModal: false, status: 0, pagination: { currentPage: 1, limit: 10, total: 0, }, siteGlobal:{}, } }, watch: { verifyStatus() { this.getItemList(); }, }, mounted() { this.siteGlobal = window.siteGlobal; this.getItemList(); }, methods: { getItemList() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleVerify/itemList', { page: this.pagination.currentPage, limit: this.pagination.limit, }).then(res => { this.itemList = []; if(res.code == 1) { var itemList = res.data.itemList; if (itemList) { for (var i = 0; i < itemList.length; i++) { itemList[i].itemListSelectStatus = false; } this.itemList = itemList; } this.pagination.total = res.data.total; } }); }, itemDel(val) { this.$Modal.confirm({ title: '消息提示', content: '

確定刪除么?刪除后不可恢復

', onOk: () => { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleVerify/itemDel', { uuid: val.uuid, }).then(res => { if(res.code == 1) { this.$Message.success('操作成功'); this.getItemList(); } }); }, onCancel: () => { } }); }, itemListSelectChange() { var itemList = this.itemList; for (var i = 0; i < itemList.length; i++) { if (this.itemListSelectStatus) { itemList[i].itemListSelectStatus = true; } else { itemList[i].itemListSelectStatus = false; } } this.itemList = itemList; }, itemPaginationSelect(val) { this.pagination.limit = val; this.getItemList(); }, itemPaginationClick(val) { this.pagination.currentPage = val; this.getItemList(); }, //搜索 itemSearchClick: function() { this.getItemList(); }, } } Vue.component('article-list-verify',ArticleListVerify);Vue.component('ArticleListVerify',ArticleListVerify);const ArticleList = {template: `
  • 分類
  • 標題
  • 時間
  • 瀏覽
  • 操作

暫無數據

全選

數據加載中...

發布文章
`, data () { return { loading: false, itemListSelectStatus: false, itemList: [], searchData: '', verifyStatus: '', currentTab: 'list', pagination: { currentPage: 1, limit: 10, total: 0, }, siteGlobal:{}, } }, watch: { }, mounted() { this.siteGlobal = window.siteGlobal; var currentTab = utils.getUrlParam('tab'); if (currentTab) { this.currentTab = currentTab; } this.getItemList(); }, methods: { tapChange(val) { if (val == 'list') { this.getItemList(); var state = {title:'',url:'/account/article/articleList'}; history.pushState(state,'','/account/article/articleList'); } if (val == 'verify') { this.verifyStatus = Math.random(); var state = {title:'',url:'/account/article/articleList'}; history.pushState(state,'','/account/article/articleList?tab=verify'); } }, getItemList() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/itemList', { page: this.pagination.currentPage, limit: this.pagination.limit, }).then(res => { this.itemList = []; if(res.code == 1) { var itemList = res.data.itemList; if (itemList) { for (var i = 0; i < itemList.length; i++) { itemList[i].itemListSelectStatus = false; } this.itemList = itemList; } this.pagination.total = res.data.total; } }); }, itemDel(val) { this.$Modal.confirm({ title: '消息提示', content: '

確定刪除么?刪除后不可恢復

', onOk: () => { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/itemDel', { uuid: val.uuid, }).then(res => { if(res.code == 1) { this.$Message.success('操作成功'); this.getItemList(); } }); }, onCancel: () => { } }); }, itemListSelectChange() { var itemList = this.itemList; for (var i = 0; i < itemList.length; i++) { if (this.itemListSelectStatus) { itemList[i].itemListSelectStatus = true; } else { itemList[i].itemListSelectStatus = false; } } this.itemList = itemList; }, itemPaginationSelect(val) { this.pagination.limit = val; this.getItemList(); }, itemPaginationClick(val) { this.pagination.currentPage = val; this.getItemList(); }, //搜索 itemSearchClick: function() { this.getItemList(); }, } } Vue.component('articleList',ArticleList);Vue.component('ArticleList',ArticleList);const ArticlePublish = {template: `

文章

{{itemId? "編輯文章" : "發布文章"}}
  • {{item}}
{{item}}
`, data () { return { itemId: '', title: '', content: '', tags: '', cid: '', cidArray: [], categoryList: [], toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul', 'blockquote', 'code','|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment'], uploadUrl: '', editType: '', tagsList: [], tagsListDefault: [], tagName: '', selectedTagsList: [], //已選中的標簽列表 isShowTagsList: false, //標簽下拉狀態 } }, watch: { }, mounted() { var uuid = utils.getUrlParam('uuid'); if (uuid) { this.itemId = uuid; } var editType = utils.getUrlParam('type'); if (editType) { this.editType = editType; } this.createEditor(); }, methods: { //創建編輯器 createEditor() { var _this = this; this.uploadUrl = siteGlobal.domain + '/user/ApiUserUpload/defaultImgUpload'; document.getElementById('article_editor').innerHTML = ''; this.editor = new Simditor({ textarea: document.getElementById('article_editor'), toolbar: _this.toolbar, defaultImage: '/public/assets/plugin/simditor/images/image.png', upload: { url: this.uploadUrl, params: { type: 'article', }, fileKey: 'fileDataFileName', connectionCount: 3, leaveConfirm: '正在上傳文件' }, pasteImage: true, }); this.getCategoryList(); }, getItemInfo() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/' + 'itemInfo', { uuid: this.itemId, editType: this.editType, }).then(res => { if (res.code == 1) { var itemInfo = res.data.itemInfo; this.title = itemInfo.title; this.cid = itemInfo.cid; if (this.cid) { var tempCidArray = []; for (var i = 0; i < this.categoryList.length; i++) { if (this.cid == this.categoryList[i].id) { tempCidArray.push(this.categoryList[i].id); } else { if (this.categoryList[i].children && this.categoryList[i].children.length) { for (var g = 0; g < this.categoryList[i].children.length; g++) { if (this.cid == this.categoryList[i].children[g].id) { tempCidArray.push(this.categoryList[i].id); tempCidArray.push(this.categoryList[i].children[g].id); } } } } } } this.cidArray = tempCidArray; if (this.editType == 'verify') { this.tags = itemInfo.tags; } this.getItemTags(itemInfo['uuid']); this.editor.setValue(itemInfo.content); } }); }, //開始發布 publishPost: function(param) { var content = this.editor.getValue(); if(this.itemId) { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/' + 'itemEdit', { uuid: this.itemId, title: this.title, content: content, cid: this.cidArray[this.cidArray.length - 1], tags: this.selectedTagsList.join(','), verifyTags: this.tags, editType: this.editType, }).then(res => { if(res.code == 1) { this.editor.setValue(''); this.$Message.success(res.msg); if (res.data == 'verify') { this.$router.push({ path: '/article/articleList?tab=verify', params: { mod:'article'} }); } else { this.$router.push({ name: 'articleList', params: { mod:'article'} }); } } }); } else { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/' + 'itemAdd', { title: this.title, content: content, cid: this.cidArray[this.cidArray.length - 1], tags: this.selectedTagsList.join(','), }).then(res => { if(res.code == 1) { this.editor.setValue(''); this.$Message.success(res.msg); if (res.data == 'verify') { this.$router.push({ path: '/article/articleList?tab=verify', params: { mod:'article'} }); } else { this.$router.push({ name: 'articleList', params: { mod:'article'} }); } } }); } }, getCategoryList: function() { var _this = this; this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleCategory/' + 'categoryList', { }).then(res => { if(res.code == 1) { var categoryList = res.data.categoryList; this.categoryList = categoryList; if (this.itemId) { this.getItemInfo(); } else { this.cidArray = []; } } }); }, getItemTags: function(itemId) { this.$ssy.ajax('/tag/ApiUserTagsRel/itemList', { 'itemType': 'article', 'itemId': itemId, }).then(res => { if(res.code == 1) { var tagsList = res.data.itemList; if (tagsList) { if(tagsList.length > 0) { for(var i = 0; i < tagsList.length; i++) { tagsList[i].title = tagsList[i].tags.title; this.selectedTagsList.push(tagsList[i].title); } } } } }); }, getTags() { this.$ssy.ajax('/tag/ApiUserTag/itemList', { limit: 10, orderBy: 'relevance_num', keywords: this.tagName, }).then(res => { if(res.code == 1) { var tagsList = res.data.itemList; this.isShowTagsList = true; this.tagsList = []; if (tagsList.length) { for (var i = 0; i < tagsList.length; i++) { this.tagsList.push(tagsList[i].title); } } else { this.isShowTagsList = false; } } }); }, tagsSearch() { this.getTags(); }, btnTags: function() { if (this.tagName) { //支持,號空格分割 var tempSubTagName = this.tagName.split(','); if (tempSubTagName) { for (var j = 0; j < tempSubTagName.length; j++) { if (tempSubTagName[j]) { if (this.selectedTagsList.indexOf(tempSubTagName[j]) == -1) { this.selectedTagsList.push(tempSubTagName[j]); } } } } this.tagName = ''; this.isShowTagsList = false; } }, enterTags: function(ev) { if(ev.keyCode == 13) { this.btnTags(); } }, timeShowList() { var _this = this; setTimeout(function() { _this.isShowTagsList = false; },200) }, tagsClick(val) { if (this.selectedTagsList.indexOf(val) == -1) { this.selectedTagsList.push(val); } this.tagName = ''; this.isShowTagsList = false; }, selectedTagsListClose(event, name) { const index = this.selectedTagsList.indexOf(name); this.selectedTagsList.splice(index, 1); }, articlePublishBack() { this.$router.push({ name: 'articleList', params: { mod:'article'} }); }, } } Vue.component('articlePublish',ArticlePublish);Vue.component('ArticlePublish',ArticlePublish);const Msg = {template: `

我的消息

時間 內容 狀態 操作
{{item.add_time | time}} {{item.title}} {{item.status ? '已讀' : '未讀'}} 查看

暫無數據

`, data () { return { loading: false, itemList: [], itemListSelectStatus: false, pagination: { currentPage: 1, limit: 10, total: 0, }, } }, watch: { }, mounted() { this.getItemList(); }, methods: { getItemList() { this.loading = true; this.$ssy.ajax(siteGlobal.domain + '/account/ApiUserBaseMsg/itemList', { page: this.pagination.currentPage, limit: this.pagination.limit, }).then(res => { this.itemList = []; if(res.code == 1) { var itemList = res.data.itemList; if (itemList) { for (var i = 0; i < itemList.length; i++) { itemList[i].itemListSelectStatus = false; } this.itemList = itemList; } this.pagination.total = res.data.total; } this.loading = false; }); }, itemListSelectChange() { }, } } Vue.component('msg',Msg);Vue.component('Msg',Msg);const Order = {template: `

我的訂單

訂單號名稱時間金額狀態操作
{{item.id}} {{item.modInfo.title}} {{item.add_time | time}} ¥ {{item.money}} {{item.is_close ? '已關閉' : item.pay_status == 0 ? '未付款' : '成功'}}
已關閉

暫無數據!

數據加載中...

`, data () { return { loading: false, itemList: [], pagination: { currentPage: 1, limit: 10, total: this.total, }, } }, watch: { }, mounted() { this.getItemList(); }, methods: { payOrder(item) { window.location.href = siteGlobal.domain + '/payment/payPage/payOrder/?orderId=' +item.order_id; }, close(val) { this.$Modal.confirm({ title: '消息提示', content: '

確定關閉么?

', onOk: () => { this.$ssy.ajax(siteGlobal.domain + '/payment/ApiUserOrder/itemClose', { id: val.id, }).then(res => { if(res.code == 1) { this.$Message.success('操作成功'); this.getItemList(); } }); }, onCancel: () => { } }); }, getItemList() { this.loading = true; this.$ssy.ajax(siteGlobal.domain + '/payment/ApiUserOrder/itemList', { page: this.pagination.currentPage, limit: this.pagination.limit, }).then(res => { this.itemList = []; if(res.code == 1) { var itemList = res.data.itemList; if (itemList) { for (var i = 0; i < itemList.length; i++) { itemList[i].itemListSelectStatus = false; } this.itemList = itemList; } this.pagination.total = res.data.total; } this.loading = false; }); }, itemListSelectChange() { var itemList = this.itemList; for (var i = 0; i < itemList.length; i++) { if (this.itemListSelectStatus) { itemList[i].itemListSelectStatus = true; } else { itemList[i].itemListSelectStatus = false; } } this.itemList = itemList; }, itemPaginationSelect(val) { this.pagination.limit = val; this.getItemList(); }, itemPaginationClick(val) { this.pagination.currentPage = val; this.getItemList(); }, } } Vue.component('order',Order);Vue.component('Order',Order);const Settings = {template: `

個人設置

本地上傳
`, data () { return { imageUrl: '', userInfo: {}, avatarList: [], avatarModalStatus: false, currentAvatar: '', } }, watch: { }, mounted() { this.getUserInfo(); this.getAvatarList(); }, methods: { getAvatarList: function() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/getAvatarList', { }).then(res => { if (res.code == 1) { var avatarList = res.data; for (var i = 0; i < avatarList.length; i++) { avatarList[i].active = ''; } this.avatarList = avatarList; } }); }, recommendClick() { this.avatarModalStatus = true; }, avatarClick(item) { var avatarList = this.avatarList; for (var i = 0; i < avatarList.length; i++) { avatarList[i].active = ''; if (item.name == avatarList[i].name) { avatarList[i].active = 'active'; } } this.avatarList = avatarList; this.currentAvatar = item.url; }, avatarChangeSave() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/userAvatarEdit', { avatar: this.currentAvatar }).then(res => { if (res.code == 1) { this.avatarModalStatus = false; this.getUserInfo(); this.$Message.success('操作成功'); } }); }, getUserInfo: function() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/getUserInfo', { }).then(res => { if (res.code == 1) { this.userInfo = res.data; this.imageUrl = res.data.avatar; } }); }, settingUserInfoSave: function() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/userEdit', { nickname: this.userInfo.nickname, qq: this.userInfo.qq, signature: this.userInfo.signature, }).then(res => { if (res.code == 1) { this.getUserInfo(); this.$Message.success('操作成功'); } }); }, changeImage: function(e) { var file = e.target.files[0]; this.beforeAvatarUpload(file); var reader= new FileReader(); var that = this; that.file = file; reader.addEventListener("load", function () { that.imageUrl = reader.result; that.defaultImgUpload(that.file); }, false); if (file) { reader.readAsDataURL(file); } }, defaultImgUpload:function (file) { var formFile = new FormData(); formFile.append("fileDataFileName", file); formFile.append("type", 'avatar'); this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUpload/defaultImgUpload', formFile).then(res => { if (res.code == 1) { var imgUrl = res.data; this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/userAvatarEdit', { avatar: imgUrl, }).then(res => { if (res.code == 1) { this.$Message.success('操作成功'); this.getUserInfo(); } }); } }); }, beforeAvatarUpload: function (file) { var isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif' || file.type === 'image/jpg'; var isLt2M = file.size / 1024 / 1024 < 2; if (!isJPG) { Message.error('上傳頭像圖片的格式不在范圍'); } if (!isLt2M) { Message.error('上傳頭像圖片大小不能超過 2MB'); } return isJPG && isLt2M; }, } } Vue.component('settings',Settings);Vue.component('Settings',Settings);const ComponentArticleDel = {template: `
`, props: { uuid: String, }, data () { return { } }, watch: { }, mounted() { }, methods: { itemDel() { this.$Modal.confirm({ title: '消息提示', content: '

確定要刪除么?

', onOk: () => { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleAction/itemDel', { uuid: this.uuid, }).then(res => { if(res.code == 1) { window.location.href = siteGlobal.domain; } }); }, onCancel: () => { } }); }, } } Vue.component('component-article-del',ComponentArticleDel);Vue.component('ComponentArticleDel',ComponentArticleDel);const ComponentArticleElite = {template: `
`, props: { status: String, uuid: String, }, data () { return { } }, watch: { }, mounted() { }, methods: { getItemInfo() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/itemInfo', { uuid: this.uuid, }).then(res => { if(res.code == 1) { this.status = res.data.itemInfo.elite; } }); }, itemElite(status) { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleAction/itemElite', { uuid: this.uuid, status: status, }).then(res => { if(res.code == 1) { this.getItemInfo(); if (status) { this.$Message.success('加精成功'); } else { this.$Message.success('加精已取消'); } } }); }, } } Vue.component('component-article-elite',ComponentArticleElite);Vue.component('ComponentArticleElite',ComponentArticleElite);const ComponentArticleRecommend = {template: `
`, props: { status: String, uuid: String, }, data () { return { } }, watch: { }, mounted() { }, methods: { getItemInfo() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/itemInfo', { uuid: this.uuid, }).then(res => { if(res.code == 1) { this.status = res.data.itemInfo.is_recommend; } }); }, itemRecommend(status) { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleAction/itemRecommend', { uuid: this.uuid, status: status, }).then(res => { if(res.code == 1) { this.getItemInfo(); if (status) { this.$Message.success('推薦成功'); } else { this.$Message.success('推薦已取消'); } } }); }, } } Vue.component('component-article-recommend',ComponentArticleRecommend);Vue.component('ComponentArticleRecommend',ComponentArticleRecommend);const ComponentArticleTop = {template: `
`, props: { status: String, uuid: String, }, data () { return { } }, watch: { }, mounted() { }, methods: { getItemInfo() { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticle/itemInfo', { uuid: this.uuid, }).then(res => { if(res.code == 1) { this.status = res.data.itemInfo.top; } }); }, itemTop(status) { this.$ssy.ajax(siteGlobal.domain + '/article/ApiUserArticleAction/itemTop', { uuid: this.uuid, status: status, }).then(res => { if(res.code == 1) { this.getItemInfo(); if (status) { this.$Message.success('置頂成功'); } else { this.$Message.success('置頂已取消'); } } }); }, } } Vue.component('component-article-top',ComponentArticleTop);Vue.component('ComponentArticleTop',ComponentArticleTop);const ComponentArticleUserFollow = {template: `
`, props: { uid: String, }, data () { return { isUserFollow: '', } }, watch: { }, mounted() { this.getUserFollow(); }, methods: { getUserFollow() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/getUserFollow', { uid: this.uid, }).then(res => { if(res.code == 1) { var temp = res.data; this.isUserFollow = temp ? temp : ''; } }); }, userFollow() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/userFollow', { uid: this.uid, }).then(res => { if(res.code == 1) { this.getUserFollow(); this.$Message.success('關注成功'); } }); }, userCancelFollow() { this.$ssy.ajax(siteGlobal.domain + '/user/ApiUserUser/userCancelFollow', { uid: this.uid, }).then(res => { if(res.code == 1) { this.getUserFollow(); this.$Message.success('取消成功'); } }); }, } } Vue.component('component-article-user-follow',ComponentArticleUserFollow);Vue.component('ComponentArticleUserFollow',ComponentArticleUserFollow);const ArticleComment = {template: `

評論

`, data () { return { itemId: siteGlobal.itemDetailId, commentsContent: '', commentStatus: true, commentsId: '', commentsEditData: '', commentsModalStatus: false, commentsList: [], commentsReplyContent: '', placeholder: '', replyItemId: '', isReply: 0, replyUid: '', //編輯器 commentsEditor: '', commentsEditEditor: '', answer: { toolbar : ['title', 'bold', 'italic', 'underline', 'strikethrough','color', '|', 'ol', 'ul', 'blockquote', 'code', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment'], mobileToolbar : ["bold", "underline", "strikethrough", "color", "ul", "ol"], }, } }, watch: { }, mounted() { if (siteGlobal.userId) { this.getCommentsList(); var _this = this; setTimeout(function() { _this.createEditor(); _this.createEditEditor(); }, 100); } }, methods: { createEditor: function() { this.commentsEditor = new Simditor({ textarea: document.getElementById('comments_editor'), toolbar: this.answer.toolbar, upload: { url: modConfig.modUploadApi + 'defaultImgUpload', params: { type: modConfig.modName, }, fileKey: 'fileDataFileName', connectionCount: 3, leaveConfirm: '正在上傳文件' }, pasteImage: true, }); }, createEditEditor: function() { this.commentsEditEditor = new Simditor({ textarea: document.getElementById('comments_edit_editor'), toolbar: this.answer.toolbar, upload: { url: modConfig.modUploadApi + 'defaultImgUpload', params: { type: modConfig.modName, }, fileKey: 'fileDataFileName', connectionCount: 3, leaveConfirm: '正在上傳文件' }, pasteImage: true, }); }, //評論添加 commentsAdd: function() { var commentsContent = this.commentsEditor.getValue(); this.$ssy.ajax(modConfig.modCommentApi + 'itemAdd', { itemId: this.itemId, content: commentsContent, }).then(res => { if (res.code == 1) { this.commentsContent = ''; this.commentsEditor.setValue(''); this.$Message.success(res.msg); this.getCommentsList(); } }); }, //評論刪除 commentsDel: function(id) { this.$Modal.confirm({ title: '消息提示', content: '

確定刪除么?刪除后不可恢復

', onOk: () => { this.$ssy.ajax(modConfig.modCommentApi + 'itemDel', { itemId: this.itemId, commentsId: id, }).then(res => { if (res.code == 1) { this.$Message.success('刪除成功'); this.getCommentsList(); } }); }, onCancel: () => { } }); }, //評論查詢 getCommentsList() { this.$ssy.ajax(modConfig.modCommentApi + 'itemList', { itemId: this.itemId, order: 'asc', }).then(res => { if (res.code == 1) { var commentsList= res.data.itemList; for (var i = 0; i < commentsList.length; i++) { commentsList[i].commentStatus = false; } this.commentsList = commentsList; } }); }, //評論修改(彈出修改界面) commentsEditModalClick:function(id) { this.commentsModalStatus = true; this.$ssy.ajax(modConfig.modCommentApi + 'itemInfo', { itemId: this.itemId, commentsId: id, }).then(res => { if (res.code == 1) { this.commentsEditEditor.setValue(res.data.content); this.commentsId = id; } }); }, //評論修改(確認提交) commentsEdit: function() { var commentsEditData = this.commentsEditEditor.getValue(); this.$ssy.ajax(modConfig.modCommentApi + 'itemEdit', { itemId: this.itemId, commentsId: this.commentsId, content: commentsEditData, }).then(res => { if (res.code == 1) { this.commentsEditData = ''; this.commentsModalStatus = false; this.$Message.success('修改成功'); this.getCommentsList(); } }); }, //二層回復開始 //取消回復 commentsReplyCancel() { this.getCommentsList(); }, goAnchor(item,selector,textareaId,isReply,sub) { this.commentsReplyContent = ''; var commentsList= this.commentsList; for (var i = 0; i < commentsList.length; i++) { if (item.id == commentsList[i].id) { commentsList[i].commentStatus = true; } else { commentsList[i].commentStatus = false; } } this.commentsList = commentsList; var _this = this; setTimeout(function() { var anchor = _this.$el.querySelector(selector); var anchorHeight = _this.getElementTop(anchor); const sTop = document.documentElement.scrollTop || document.body.scrollTop; _this.scrollTop(window, sTop, anchorHeight - 300, 1000); document.getElementById(textareaId).focus(); }, 100); if (isReply == 0) { this.placeholder = '請輸入回復的內容'; this.isReply = 0; this.replyUid = ''; this.replyItemId = ''; } else { this.placeholder = '回復 ' + sub.userInfo.nickname + ':'; this.isReply = isReply; this.replyUid = sub.uid; this.replyItemId = sub.id; } }, scrollTop(el, from = 0, to, duration = 500, endCallback) { if (!window.requestAnimationFrame) { window.requestAnimationFrame = ( window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { return window.setTimeout(callback, 1000/60); } ); } const difference = Math.abs(from - to); const step = Math.ceil(difference / duration * 50); function scroll(start, end, step) { if (start === end) { endCallback && endCallback(); return; } let d = (start + step > end) ? end : start + step; if (start > end) { d = (start - step < end) ? end : start - step; } if (el === window) { window.scrollTo(d, d); } else { el.scrollTop = d; } window.requestAnimationFrame(() => scroll(d, end, step)); } scroll(from, to, step); }, getElementTop(el) { var anchorTop = el.offsetTop; var current = el.offsetParent; while (current !== null) { anchorTop += current.offsetTop; current = current.offsetParent; } return anchorTop; }, //提交回復內容 commentsReplyAdd: function(item) { this.$ssy.ajax(modConfig.modCommentApi + 'commentsAdd', { itemId: item.id, replyItemId: this.replyItemId, isReply: this.isReply, replyUid: this.replyUid, content: this.commentsReplyContent, }).then(res => { if (res.code == 1) { this.$Message.success(res.msg); this.getCommentsList(); } }); }, // subDel(id) { this.$Modal.confirm({ title: '消息提示', content: '

確定刪除么?刪除后不可恢復

', onOk: () => { this.$ssy.ajax(modConfig.modCommentApi + 'commentDel', { itemId: this.itemId, commentsId: id, }).then(res => { if (res.code == 1) { this.$Message.success('刪除成功'); this.getCommentsList(); } }); }, onCancel: () => { } }); }, } } Vue.component('article-comment',ArticleComment);Vue.component('ArticleComment',ArticleComment);const BlockMiniPages = {template: `
`, props: { total: String, pageSize: String, param: String, showNum: String, }, data () { return { itemList: [], currentNum: 1, } }, watch: { total() { this.pageChange(); } }, mounted() { if (this.total) { this.pagesInit(); } }, methods: { pagesInit() { if (this.total <= this.pageSize) { this.itemList = []; } else { var pageTotal = Math.ceil(this.total / this.pageSize); var showNum = this.showNum ? this.showNum : 5; var itemList = [] for (var i = 1; i <= pageTotal; i++) { if (i <= showNum) { itemList.push({'num': i,'active': false}); } } for (var i = 0; i < itemList.length; i++) { if (1 == itemList[i].num) { itemList[i].active = true; } else { itemList[i].active = false; } } this.itemList = itemList; } }, pageChange() { if (this.total <= this.pageSize) { this.itemList = []; } else { var pageTotal = Math.ceil(this.total / this.pageSize); var showNum = this.showNum ? this.showNum : 5; var tempNum = parseInt(showNum / 2); var itemList = [] if (this.currentNum <= tempNum + 1) { for (var i = 1; i <= pageTotal; i++) { if (i <= showNum) { itemList.push({'num': i,'active': false}); } } } else { if (this.currentNum >= pageTotal - tempNum) { for (var i = 1; i <= pageTotal; i++) { if (i > pageTotal - showNum) { itemList.push({'num': i,'active': false}); } } } else { for (var i = 1; i <= pageTotal; i++) { if ((i >= this.currentNum - tempNum) && (i <= this.currentNum + tempNum)) { itemList.push({'num': i,'active': false}); } } } } for (var i = 0; i < itemList.length; i++) { if (this.currentNum == itemList[i].num) { itemList[i].active = true; } else { itemList[i].active = false; } } this.itemList = itemList; } }, pageItemClick(item) { this.currentNum = item.num; for (var i = 0; i < this.itemList.length; i++) { if (item.num == this.itemList[i].num) { this.itemList[i].active = true; } else { this.itemList[i].active = false; } } this.param.currentPage = this.currentNum; this.pageChange(); this.$emit('pageChange', {num: this.currentNum,param:this.param}); }, } } Vue.component('block-mini-pages',BlockMiniPages);Vue.component('BlockMiniPages',BlockMiniPages);久久综合九色综合欧美就去吻