123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- var vm = new Vue({
- el: '#detailed',
- delimiters: ['{', '}'],
- data () {
- return {
- tit: '',
- imgSrcs: [
- {title: '活动优惠', url:'huodong'},
- {title: '服务通知', url:'fuwu'},{title: '订阅消息', url:'dingyue'},
- {title: '项目动态', url:'xiangmu'},{title: '企业动态', url:'qiye'},
- {title: '分析报告', url:'fenxi'},{title: '系统通知', url:'xitong'}
- ],
- lists: [],
- tabsList: {
- offset: 1,
- pageSize: 20,
- totals: 0,
- loading: true,
- finished: false
- }
- }
- },
- created() {
- let indx = getQueryString('type')
- let nums = getQueryString('num')
- if (nums != 0) {
- this.setRead(indx)
- }
- setTimeout(() => {
- let wxType = getType()
- if (!wxType) {
- checkMsgCount(true, 0)
- }
- }, 300)
- this.tit = this.imgSrcs[indx - 1].title
- document.title = this.imgSrcs[indx - 1].title
- },
- mounted () {
- iosBackRefresh()
- },
- updated() {
- let el = document.getElementById('descri')
- el.scrollTop = el.scrollHeight
- },
- methods: {
- platType() {
- let wxType = getType()
- if (wxType) {
- return 3
- } else {
- return 2
- }
- },
- // 点击分类修改分类下的消息为已读
- setRead(val) {
- const _this = this
- $.ajax({
- type:'POST',
- url:'/jymessageCenter/setReadStatus',
- data: {
- msgType: val
- },
- success:function () {
- // try {
- // JyObj.refreshAppointTab('search', 1)
- // } catch (error) {
- // console.log(error)
- // }
- }
- })
- },
- appMesg(type) {
- const _this = this
- $.ajax({
- type: 'GET',
- url: '/jymessageCenter/appClickMessage',
- data: {
- msgType: type,
- platform: _this.platType(),
- offset: this.tabsList.offset,
- pageSize: this.tabsList.pageSize
- },
- success:function () {}
- })
- },
- // 消息详情
- msgData() {
- const _this = this
- this.appMesg(getQueryString('type'))
- $.ajax({
- type: 'POST',
- url: '/jymessageCenter/messageList',
- data: {
- needFilter: 0,
- msgType: getQueryString('type'),
- isRead: '-1',
- offset: this.tabsList.offset,
- pageSize: this.tabsList.pageSize
- },
- success: function (r) {
- if (r && r.status == 1) {
- _this.tabsList.offset++
- if (_this.tabsList.offset === 1) {
- if (r.data.total || r.data.total === 0) {
- _this.tabsList.total = r.data.total
- } else {
- _this.tabsList.finished = true
- }
- }
- if (Array.isArray(r.data.list) && r.data.list.length !== 0) {
- setTimeout(() => {
- r.data.list.map(function (v) {
- _this.lists.unshift({
- id: v.id,
- msg_type: v.msg_type,
- title: v.title,
- content: v.content,
- createtime: v.createtime,
- link: v.link,
- url: v.url
- })
- })
- }, 200)
- } else {
- _this.tabsList.finished = true
- }
- // _this.tabsList.loading = false
- if (_this.tabsList.total !== -1 && _this.tabsList.total <= _this.lists.length) {
- _this.tabsList.finished = true
- }
- }
- }
- })
- },
- msgClick(url) {
- let wxType = getType()
- let appType = androidOrIOS()
- if (wxType) {
- if (url.weChatUrl) {
- //location.href = url.weChatUrl
- //链接中如果是www.jianyu360.cn域名,微信中会唤起app,该用window.open
- window.open(url.weChatUrl);
- } else {
- return
- }
- } else {
- const toLink = appType == 'android' ? url.androidUrl : url.iosUrl
- if (toLink) {
- // 检查是否 tabbar 页面
- const tabbarKey = utils.checkNowInAppTabbarPage(toLink)
- if (tabbarKey) {
- try {
- // 刷新对应 tabbar 并切换
- JyObj.refreshAppointTab(tabbarKey,1)
- JyObj.skipAppointTab(tabbarKey)
- } catch (e) {
- console.warn(e)
- }
- } else {
- location.href = toLink
- }
- }
- return
- }
- }
- }
- })
|