|
@@ -50,16 +50,28 @@ var vm = new Vue({
|
|
|
tooLittleTipShow: function () {
|
|
|
return this.pInfo.pushCount < 30
|
|
|
},
|
|
|
+ // 监听关键词和匹配方式变化
|
|
|
+ needGetRecList: function () {
|
|
|
+ return {
|
|
|
+ key: this.keyInfo.key,
|
|
|
+ matchWay: this.keyInfo.matchWay
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听关键词、匹配方式和排除词变化
|
|
|
keyInfoChange: function () {
|
|
|
return {
|
|
|
key: this.keyInfo.key,
|
|
|
+ notKey: this.keyInfo.notKey,
|
|
|
matchWay: this.keyInfo.matchWay
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- keyInfoChange: utils.debounce(function (newVal, oldVal) {
|
|
|
+ needGetRecList: utils.debounce(function (newVal, oldVal) {
|
|
|
this.getKeyRecommend()
|
|
|
+ }, 2000),
|
|
|
+ keyInfoChange: utils.debounce(function () {
|
|
|
+ this.getPushCount()
|
|
|
}, 2000)
|
|
|
},
|
|
|
created: function () {
|
|
@@ -81,9 +93,6 @@ var vm = new Vue({
|
|
|
if (this.pInfo.editType === 'add') {
|
|
|
this.getKeyRecommend()
|
|
|
}
|
|
|
- if (this.pInfo.editType === 'edit') {
|
|
|
- this.getPushCount()
|
|
|
- }
|
|
|
}.bind(this)
|
|
|
})
|
|
|
},
|
|
@@ -512,6 +521,9 @@ var vm = new Vue({
|
|
|
|
|
|
if (keysArr.length === 0) return
|
|
|
|
|
|
+ if (this.recListState.loading) return
|
|
|
+ this.recListState.loading = true
|
|
|
+
|
|
|
var fetchData = {
|
|
|
count: 20, // 最少需要多少条数据
|
|
|
value: utils.unique(keysArr).join(' ')
|
|
@@ -521,9 +533,13 @@ var vm = new Vue({
|
|
|
type: 'POST',
|
|
|
data: fetchData,
|
|
|
success: function (r) {
|
|
|
+ _this.recListState.loading = false
|
|
|
if (r && r instanceof Array && r.length !== 0) {
|
|
|
_this.loadKeyRecommend(r)
|
|
|
}
|
|
|
+ },
|
|
|
+ complete: function () {
|
|
|
+ _this.recListState.loading = false
|
|
|
}
|
|
|
})
|
|
|
},
|