|
@@ -159,14 +159,14 @@ var subScribeTemplate = `
|
|
<div class="close-btn" @click="closeInfoType"></div>
|
|
<div class="close-btn" @click="closeInfoType"></div>
|
|
</div>
|
|
</div>
|
|
<div class="menu-content">
|
|
<div class="menu-content">
|
|
- <div class="infoType-btn" @click="changeBtnType('全部')" :class="infoTypeData.indexOf('全部') !== -1 ? 'infoTypeActive' : ''">全部</div>
|
|
|
|
|
|
+ <div class="infoType-btn" @click="changeBtnType('all')" :class="infoTypeData.length === 0 ? 'infoTypeActive' : ''">全部</div>
|
|
<div v-for="(item, index) in infoTypeList" :key="index" class="infoType-item">
|
|
<div v-for="(item, index) in infoTypeList" :key="index" class="infoType-item">
|
|
<div class="infoType-btn" @click="changeBtnType(item.value)" :class="infoTypeData.indexOf(item.value) !== -1 ? 'infoTypeActive' : ''">{{item.title}}</div>
|
|
<div class="infoType-btn" @click="changeBtnType(item.value)" :class="infoTypeData.indexOf(item.value) !== -1 ? 'infoTypeActive' : ''">{{item.title}}</div>
|
|
<div class="infoType-msg">{{item.desc}}</div>
|
|
<div class="infoType-msg">{{item.desc}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bottom-btn-wrap">
|
|
<div class="bottom-btn-wrap">
|
|
- <div class="bottom-btn cancel" @click="reset" :class="isChange?'thisChange':''">重置</div>
|
|
|
|
|
|
+ <button class="bottom-btn cancel" @click="reset" :disabled="infoTypeData.length === 0">重置</button>
|
|
<div class="bottom-btn enter" @click="confirm">确认</div>
|
|
<div class="bottom-btn enter" @click="confirm">确认</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -255,8 +255,7 @@ var subComponent = {
|
|
userType: false, // 用户是否为付费用户
|
|
userType: false, // 用户是否为付费用户
|
|
userAreaAllNum: 1, // 用户可修改地区总次数
|
|
userAreaAllNum: 1, // 用户可修改地区总次数
|
|
infoTypeMenu: false, // 信息类型弹窗状态
|
|
infoTypeMenu: false, // 信息类型弹窗状态
|
|
- infoTypeData: ['全部'], // 信息类型选择列表
|
|
|
|
- isChange: false, // 信息类型是否做过更改
|
|
|
|
|
|
+ infoTypeData: [], // 信息类型选择列表
|
|
conf: {}, // 信息类型数据
|
|
conf: {}, // 信息类型数据
|
|
noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
|
|
noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
|
|
backTipShowCount: 0, // 离开页面展示弹窗次数
|
|
backTipShowCount: 0, // 离开页面展示弹窗次数
|
|
@@ -288,7 +287,6 @@ var subComponent = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
vSwitch: function (val) {
|
|
vSwitch: function (val) {
|
|
- sessionStorage.setItem('infoTypeVswitch', val)
|
|
|
|
if (val === 'f') {
|
|
if (val === 'f') {
|
|
this.getUserSubscribe()
|
|
this.getUserSubscribe()
|
|
}
|
|
}
|
|
@@ -730,25 +728,35 @@ var subComponent = {
|
|
},
|
|
},
|
|
// 重置信息类型
|
|
// 重置信息类型
|
|
reset: function () {
|
|
reset: function () {
|
|
- if (this.isChange) {
|
|
|
|
- this.infoTypeData = ['全部']
|
|
|
|
- this.isChange = false
|
|
|
|
- }
|
|
|
|
|
|
+ this.infoTypeData = []
|
|
},
|
|
},
|
|
// 确认信息类型
|
|
// 确认信息类型
|
|
confirm: function () {
|
|
confirm: function () {
|
|
this.infoTypeMenu = false
|
|
this.infoTypeMenu = false
|
|
- // var callback = utils.getParam('callback')
|
|
|
|
- // 如果有callback,则使用页面内部自己定义的方法来恢复和保存数据
|
|
|
|
- if (true) {
|
|
|
|
- try {
|
|
|
|
- custom['_setting_save'](this.infoTypeData)
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log(error)
|
|
|
|
|
|
+ this.saveInfoTypeChange()
|
|
|
|
+ },
|
|
|
|
+ saveInfoTypeChange: function () {
|
|
|
|
+ var _this = this
|
|
|
|
+ $.ajax({
|
|
|
|
+ type:'POST',
|
|
|
|
+ url:'/publicapply/subscribe/setUserInfo',
|
|
|
|
+ data: {
|
|
|
|
+ pageType: 'infoType',
|
|
|
|
+ infoTypeArr: this.infoTypeData.join(','),
|
|
|
|
+ vSwitch: this.vSwitch
|
|
|
|
+ },
|
|
|
|
+ success:function(res){
|
|
|
|
+ if(res.flag) {
|
|
|
|
+ if (_this.infoTypeData.length) {
|
|
|
|
+ _this.info.infoType = _this.infoTypeData.join('、')
|
|
|
|
+ } else {
|
|
|
|
+ _this.info.infoType = '全部类型'
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ _this.$toast(res.data.error_msg)
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- setInfoTypeFn.saveToSessionStorage(this.infoTypeData)
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 关闭信息类型菜单
|
|
// 关闭信息类型菜单
|
|
closeInfoType: function () {
|
|
closeInfoType: function () {
|
|
@@ -756,23 +764,15 @@ var subComponent = {
|
|
},
|
|
},
|
|
// 点击按钮改变按钮状态
|
|
// 点击按钮改变按钮状态
|
|
changeBtnType: function (item) {
|
|
changeBtnType: function (item) {
|
|
- this.isChange = true
|
|
|
|
- let thisIndex = this.infoTypeData.indexOf(item)
|
|
|
|
- let allType = this.infoTypeData.indexOf('全部')
|
|
|
|
- if (allType !== -1) {
|
|
|
|
- this.infoTypeData.splice(allType,1)
|
|
|
|
- }
|
|
|
|
- if (item === '全部') {
|
|
|
|
- this.infoTypeData = ['全部']
|
|
|
|
|
|
+ if (item === 'all') {
|
|
|
|
+ this.infoTypeData = []
|
|
} else {
|
|
} else {
|
|
|
|
+ let thisIndex = this.infoTypeData.indexOf(item)
|
|
if (thisIndex !== -1) {
|
|
if (thisIndex !== -1) {
|
|
- this.infoTypeData.splice(thisIndex,1)
|
|
|
|
|
|
+ this.infoTypeData.splice(thisIndex, 1)
|
|
} else {
|
|
} else {
|
|
this.infoTypeData.push(item)
|
|
this.infoTypeData.push(item)
|
|
}
|
|
}
|
|
- if (this.infoTypeData.length === 0 || this.infoTypeData.length === this.infoTypeList.length) {
|
|
|
|
- this.infoTypeData = ['全部']
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 跳转地区选择
|
|
// 跳转地区选择
|
|
@@ -787,53 +787,31 @@ var subComponent = {
|
|
getUserSubscribe: function () {
|
|
getUserSubscribe: function () {
|
|
let _this = this
|
|
let _this = this
|
|
$.ajax({
|
|
$.ajax({
|
|
- url: '/publicapply/free/subscribe',
|
|
|
|
- type: 'POST',
|
|
|
|
- success: function (res) {
|
|
|
|
- let freeArea = JSON.stringify(res.data)
|
|
|
|
- sessionStorage.setItem('sub_free_state', freeArea)
|
|
|
|
- _this.UserSubscribe = res
|
|
|
|
- _this.info.area = res.data.area
|
|
|
|
- _this.userAreaNum = res.data.areanum
|
|
|
|
- _this.userType = res.data.provincenum === 0 ? false : true
|
|
|
|
- _this.userAreaAllNum = res.data.provincenum
|
|
|
|
- _this.initdata.infotype = res.data.infotype || []
|
|
|
|
- _this.info.infoType = _this.initdata.infotype.join('、')
|
|
|
|
- // _this.$emit('UserSubscribe',res)
|
|
|
|
-
|
|
|
|
- // let proStr = ''
|
|
|
|
- // Object.keys(res.data.area).forEach(function(item,index) {
|
|
|
|
- // if(res.data.area[item].length == 0) {
|
|
|
|
- // proStr += item + '、'
|
|
|
|
- // } else {
|
|
|
|
- // let cityStr = ''
|
|
|
|
- // res.data.area[item].forEach(function(data, i) {
|
|
|
|
- // cityStr += data + '、'
|
|
|
|
- // })
|
|
|
|
- // if (cityStr.length > 0) {
|
|
|
|
- // cityStr = cityStr.substr(0,cityStr.length - 1);
|
|
|
|
- // }
|
|
|
|
- // proStr += item+ '(' + cityStr + ')' + '、'
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // if(proStr[proStr.length - 1] == '、') {
|
|
|
|
- // proStr = proStr.substr(0,proStr.length - 1);
|
|
|
|
- // }
|
|
|
|
- // _this.info.area = '已选:' + proStr
|
|
|
|
|
|
+ url: '/publicapply/free/subscribe',
|
|
|
|
+ type: 'POST',
|
|
|
|
+ success: function (res) {
|
|
|
|
+ _this.UserSubscribe = res
|
|
|
|
+ if (res.data) {
|
|
|
|
+ _this.info.area = res.data.area
|
|
|
|
+ _this.userAreaNum = res.data.areanum
|
|
|
|
+ _this.userType = res.data.provincenum === 0 ? false : true
|
|
|
|
+ _this.userAreaAllNum = res.data.provincenum
|
|
|
|
+ _this.initdata.infotype = res.data.infotype || []
|
|
|
|
+ _this.infoTypeData = res.data.infotype || []
|
|
|
|
|
|
- let areaArr = []
|
|
|
|
- if (res.data) {
|
|
|
|
- if (!res.data.area) {
|
|
|
|
- _this.noAreaFreeType = true
|
|
|
|
- } else {
|
|
|
|
- for (const key in res.data.area) {
|
|
|
|
|
|
+ _this.info.infoType = _this.infoTypeData.length === 0 ? '全部类型' : _this.infoTypeData.join('、')
|
|
|
|
+ let areaArr = []
|
|
|
|
+ if (!res.data.area) {
|
|
|
|
+ _this.noAreaFreeType = true
|
|
|
|
+ _this.info.area = '请选择区域'
|
|
|
|
+ } else {
|
|
|
|
+ for (const key in res.data.area) {
|
|
areaArr.push(key)
|
|
areaArr.push(key)
|
|
- }
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
- $('#menuArea').text('已选:'+ areaArr.join('、'))
|
|
|
|
- _this.info.infoType = sessionStorage.getItem('thisUserInfoType')
|
|
|
|
|
|
+ _this.info.area = '已选:' + (areaArr.length === 0 ? '全国': areaArr.join('、'))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 关闭未选择地区提示
|
|
// 关闭未选择地区提示
|
|
@@ -922,57 +900,3 @@ var subComponent = {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
-
|
|
|
|
-var setInfoTypeFn = {
|
|
|
|
- conf: {
|
|
|
|
- sKey: 'big-setInfoType'
|
|
|
|
- },
|
|
|
|
- init: function () {
|
|
|
|
- var setKey = ''
|
|
|
|
- if (setKey) {
|
|
|
|
- this.conf.sKey = setKey
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var initData = sessionStorage.getItem(this.conf.sKey)
|
|
|
|
- if (initData) {
|
|
|
|
- initData = JSON.parse(initData)
|
|
|
|
- console.log(initData)
|
|
|
|
- // vNode.data.initInfoType = initData
|
|
|
|
- // vueComponent.setInfoTypeState(vNode.data.initInfoType)
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- saveToSessionStorage: function (data) {
|
|
|
|
- sessionStorage.setItem(this.conf.sKey, JSON.stringify(data))
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-var custom = {
|
|
|
|
- _setting_save: function (setdata) {
|
|
|
|
- if(setdata.length == 0) {
|
|
|
|
- setdata = ''
|
|
|
|
- } else {
|
|
|
|
- setdata = setdata.join(',')
|
|
|
|
- }
|
|
|
|
- sessionStorage.setItem('thisUserInfoType', setdata)
|
|
|
|
- let vswitch = sessionStorage.getItem('infoTypeVswitch')
|
|
|
|
- $.ajax({
|
|
|
|
- type:'POST',
|
|
|
|
- url:'/publicapply/subscribe/setUserInfo',
|
|
|
|
- data: {
|
|
|
|
- pageType: 'infoType',
|
|
|
|
- infoTypeArr: setdata,
|
|
|
|
- vSwitch: vswitch
|
|
|
|
- },
|
|
|
|
- success:function(res){
|
|
|
|
- sessionStorage.removeItem('infoTypeVswitch')
|
|
|
|
- if(res.flag) {
|
|
|
|
- sessionStorage.removeItem('big-setInfoType')
|
|
|
|
- location.reload()
|
|
|
|
- } else {
|
|
|
|
- vueComponent.$toast(res.data.error_msg)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-setInfoTypeFn.init()
|
|
|