123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919 |
- var subScribeTemplate = `
- <div class="sub-scribe">
- <ul style="border-radius:.16rem;overflow:hidden">
- <li class="body-item area">
- <a class="item-container" :href="linkobj.area" @click="userNumOver">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-loaction"></span>
- <span class="item-label">区域</span>
- </span>
- <span class="item-r">
- <span class="keywords-text ellipsis" id="menuArea">{{info.area}}</span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- <div class="amendmentNum" v-show="vSwitch === 'f'">
- 当<span v-show="userAreaAllNum === 0">年</span><span v-show="userAreaAllNum > 0">月</span>剩余可修改次数:<span class="numColor" v-show="userAreaNum != -1">{{userAreaNum}} </span><span v-show="userAreaNum != -1">次</span><span v-show="userAreaNum === -1">无限制</span>
- <i class="iconfont icon-bangzhu" @click="amendmentNumNotice"></i>
- </div>
- </li>
- <li class="body-item industry">
- <a class="item-container" :href="linkobj.industry" @click="userNoIndustry">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-industry"></span>
- <span class="item-label">采购单位类型</span>
- <span class="openVip" v-show="vSwitch === 'f'">开通</span>
- </span>
- <span class="item-r">
- <span class="keywords-text ellipsis">{{info.industry}}</span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item keywords">
- <a class="item-container" :href="linkobj.keyword">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-keywords"></span>
- <span class="item-label">关键词</span>
- </span>
- <span class="item-r">
- <span class="keywords-text ellipsis">请设置关键词</span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item match-way" @click="matchWay">
- <a class="item-container" href="javascript:;">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-matchkeywords"></span>
- <span class="item-label" style="white-space: nowrap;">关键词匹配方式</span>
- </span>
- <span class="item-r">
- <span class="keywords-text ellipsis match-way-value"></span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item info-type">
- <a class="item-container" href="javascript:;" :thisHref="linkobj.infotype" @click="openInfoType">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-info-type"></span>
- <span class="item-label">信息类型</span>
- </span>
- <span class="item-r">
- <span class="info-type-text ellipsis">{{info.infoType}}</span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item project-match">
- <a class="item-container" href="javascript:;">
- <div class="item">
- <span class="item-l">
- <span class="leading jy-icon-project-match"></span>
- <span class="item-label matching">
- <span class="label-text">项目匹配</span>
- <i class="iconfont icon-bangzhu" @click="projectNotice"></i>
- <span class="openVip" v-show="vSwitch === 'f'">开通</span>
- </span>
- </span>
- <span class="item-r media_switch">
- <div class="weui-cell__ft">
- <button class="jy-switch switch" :class="{checked:checkedflag}" @click="switchs"></button>
- </div>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item resultpreview">
- <a class="item-container" :href="linkobj.resultview" id="pushResultPreview">
- <div class="item">
- <span class="item-l">
- <span class="leading_ jy-icon-resultpreview-match"></span>
- <span class="item-label-other">
- <span class="label-text">推送结果预览<span class="threeInfo">{{resultTime}}</span></span>
- <span v-if="littleShow" class="info-little">当前匹配信息过少,请适当修改订阅条件</span>
- </span>
- </span>
- <span class="item-r media_switch">
- <span class="info-type-text ellipsis"></span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- <li class="body-item push-set" v-if="pushsetShow">
- <a class="item-container" :href="linkobj.pushLink || linkobj.pushsetting">
- <div class="item">
- <span class="item-l">
- <span class="leading_ jy-icon-push-set"></span>
- <span class="item-label-other">
- <span class="label-text">推送设置</span>
- </span>
- </span>
- <span class="item-r media_switch">
- <span class="info-type-text ellipsis"></span>
- <span class="iconfont icon-arrow"></span>
- </span>
- </div>
- </a>
- </li>
- </ul>
- <!-- 匹配方式 -->
- <div class="match-keywords-actionsheet">
- <div class="weui-mask" id="iosMask" @click="iosMask" style="opacity: 1;display: none;"></div>
- <div class="weui-actionsheet" id="iosActionsheet">
- <div class="weui-actionsheet__title" style="display:none">
- <p class="weui-actionsheet__title-text">关键词匹配方式</p>
- <i class="weui-icon-clear" id="iosActionsheetCancel" @click="iosActionsheetCancel"></i>
- </div>
- <div class="weui-actionsheet__menu">
- <div class="weui-actionsheet__cell titleMacth" :class="{active:active==1}" @click="actionSheet('按标题匹配', 1)">
- <p class="cell_title">按标题匹配</p>
- </div>
- <div class="weui-actionsheet__cell allMacth" :class="{active:active==2}" @click="actionSheet('按全文匹配', 2)">
- <p class="cell_title">按全文匹配<span class="openVip-keywords" v-show="vSwitch === 'f'">开通</span></p>
- <p class="small-title">会产生无效信息,请根据需要选择</p>
- </div>
- </div>
- <!-- <div class="weui-actionsheet__action">
- <div class="weui-actionsheet__cell" id="iosActionsheetCancel" @click="iosActionsheetCancel">取消</div>
- </div> -->
- </div>
- </div>
- <!-- 信息类型 -->
- <div class="menu-infoType-wrap" v-show="infoTypeMenu">
- <div class="infoType-content">
- <div class="infoType-title">
- <div class="menu-title">选择信息类型</div>
- <div class="close-btn" @click="closeInfoType"></div>
- </div>
- <div class="menu-content">
- <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 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>
- </div>
- <div class="bottom-btn-wrap">
- <button class="bottom-btn cancel" @click="reset" :disabled="infoTypeData.length === 0">重置</button>
- <div class="bottom-btn enter" @click="confirm">确认</div>
- </div>
- </div>
- </div>
- <!-- 免费用户未设置地区弹窗 -->
- <div class="oldUserTips" v-show="noAreaFreeType">
- <div class="updateTips-wrap">
- <div class="close-btn closeNoAreaIcon" @click="closeNoAreaTips"></div>
- <div class="updateTips-text" style="text-align:center">您的订阅区域尚未设置,为了不影响您的使用,还请您尽快完善哦</div>
- <div class="updateTips-btnWrap">
- <div class="updateTips-btn levelUp" id="gotoPay" @click="gotoArea">去完善</div>
- </div>
- </div>
- </div>
- </div>
- `
- var subComponent = {
- name: 'vip-subscribe-set-template',
- template: subScribeTemplate,
- props: {
- 'linkobj': {
- type: Object,
- default: function() {
- return {}
- }
- },
- "initdata": {
- type: Object,
- default: function() {
- return {}
- }
- },
- "type": {
- type: String,
- default: ''
- },
- vSwitch: {
- type: String,
- default: 'f'
- }
- },
- data: function() {
- return {
- info: {
- area: '请选择区域',
- industry: '请选择采购单位行业',
- infoType: '请选择信息类型'
- },
- // 信息类型数据
- infoTypeList: [
- {
- title: '拟建项目',
- value: '拟建',
- desc: '采集建筑工程、信息化等类项目在招标前由发改委等部门审批的信息,并向用户提供“拟建项目预告”功能。'
- },
- {
- title: '招标预告',
- value: '预告',
- desc: '在正式招标之前发布的公告信息,主要有采购计划、项目预告、采购预告、招标文件预公示、招标方式公示等信息'
- },
- {
- title: '招标公告',
- value: '招标',
- desc: '包括公开招标、邀请招标、询价采购、竞争性谈判、单一来源、公开竞价、电子反拍、变更公告等公告信息'
- },
- {
- title: '招标结果',
- value: '结果',
- desc: '包括中标公示、成交公告、废标公告、流标公告等'
- },
- {
- title: '其他信息',
- value: '其它',
- desc: '包括合同公告、验收公告、违规处理等'
- },
- ],
- // 匹配方式
- active: 1,
- pushsetShow: true,
- resultTime: '(近3个月内共条信息)',
- checkedflag: false,
- littleShow: false,
- accStatus: 0,
- userAreaNum: 1, // 用户修改地区剩余次数
- userType: false, // 用户是否为付费用户
- userAreaAllNum: 1, // 用户可修改地区总次数
- infoTypeMenu: false, // 信息类型弹窗状态
- infoTypeData: [], // 信息类型选择列表
- conf: {}, // 信息类型数据
- noAreaFreeType: false, // 免费用户未设置地区时显示弹窗
- backTipShowCount: 0, // 离开页面展示弹窗次数
- thisvSwitch: 'f',
- UserSubscribe: {}, // 免费用户数据
- }
- },
- mounted () {
- let switchpro = sessionStorage.getItem('switch-product')
- if(switchpro) {
- if(switchpro == 'bigmember') {
- this.accStatus = 2
- } else if(switchpro == 'supervip') {
- this.accStatus = 1
- }
- }
- this.getData()
- this.$emit('mounted')
- // this.addBackTip()
- },
- watch: {
- initdata: function(newVal, oldVal) {
- if(newVal) {
- this.getResultView()
- this.getData()
- if (this.vSwitch !== 'f') {
- this.setIosData()
- }
- }
- },
- vSwitch: function (val) {
- if (val === 'f') {
- this.getUserSubscribe()
- }
- }
- },
- methods: {
- getData: function() {
- this.setArea()
- this.setIndustry()
- this.setKeyword()
- this.getActionDefault()
- this.getIndustryType()
- this.getProjectMatch()
- this.iosBackRefresh()
- },
- // 判断用户权限
- // 设置区域
- setArea: function() {
- let _this = this
- if(this.initdata.area) {
- if(_this.accStatus == 2) {
- sessionStorage.setItem('big-setArea', JSON.stringify(this.initdata.area))
- }
- if(JSON.stringify(this.initdata.area) === '{}') {
- this.info.area = '全国'
- } else {
- let proStr = ''
- Object.keys(this.initdata.area).forEach(function(item,index) {
- if(_this.initdata.area[item].length == 0) {
- proStr += item + '、'
- } else {
- let cityStr = ''
- _this.initdata.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
- }
- } else {
- this.info.area = '请选择区域'
- }
- var areaNull = sessionStorage.getItem('areaNull')
- if(areaNull) {
- this.initdata.area = {}
- this.info.area = '请选择区域'
- }
- },
- // 设置行业
- setIndustry: function() {
- let _this = this
- if(this.initdata.industry) {
- // this.initdata.industry = JSON.parse(this.initdata.industry)
- if(this.accStatus == 2) {
- sessionStorage.setItem('big-setCate', JSON.stringify(this.initdata.industry))
- }
- if(this.initdata.industry.length == 0) {
- this.info.industry = '已选:全部'
- if (this.vSwitch === 'f') {
- this.info.industry = '请选择采购单位类型'
- }
- } else {
- this.info.industry = '已选:' + this.initdata.industry.join('、')
- }
- } else {
- this.info.industry = '请选择采购单位类型'
- }
- var industryNull = sessionStorage.getItem('industryNull')
- if(industryNull) {
- this.initdata.industry = []
- this.info.industry = '请选择采购单位类型'
- }
- },
- // 设置关键词
- setKeyword: function() {
- let state = this.initdata
- if(state) {
- if(state.items) {
- if (state.items.length === 0) {
- $('.body-item.keywords .keywords-text').text('请设置关键词')
- } else {
- var arr = []
- state.items.forEach(function (item, index) {
- item.a_key.forEach(function(data,i) {
- arr.push(data.key[0])
- })
- })
- if(arr.length == 0) {
- $('.body-item.keywords .keywords-text').text('请设置关键词')
- } else {
- $('.body-item.keywords .keywords-text').text('已设置' +arr.length+ '组关键词')
- }
- // $('.body-item.keywords .keywords-text').text(arr.join('、'))
- }
- }
- } else {
- $('.body-item.keywords .keywords-text').text('请设置关键词')
- }
- },
- // ios关键词重新赋值
- setIosData: function () {
- let _this = this
- let u = navigator.userAgent;
- let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
- let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
- if (isAndroid == true) {
- console.log("安卓手机")
- } else {
- $.ajax({
- type: 'POST',
- url: '/subscribepay/vipsubscribe/getSubBuyMsg?t=' + Date.now(),
- success:function(res) {
- if(res.success) {
- _this.setKeyword()
- }
- }
- })
- }
- },
- // 信息类型
- getIndustryType: function() {
- if(this.initdata) {
- if(this.initdata.infotype) {
- if(this.accStatus == 2) {
- sessionStorage.setItem('big-setInfoType', JSON.stringify(this.initdata.infotype))
- }
- if (this.initdata.infotype.length === 0) {
- this.info.infoType = '全部类型'
- } else {
- this.info.infoType = this.initdata.infotype.join('、')
- }
- } else {
- this.info.infoType = '全部类型'
- }
- }
- },
- // 项目匹配
- getProjectMatch: function() {
- if (this.initdata.projectmatch == 1) {
- $('.switch').addClass('checked')
- this.checkedflag = true
- } else {
- $('.switch').removeClass('checked')
- this.checkedflag = false
- }
- },
- switchs: function() {
- // 用户未购买项目匹配功能
- if (this.vSwitch === 'f') {
- $('.switch').removeClass('checked')
- this.checkedflag = false
- if (location.href.indexOf('front') !== -1) {
- var href = '/front/vipsubscribe/introducePage'
- } else {
- var href = '/jyapp/vipsubscribe/introducePage'
- }
- location.href = href
- } else {
- // switch点击切换
- if (!this.checkedflag) {
- this.checkedflag = !this.checkedflag;
- this.setprojectmatch('projectMatch', 1);
- } else {
- this.checkedflag = !this.checkedflag;
- this.setprojectmatch('projectMatch', 0);
- weui.toast('项目匹配已关闭', {
- duration: 1500,
- className: 'jy-toast',
- callback: function () {
- console.log('close')
- }
- });
- }
- }
- },
- setprojectmatch(pagetype,index) {
- let _this = this
- let vswitch ='v'
- if(_this.accStatus == 2) {
- vswitch = 'm'
- } else if(_this.accStatus == 1) {
- vswitch = 'v'
- }
- $.post("/publicapply/subscribe/setUserInfo", {pageType: pagetype, pmindex: index, vSwitch:vswitch}, function (r) {
- if (r.flag) {
- if(index == 0 || index == 1) {
- var subVipState = sessionStorage.getItem('sub_vip_state');
- var reqData = JSON.parse(subVipState);
- reqData.projectmatch = index;
- sessionStorage.setItem('sub_vip_state', JSON.stringify(reqData))
- }
- }
- })
- },
- // 关键词匹配方式
- getActionDefault: function() {
- let _this = this
- let defaultTitle = ''
- if(this.initdata.matchway == 1 || !this.initdata.matchway) {
- $('.match-way-value').text('按标题匹配')
- this.active = 1
- } else if(this.initdata.matchway == 2) {
- $('.match-way-value').text('按全文匹配')
- this.active = 2
- }
- // $('#iosActionsheet .weui-actionsheet__cell').each(function (index, item) {
- // var t = $(item).children().text().trim();
- // if (t == defaultTitle) {
- // $(this).addClass('active')
- // }
- // })
- },
- hideActionSheet: function() {
- var update_renew = $('.update_renew')
- var $iosMask = $('#iosMask');
- var $iosActionsheet = $('#iosActionsheet');
- $iosActionsheet.removeClass('weui-actionsheet_toggle');
- $('.match-keywords-actionsheet').hide()
- $iosMask.fadeOut(200);
- // 免费用户
- if (this.thisvSwitch === 'f') {
- return
- }
- // 超级订阅升级提示
- if(update_renew) {
- if(this.accStatus == 2) {
- update_renew.hide()
- } else {
- update_renew.show()
- }
- }
- this.$emit('footershow', 'false')
- },
- iosMask: function() {
- this.hideActionSheet()
- },
- iosActionsheetCancel: function() {
- this.hideActionSheet()
- },
- matchWay: function() {
- var update_renew = $('.update_renew')
- var $iosMask = $('#iosMask');
- var $iosActionsheet = $('#iosActionsheet');
- $iosActionsheet.addClass('weui-actionsheet_toggle');
- $('.match-keywords-actionsheet').show()
- $iosMask.fadeIn(200);
- if(update_renew) {
- update_renew.hide()
- }
- this.$emit('footershow', 'true')
- },
- actionSheet: function(title, index) {
- let _this = this
- let vswitch = 'v'
- var href = ''
- if (index === 2 && this.vSwitch === 'f') {
- if (location.href.indexOf('front') !== -1) {
- href = '/front/vipsubscribe/introducePage'
- } else {
- href = '/jyapp/vipsubscribe/introducePage'
- }
- location.href = href
- } else {
- if (this.vSwitch === 'f') {
- return this.hideActionSheet()
- }
- if(_this.accStatus == 2) {
- vswitch = 'm'
- } else if(_this.accStatus == 1) {
- vswitch = 'v'
- }
- var update_renew = $('.update_renew')
- $.post("/publicapply/subscribe/setUserInfo", {pageType: "saveSeniorset", matchtype: index, vSwitch: vswitch}, function (r) {
- if (r.flag) {
- var subVipState = sessionStorage.getItem('sub_vip_state');
- var reqData = JSON.parse(subVipState);
- _this.active = index
- var $iosMask = $('#iosMask');
- var $iosActionsheet = $('#iosActionsheet');
- $iosActionsheet.removeClass('weui-actionsheet_toggle');
- $('.match-keywords-actionsheet').hide()
- $iosMask.fadeOut(200);
- if(update_renew) {
- if(_this.accStatus == 2) {
- update_renew.hide()
- } else {
- update_renew.show()
- }
- }
- _this.$emit('footershow', 'false')
- $('.match-way-value').text(title)
- if(index == 1) {
- $('.titleMacth').addClass('active')
- $('.allMacth').removeClass('active')
- } else {
- $('.titleMacth').removeClass('active')
- $('.allMacth').addClass('active')
- }
- reqData.matchway = index;
- sessionStorage.setItem('sub_vip_state', JSON.stringify(reqData))
- } else {
- weui.toast('关键词匹配方式修改失败', {
- duration: 1500,
- className: 'jy-toast',
- callback: function () {
- console.log('close')
- }
- });
- }
- })
- // var nowMode = title
- // var ModeArr = ['按标题匹配', '按全文匹配']
- // var nowIndex = ModeArr.indexOf(nowMode)
- // if (nowIndex !== -1) {
- // this.setMatchway(ModeArr.indexOf(nowMode) + 1)
- // } else {
- // // $(this).removeClass('active').siblings().addClass('active');
- // $('.match-way-value').text($(this).siblings().children('.cell_title').text())
- // weui.toast('关键词匹配方式修改失败', {
- // duration: 1500,
- // className: 'jy-toast',
- // callback: function () {
- // console.log('close')
- // }
- // });
- // }
- this.getResultView()
- }
- },
- // 项目匹配问号点击事件
- projectNotice: function () {
- var str = '开启后,系统将根据你订阅的关键词自动匹配出相关联的项目,并将相关联项目的后续动态在超级订阅内一并推送。'
- weui.alert(str, {
- title: '项目匹配',
- className: 'jy-alert',
- buttons: [{
- label: '我知道了'
- }]
- });
- },
- // 用户未购买修改采购单位类型功能
- userNoIndustry: function () {
- if (this.vSwitch !== 'f') {
- var href = '/jyapp/vipsubscribe/toChangeIndustry?header=save'
- } else {
- if (location.href.indexOf('front') !== -1) {
- var href = '/front/vipsubscribe/introducePage'
- } else {
- var href = '/jyapp/vipsubscribe/introducePage'
- }
- }
- this.linkobj.industry = href
- },
- // 修改地区无次数点击事件
- userNumOver: function () {
- var _this = this
- if (this.vSwitch === 'f' && this.userAreaNum === 0) {
- this.linkobj.area = 'javascript:;'
- if (this.userAreaAllNum > 0) {
- var str = `对不起,您当月修改区域的机会(${this.userAreaAllNum}次)已消耗完毕,无法再次修改~可前往升级省份订阅包增加订阅省份和修改次数`
- } else {
- var str = `对不起,您今年修改免费订阅区域的机会(1次)已消耗完毕,无法再次修改~可前往购买省份订阅包增加订阅省份`
- }
- weui.alert(str, {
- title: '',
- className: 'area-noNum',
- buttons: [{
- label: '取消',
- type: 'default'
- },{
- label: _this.userType ? '去升级' : '去购买',
- onClick: function(){
- if (_this.userType) {
- if (location.href.indexOf('front') !== -1) {
- var href = '/areaPack/wx/page/buy?type=upgrade'
- } else {
- var href = '/jyapp/areaPack/page/buy?type=upgrade'
- }
- } else {
- if (location.href.indexOf('front') !== -1) {
- var href = '/areaPack/wx/page/buy?type=buy'
- } else {
- var href = '/jyapp/areaPack/page/buy?type=buy'
- }
- }
- location.href = href
- }
- }]
- });
- }
- else {
- // this.linkobj.area = '/jyapp/big/page/set_area?callback=setting_save'
- if (this.vSwitch === 'f') {
- if (location.href.indexOf('front') !== -1) {
- this.linkobj.area = '/areaPack/wx/page/set_area'
- } else {
- this.linkobj.area = '/jyapp/areaPack/page/set_area'
- }
- }
- }
- },
- // 修改地区剩余次数问号点击事件
- amendmentNumNotice: function () {
- if (this.userAreaAllNum > 0) {
- var str = '每月可修改次数=可订阅省份数量,即每增加购买1个省份,可增加1次修改机会,次月清零重新计算,购买全国不限制每月修改次数。'
- } else {
- var str = '免费用户每年享有 1 次修改区域的机会'
- }
- weui.alert(str, {
- title: '',
- className: 'area-alert',
- buttons: [{
- label: '我知道了'
- }]
- });
- },
- // 打开信息类型
- openInfoType: function () {
- if (this.vSwitch === 'f') {
- this.infoTypeMenu = true
- } else {
- if (location.href.indexOf('front') !== -1) {
- location.href = '/front/vipsubscribe/toSetInfoTypePage'
- } else {
- location.href = '/jyapp/vipsubscribe/toSetInfoTypePage'
- }
- }
- },
- // 重置信息类型
- reset: function () {
- this.infoTypeData = []
- },
- // 确认信息类型
- confirm: function () {
- this.infoTypeMenu = false
- 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) {
- location.reload()
- } else {
- _this.$toast(res.data.error_msg)
- }
- }
- })
- },
- // 关闭信息类型菜单
- closeInfoType: function () {
- this.infoTypeMenu = false
- },
- // 点击按钮改变按钮状态
- changeBtnType: function (item) {
- if (item === 'all') {
- this.infoTypeData = []
- } else {
- let thisIndex = this.infoTypeData.indexOf(item)
- if (thisIndex !== -1) {
- this.infoTypeData.splice(thisIndex, 1)
- } else {
- this.infoTypeData.push(item)
- }
- }
- },
- // 跳转地区选择
- gotoArea: function () {
- if (location.href.indexOf('front') !== -1) {
- location.href = '/areaPack/wx/page/set_area?type=new'
- } else {
- location.href = '/jyapp/areaPack/page/set_area?type=new'
- }
- },
- // 获取用户权限
- getUserSubscribe: function () {
- let _this = this
- $.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.infoTypeData = res.data.infotype || []
- _this.info.infoType = _this.infoTypeData.length === 0 ? '全部类型' : _this.infoTypeData.join('、')
- // 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
- let areaArr = []
- if (res.data) {
- if (!res.data.area) {
- _this.noAreaFreeType = true
- } else {
- for (const key in res.data.area) {
- areaArr.push(key)
- }
- }
- }
- $('#menuArea').text('已选:'+ areaArr.join('、'))
- }
- })
- },
- // 关闭未选择地区提示
- closeNoAreaTips: function () {
- this.noAreaFreeType = false
- },
- // 页面跳转返回提示
- addBackTip: function () {
- var _this = this
- var pushContent = {
- info: '订阅管理返回',
- url: '#tipover'
- }
- if (!history.state && this.backTipShowCount < 1) {
- history.pushState(pushContent, null, pushContent.url);
- }
- $(window).on('popstate', function () {
- _this.noAreaFreeType = true
- _this.backTipShowCount++
- })
- },
- //
- // 最近三个月推送结果预览总数
- getResultView: function () {
- let keyArr = []
- let notKeyArr = []
- let matchway = this.initdata.matchway
- let vt = 'v'
- let switchpro = sessionStorage.getItem('switch-product')
- if(switchpro) {
- if(switchpro == 'bigmember') {
- vt = 'm'
- } else if(switchpro == 'supervip') {
- vt = 'v'
- }
- }
- if (this.initdata.items) {
- this.initdata.items.forEach(function(item) {
- item.a_key.forEach(function(r) {
- keyArr.push(r.key[0])
- if(r.notkey) {
- r.notkey.forEach(function(nok) {
- notKeyArr.push(nok)
- })
- }
- })
- })
- }
- let _this = this
- $.ajax({
- type: 'POST',
- url: '/publicapply/subscribe/getPushAllCount',
- data: {
- item: '',
- index: -1,
- vt: vt
- },
- success: function(res) {
- if(_this.type == 'introduce') {
- _this.pushsetShow = false
- _this.resultTime = '(仅限超级订阅用户预览)'
- _this.linkobj.resultview = 'javascript:;'
- $('.resultpreview .icon-arrow').hide()
- } else {
- if(res.count < 30) {
- _this.littleShow = true
- } else {
- _this.littleShow = false
- }
- _this.resultTime = '(近3个月内共' + res.count + '条信息)'
- }
- }
- })
- },
- // 解决ios返回不刷新页面的问题
- iosBackRefresh: function () {
- var isPageHide = false;
- window.addEventListener('pageshow', function () {
- if (isPageHide) {
- location.reload();
- }
- });
- window.addEventListener('pagehide', function () {
- isPageHide = true;
- });
- },
- },
- }
|