@ -1,47 +1,75 @@
|
||||
// app.js
|
||||
const $api = require('./utils/api').API; |
||||
App({ |
||||
onLaunch() { |
||||
// 监听更新版本
|
||||
if (wx.canIUse('getUpdateManager')) { |
||||
const updateManager = wx.getUpdateManager() |
||||
updateManager.onCheckForUpdate(function (res) { |
||||
// 请求完新版本信息的回调
|
||||
if (res.hasUpdate) { |
||||
console.log('res.hasUpdate====') |
||||
updateManager.onUpdateReady(function () { |
||||
wx.showModal({ |
||||
title: '更新提示', |
||||
content: '新版本已经准备好,是否重启应用?', |
||||
success: function (res) { |
||||
console.log('success====', res) |
||||
// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
|
||||
if (res.confirm) { |
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate() |
||||
onLaunch() { |
||||
// 监听更新版本
|
||||
if (wx.canIUse('getUpdateManager')) { |
||||
const updateManager = wx.getUpdateManager() |
||||
updateManager.onCheckForUpdate(function (res) { |
||||
// 请求完新版本信息的回调
|
||||
if (res.hasUpdate) { |
||||
console.log('res.hasUpdate====') |
||||
updateManager.onUpdateReady(function () { |
||||
wx.showModal({ |
||||
title: '更新提示', |
||||
content: '新版本已经准备好,是否重启应用?', |
||||
success: function (res) { |
||||
console.log('success====', res) |
||||
// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
|
||||
if (res.confirm) { |
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate() |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
}) |
||||
}) |
||||
updateManager.onUpdateFailed(function () { |
||||
// 新的版本下载失败
|
||||
wx.showModal({ |
||||
title: '已经有新版本了哟~', |
||||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~' |
||||
updateManager.onUpdateFailed(function () { |
||||
// 新的版本下载失败
|
||||
wx.showModal({ |
||||
title: '已经有新版本了哟~', |
||||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~' |
||||
}) |
||||
}) |
||||
}) |
||||
} |
||||
}) |
||||
} |
||||
}, |
||||
queryUsreInfo() { |
||||
$api.getUserInfo().then(res => { |
||||
if (res.code === 0) { |
||||
wx.setStorageSync('userInfo', res.data.sysUser) |
||||
} |
||||
}) |
||||
}, |
||||
globalData: { |
||||
userInfo: null |
||||
} |
||||
}, |
||||
queryUsreInfo() { |
||||
$api.getUserInfo().then(res => { |
||||
if (res.code === 0) { |
||||
wx.setStorageSync('userInfo', res.data.sysUser) |
||||
} |
||||
}) |
||||
}, |
||||
globalData: { |
||||
userInfo: null |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
! function () { |
||||
//获取页面配置并进行页面分享配置
|
||||
var PageTmp = Page |
||||
Page = function (pageConfig) { |
||||
//1. 获取当前页面路由
|
||||
let routerUrl = "" |
||||
wx.onAppRoute(function (res) { |
||||
//app.js中需要在隐式路由中才能用getCurrentPages()获取到页面路由
|
||||
let pages = getCurrentPages(), |
||||
view = pages[pages.length - 1]; |
||||
routerUrl = view.route |
||||
}) |
||||
|
||||
//2. 全局开启分享配置
|
||||
pageConfig = Object.assign({ |
||||
onShareAppMessage: function () { |
||||
//根据不同路由设置不同分享内容(微信小程序分享自带参数,如非特例,不需配置分享路径)
|
||||
return {} |
||||
}, |
||||
onShareTimeline() { |
||||
return {} |
||||
} |
||||
}, pageConfig); |
||||
// 配置页面模板
|
||||
PageTmp(pageConfig); |
||||
} |
||||
}(); |
@ -0,0 +1,29 @@
|
||||
// pages/message-detail/message-detail.js
|
||||
const WxParse = require('../../wxParse/wxParse.js'); |
||||
const $api = require('../../utils/api').API; |
||||
Page({ |
||||
|
||||
/** |
||||
* 页面的初始数据 |
||||
*/ |
||||
data: { |
||||
article: {} |
||||
}, |
||||
|
||||
/** |
||||
* 生命周期函数--监听页面加载 |
||||
*/ |
||||
onLoad: function (options) { |
||||
let messageId = options.messageId |
||||
$api.AJAX('get', `applets/message/${messageId}`).then(res => { |
||||
let article = res.data.messageContent; |
||||
WxParse.wxParse('article', 'html', article, this, 5); |
||||
}) |
||||
}, |
||||
/** |
||||
* 用户点击右上角分享 |
||||
*/ |
||||
onShareAppMessage: function () { |
||||
|
||||
} |
||||
}) |
@ -0,0 +1,3 @@
|
||||
{ |
||||
"usingComponents": {} |
||||
} |
@ -0,0 +1,11 @@
|
||||
<!--pages/message-detail/message-detail.wxml--> |
||||
<import src="../../wxParse/wxParse.wxml" /> |
||||
<view class="pages"> |
||||
<mp-navigation-bar ext-class="set-bar" title="消息通知"></mp-navigation-bar> |
||||
<view class="main"> |
||||
<view class="title">{{title}}</view> |
||||
<view class="content"> |
||||
<template is="wxParse" data="{{wxParseData:article.nodes}}" /> |
||||
</view> |
||||
</view> |
||||
</view> |
@ -0,0 +1 @@
|
||||
/* pages/message-detail/message-detail.wxss */ |
@ -1,21 +1,22 @@
|
||||
<view class="pages"> |
||||
<mp-navigation-bar ext-class="set-bar" title="消息通知"></mp-navigation-bar> |
||||
<view class="main"> |
||||
<view class="tab"> |
||||
<view class="main"> |
||||
<view class="tab"> |
||||
<view class="tab-item {{item.id===active?'active':''}}" wx:for="{{tabList}}" wx:for-index="i" wx:for-item="item" |
||||
wx:key="id" bindtap="tabDowm" data-id="{{item.id}}"> |
||||
<text class="tab-title">{{item.name}}</text> |
||||
<image class="tab-tag" src="../../assets/images/tab-tag.png"></image> |
||||
</view> |
||||
</view> |
||||
<view class="info" wx:for="{{dataList}}" wx:for-index="i" wx:for-item="item" wx:key="i"> |
||||
<view class="text"> |
||||
{{item.messageTitle}} |
||||
<view class="info" wx:for="{{dataList}}" wx:for-index="i" wx:for-item="item" wx:key="i" bindtap="detail" |
||||
data-messageId="{{item.messageId}}"> |
||||
<view class="text"> |
||||
{{item.messageTitle}} |
||||
</view> |
||||
<text class="timer">{{item.updateDate}}</text> |
||||
</view> |
||||
<text class="timer">{{item.updateDate}}</text> |
||||
</view> |
||||
<view class="noText" style="padding-top:50rpx" wx:if="{{dataList<=0}}"> |
||||
暂无数据 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
暂无数据 |
||||
</view> |
||||
</view> |
||||
</view> |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1015 B |
After Width: | Height: | Size: 1003 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 996 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1012 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1008 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 999 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1022 B |
After Width: | Height: | Size: 1013 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 956 B |
After Width: | Height: | Size: 1022 B |
After Width: | Height: | Size: 972 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 980 B |
After Width: | Height: | Size: 945 B |
After Width: | Height: | Size: 936 B |
After Width: | Height: | Size: 1012 B |
After Width: | Height: | Size: 968 B |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.0 KiB |