|
@@ -12,10 +12,10 @@ function getRandomString (len) {
|
|
return randomString
|
|
return randomString
|
|
}
|
|
}
|
|
// toast上限提示
|
|
// toast上限提示
|
|
-function toastFn (text, duration) {
|
|
|
|
- if (duration) {
|
|
|
|
- duration = 1000
|
|
|
|
- }
|
|
|
|
|
|
+function toastFn (text, duration = 1000) {
|
|
|
|
+ // if (duration) {
|
|
|
|
+ // duration = 1000
|
|
|
|
+ // }
|
|
var _html = ""
|
|
var _html = ""
|
|
_html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
|
|
_html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
|
|
_html+='<span>' + text + '</span></div></div>'
|
|
_html+='<span>' + text + '</span></div></div>'
|
|
@@ -113,6 +113,7 @@ var vm = new Vue({
|
|
children: [],
|
|
children: [],
|
|
id: ''
|
|
id: ''
|
|
},
|
|
},
|
|
|
|
+ datas: '',
|
|
attentionName: [],
|
|
attentionName: [],
|
|
claimcheckName: [],
|
|
claimcheckName: [],
|
|
showmoreBtn: true,
|
|
showmoreBtn: true,
|
|
@@ -165,6 +166,7 @@ var vm = new Vue({
|
|
this.getList(1)
|
|
this.getList(1)
|
|
},
|
|
},
|
|
mounted: function () {
|
|
mounted: function () {
|
|
|
|
+ this.initCollectEvent()
|
|
this.initDOMEvents()
|
|
this.initDOMEvents()
|
|
ewmMoveHover()
|
|
ewmMoveHover()
|
|
this.$on('updatescope', (data) => {
|
|
this.$on('updatescope', (data) => {
|
|
@@ -418,6 +420,7 @@ var vm = new Vue({
|
|
}
|
|
}
|
|
this.listState.loading = true
|
|
this.listState.loading = true
|
|
this.listState.loaded = false
|
|
this.listState.loaded = false
|
|
|
|
+ this.listState.list = []
|
|
const _this = this
|
|
const _this = this
|
|
let arrs = [], arr1 = []
|
|
let arrs = [], arr1 = []
|
|
$.ajax({
|
|
$.ajax({
|
|
@@ -435,16 +438,18 @@ var vm = new Vue({
|
|
arrs.forEach(v => {
|
|
arrs.forEach(v => {
|
|
arr1.push(v.Buyer)
|
|
arr1.push(v.Buyer)
|
|
})
|
|
})
|
|
|
|
+ console.info(arrs)
|
|
if (arrs.length == 0) {
|
|
if (arrs.length == 0) {
|
|
this.listState.list = []
|
|
this.listState.list = []
|
|
- if (res.error_msg) {
|
|
|
|
- toastFn(res.error_msg, 2000)
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
_this.attentionCheck(arrs, String(arr1))
|
|
_this.attentionCheck(arrs, String(arr1))
|
|
}
|
|
}
|
|
this.listState.total = res.data.list.length
|
|
this.listState.total = res.data.list.length
|
|
this.listState.loading = false
|
|
this.listState.loading = false
|
|
|
|
+ } else {
|
|
|
|
+ if (res.error_msg) {
|
|
|
|
+ toastFn(res.error_msg, 2000)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}.bind(this),
|
|
}.bind(this),
|
|
complete: function () {
|
|
complete: function () {
|
|
@@ -458,7 +463,7 @@ var vm = new Vue({
|
|
this.getList(p)
|
|
this.getList(p)
|
|
},
|
|
},
|
|
goTitle(name) {
|
|
goTitle(name) {
|
|
- location.href = '/unit_portrayal/' + name
|
|
|
|
|
|
+ location.href = '/entpc/unit_portrayal/' + name
|
|
},
|
|
},
|
|
// 全选
|
|
// 全选
|
|
allChange() {
|
|
allChange() {
|
|
@@ -603,20 +608,6 @@ var vm = new Vue({
|
|
} else {
|
|
} else {
|
|
this.claim = true
|
|
this.claim = true
|
|
}
|
|
}
|
|
- // if (type == 1) {
|
|
|
|
- // $('.tags-box').css('display', 'block')
|
|
|
|
- // if (str == 'all') {
|
|
|
|
- // $('.tags-box').css('top',0)
|
|
|
|
- // } else {
|
|
|
|
- // if (index == (this.listState.pageNum - 1) * this.listState.pageSize) {
|
|
|
|
- // index = 0
|
|
|
|
- // }
|
|
|
|
- // $('.tags-box').css('top', (index + 1) * 91)
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // $('.tags-box').css('display', 'none')
|
|
|
|
- // $('.tags-box').css('top',0)
|
|
|
|
- // }
|
|
|
|
}
|
|
}
|
|
}.bind(this)
|
|
}.bind(this)
|
|
})
|
|
})
|
|
@@ -666,8 +657,23 @@ var vm = new Vue({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- guanAndren(item, type) {
|
|
|
|
- this.attention(item, type, '')
|
|
|
|
|
|
+ guanAndren(item, type, index) {
|
|
|
|
+ if (!item.claim1) {
|
|
|
|
+ var top = 91 * (index + 1) + 'px'
|
|
|
|
+ this.datas = item.Buyer
|
|
|
|
+ $('.tags-box').slideToggle(function () {
|
|
|
|
+ window.activeTags = []
|
|
|
|
+ $('.tag-labels').empty()
|
|
|
|
+ $('.clear-input').val('')
|
|
|
|
+ $('.tags-list').find('.tags-item').removeClass('tags-active')
|
|
|
|
+ $('.tag-placeholder').show()
|
|
|
|
+ }).css({
|
|
|
|
+ top: top,
|
|
|
|
+ right: 0
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.attention(item, type, '')
|
|
|
|
+ }
|
|
},
|
|
},
|
|
caiIndus(val, index) {
|
|
caiIndus(val, index) {
|
|
let arrIndex = this.caiIndex.indexOf(index);
|
|
let arrIndex = this.caiIndex.indexOf(index);
|
|
@@ -833,6 +839,229 @@ var vm = new Vue({
|
|
} else {
|
|
} else {
|
|
return mUnit.test(m, type, lv)
|
|
return mUnit.test(m, type, lv)
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ initCollectEvent () {
|
|
|
|
+ const _this = this
|
|
|
|
+ // 自定义标签
|
|
|
|
+ // 标签输入框事件
|
|
|
|
+ $('.tags-box').click(function (e) {
|
|
|
|
+ e.stopPropagation()
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ $('.tag-input').click(function (e) {
|
|
|
|
+ e.stopPropagation()
|
|
|
|
+ $(this).children('.tag-placeholder').hide()
|
|
|
|
+ $(this).children('input').focus()
|
|
|
|
+ })
|
|
|
|
+ // 标签输入框回车事件
|
|
|
|
+ $('.tag-input .clear-input').keydown(function (event) {
|
|
|
|
+ event.stopPropagation()
|
|
|
|
+ if (event.keyCode == 13) {
|
|
|
|
+ if (!$('.tags-box').is(':hidden')) {
|
|
|
|
+ $('.tags-inputs .add-tag-button').trigger('click')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // 标签输入框失去焦点事件
|
|
|
|
+ $('.tag-input .clear-input').blur(function () {
|
|
|
|
+ if ($('.tag-labels').children().length == 0 && $(this).val() == '') {
|
|
|
|
+ $('.tag-placeholder').show()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // 添加标签按钮事件
|
|
|
|
+ $('.tags-inputs .add-tag-button').on('click', function () {
|
|
|
|
+ var input = $('.tag-input .clear-input')
|
|
|
|
+ if (input.val().length >= 2 && input.val().length < 6) {
|
|
|
|
+ // ajax提交自定义标签
|
|
|
|
+ addTagsAjax(input.val())
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // 点击确定按钮,绑定标签
|
|
|
|
+ $('.tags-footer .button-confirm').on('click', function () {
|
|
|
|
+ if (!$('.tags-box').is(':hidden')) {
|
|
|
|
+ var lids = ''
|
|
|
|
+ var lname = ''
|
|
|
|
+ $('.tags-item.tags-active').each(function () {
|
|
|
|
+ if ($(this).attr('data-id')) {
|
|
|
|
+ if (lids != '') {
|
|
|
|
+ lids += ','
|
|
|
|
+ }
|
|
|
|
+ if (lname != '') {
|
|
|
|
+ lname += ','
|
|
|
|
+ }
|
|
|
|
+ lids += $(this).attr('data-id')
|
|
|
|
+ lname += $(this).text()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ var params = {
|
|
|
|
+ name: _this.datas,
|
|
|
|
+ mold: 1,
|
|
|
|
+ D: false,
|
|
|
|
+ label: lids
|
|
|
|
+ }
|
|
|
|
+ console.log(params)
|
|
|
|
+ // 执行保存绑定标签操作
|
|
|
|
+ if (params.label !== '') {
|
|
|
|
+ saveChooseTags(params, function () {
|
|
|
|
+ $('.tags-footer .button-cancel').trigger('click')
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ $('.tags-footer .button-cancel').on('click', function () {
|
|
|
|
+ $('.tags-box').slideToggle(function () {
|
|
|
|
+ // 标签弹框消失时 清除上次选择的标签分类
|
|
|
|
+ activeTags = []
|
|
|
|
+ $('.tag-labels').empty()
|
|
|
|
+ $('.clear-input').val('')
|
|
|
|
+ $('.tags-list').find('.tags-item').removeClass('tags-active')
|
|
|
|
+ $('.tag-placeholder').show()
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ window.activeTags = [] // 选中的自定义标签 作为全局变量使用
|
|
|
|
+ // 解绑自定义标签
|
|
|
|
+ function deleteInputTag (item) {
|
|
|
|
+ var index = $(item).parent().attr('data-index')
|
|
|
|
+ var id = $(item).parent().attr('data-id')
|
|
|
|
+ activeTags.splice(index, 1)
|
|
|
|
+ inputTagList()
|
|
|
|
+ $('.tags-item[data-id="' + id + '"]').removeClass('tags-active')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ window.deleteInputTag = deleteInputTag
|
|
|
|
+
|
|
|
|
+ function inputTagList () {
|
|
|
|
+ var ht = ''
|
|
|
|
+ $('.tag-labels').html(ht)
|
|
|
|
+ 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>'
|
|
|
|
+ ht += '</span>'
|
|
|
|
+ })
|
|
|
|
+ $('.tag-labels').html(ht)
|
|
|
|
+ if ($('.tag-labels').children('.tag-label').length > 0) {
|
|
|
|
+ $('.tag-placeholder').hide()
|
|
|
|
+ }
|
|
|
|
+ checkTagDisabled()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 渲染标签列表数据
|
|
|
|
+ function renderTagsList (data) {
|
|
|
|
+ if (data && data.length > 0) {
|
|
|
|
+ var ht = ''
|
|
|
|
+ data.forEach(function (v, i) {
|
|
|
|
+ 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) {
|
|
|
|
+ $('.tags-list .tags-item[data-id="' + s.lid + '"]').addClass('tags-active')
|
|
|
|
+ })
|
|
|
|
+ $('.tags-item').click(function (e) {
|
|
|
|
+ e.stopPropagation()
|
|
|
|
+ if ($(this).hasClass('disabled')) return
|
|
|
|
+ var id = $(this).attr('data-id')
|
|
|
|
+ var name = $(this).text()
|
|
|
|
+ $(this).toggleClass('tags-active')
|
|
|
|
+ if ($(this).hasClass('tags-active')) {
|
|
|
|
+ activeTags.push({
|
|
|
|
+ lid: id,
|
|
|
|
+ lname: name
|
|
|
|
+ })
|
|
|
|
+ inputTagList()
|
|
|
|
+ } else {
|
|
|
|
+ var newArr = activeTags.filter(function (item) {
|
|
|
|
+ return item.lid != id
|
|
|
|
+ })
|
|
|
|
+ activeTags = newArr
|
|
|
|
+ console.log(activeTags, newArr, 'quxiao')
|
|
|
|
+ inputTagList()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ inputTagList()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取用户自定义标签
|
|
|
|
+ function getUserTags () {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'post',
|
|
|
|
+ url: '/entnicheNew/customer/getLabel?t=' + Date.now(),
|
|
|
|
+ success: function (r) {
|
|
|
|
+ if (r.error_code == 0 && $.isArray(r.data)) {
|
|
|
|
+ renderTagsList(r.data.reverse())
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ window.getUserTags = getUserTags
|
|
|
|
+ // 添加标签后认领接口
|
|
|
|
+ function saveChooseTags (params, callback) {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'post',
|
|
|
|
+ url: '/entnicheNew/customer/attention',
|
|
|
|
+ contentType: 'application/json',
|
|
|
|
+ data: JSON.stringify(params),
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ success: function (r) {
|
|
|
|
+ if (r.error_code == 0 && r.data) {
|
|
|
|
+ _this.$toast('认领成功!')
|
|
|
|
+ _this.$emit('updatelist', true)
|
|
|
|
+ callback && callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 新增标签
|
|
|
|
+ function addTagsAjax (name) {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'post',
|
|
|
|
+ url: '/entnicheNew/customer/addLabel',
|
|
|
|
+ data: {
|
|
|
|
+ name: name
|
|
|
|
+ },
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ success: function (r) {
|
|
|
|
+ if (r.data) {
|
|
|
|
+ $('.tag-input .clear-input').val('')
|
|
|
|
+ // 添加标签成功后 绑定标签
|
|
|
|
+ if (activeTags.length < 3) {
|
|
|
|
+ activeTags.push({
|
|
|
|
+ lid: r.data,
|
|
|
|
+ lname: name
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ getUserTags()
|
|
|
|
+ } else {
|
|
|
|
+ toastFn('标签已经存在,无需添加', 1000)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function checkTagDisabled () {
|
|
|
|
+ if (activeTags.length >= 3) {
|
|
|
|
+ // 禁用标签
|
|
|
|
+ $('.tags-list').find('.tags-item:not(.tags-active)').addClass('disabled')
|
|
|
|
+ } else {
|
|
|
|
+ // 解除禁用
|
|
|
|
+ $('.tags-list').find('.disabled').removeClass('disabled')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function baiduEvent (str) {
|
|
|
|
+ try {
|
|
|
|
+ // eslint-disable-next-line no-undef
|
|
|
|
+ _hmt.push(['_trackEvent', '大会员-pc', 'click', str])
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log('未初始化百度统计')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ getUserTags()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|