137 lines
2.8 KiB
JavaScript
137 lines
2.8 KiB
JavaScript
|
// pages/matchDetail/matchDetail.js
|
||
|
const app = getApp()
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
requestIp: '',
|
||
|
token: '',
|
||
|
type: '',
|
||
|
matchId: '',
|
||
|
matchInfo: {},
|
||
|
activityInfo: {}
|
||
|
},
|
||
|
getMatchDetail: function () {
|
||
|
var self = this
|
||
|
wx.request({
|
||
|
url: self.data.requestIp + 'wxminiapp/article/getmatchinfodetailrelease',
|
||
|
data: {
|
||
|
matchId: self.data.id
|
||
|
},
|
||
|
header: {
|
||
|
'token': self.data.token
|
||
|
},
|
||
|
success: function (res) {
|
||
|
var src = 'src="' + self.data.requestIp
|
||
|
if(res.data.data.matchSummary.indexOf('src="') != -1){
|
||
|
res.data.data.matchSummary =res.data.data.matchSummary.replace(/src="/g, src)
|
||
|
res.data.data.matchSummary =res.data.data.matchSummary.replace(/style="max-width:100%;"/g, '')
|
||
|
}
|
||
|
self.setData({
|
||
|
matchInfo: res.data.data
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
getActivityDetail: function () {
|
||
|
var self = this
|
||
|
wx.request({
|
||
|
url: self.data.requestIp + 'wxminiapp/article/getactivityinfodetailrelease',
|
||
|
data: {
|
||
|
activityId: self.data.id
|
||
|
},
|
||
|
header: {
|
||
|
'token': self.data.token
|
||
|
},
|
||
|
success: function (res) {
|
||
|
console.log(res)
|
||
|
var src = 'src="' + self.data.requestIp
|
||
|
if(res.data.data.activitySummary.indexOf('src="') != -1){
|
||
|
res.data.data.activitySummary =res.data.data.activitySummary.replace(/src="/g, src)
|
||
|
res.data.data.activitySummary =res.data.data.activitySummary.replace(/style="max-width:100%;"/g, '')
|
||
|
}
|
||
|
self.setData({
|
||
|
activityInfo: res.data.data
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
getToken: function () {
|
||
|
var self = this
|
||
|
wx.getStorage({
|
||
|
key: 'token',
|
||
|
success: function (res) {
|
||
|
self.setData({
|
||
|
token: res.data
|
||
|
})
|
||
|
if(self.data.type == 'match'){
|
||
|
self.getMatchDetail()
|
||
|
}else{
|
||
|
self.getActivityDetail()
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
this.setData({
|
||
|
requestIp: app.globalData.requestIp,
|
||
|
id: options.id,
|
||
|
type: options.type
|
||
|
})
|
||
|
this.getToken()
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
}
|
||
|
})
|