method: 'GET', | method: 'GET', | ||||
data | data | ||||
}) | }) | ||||
} | |||||
export const api_getApply = function (data) { | |||||
return request({ | |||||
url: '/westreamActivityApply/getApply', | |||||
method: 'GET', | |||||
data | |||||
}) | |||||
} | } |
*/ | */ | ||||
data: { | data: { | ||||
activityId: null, | activityId: null, | ||||
activityInfo:{}, | |||||
tobegin:true, | |||||
userInfo: { | userInfo: { | ||||
applyName: '', | applyName: '', | ||||
applyPhone: '' | applyPhone: '' | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad(options) { | onLoad(options) { | ||||
const activityId = options.id | |||||
const activityInfo = JSON.parse(decodeURIComponent(options.activityInfo)) | |||||
this.setData({ | this.setData({ | ||||
activityId | |||||
activityInfo | |||||
}) | }) | ||||
}, | }, | ||||
}, | }, | ||||
handleSubmit(){ | handleSubmit(){ | ||||
if(this.data.userInfo.applyName=='' || this.data.userInfo.applyPhone==''){ | if(this.data.userInfo.applyName=='' || this.data.userInfo.applyPhone==''){ | ||||
wx.showToast({ | wx.showToast({ | ||||
title: '请填写完整', | |||||
title: '请输入姓名/电话', | |||||
icon:'none' | icon:'none' | ||||
}) | }) | ||||
return | return | ||||
}) | }) | ||||
return | return | ||||
} | } | ||||
if(!this.data.tobegin){ | |||||
return | |||||
} | |||||
this.data.tobegin = false | |||||
setTimeout(()=>{ | |||||
this.data.tobegin=true | |||||
this.setData({ | |||||
tobegin:this.data.tobegin | |||||
}) | |||||
},2000) | |||||
const openid = wx.getStorageSync('openid') | const openid = wx.getStorageSync('openid') | ||||
const userInfo = wx.getStorageSync('userInfo') | |||||
const params = { | const params = { | ||||
...this.data.userInfo, | ...this.data.userInfo, | ||||
openid, | openid, | ||||
activityId: this.data.activityId | |||||
nickname:userInfo.nickname, | |||||
activityId: this.data.activityInfo.id, | |||||
activityTitle:this.data.activityInfo.activityTitle | |||||
} | } | ||||
activitySubmit(params) | activitySubmit(params) | ||||
.then(res=>{ | .then(res=>{ | ||||
if(res.code==0){ | |||||
wx.showToast({ | |||||
title: '报名成功', | |||||
icon:"none" | |||||
}), | |||||
setTimeout(()=>{ | |||||
wx.navigateBack() | |||||
} | |||||
,2000) | |||||
} | |||||
}) | |||||
this.setData({ | |||||
tobegin:this.data.tobegin | |||||
}) | }) | ||||
}, | }, | ||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
ossForm: {}, | |||||
imageList:[], | imageList:[], | ||||
imagePreviewList: [], | imagePreviewList: [], | ||||
formRules: { | |||||
imageList: { | |||||
validator: function (value) { | |||||
return value.length!=0; | |||||
}, | |||||
warning: false | |||||
} | |||||
} | |||||
}, | }, | ||||
/** | /** | ||||
}, | }, | ||||
/* 表单上传 */ | /* 表单上传 */ | ||||
submit(){ | submit(){ | ||||
let ossForm = this.data.ossForm | |||||
let temp = [] | |||||
if (this.data.imageList.length > 0) { | |||||
wx.showLoading({title:"上传中",mask:true}) | |||||
temp = this.data.imageList.map(item => { | |||||
console.log(item); | |||||
// 设置文件上传路径 | |||||
const randomString = Math.random().toString(36).slice(2) | |||||
const timestamp = new Date().getTime() | |||||
const key = `imagedir/${randomString}_${timestamp}.png` | |||||
// 上传图片 | |||||
return new Promise((resolve, reject)=> { | |||||
wx.uploadFile({ | |||||
url: 'https://ta-tech-image.oss-cn-shanghai.aliyuncs.com', | |||||
filePath: item, | |||||
name: 'file', | |||||
formData: { | |||||
key, | |||||
OSSAccessKeyId: ossForm.OSSAccessKeyId, | |||||
signature: ossForm.signature, | |||||
policy: ossForm.policy, | |||||
'x-oss-security-token': ossForm.SecurityToken | |||||
}, | |||||
success: (res)=> { | |||||
if(res.statusCode === 204) { | |||||
// 上传成功,将图片路径resolve出去 | |||||
resolve(key) | |||||
} else { | |||||
wx.showToast({ | |||||
title: '图片上传失败', | |||||
}) | |||||
this.validateForm().then(res => { | |||||
let ossForm = this.data.ossForm | |||||
let temp = [] | |||||
if (this.data.imageList.length > 0) { | |||||
wx.showLoading({title:"上传中",mask:true}) | |||||
temp = this.data.imageList.map(item => { | |||||
console.log(item); | |||||
// 设置文件上传路径 | |||||
const randomString = Math.random().toString(36).slice(2) | |||||
const timestamp = new Date().getTime() | |||||
const key = `imagedir/${randomString}_${timestamp}.png` | |||||
// 上传图片 | |||||
return new Promise((resolve, reject)=> { | |||||
wx.uploadFile({ | |||||
url: 'https://ta-tech-image.oss-cn-shanghai.aliyuncs.com', | |||||
filePath: item, | |||||
name: 'file', | |||||
formData: { | |||||
key, | |||||
OSSAccessKeyId: ossForm.OSSAccessKeyId, | |||||
signature: ossForm.signature, | |||||
policy: ossForm.policy, | |||||
'x-oss-security-token': ossForm.SecurityToken | |||||
}, | |||||
success: (res)=> { | |||||
if(res.statusCode === 204) { | |||||
// 上传成功,将图片路径resolve出去 | |||||
resolve(key) | |||||
wx.showToast({ | |||||
title: '您的图片已提交', | |||||
icon:'none' | |||||
}) | |||||
setTimeout(()=>{ | |||||
wx.redirectTo({ | |||||
url: '../../pages/AttentionMethod/index', | |||||
}) | |||||
},2000) | |||||
} else { | |||||
wx.showToast({ | |||||
title: '图片上传失败', | |||||
}) | |||||
reject('图片上传失败') | |||||
} | |||||
}, | |||||
fail: (e)=> { | |||||
console.log(e); | |||||
reject('图片上传失败') | reject('图片上传失败') | ||||
} | } | ||||
}, | |||||
fail: (e)=> { | |||||
console.log(e); | |||||
reject('图片上传失败') | |||||
} | |||||
}) | |||||
}) | }) | ||||
}) | }) | ||||
}) | |||||
Promise.all(temp).then((res)=> { | |||||
let tenantObj = wx.getStorageSync('tenant') | |||||
let openid = wx.getStorageSync('openid') | |||||
let data = { | |||||
openid:openid, | |||||
imageUrl:res.join(','), | |||||
tenantId:tenantObj.tenantId | |||||
} | |||||
api_TiktokAdd(data).then(res => { | |||||
if (res.code === 0) { | |||||
wx.reLaunch({ | |||||
url: '/package_first/pages/successPage/index', | |||||
}) | |||||
Promise.all(temp).then((res)=> { | |||||
let tenantObj = wx.getStorageSync('tenant') | |||||
let openid = wx.getStorageSync('openid') | |||||
let data = { | |||||
openid:openid, | |||||
imageUrl:res.join(','), | |||||
tenantId:tenantObj.tenantId | |||||
} | } | ||||
}).finally(()=>{ | |||||
wx.hideLoading(); | |||||
api_TiktokAdd(data).then(res => { | |||||
if (res.code === 0) { | |||||
wx.showToast({ | |||||
title: '您的图片已提交', | |||||
icon:'none' | |||||
}) | |||||
setTimeout(()=>{ | |||||
wx.navigateBack() | |||||
},2000) | |||||
} | |||||
}).finally(()=>{ | |||||
wx.hideLoading(); | |||||
}) | |||||
}).catch(()=> { | |||||
wx.hideLoading() | |||||
}) | }) | ||||
}).catch(()=> { | |||||
wx.hideLoading() | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
} | } | ||||
}) | }) |
.attention_container{ | .attention_container{ | ||||
position: relative; | position: relative; | ||||
width: 100%; | width: 100%; | ||||
background-color: RGBA(224, 235, 255, 1); | |||||
} | } | ||||
.main{ | .main{ | ||||
width: 100%; | width: 100%; | ||||
height: 2640rpx; | |||||
height: 1940rpx; | |||||
padding-bottom: 40rpx; | |||||
} | } | ||||
.button{ | .button{ | ||||
width: calc(100% - 60rpx); | width: calc(100% - 60rpx); | ||||
text-align: center; | text-align: center; | ||||
line-height: 95rpx; | line-height: 95rpx; | ||||
position: fixed; | position: fixed; | ||||
bottom: 55rpx; | |||||
bottom: 30rpx; | |||||
left: 30rpx; | left: 30rpx; | ||||
} | } |
params: { | params: { | ||||
openid: null | openid: null | ||||
}, | }, | ||||
userPage:{ | |||||
page:1, | |||||
limit:10 | |||||
}, | |||||
current: '' | current: '' | ||||
}, | }, | ||||
* 页面上拉触底事件的处理函数 | * 页面上拉触底事件的处理函数 | ||||
*/ | */ | ||||
onReachBottom() { | onReachBottom() { | ||||
if(this.data.userPage.page*this.data.userPage.limit<this.data.total){ | |||||
this.data.userPage.page++ | |||||
this.setData({ | |||||
userPage:this.data.userPage | |||||
}) | |||||
this.westreamVideo() | |||||
} | |||||
}, | }, | ||||
/** | /** | ||||
...this.data.userPage | ...this.data.userPage | ||||
} | } | ||||
api_westreamVideo(data).then(res=>{ | api_westreamVideo(data).then(res=>{ | ||||
let list = [...this.data.list,...res.data.records] | |||||
let list = [] | |||||
if(this.data.userPage.page==1){ | |||||
list = res.data.records | |||||
}else{ | |||||
list = [...this.data.list,...res.data.records] | |||||
} | |||||
let total = res.data.total | let total = res.data.total | ||||
this.setData({ | this.setData({ | ||||
total, | total, |
background-color: #1BE9BC; | background-color: #1BE9BC; | ||||
} | } | ||||
.bottom{ | .bottom{ | ||||
width: 100%; | |||||
font-size: 26rpx; | font-size: 26rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #C5C5C5; | color: #C5C5C5; | ||||
line-height: 36rpx; | line-height: 36rpx; | ||||
text-align: center; | text-align: center; | ||||
margin-top: 27rpx; | |||||
padding-top: 27rpx; | |||||
background: #F2F6F9; | |||||
} | } |
const entersList = this.data.entersList | const entersList = this.data.entersList | ||||
const {tenantId} = wx.getStorageSync('tenant') | const {tenantId} = wx.getStorageSync('tenant') | ||||
const openid = wx.getStorageSync('openid') | const openid = wx.getStorageSync('openid') | ||||
if(tenantId === null){ | |||||
if(tenantId !== 5){ | |||||
entersList[0].isShow = false | entersList[0].isShow = false | ||||
this.setData({ entersList }) | this.setData({ entersList }) | ||||
}else{ | }else{ |
// package_first/pages/ProtectionSuggestion/ProtectionSuggestion.js | |||||
// import { PostProcess } from 'XrFrame/xrFrameSystem'; | |||||
import { api_westreamSuggest, | import { api_westreamSuggest, | ||||
api_getUserInfo | api_getUserInfo | ||||
} from '../../../api/suggestion'; | } from '../../../api/suggestion'; | ||||
form : { | form : { | ||||
content:'' | content:'' | ||||
}, | }, | ||||
tobegin:true, | |||||
dialogShow:false, | dialogShow:false, | ||||
userInfo:{}, | userInfo:{}, | ||||
formRules: { | formRules: { | ||||
icon:'none' | icon:'none' | ||||
}) | }) | ||||
}else{ | }else{ | ||||
if(!this.data.tobegin){ | |||||
return | |||||
} | |||||
this.data.tobegin = false | |||||
setTimeout(()=>{ | |||||
this.data.tobegin = true | |||||
this.setData({ | |||||
tobegin:this.data.tobegin | |||||
}) | |||||
},2000) | |||||
let data = { | let data = { | ||||
tenantId:tenantObj.tenantId, | tenantId:tenantObj.tenantId, | ||||
openid : openid, | openid : openid, | ||||
} | } | ||||
api_westreamSuggest(data).then(res=>{ | api_westreamSuggest(data).then(res=>{ | ||||
// let dialogShow = true | // let dialogShow = true | ||||
// this.setData({ | |||||
// dialogShow, | |||||
// }) | |||||
this.setData({ | |||||
tobegin:this.data.tobegin | |||||
}) | |||||
wx.showToast({ | wx.showToast({ | ||||
title: '提交成功', | |||||
title: '您的宝贵意见已提交', | |||||
icon:'none' | icon:'none' | ||||
}) | }) | ||||
setTimeout(()=>{ | setTimeout(()=>{ | ||||
wx.switchTab({ | wx.switchTab({ | ||||
url: '/pages/FirstPage/index', | url: '/pages/FirstPage/index', | ||||
}) | }) | ||||
},1000) | |||||
},2000) | |||||
}) | }) | ||||
} | } | ||||
} | } |
<view class="bottom"> | <view class="bottom"> | ||||
<view class="suggestion">护河建议</view> | <view class="suggestion">护河建议</view> | ||||
<view class="suggestion_text"> | <view class="suggestion_text"> | ||||
<textarea class="text_content" maxlength="150" bindinput="remarkInputAction" placeholder="请留下您的宝贵意见。" auto-focus="true" value="{{form.content}}" /> | |||||
<textarea class="text_content" maxlength="200" bindinput="remarkInputAction" placeholder="请留下您的宝贵意见。" auto-focus="true" value="{{form.content}}" /> | |||||
</view> | </view> | ||||
<view class="button" bindtap="submit"> | <view class="button" bindtap="submit"> | ||||
提交 | 提交 |
// package_first/pages/volunteerActivity/index.js | // package_first/pages/volunteerActivity/index.js | ||||
import {api_westreamActivity,activitySubmit,} from '../../../api/volunteer'; | |||||
import {api_westreamActivity,activitySubmit,api_getApply} from '../../../api/volunteer'; | |||||
Page({ | Page({ | ||||
/** | /** | ||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
activityId: null, | |||||
list:[], | list:[], | ||||
activityId:'', | |||||
nickname:'', | nickname:'', | ||||
activityTitle:'', | activityTitle:'', | ||||
applyName:'', | applyName:'', | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad(options) { | onLoad(options) { | ||||
const activityId = options.id | |||||
this.setData({ | |||||
activityId | |||||
}) | |||||
console.log(options); | |||||
}, | }, | ||||
/** | /** | ||||
* 页面上拉触底事件的处理函数 | * 页面上拉触底事件的处理函数 | ||||
*/ | */ | ||||
onReachBottom() { | onReachBottom() { | ||||
if(this.data.userPage.page*this.data.userPage.limit<this.data.total){ | |||||
this.data.userPage.page++ | |||||
this.setData({ | |||||
userPage:this.data.userPage | |||||
}) | |||||
this.westreamActivity() | |||||
} | |||||
}, | }, | ||||
/** | /** | ||||
} | } | ||||
api_westreamActivity(data).then(res=>{ | api_westreamActivity(data).then(res=>{ | ||||
let list =[] | let list =[] | ||||
if(this.data.userPage.page==1){ | |||||
list =res.data.records | |||||
}else{ | |||||
list = [...this.data.list,...res.data.records] | |||||
} | |||||
let total = res.data.total | |||||
list = list.reduce((pre,item)=>{ | |||||
res.data.records = res.data.records.reduce((pre,item)=>{ | |||||
return [...pre,{ | return [...pre,{ | ||||
...item, | ...item, | ||||
activityBeginTime:this.formatDate(item.activityBeginTime), | activityBeginTime:this.formatDate(item.activityBeginTime), | ||||
activityEndTime:this.formatDate(item.activityEndTime) | activityEndTime:this.formatDate(item.activityEndTime) | ||||
}] | }] | ||||
},[]) | },[]) | ||||
if(this.data.userPage.page==1){ | |||||
list =res.data.records | |||||
}else{ | |||||
list = [...this.data.list,...res.data.records] | |||||
} | |||||
let total = res.data.total | |||||
this.setData({ | this.setData({ | ||||
total, | total, | ||||
list, | list, | ||||
}), | }), | ||||
console.log(res); | console.log(res); | ||||
}) | }) | ||||
}, | }, | ||||
url: '/package_first/pages/VolunteerDetail/index?data='+ encodeURIComponent(data), | url: '/package_first/pages/VolunteerDetail/index?data='+ encodeURIComponent(data), | ||||
}) | }) | ||||
}, | }, | ||||
go_applypage(){ | |||||
wx.navigateTo({ | |||||
url: '/package_first/pages/ActivityApply/index', | |||||
}) | |||||
} | |||||
}) | }) |
</view> | </view> | ||||
</view> | </view> | ||||
<view class="activity_bottom"> | <view class="activity_bottom"> | ||||
<view> | |||||
<view class="apply" wx:if="{{item.status==2}}" bindtap="go_applypage">立即报名</view> | |||||
<view class="apply" wx:if="{{item.status==2}}" data-item="{{item}}" bindtap="showDetail">立即报名</view> | |||||
<view class="join" bindtap="showDetail" data-item="{{item}}">进入活动 》</view> | <view class="join" bindtap="showDetail" data-item="{{item}}">进入活动 》</view> | ||||
</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="bottom">- 更多视频 敬请期待 -</view> | |||||
<view class="bottom">- 更多活动 敬请期待 -</view> | |||||
</view> | </view> | ||||
</view> | </view> |
/* package_first/pages/volunteerActivity/index.wxss */ | /* package_first/pages/volunteerActivity/index.wxss */ | ||||
.volunteerActivity_container{ | .volunteerActivity_container{ | ||||
width: 100%; | width: 100%; | ||||
height: 100vh; | |||||
height: 100%; | |||||
background: #F2F6F9; | background: #F2F6F9; | ||||
padding: 30rpx; | padding: 30rpx; | ||||
} | } | ||||
width: calc(100%-60rpx); | width: calc(100%-60rpx); | ||||
background-color:#FFFFFF ; | background-color:#FFFFFF ; | ||||
margin-bottom: 19rpx; | margin-bottom: 19rpx; | ||||
padding-bottom: 19rpx; | |||||
border-radius: 10rpx; | |||||
padding-bottom: 41rpx; | |||||
} | } | ||||
.activity_image{ | .activity_image{ | ||||
width: 100%; | width: 100%; | ||||
height: 277rpx; | height: 277rpx; | ||||
border-radius: 10rpx; | |||||
border-top-right-radius: 10rpx; | |||||
border-top-left-radius: 10rpx; | |||||
} | } | ||||
.activity{ | .activity{ | ||||
display: flex; | display: flex; | ||||
flex-wrap: wrap; | flex-wrap: wrap; | ||||
justify-content: space-between; | |||||
} | } | ||||
.activity_name{ | .activity_name{ | ||||
width: 300rpx; | |||||
font-size: 34rpx; | font-size: 34rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #000000; | color: #000000; | ||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
} | } | ||||
.part_middle{ | .part_middle{ | ||||
margin: 31rpx 31rpx 22rpx 27rpx; | margin: 31rpx 31rpx 22rpx 27rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #FFFFFF; | color: #FFFFFF; | ||||
line-height: 36rpx; | |||||
line-height: 42rpx; | |||||
text-align: center; | text-align: center; | ||||
margin-left: 39rpx; | margin-left: 39rpx; | ||||
align-items: center; | |||||
} | } | ||||
.is_apply{ | .is_apply{ | ||||
background: #006DF7; | background: #006DF7; | ||||
border-radius: 10px; | border-radius: 10px; | ||||
} | } | ||||
.activity_bottom{ | .activity_bottom{ | ||||
position: relative; | |||||
padding: 0 30rpx 35rpx 33rpx; | |||||
padding: 22rpx 30rpx 35rpx 33rpx; | |||||
} | } | ||||
.join{ | .join{ | ||||
position: absolute; | |||||
top: 0; | |||||
right: 0; | |||||
display: block; | |||||
float: right; | |||||
font-size: 32rpx; | font-size: 32rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #3275E9; | color: #3275E9; | ||||
line-height: 36rpx; | line-height: 36rpx; | ||||
padding-bottom: 41rpx; | |||||
} | } | ||||
.apply{ | .apply{ | ||||
display: block; | |||||
float: left; | |||||
width: 125rpx; | width: 125rpx; | ||||
height: 42rpx; | height: 42rpx; | ||||
background: #006DF7; | background: #006DF7; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #FFFFFF; | color: #FFFFFF; | ||||
line-height: 36rpx; | |||||
line-height: 42rpx; | |||||
text-align: center; | text-align: center; | ||||
} | } | ||||
.bottom{ | .bottom{ |
// package_first/pages/VolunteerDetail/index.js | // package_first/pages/VolunteerDetail/index.js | ||||
import {api_westreamActivity,activitySubmit} from '../../../api/volunteer'; | |||||
import {api_westreamActivity,activitySubmit,api_getApply} from '../../../api/volunteer'; | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
status:false, | status:false, | ||||
activityInfo:{}, | activityInfo:{}, | ||||
dataSource: {}, | |||||
list:[], | list:[], | ||||
userPage:{ | userPage:{ | ||||
page:1, | page:1, | ||||
this.setData({ | this.setData({ | ||||
activityInfo:data | activityInfo:data | ||||
}) | }) | ||||
let imgs=data.intro.match(/<img.*?src="(.*)".*?\/>/g); | |||||
if(!imgs){ | |||||
this.setData({'dataSource.content': data.intro}) | |||||
} else { | |||||
for(let img of imgs){ | |||||
let temp | |||||
temp=img.replace(/(width=".*?"|height=".*?")/g,""); | |||||
if(/style="(.*?)"/.test(temp)){ | |||||
temp=temp.replace(RegExp.$1,RegExp.$1+"width:100% !important;height:auto;display:block") | |||||
}else{ | |||||
temp=temp.replace(/<img/,"<img style='width:100% !important;height:auto;display:block'") | |||||
} | |||||
data.intro=data.intro.replace(img,temp) | |||||
} | |||||
this.setData({'dataSource.content': data.intro}) | |||||
} | |||||
this.getApplyStatus() | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow() { | onShow() { | ||||
this.activitySubmit() | |||||
// this.activitySubmit() | |||||
this.getApplyStatus() | |||||
}, | }, | ||||
/** | /** | ||||
onReachBottom() { | onReachBottom() { | ||||
}, | }, | ||||
getApplyStatus(){ | |||||
const openid = wx.getStorageSync('openid') | |||||
const params = { | |||||
openid, | |||||
activityId: this.data.activityInfo.id, | |||||
} | |||||
api_getApply(params).then(res=>{ | |||||
if(res.code==0){ | |||||
let status = res.data?.status || 3 | |||||
this.setData({ | |||||
status | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
activitySubmit(){ | activitySubmit(){ | ||||
let tenantObj = wx.getStorageSync('tenant') | let tenantObj = wx.getStorageSync('tenant') | ||||
return `${year}年${month}月${day}日`; | return `${year}年${month}月${day}日`; | ||||
}, | }, | ||||
goApply(e){ | goApply(e){ | ||||
if(this.data.status){ | |||||
if(this.data.status === 1){ | |||||
wx.showToast({ | |||||
title: '您已参加该活动', | |||||
icon:"none" | |||||
}) | |||||
return | return | ||||
} | } | ||||
// if(status == 2){ | |||||
// console.log(this.data.status); | |||||
// wx.navigateTo({ | |||||
// url:"/package_first/pages/ActivityApply/index" | |||||
// }) | |||||
// }else{ | |||||
// wx.showToast({ | |||||
// title: '不在报名时间', | |||||
// icon:'none' | |||||
// }) | |||||
// } | |||||
wx.navigateTo({ | |||||
url:"/package_first/pages/ActivityApply/index?id=" + this.data.activityInfo.id | |||||
if(this.data.status === 3){ | |||||
let activityInfo = JSON.stringify(this.data.activityInfo) | |||||
wx.navigateTo({ | |||||
url:"/package_first/pages/ActivityApply/index?activityInfo=" + encodeURIComponent(activityInfo) | |||||
}) | }) | ||||
} | |||||
}, | }, | ||||
/** | /** | ||||
* 用户点击右上角分享 | * 用户点击右上角分享 | ||||
*/ | */ | ||||
onShareAppMessage() { | onShareAppMessage() { | ||||
} | } | ||||
}) | }) |
<!--package_first/pages/VolunteerDetail/index.wxml--> | <!--package_first/pages/VolunteerDetail/index.wxml--> | ||||
<view class="VolunteerDetail_container"> | <view class="VolunteerDetail_container"> | ||||
<view class="main"> | <view class="main"> | ||||
<view class="content"> | |||||
{{activityInfo.intro}} | |||||
</view> | |||||
<rich-text class="content" type="node" style="width:100%; white-space: pre-wrap;word-break: break-all;" nodes="{{dataSource.content}}"></rich-text> | |||||
<view > | <view > | ||||
<image class="Volunteer_image" src="{{activityInfo.imageUrl}}" mode=""/> | |||||
<!-- <image class="Volunteer_image" src="{{activityInfo.imageUrl}}" mode=""/> --> | |||||
</view> | </view> | ||||
<view class="apply_time"> | <view class="apply_time"> | ||||
<view class="apply">报名时间:</view> | <view class="apply">报名时间:</view> | ||||
<view class="time_act">{{activityInfo.activityBeginTime}}~{{activityInfo.activityEndTime}}</view> | <view class="time_act">{{activityInfo.activityBeginTime}}~{{activityInfo.activityEndTime}}</view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="button" bindtap="goApply"> | |||||
{{status==3?'已报名':'报名'}} | |||||
<view wx:if="{{activityInfo.status==2}}" class="button" bindtap="goApply"> | |||||
{{status === 2 ?'已报名':'立即报名'}} | |||||
</view> | </view> | ||||
</view> | </view> |
} | } | ||||
.main{ | .main{ | ||||
width: 100%; | width: 100%; | ||||
height: calc(100vh - 170rpx); | |||||
overflow: hidden; | |||||
overflow-y: scroll; | |||||
background: #FFFFFF; | background: #FFFFFF; | ||||
box-shadow: 0rpx 0rpx 14rpx 2rpx rgba(43,93,184,0.09); | box-shadow: 0rpx 0rpx 14rpx 2rpx rgba(43,93,184,0.09); | ||||
border-radius: 20rpx; | border-radius: 20rpx; | ||||
.time_act{ | .time_act{ | ||||
width: 645rpx; | width: 645rpx; | ||||
height: 66rpx; | height: 66rpx; | ||||
background: rgba(50, 117, 233, 0.2); | |||||
background: rgba(16, 177, 255, 0.2); | |||||
color: rgba(16, 177, 255, 1); | |||||
border-radius: 4rpx; | border-radius: 4rpx; | ||||
font-size: 30rpx; | font-size: 30rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: #3275E9; | |||||
text-align: center; | text-align: center; | ||||
line-height:66rpx; | line-height:66rpx; | ||||
} | } | ||||
.time{ | .time{ | ||||
width: 645rpx; | width: 645rpx; | ||||
height: 66rpx; | height: 66rpx; | ||||
background: rgba(16, 177, 255, 0.2); | |||||
border-radius: 4rpx; | border-radius: 4rpx; | ||||
font-size: 30rpx; | font-size: 30rpx; | ||||
font-family: Source Han Sans CN; | font-family: Source Han Sans CN; | ||||
font-weight: 400; | font-weight: 400; | ||||
color: rgba(16, 177, 255, 1); | |||||
background: rgba(50, 117, 233, 0.2); | |||||
color: #3275E9; | |||||
text-align: center; | text-align: center; | ||||
line-height:66rpx; | line-height:66rpx; | ||||
} | } |
videoProgress: 0, | videoProgress: 0, | ||||
openid: null, | openid: null, | ||||
initialTime: 0, | initialTime: 0, | ||||
control:false, | |||||
statusList:{ | statusList:{ | ||||
0: '待学习', | 0: '待学习', | ||||
1: '学习中', | |||||
// 1: '学习中', | |||||
2: '已学习', | 2: '已学习', | ||||
}, | }, | ||||
classList:{ | classList:{ | ||||
0: 'no--sutdy', | |||||
1: 'is--sutdy', | |||||
0: 'no--study', | |||||
// 1: 'is--study', | |||||
2: 'is--finish', | 2: 'is--finish', | ||||
}, | }, | ||||
detail: {} | detail: {} | ||||
}, | }, | ||||
onLoad(options){ | onLoad(options){ | ||||
let data = JSON.parse(decodeURIComponent(options.data)) | let data = JSON.parse(decodeURIComponent(options.data)) | ||||
data.status = data.status === 0 ? 0 : data.status | |||||
const openid = wx.getStorageSync('openid') | const openid = wx.getStorageSync('openid') | ||||
this.setData({ | this.setData({ | ||||
detail:data, | detail:data, | ||||
openid | |||||
openid, | |||||
control : data.status === 2 ? true : false, | |||||
}) | }) | ||||
this.getProgress() | |||||
}, | |||||
onHide(){ | |||||
this.handleEnded(this.data.detail.status) | |||||
}, | |||||
onUnload(){ | |||||
this.handleEnded(this.data.detail.status) | |||||
}, | }, | ||||
saveTime(e){ | saveTime(e){ | ||||
let time = e.detail.currentTime | let time = e.detail.currentTime | ||||
this.setData({ | this.setData({ | ||||
} | } | ||||
getVideoProgress(data).then(res=>{ | getVideoProgress(data).then(res=>{ | ||||
this.setData({ | this.setData({ | ||||
initialTime:res.data.videoProgress | |||||
initialTime:res.data.videoProgress, | |||||
}) | }) | ||||
}) | }) | ||||
}, | }, | ||||
handleEnded(status){ | |||||
handleEnded(){ | |||||
if(this.data.control){ | |||||
return | |||||
} | |||||
const isNumber = typeof(status) === 'number' | |||||
const params = { | const params = { | ||||
status: status === 1 ? 1 : 2, | |||||
status: 2, | |||||
videoId: this.data.detail.id, | videoId: this.data.detail.id, | ||||
openid: this.data.openid, | openid: this.data.openid, | ||||
videoProgress: typeof(status) === 'number' ? this.data.videoProgress : 0 | |||||
videoProgress: isNumber ? this.data.videoProgress : 0 | |||||
} | } | ||||
updateProgress(params) | updateProgress(params) | ||||
.then(res=>{ | .then(res=>{ | ||||
let initialTime = null | let initialTime = null | ||||
if(res.code == 0){ | |||||
if(res.code == 0){ | |||||
initialTime = res.data==null?0:res.data | initialTime = res.data==null?0:res.data | ||||
} | } | ||||
this.setData({ | this.setData({ | ||||
'detail.status': status === 1 ? 1 : 2, | |||||
'detail.status': params.status, | |||||
control : true | |||||
}) | }) | ||||
}) | }) | ||||
} | } |
.video__header{ | .video__header{ | ||||
width: 100%; | width: 100%; | ||||
} | } |