|
@@ -323,7 +323,7 @@ var keySetDetail = new Vue({
|
|
|
// 限制数组最大长度
|
|
|
conf: {
|
|
|
maxKeyLength: 10,
|
|
|
- recommendTagsCount: 10
|
|
|
+ recommendTagsCount: 6
|
|
|
},
|
|
|
// 是编辑(查看详情)还是添加
|
|
|
modeType: 'add',
|
|
@@ -335,8 +335,18 @@ var keySetDetail = new Vue({
|
|
|
showAreaPicker: false,
|
|
|
// 是否显示选择类型picker
|
|
|
showInfoTypePicker: false,
|
|
|
- // 新增时的关键词推荐
|
|
|
+ // 新增时的关键词推荐(关键词输入框下方的,只显示一行,超出不显示)
|
|
|
recommendTags: [],
|
|
|
+ // 关键词刷新状态保存(类似前端分页)
|
|
|
+ recListState: {
|
|
|
+ loading: false, // 是否刷新中?
|
|
|
+ loaded: false, // 请求是否完成
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 6,
|
|
|
+ total: 0, // 一共多少条数据
|
|
|
+ list: [],
|
|
|
+ listAll: [] // 后端返回的全部推荐关键词
|
|
|
+ },
|
|
|
// 当前关键词索引(如果为add状态,索引会加一)
|
|
|
currentIndex: 0,
|
|
|
// 当前关键词展示详情
|
|
@@ -409,7 +419,25 @@ var keySetDetail = new Vue({
|
|
|
desc: '包括合同公告、验收公告、违规处理等'
|
|
|
},
|
|
|
],
|
|
|
- infoTypeMapArr: []
|
|
|
+ infoTypeMapArr: [],
|
|
|
+ noSpaceDialog: {
|
|
|
+ // 触发提示的次数
|
|
|
+ count: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 禁止输入空格
|
|
|
+ 'currentInfo.key': function (newVal, oldVal) {
|
|
|
+ var spaceReg = /\s+/g
|
|
|
+ var hasSpace = spaceReg.test(newVal)
|
|
|
+ if (hasSpace) {
|
|
|
+ this.noSpaceDialog.count++
|
|
|
+ if (this.noSpaceDialog.count <= 1) {
|
|
|
+ this.showSpaceDialog()
|
|
|
+ }
|
|
|
+ this.currentInfo.key = this.currentInfo.key.replace(spaceReg, '')
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
typeConf: function () {
|
|
@@ -481,6 +509,30 @@ var keySetDetail = new Vue({
|
|
|
}, 100)
|
|
|
},
|
|
|
methods: {
|
|
|
+ showDialog: function (conf) {
|
|
|
+ var defaultConf = {
|
|
|
+ title: '提示',
|
|
|
+ message: 'message',
|
|
|
+ className: 'j-confirm-dialog',
|
|
|
+ showConfirmButton: true,
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonColor: '#2abed1'
|
|
|
+ }
|
|
|
+ if (conf) {
|
|
|
+ Object.assign(defaultConf, conf)
|
|
|
+ }
|
|
|
+ return this.$dialog.confirm(defaultConf)
|
|
|
+ },
|
|
|
+ showSpaceDialog: function () {
|
|
|
+ this.showDialog({
|
|
|
+ title: '',
|
|
|
+ message: '免费订阅关键词不可输入空格键,如需添加多个关键词,请前往购买超级订阅',
|
|
|
+ confirmButtonText: '立即购买'
|
|
|
+ }).then(function () {
|
|
|
+ this.toVipPage()
|
|
|
+ }.bind(this))
|
|
|
+ .catch(function () {})
|
|
|
+ },
|
|
|
// 获取关键词数据
|
|
|
getKeyList: function () {
|
|
|
var _this = this
|
|
@@ -579,6 +631,10 @@ var keySetDetail = new Vue({
|
|
|
var afterFilterArr = this.filterKeyRecommend(list)
|
|
|
this.recommendTags = afterFilterArr.slice(0, this.conf.recommendTagsCount)
|
|
|
|
|
|
+ this.recListState.listAll = afterFilterArr
|
|
|
+ this.recListState.count = afterFilterArr.length
|
|
|
+ this.nextPageRec()
|
|
|
+
|
|
|
// 超出隐藏判断
|
|
|
this.$nextTick(function () {
|
|
|
var recommendTagsDOM = _this.$refs.recommendTags
|
|
@@ -648,6 +704,33 @@ var keySetDetail = new Vue({
|
|
|
|
|
|
return afterTile
|
|
|
},
|
|
|
+ getRecListTags: function () {
|
|
|
+ var listAll = this.recListState.listAll
|
|
|
+ this.recListState.total = listAll.length
|
|
|
+
|
|
|
+ var startIndex = ((this.recListState.pageNum - 1) * this.recListState.pageSize)
|
|
|
+ var endIndex = (this.recListState.pageNum * this.recListState.pageSize)
|
|
|
+
|
|
|
+ return listAll.slice(startIndex, endIndex)
|
|
|
+ },
|
|
|
+ nextPageRec: function () {
|
|
|
+ if (this.recListState.loading) return
|
|
|
+ this.recListState.loading = true
|
|
|
+ this.recListState.list = this.getRecListTags()
|
|
|
+
|
|
|
+ setTimeout(function () {
|
|
|
+ this.recListState.loading = false
|
|
|
+ }.bind(this), 500)
|
|
|
+
|
|
|
+ // 最后一页,则重置页码
|
|
|
+ if (this.recListState.pageNum * this.recListState.pageSize >= this.recListState.total) {
|
|
|
+ this.recListState.pageNum = 1
|
|
|
+ } else {
|
|
|
+ this.recListState.pageNum++
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.recListState.list
|
|
|
+ },
|
|
|
clickTag: function (item) {
|
|
|
this.currentInfo.key = item
|
|
|
this.checkUpdate()
|
|
@@ -864,6 +947,9 @@ var keySetDetail = new Vue({
|
|
|
}]
|
|
|
})
|
|
|
},
|
|
|
+ toVipPage: function () {
|
|
|
+ location.href = '/jyapp/vipsubscribe/introducePage'
|
|
|
+ },
|
|
|
// 显示关键词输入提示
|
|
|
showKeyWordRegErrorToast: function (type) {
|
|
|
var conf = {
|