|
@@ -18,12 +18,12 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
datas: []
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ mounted () {
|
|
|
this.initCollectEvent()
|
|
|
},
|
|
|
methods: {
|
|
@@ -39,10 +39,11 @@ export default {
|
|
|
$('.custom-toast').fadeOut().remove()
|
|
|
}, duration)
|
|
|
},
|
|
|
- tagsShow(data) {
|
|
|
+ tagsShow (data) {
|
|
|
this.datas = data.data
|
|
|
var top = data.liHeight * (data.i + 1) + 'px'
|
|
|
if (data.show) {
|
|
|
+ // baiduEvent('列表页认领') // 百度统计代码
|
|
|
$('.tags-box').slideToggle(function () {
|
|
|
window.activeTags = []
|
|
|
$('.tag-labels').empty()
|
|
@@ -54,7 +55,6 @@ export default {
|
|
|
right: 0
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
initCollectEvent () {
|
|
|
const _this = this
|
|
@@ -75,7 +75,7 @@ export default {
|
|
|
// 标签输入框回车事件
|
|
|
$('.tag-input .clear-input').keydown(function (event) {
|
|
|
event.stopPropagation()
|
|
|
- if (event.keyCode == 13) {
|
|
|
+ if (event.keyCode === 13) {
|
|
|
if (!$('.tags-box').is(':hidden')) {
|
|
|
$('.tags-inputs .add-tag-button').trigger('click')
|
|
|
}
|
|
@@ -83,7 +83,7 @@ export default {
|
|
|
})
|
|
|
// 标签输入框失去焦点事件
|
|
|
$('.tag-input .clear-input').blur(function () {
|
|
|
- if ($('.tag-labels').children().length == 0 && $(this).val() == '') {
|
|
|
+ if ($('.tag-labels').children().length === 0 && $(this).val() === '') {
|
|
|
$('.tag-placeholder').show()
|
|
|
}
|
|
|
})
|
|
@@ -102,10 +102,10 @@ export default {
|
|
|
var lname = ''
|
|
|
$('.tags-item.tags-active').each(function () {
|
|
|
if ($(this).attr('data-id')) {
|
|
|
- if (lids != '') {
|
|
|
+ if (lids !== '') {
|
|
|
lids += ','
|
|
|
}
|
|
|
- if (lname != '') {
|
|
|
+ if (lname !== '') {
|
|
|
lname += ','
|
|
|
}
|
|
|
lids += $(this).attr('data-id')
|
|
@@ -119,18 +119,16 @@ export default {
|
|
|
label: lids
|
|
|
}
|
|
|
// 执行保存绑定标签操作
|
|
|
- // if (params.label !== '') {
|
|
|
- saveChooseTags(params, function () {
|
|
|
- $('.tags-footer .button-cancel').trigger('click')
|
|
|
- })
|
|
|
- // }
|
|
|
+ saveChooseTags(params, function () {
|
|
|
+ $('.tags-footer .button-cancel').trigger('click')
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
|
|
|
$('.tags-footer .button-cancel').on('click', function () {
|
|
|
$('.tags-box').slideToggle(function () {
|
|
|
// 标签弹框消失时 清除上次选择的标签分类
|
|
|
- activeTags = []
|
|
|
+ window.activeTags = []
|
|
|
$('.tag-labels').empty()
|
|
|
$('.clear-input').val('')
|
|
|
$('.tags-list').find('.tags-item').removeClass('tags-active')
|
|
@@ -143,7 +141,7 @@ export default {
|
|
|
function deleteInputTag (item) {
|
|
|
var index = $(item).parent().attr('data-index')
|
|
|
var id = $(item).parent().attr('data-id')
|
|
|
- activeTags.splice(index, 1)
|
|
|
+ window.activeTags.splice(index, 1)
|
|
|
inputTagList()
|
|
|
$('.tags-item[data-id="' + id + '"]').removeClass('tags-active')
|
|
|
}
|
|
@@ -153,7 +151,7 @@ export default {
|
|
|
function inputTagList () {
|
|
|
var ht = ''
|
|
|
$('.tag-labels').html(ht)
|
|
|
- activeTags.forEach(function (v, i) {
|
|
|
+ window.activeTags.forEach(function (v, i) {
|
|
|
ht += '<span class="tag-label" data-index=' + i + ' data-id="' + v.lid + '">'
|
|
|
ht += '<em>' + v.lname + '</em>'
|
|
|
ht += '<i class="tag-close" onclick="deleteInputTag(this)"></i>'
|
|
@@ -174,7 +172,7 @@ export default {
|
|
|
ht += '<span class="tags-item" data-count=' + v.count + ' data-id=' + v.lid + '>' + v.lanme + '</span>'
|
|
|
})
|
|
|
$('.tags-list').html(ht)
|
|
|
- activeTags.forEach(function (s, j) {
|
|
|
+ window.activeTags.forEach(function (s, j) {
|
|
|
$('.tags-list .tags-item[data-id="' + s.lid + '"]').addClass('tags-active')
|
|
|
})
|
|
|
$('.tags-item').click(function (e) {
|
|
@@ -184,17 +182,17 @@ export default {
|
|
|
var name = $(this).text()
|
|
|
$(this).toggleClass('tags-active')
|
|
|
if ($(this).hasClass('tags-active')) {
|
|
|
- activeTags.push({
|
|
|
+ window.activeTags.push({
|
|
|
lid: id,
|
|
|
lname: name
|
|
|
})
|
|
|
inputTagList()
|
|
|
} else {
|
|
|
- var newArr = activeTags.filter(function (item) {
|
|
|
- return item.lid != id
|
|
|
+ var newArr = window.activeTags.filter(function (item) {
|
|
|
+ return item.lid !== id
|
|
|
})
|
|
|
- activeTags = newArr
|
|
|
- console.log(activeTags, newArr, 'quxiao')
|
|
|
+ window.activeTags = newArr
|
|
|
+ console.log(window.activeTags, newArr, 'quxiao')
|
|
|
inputTagList()
|
|
|
}
|
|
|
})
|
|
@@ -208,7 +206,7 @@ export default {
|
|
|
type: 'post',
|
|
|
url: '/entnicheNew/customer/getLabel?t=' + Date.now(),
|
|
|
success: function (r) {
|
|
|
- if (r.error_code == 0 && $.isArray(r.data)) {
|
|
|
+ if (r.error_code === 0 && $.isArray(r.data)) {
|
|
|
renderTagsList(r.data.reverse())
|
|
|
}
|
|
|
}
|
|
@@ -225,7 +223,7 @@ export default {
|
|
|
data: JSON.stringify(params),
|
|
|
dataType: 'json',
|
|
|
success: function (r) {
|
|
|
- if (r.error_code == 0 && r.data) {
|
|
|
+ if (r.error_code === 0 && r.data) {
|
|
|
_this.$toast('认领成功!')
|
|
|
_this.$emit('getClientList', true)
|
|
|
callback && callback()
|
|
@@ -251,8 +249,8 @@ export default {
|
|
|
if (r.data) {
|
|
|
$('.tag-input .clear-input').val('')
|
|
|
// 添加标签成功后 绑定标签
|
|
|
- if (activeTags.length < 3) {
|
|
|
- activeTags.push({
|
|
|
+ if (window.activeTags.length < 3) {
|
|
|
+ window.activeTags.push({
|
|
|
lid: r.data,
|
|
|
lname: name
|
|
|
})
|
|
@@ -267,7 +265,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
function checkTagDisabled () {
|
|
|
- if (activeTags.length >= 3) {
|
|
|
+ if (window.activeTags.length >= 3) {
|
|
|
// 禁用标签
|
|
|
$('.tags-list').find('.tags-item:not(.tags-active)').addClass('disabled')
|
|
|
} else {
|
|
@@ -276,16 +274,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function baiduEvent (str) {
|
|
|
- try {
|
|
|
- // eslint-disable-next-line no-undef
|
|
|
- _hmt.push(['_trackEvent', '大会员-pc', 'click', str])
|
|
|
- } catch (e) {
|
|
|
- console.log('未初始化百度统计')
|
|
|
- }
|
|
|
- }
|
|
|
+ // function baiduEvent (str) {
|
|
|
+ // try {
|
|
|
+ // // eslint-disable-next-line no-undef
|
|
|
+ // _hmt.push(['_trackEvent', '大会员-pc', 'click', str])
|
|
|
+ // } catch (e) {
|
|
|
+ // console.log('未初始化百度统计')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
getUserTags()
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -488,4 +486,4 @@ export default {
|
|
|
transform: translateX(-50%) translateY(-50%);
|
|
|
z-index: 99;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|