This commit is contained in:
dong_bo0602 2020-10-12 18:03:02 +08:00
parent 5ae1687061
commit 3439858af5
4 changed files with 25 additions and 13 deletions

View File

@ -11,7 +11,8 @@ Page({
typeList: [], typeList: [],
currentPage: 1, currentPage: 1,
rows: 10, rows: 10,
currentNewsDictionariesId: '' currentNewsDictionariesId: '',
trainList: []
}, },
getType: function () { getType: function () {
var self = this var self = this
@ -47,7 +48,7 @@ Page({
if(page <= 1) { if(page <= 1) {
newsArray = data.rows; newsArray = data.rows;
} else { } else {
newsArray = self.data.news.newsList; newsArray = self.data.trainList;
newsArray = newsArray.concat(data.rows); newsArray = newsArray.concat(data.rows);
} }
self.setData({ self.setData({
@ -70,14 +71,20 @@ Page({
var link = e.currentTarget.dataset.contentLink var link = e.currentTarget.dataset.contentLink
if (link) { if (link) {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?link=' + link, url: '../template/template?link=' + encodeURIComponent(link),
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?url=' + url, url: '../template/template?url=' + encodeURIComponent(url),
}) })
} }
}, },
doClearCurrentNewsDictionariesId: function () {
this.setData({
currentNewsDictionariesId: ''
})
this.getList(1)
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */

View File

@ -13,19 +13,22 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options)
if (options.link) { if (options.link) {
options.link = decodeURIComponent(options.link)
app.dialog.loading('正在加载');
var type = options.link.split('.') var type = options.link.split('.')
if (type[type.length-1] == 'pdf') { if (type[type.length-1] == 'pdf') {
wx.downloadFile({ wx.downloadFile({
url: options.link, url: options.link,
success: function (res) { success: function (res) {
const filePath = res.tempFilePath const filePath = res.tempFilePath
console.log(res)
wx.openDocument({ wx.openDocument({
filePath: filePath, filePath: filePath,
fileType: 'pdf', fileType: 'pdf',
success: function (res) { success: function (res) {
console.log(res) wx.stopPullDownRefresh();
wx.hideLoading();
} }
}) })
}, },
@ -33,11 +36,13 @@ Page({
console.log(error) console.log(error)
} }
}) })
} else {
this.setData({
url: options.link
})
} }
// this.setData({
// url: options.link
// })
} else { } else {
options.url = decodeURIComponent(options.url)
this.setData({ this.setData({
url: 'https://www.wgink.ink/' + options.url url: 'https://www.wgink.ink/' + options.url
}) })

View File

@ -78,11 +78,11 @@ Page({
var link = e.currentTarget.dataset.contentLink var link = e.currentTarget.dataset.contentLink
if (link) { if (link) {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?url=' + link, url: '../template/template?link=' + encodeURIComponent(link),
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?url=' + url, url: '../template/template?url=' + encodeURIComponent(url),
}) })
} }
}, },

View File

@ -52,11 +52,11 @@ Page({
var link = e.currentTarget.dataset.contentLink var link = e.currentTarget.dataset.contentLink
if (link) { if (link) {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?url=' + link, url: '../template/template?link=' + encodeURIComponent(link),
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '../template/template?url=' + url, url: '../template/template?url=' + encodeURIComponent(url),
}) })
} }
}, },