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: [],
currentPage: 1,
rows: 10,
currentNewsDictionariesId: ''
currentNewsDictionariesId: '',
trainList: []
},
getType: function () {
var self = this
@ -47,7 +48,7 @@ Page({
if(page <= 1) {
newsArray = data.rows;
} else {
newsArray = self.data.news.newsList;
newsArray = self.data.trainList;
newsArray = newsArray.concat(data.rows);
}
self.setData({
@ -70,14 +71,20 @@ Page({
var link = e.currentTarget.dataset.contentLink
if (link) {
wx.navigateTo({
url: '../template/template?link=' + link,
url: '../template/template?link=' + encodeURIComponent(link),
})
} else {
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) {
console.log(options)
if (options.link) {
options.link = decodeURIComponent(options.link)
app.dialog.loading('正在加载');
var type = options.link.split('.')
if (type[type.length-1] == 'pdf') {
wx.downloadFile({
url: options.link,
success: function (res) {
const filePath = res.tempFilePath
console.log(res)
wx.openDocument({
filePath: filePath,
fileType: 'pdf',
success: function (res) {
console.log(res)
wx.stopPullDownRefresh();
wx.hideLoading();
}
})
},
@ -33,11 +36,13 @@ Page({
console.log(error)
}
})
} else {
this.setData({
url: options.link
})
}
// this.setData({
// url: options.link
// })
} else {
options.url = decodeURIComponent(options.url)
this.setData({
url: 'https://www.wgink.ink/' + options.url
})

View File

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