|
@@ -0,0 +1,536 @@
|
|
|
+var matchTypeListForComputed = [
|
|
|
+ {
|
|
|
+ label: '标题搜索',
|
|
|
+ value: 'title'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '正文搜索',
|
|
|
+ value: 'content'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '中标项目/标的物',
|
|
|
+ value: 'purchasing'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '采购单位',
|
|
|
+ value: 'buyer'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '招标代理机构',
|
|
|
+ value: 'agency'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '附件',
|
|
|
+ value: 'file'
|
|
|
+ }
|
|
|
+]
|
|
|
+try {
|
|
|
+ if (is_weixin()) {
|
|
|
+ matchTypeListForComputed.pop()
|
|
|
+ }
|
|
|
+} catch (e) {}
|
|
|
+var vConfig = {
|
|
|
+ delimiters: ['${', '}'],
|
|
|
+ el: '#ent-project-news',
|
|
|
+ components: {
|
|
|
+ popupSelectComponent: popupSelectComponent,
|
|
|
+ areaComponent: areaComponent,
|
|
|
+ noticeComponent: noticeComponent,
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ platform: pageInfo.platform,
|
|
|
+ sessStorageKey: '$data-ent_project_news',
|
|
|
+ // 企业信息
|
|
|
+ entInfo: {
|
|
|
+ eid: '', // 企业id
|
|
|
+ name: '',
|
|
|
+ follow: 0,
|
|
|
+ followSearchFinish: false,
|
|
|
+ entExist: true,
|
|
|
+ buyerName: ''
|
|
|
+ },
|
|
|
+ searchInfo: {
|
|
|
+ content: ''
|
|
|
+ },
|
|
|
+ searchFilters: {
|
|
|
+ matchType: ['title', 'content'],
|
|
|
+ area: [],
|
|
|
+ infoType: [],
|
|
|
+ pushTime: ['5year'],
|
|
|
+ },
|
|
|
+ listState: {
|
|
|
+ refreshing: false,
|
|
|
+ loaded: false,
|
|
|
+ loading: false,
|
|
|
+ finished: false,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ count: 0,
|
|
|
+ offset: 50,
|
|
|
+ scrollTop: 0,
|
|
|
+ list: []
|
|
|
+ },
|
|
|
+ matchTypeList: matchTypeListForComputed,
|
|
|
+ publishTimeList: [
|
|
|
+ {
|
|
|
+ label: '最近7天',
|
|
|
+ value: '7day'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '最新30天',
|
|
|
+ value: '30day'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1年内',
|
|
|
+ value: '1year'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '3年内',
|
|
|
+ value: '3year'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '5年内',
|
|
|
+ value: '5year'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ filterInitData: {
|
|
|
+ areaArr: [],
|
|
|
+ infoType: [],
|
|
|
+ timeRange: [],
|
|
|
+ },
|
|
|
+ reqSign: 'bigmember',
|
|
|
+ info: {
|
|
|
+ bigStatus: false,
|
|
|
+ vipStatus: false,
|
|
|
+ viper: false,
|
|
|
+ power: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ projectNewUrl: function () {
|
|
|
+ // var urlMap = {
|
|
|
+ // bigmember: '/bigmember/portrait/winner/getNewMsg', // 大会员
|
|
|
+ // svip: '/bigmember/portrait/subVipPortrait/winnerNewMsg' // 超级订阅
|
|
|
+ // }
|
|
|
+ var url = '/entnicheNew/portrait/buyer/getNewMsg'
|
|
|
+ if (urlMap[this.reqSign]) {
|
|
|
+ url = urlMap[this.reqSign]
|
|
|
+ }
|
|
|
+ return url
|
|
|
+ },
|
|
|
+ filterInfoUrl: function () {
|
|
|
+ // var urlMap = {
|
|
|
+ // bigmember: '/bigmember/portrait/winner/getNewMsgSelects', // 大会员
|
|
|
+ // svip: '/bigmember/portrait/subVipPortrait/getNewMsgSelects' // 超级订阅
|
|
|
+ // }
|
|
|
+ var url = '/entnicheNew/portrait/buyer/selects'
|
|
|
+ if (urlMap[this.reqSign]) {
|
|
|
+ url = urlMap[this.reqSign]
|
|
|
+ }
|
|
|
+ return url
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+ // var eid = utils.getParam('eid')
|
|
|
+ // var reqSign = utils.getParam('reqSign')
|
|
|
+ // if (eid) {
|
|
|
+ // this.entInfo.eid = decodeURIComponent(eid)
|
|
|
+ // }
|
|
|
+ // if (reqSign) {
|
|
|
+ // this.reqSign = reqSign
|
|
|
+ // }
|
|
|
+ var entName = decodeURIComponent(utils.getParam('entName'))
|
|
|
+ if (entName) {
|
|
|
+ this.entInfo.buyerName = entName
|
|
|
+ }
|
|
|
+ // this.getUserInfo()
|
|
|
+ var recover = this.recover()
|
|
|
+ if (!recover) {
|
|
|
+ // this.getFilterInfo()
|
|
|
+ this.onLoad()
|
|
|
+ } else {
|
|
|
+ this.initSelector(_this.filterInitData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted: function () {},
|
|
|
+ methods: {
|
|
|
+ // getUserInfo: function() {
|
|
|
+ // var _this = this
|
|
|
+ // $.ajax({
|
|
|
+ // type: 'POST',
|
|
|
+ // url: '/bigmember/use/isAdd?t=' + Date.now(),
|
|
|
+ // timeout: 6000,
|
|
|
+ // success: function (res) {
|
|
|
+ // if (res.data) {
|
|
|
+ // _this.info.bigStatus = res.data.memberStatus
|
|
|
+ // _this.info.power = res.data.power
|
|
|
+ // _this.info.vipStatus = res.data.vipStatus
|
|
|
+ // _this.info.viper = res.data.viper
|
|
|
+ // var recover = _this.recover()
|
|
|
+ // if (!recover) {
|
|
|
+ // // this.getFilterInfo()
|
|
|
+ // _this.onLoad()
|
|
|
+ // } else {
|
|
|
+ // _this.initSelector(_this.filterInitData)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function (error) {
|
|
|
+ // console.log(error)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ showToast: function (message) {
|
|
|
+ this.$toast({
|
|
|
+ duration: 1500,
|
|
|
+ forbidClick: true,
|
|
|
+ message: message,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showLoading: function () {
|
|
|
+ var loading = this.$toast.loading({
|
|
|
+ duration: 0,
|
|
|
+ forbidClick: true,
|
|
|
+ message: 'loading...',
|
|
|
+ })
|
|
|
+ return loading
|
|
|
+ },
|
|
|
+ // getFilterInfo: function () {
|
|
|
+ // var _this = this
|
|
|
+ // var loading = this.showLoading()
|
|
|
+ // $.ajax({
|
|
|
+ // type: 'POST',
|
|
|
+ // url: this.filterInfoUrl,
|
|
|
+ // data: {
|
|
|
+ // entId: _this.entInfo.eid
|
|
|
+ // },
|
|
|
+ // success: function (res) {
|
|
|
+ // if (res.error_code == 0) {
|
|
|
+ // loading.clear()
|
|
|
+ // _this.filterInitData = res.data
|
|
|
+ // _this.initSelector(res.data)
|
|
|
+ // } else {
|
|
|
+ // _this.showToast(res.error_msg)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function (error) {
|
|
|
+ // loading.clear()
|
|
|
+ // console.log(error)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ onLoad: function () {
|
|
|
+ var _this = this
|
|
|
+ var t = this.listState
|
|
|
+ t.loading = true
|
|
|
+ var storageSet = JSON.parse(sessionStorage.getItem('buyer_high_set'))
|
|
|
+ // var bigUrl = '/bigmember/portrait/buyer/getNewMsg'
|
|
|
+ // var vipUrl = '/bigmember/subVipPortrait/buyer/getNewMsg'
|
|
|
+ var data = {
|
|
|
+ buyer: _this.entInfo.buyerName,
|
|
|
+ // match: _this.searchInfo.content,
|
|
|
+ // matchType: _this.searchFilters.matchType.join(','),
|
|
|
+ // area: _this.searchFilters.area.join(','),
|
|
|
+ // infoType: _this.searchFilters.infoType.join(','),
|
|
|
+ // pushTime: _this.searchFilters.pushTime.join(','),
|
|
|
+ pageNum: _this.listState.pageNum,
|
|
|
+ pageSize: _this.listState.pageSize,
|
|
|
+ }
|
|
|
+ var isMember = _this.info.bigStatus > 0 && _this.info.power.indexOf(5) > -1
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/entnicheNew/portrait/buyer/getNewMsg',
|
|
|
+ data: storageSet ? Object.assign(data, storageSet) : data,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.data) {
|
|
|
+ // 判断是否为刷新
|
|
|
+ if (t.refreshing) {
|
|
|
+ t.list = []
|
|
|
+ t.refreshing = false
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表赋值
|
|
|
+ var list = res.data.list
|
|
|
+ var count = res.data.count
|
|
|
+ if (Array.isArray(list)) {
|
|
|
+ _this.preSortList(list)
|
|
|
+ if (_this.listState.pageNum === 1) {
|
|
|
+ t.list = []
|
|
|
+ }
|
|
|
+ t.list = t.list.concat(list)
|
|
|
+ } else {
|
|
|
+ // list不为数组,则直接finish
|
|
|
+ t.loaded = true
|
|
|
+ t.loading = false
|
|
|
+ t.finished = true
|
|
|
+ }
|
|
|
+ if (count && count != -1) {
|
|
|
+ _this.listState.count = count
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载状态结束
|
|
|
+ t.loaded = true
|
|
|
+ t.loading = false
|
|
|
+
|
|
|
+ // 翻页
|
|
|
+ var hasNextPage = _this.listState.pageNum * _this.listState.pageSize < _this.listState.count
|
|
|
+ if (hasNextPage) {
|
|
|
+ t.pageNum++
|
|
|
+ } else {
|
|
|
+ t.finished = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ t.loaded = true
|
|
|
+ t.loading = false
|
|
|
+ t.finished = true
|
|
|
+ _this.$toast('请求失败')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onRefresh: function () {
|
|
|
+ // 重置数据
|
|
|
+ this.listState.pageNum = 1
|
|
|
+ // 解除加载完成状态
|
|
|
+ this.listState.finished = false
|
|
|
+ // 重新加载数据
|
|
|
+ // 将 loading 设置为 true,表示处于加载状态
|
|
|
+ this.listState.loading = true
|
|
|
+ // 请求数据
|
|
|
+ this.onLoad()
|
|
|
+ },
|
|
|
+ resetState: function () {
|
|
|
+ var rState = {
|
|
|
+ refreshing: false,
|
|
|
+ loaded: false,
|
|
|
+ loading: false,
|
|
|
+ finished: false,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ scrollTop: 0,
|
|
|
+ list: []
|
|
|
+ }
|
|
|
+ Object.assign(this.listState, rState)
|
|
|
+ },
|
|
|
+ doSearch: function () {
|
|
|
+ this.resetState()
|
|
|
+ this.onRefresh()
|
|
|
+ this.closeDropDownMenu(-1)
|
|
|
+ },
|
|
|
+ preSortList: function (list) {
|
|
|
+ return list
|
|
|
+ },
|
|
|
+ changeFollowState: function () {
|
|
|
+ return this.changeFollowStateRequest()
|
|
|
+ var _this = this
|
|
|
+ if (this.entInfo.follow) {
|
|
|
+ this.$dialog.confirm({
|
|
|
+ title: '提示信息',
|
|
|
+ message: '取消对“' + _this.entInfo.name + '”的关注?',
|
|
|
+ confirmButtonColor: '#2cb7ca'
|
|
|
+ }).then(function () {
|
|
|
+ _this.changeFollowStateRequest()
|
|
|
+ }).catch(function () {
|
|
|
+ console.log('取消操作')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.changeFollowStateRequest()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 修改企业关注状态
|
|
|
+ changeFollowStateRequest: function () {
|
|
|
+ var _this = this
|
|
|
+ var loading = this.showLoading()
|
|
|
+ var urls = {
|
|
|
+ addFollow: '/bigmember/follow/ent/addFollow',
|
|
|
+ delFollow: '/bigmember/follow/ent/delFollow'
|
|
|
+ }
|
|
|
+ var url = !!this.entInfo.follow ? urls.delFollow : urls.addFollow
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: url,
|
|
|
+ data: {
|
|
|
+ entId: _this.entInfo.eid
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if (res.error_code == 0) {
|
|
|
+ // 清除上个页面缓存
|
|
|
+ sessionStorage.removeItem('$data-ent_portrait')
|
|
|
+ loading.clear()
|
|
|
+ if (res.data && res.data == 'success') {
|
|
|
+ _this.entInfo.follow = !_this.entInfo.follow
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _this.showToast(res.error_msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ loading.clear()
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initSelector: function (data) {
|
|
|
+ // this.initMatchTypeSelector()
|
|
|
+ // this.initInfoTypeSelector(data.infoType)
|
|
|
+ // this.initProjectAreaSelector(data.areaArr)
|
|
|
+ // this.initPublishTimeSelector(data.timeRange)
|
|
|
+
|
|
|
+ // this.recoverFilterState()
|
|
|
+ },
|
|
|
+ initMatchTypeSelector: function () {
|
|
|
+ this.$refs.matchTypeSelector.setState(this.searchFilters.matchType)
|
|
|
+ },
|
|
|
+ initInfoTypeSelector: function (infoTypeList) {
|
|
|
+ if (!Array.isArray(infoTypeList)) return
|
|
|
+
|
|
|
+ var list = []
|
|
|
+ infoTypeSelectorMap.forEach(function (item) {
|
|
|
+ for (var key in item) {
|
|
|
+ var arr = []
|
|
|
+ item[key].forEach(function (t) {
|
|
|
+ if (infoTypeList.indexOf(t) !== -1) {
|
|
|
+ arr.push(t)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (arr.length) {
|
|
|
+ list.push({
|
|
|
+ [key]: arr
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$refs.infoTypeSelector.getIndustryData(list)
|
|
|
+ this.$refs.infoTypeSelector.getbBtnClick()
|
|
|
+ this.$refs.infoTypeSelector.setStates()
|
|
|
+
|
|
|
+ this.$refs.infoTypeSelector.checkBoxAll()
|
|
|
+ },
|
|
|
+ initProjectAreaSelector: function (areaArr) {
|
|
|
+ if (!Array.isArray(areaArr)) return
|
|
|
+
|
|
|
+ if (areaArr.indexOf('全国') === -1) {
|
|
|
+ areaArr.unshift('全国')
|
|
|
+ }
|
|
|
+
|
|
|
+ var areaMap = this.$refs.projectAreaSelector.provinceListMap
|
|
|
+ var map = {}
|
|
|
+ for (var key in areaMap) {
|
|
|
+ var arr = []
|
|
|
+ areaMap[key].forEach(function (item) {
|
|
|
+ if (areaArr.indexOf(item) !== -1) {
|
|
|
+ arr.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (arr.length) {
|
|
|
+ map[key] = arr
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.projectAreaSelector.arrangeListMap(map)
|
|
|
+ },
|
|
|
+ initPublishTimeSelector: function (timeRange) {
|
|
|
+ if (!Array.isArray(timeRange)) return
|
|
|
+ var arr = []
|
|
|
+ this.publishTimeList.forEach(function (item) {
|
|
|
+ if (timeRange.indexOf(item.value) !== -1) {
|
|
|
+ arr.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.publishTimeList = JSON.parse(JSON.stringify(arr))
|
|
|
+ this.$refs.publishTimeSelector.setSortedList(this.publishTimeList)
|
|
|
+ },
|
|
|
+ cancel: function (data) {
|
|
|
+ if (data.name === 'noticeItem') {
|
|
|
+ this.searchFilters.infoType = []
|
|
|
+ this.$refs.infoTypeSelector.setState()
|
|
|
+ } else if (data.name === 'areaItem') {
|
|
|
+ this.searchFilters.area = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirm: function (data) {
|
|
|
+ if (data.name === 'noticeItem') {
|
|
|
+ this.searchFilters.infoType = data.data
|
|
|
+ } else if (data.name === 'areaItem') {
|
|
|
+ this.searchFilters.area = data.data
|
|
|
+ }
|
|
|
+ this.doSearch()
|
|
|
+ },
|
|
|
+ closeDropDownMenu: function (index) {
|
|
|
+ if (index === 0) {
|
|
|
+ this.$refs.matchTypeMenu.toggle(false)
|
|
|
+ } else if (index === 1) {
|
|
|
+ this.$refs.infoTypeMenu.toggle(false)
|
|
|
+ } else if (index === 2) {
|
|
|
+ this.$refs.projectAreaMenu.toggle(false)
|
|
|
+ } else if (index === 3) {
|
|
|
+ this.$refs.publishTimeMenu.toggle(false)
|
|
|
+ } else if (index === -1) {
|
|
|
+ this.closeDropDownMenu(0)
|
|
|
+ this.closeDropDownMenu(1)
|
|
|
+ this.closeDropDownMenu(2)
|
|
|
+ this.closeDropDownMenu(3)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ pConfirm: function (e, type) {
|
|
|
+ if (type === 'matchType') {
|
|
|
+ this.searchFilters.matchType = e.data
|
|
|
+ } else if (type === 'publishTime') {
|
|
|
+ this.searchFilters.pushTime = e.data
|
|
|
+ }
|
|
|
+ this.doSearch()
|
|
|
+ },
|
|
|
+ goToDetail: function (item) {
|
|
|
+ this.saveState()
|
|
|
+ var href = ''
|
|
|
+ if (this.platform === 'app') {
|
|
|
+ href = '/jyapp/article/content/' + item.id + '.html'
|
|
|
+ } else {
|
|
|
+ href = '/article/content/' + item.id + '.html'
|
|
|
+ }
|
|
|
+ location.href = href
|
|
|
+ },
|
|
|
+ recoverFilterState: function () {
|
|
|
+ if (this.searchFilters.infoType.length) {
|
|
|
+ this.$refs.infoTypeSelector.setState(this.searchFilters.infoType)
|
|
|
+ }
|
|
|
+ if (this.searchFilters.area.length) {
|
|
|
+ this.$refs.projectAreaSelector.setState(this.searchFilters.area)
|
|
|
+ } else {
|
|
|
+ this.$refs.projectAreaSelector.resetAll()
|
|
|
+ }
|
|
|
+ this.$refs.publishTimeSelector.setState(this.searchFilters.pushTime)
|
|
|
+ },
|
|
|
+ saveState: function () {
|
|
|
+ // 保存滚动高度
|
|
|
+ this.listState.scrollTop = parseInt(this.$refs.jList.scrollTop)
|
|
|
+ var $data = JSON.stringify(this.$data)
|
|
|
+ sessionStorage.setItem(this.sessStorageKey, $data)
|
|
|
+ },
|
|
|
+ recover: function () {
|
|
|
+ var _this = this
|
|
|
+ var excludeKey = ['sessStorageKey', 'matchTypeList', 'publishTimeList']
|
|
|
+ var $data = sessionStorage.getItem(this.sessStorageKey)
|
|
|
+ if ($data) {
|
|
|
+ $data = JSON.parse($data)
|
|
|
+ if (this.entInfo.eid !== $data.entInfo.eid) return
|
|
|
+ for (var key in $data) {
|
|
|
+ if (excludeKey.indexOf(key) !== -1) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ this.$data[key] = $data[key]
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$nextTick(function () {
|
|
|
+ _this.$refs.jList.scrollTop = _this.listState.scrollTop
|
|
|
+ })
|
|
|
+ sessionStorage.removeItem(this.sessStorageKey)
|
|
|
+ }
|
|
|
+ return !!$data
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+var vm = new Vue(vConfig)
|