Browse Source

Merge branch 'zhangtao' of gitadmin/tuoheng_qmhh_web into develop

xieying
gitadmin 1 year ago
parent
commit
c924ae0e46
22 changed files with 429 additions and 172 deletions
  1. +7
    -0
      api/volunteer.js
  2. +33
    -5
      package_first/pages/ActivityApply/index.js
  3. +80
    -56
      package_first/pages/AddPicture/index.js
  4. +16
    -2
      package_first/pages/AddPicture/index.wxml
  5. +76
    -2
      package_first/pages/AddPicture/index.wxss
  6. +27
    -3
      package_first/pages/AttentionMethod/index.js
  7. +4
    -2
      package_first/pages/AttentionMethod/index.wxss
  8. +23
    -7
      package_first/pages/LearningVideo/index.js
  9. +3
    -3
      package_first/pages/LearningVideo/index.wxml
  10. +4
    -1
      package_first/pages/LearningVideo/index.wxss
  11. +15
    -4
      package_first/pages/ProtectionActivity/index.js
  12. +17
    -7
      package_first/pages/ProtectionSuggestion/index.js
  13. +1
    -1
      package_first/pages/ProtectionSuggestion/index.wxml
  14. +21
    -18
      package_first/pages/VolunteerActivity/index.js
  15. +2
    -4
      package_first/pages/VolunteerActivity/index.wxml
  16. +21
    -10
      package_first/pages/VolunteerActivity/index.wxss
  17. +47
    -18
      package_first/pages/VolunteerDetail/index.js
  18. +4
    -6
      package_first/pages/VolunteerDetail/index.wxml
  19. +7
    -4
      package_first/pages/VolunteerDetail/index.wxss
  20. +19
    -17
      package_first/pages/videoDetail/index.js
  21. +1
    -1
      package_first/pages/videoDetail/index.wxml
  22. +1
    -1
      package_first/pages/videoDetail/index.wxss

+ 7
- 0
api/volunteer.js View File

method: 'GET', method: 'GET',
data data
}) })
}
export const api_getApply = function (data) {
return request({
url: '/westreamActivityApply/getApply',
method: 'GET',
data
})
} }

+ 33
- 5
package_first/pages/ActivityApply/index.js View File

*/ */
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
}) })
}, },



+ 80
- 56
package_first/pages/AddPicture/index.js View File

* 页面的初始数据 * 页面的初始数据
*/ */
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()
})
}
}
})
} }
}) })

+ 16
- 2
package_first/pages/AddPicture/index.wxml View File

<view> <view>
<view class="add_container"> <view class="add_container">
<view class="title">上传图片</view> <view class="title">上传图片</view>
<view class="upload_image" bindtap="uploadImage">
<!-- <view class="upload_image" bindtap="uploadImage">
<view class="add_imageList" wx:for="{{imageList}}" wx:key="index"> <view class="add_imageList" wx:for="{{imageList}}" wx:key="index">
<image style="width:100%;" mode="widthFix" src="{{item}}"></image> <image style="width:100%;" mode="widthFix" src="{{item}}"></image>
<div class="close" data-current="{{index}}" catchtap="deleteImage"></div> <div class="close" data-current="{{index}}" catchtap="deleteImage"></div>
</view> </view>
<view wx:if="{{imageList.length<5}}" class="upload_part"> <view wx:if="{{imageList.length<5}}" class="upload_part">
<image style="height: 70rpx;width:70rpx;" mode="widthFix" src="../../../assets/img/upload.png"></image>
<image class="upload_img" style="height: 70rpx;width:70rpx;" mode="widthFix" src="../../../assets/img/upload.png"></image>
<view class="upload_text">上传图片</view>
</view>
</view> -->
<view class="upload_images {{formRules.imageList.warning? 'warning': ''}}">
<view class="image_list">
<view class="image_preview" wx:for="{{imagePreviewList}}" wx:key="index">
<image class="image_item" src="{{item}}" mode="aspectFill" data-item="{{item}}">
</image>
<div class="close" data-current="{{index}}" catchtap="deleteImage"></div>
</view>
<view class="upload_image" bindtap="uploadImage" wx:if="{{imageList.length<5}}">
<image style="height: 56rpx;width: 56rpx; padding-top: 80rpx;" mode="widthFix" src="../../../assets/img/upload.png"></image>
<view class="upload_text">上传图片</view> <view class="upload_text">上传图片</view>
</view> </view>
</view> </view>
<text class="tips">请先上传图片</text>
</view>
<view class="button" bindtap="submit"> <view class="button" bindtap="submit">
提交 提交
</view> </view>

+ 76
- 2
package_first/pages/AddPicture/index.wxss View File

} }
.close{ .close{
position: absolute; position: absolute;
top:180rpx;
right:65rpx;
top:0;
right:0;
transform: translate(40%,-40%); transform: translate(40%,-40%);
height:50rpx; height:50rpx;
width:50rpx; width:50rpx;
border-radius: 50%; border-radius: 50%;
z-index: 10; z-index: 10;
} }
.close::before{
content: "";
display: block;
position: absolute;
width: 60%;
height: 6rpx;
top:50%;
left:50%;
background:rgb(124, 124, 124);
transform-origin: center;
/* transform: ; */
transform: translate(-50%,-50%) rotate(45deg);
}
.close::after{
content: "";
display: block;
position: absolute;
width: 60%;
height: 6rpx;
top:50%;
left:50%;
background:rgb(124, 124, 124);
transform-origin: center;
/* transform: ; */
transform: translate(-50%,-50%) rotate(-45deg);
}
.upload_part { .upload_part {
padding-top: 70rpx; padding-top: 70rpx;
width: 100%;
height: 180rpx;
} }


.upload_text{ .upload_text{


.add_imageList { .add_imageList {
width: 100%; width: 100%;
}
.tips{
position: absolute;
bottom: 150rpx;
left: 0rpx;
color: red;
font-size: 24rpx;
transform: translate(27rpx, -5rpx);
display: none;
}
.form_item.warning .tips, .use_purpose.warning .tips, .upload_images.warning .tips{
display: block;
}
.image_item {
height:100%;
width: 100%;
margin-right: 30rpx;
margin-bottom: 20rpx;
}
.image_preview {
height: 250rpx;
width: 100%;
margin-right: 30rpx;
margin-bottom: 20rpx;
position: relative;
}
.image_list {
width: 100%;
margin-top: 20rpx;
padding: 20rpx 0;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
}
/* 上传图片 */
.upload_images {
width: 100%;
margin-bottom: 30rpx;
padding: 0 30rpx;
display: flex;
justify-content: space-between;
align-items: flex-start;
font-size: 28rpx;
color: #666666;
position: relative;
} }

+ 27
- 3
package_first/pages/AttentionMethod/index.js View File

// package_first/pages/AttentionMethod/index.js // package_first/pages/AttentionMethod/index.js
import {
api_getIsApply
} from '../../../api/attention.js';
Page({ Page({


/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
status:null
}, },


/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {

// let status = options.status
// this.setData({
// status
// })
// console.log(status);
}, },


/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.getIsApply()
}, },


/** /**
*/ */
onShareAppMessage() { onShareAppMessage() {


},
getIsApply(){
const {tenantId} = wx.getStorageSync('tenant')
const openid = wx.getStorageSync('openid')
const data = { openid }
api_getIsApply(data).then(res=>{
console.log(res);
this.data.status = res.data
})
}, },
goPage(e){ goPage(e){
if(this.data.status == 1 ){
wx.showToast({
title: '您已参加该活动',
icon:"none"
})
return
}
wx.navigateTo({ wx.navigateTo({
url: `/package_first/pages/AddPicture/index`, url: `/package_first/pages/AddPicture/index`,
}) })

+ 4
- 2
package_first/pages/AttentionMethod/index.wxss View File

.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;
} }

+ 23
- 7
package_first/pages/LearningVideo/index.js View File

params: { params: {
openid: null openid: null
}, },
userPage:{
page:1,
limit:10
},
total:0,
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,
list, list,
}) })
if(list.status == 0){
data.entersList[0].isstudy = true
}else if(list.status == 1){
data.entersList[1].isstudy = true
}
// if(list.status == 0){
// data.entersList[0].isstudy = true
// }else if(list.status == 1){
// data.entersList[1].isstudy = true
// }
}) })
}, },
handleDetail(e){ handleDetail(e){

+ 3
- 3
package_first/pages/LearningVideo/index.wxml View File

<view class="cotent"> <view class="cotent">
<view class="title"> <view class="title">
<view class="title_text">{{item.videoTitle}}</view> <view class="title_text">{{item.videoTitle}}</view>
<view class="{{item.status==1?'item__tag sutdying':item.status==0?'item__tag no--sutdy':'item__tag is--sutdy'}}">
{{item.status==1?'学习中':item.status==0?'待学习':'已学习'}}
<view class="{{item.status==2?'item__tag is--sutdy':'item__tag no--sutdy'}}">
{{item.status==2?'已学习':'待学习'}}
</view> </view>
</view> </view>
<view class="title_content">{{item.videoBrief}}</view> <view class="title_content">{{item.videoBrief}}</view>
</view> </view>
</view> </view>
<view class="bottom">- 更多视频 敬请期待 -</view>
</list> </list>
<view class="bottom">- 更多视频 敬请期待 -</view>
</view> </view>

+ 4
- 1
package_first/pages/LearningVideo/index.wxss View File

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;
} }

+ 15
- 4
package_first/pages/ProtectionActivity/index.js View File

* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
tikStatus:null,
entersList:[ entersList:[
{ {
title:'关注抖音', title:'关注抖音',
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{
const data = { openid } const data = { openid }
api_getIsApply(data).then(res=>{ api_getIsApply(data).then(res=>{
entersList[0].isJoin = !!res.data
this.setData({ entersList })
let tikStatus = res.data
entersList[0].isJoin = res.data == 2 ? true:false
this.setData({ entersList,tikStatus })
}) })
} }


}, },
goPage(e){ goPage(e){
const { path } = e.currentTarget.dataset const { path } = e.currentTarget.dataset
// if(path=='/package_first/pages/AttentionMethod/index'){
// wx.navigateTo({
// url: '/package_first/pages/AttentionMethod/index?status='+this.data.tikStatus
// })
// }else{
// wx.navigateTo({
// url: path
// })
// }
wx.navigateTo({ wx.navigateTo({
url: path
url: path
}) })
}, },
homepage(e){ homepage(e){

+ 17
- 7
package_first/pages/ProtectionSuggestion/index.js View File

// 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)
}) })
} }
} }

+ 1
- 1
package_first/pages/ProtectionSuggestion/index.wxml View File

<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">
提交 提交

+ 21
- 18
package_first/pages/VolunteerActivity/index.js View File

// 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',
})
}
}) })

+ 2
- 4
package_first/pages/VolunteerActivity/index.wxml View File

</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>

+ 21
- 10
package_first/pages/VolunteerActivity/index.wxss View File

/* 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{

+ 47
- 18
package_first/pages/VolunteerDetail/index.js View File

// 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() {
} }
}) })

+ 4
- 6
package_first/pages/VolunteerDetail/index.wxml View File

<!--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>

+ 7
- 4
package_first/pages/VolunteerDetail/index.wxss View File

} }
.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;
} }

+ 19
- 17
package_first/pages/videoDetail/index.js View File

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
}) })
}) })
} }

+ 1
- 1
package_first/pages/videoDetail/index.wxml View File

autoplay="{{false}}" autoplay="{{false}}"
muted="{{true}}" muted="{{true}}"
initial-time="{{ initialTime }}" initial-time="{{ initialTime }}"
show-progress="{{false}}"
show-progress="{{ control }}"
show-mute-btn="{{true}}" show-mute-btn="{{true}}"
enable-progress-gesture="{{false}}" enable-progress-gesture="{{false}}"
bindtimeupdate="saveTime" bindtimeupdate="saveTime"

+ 1
- 1
package_first/pages/videoDetail/index.wxss View File

border-radius: 4rpx; border-radius: 4rpx;
} }


.no--sutdy{
.no--study{
background: #EBAC14; background: #EBAC14;
} }



Loading…
Cancel
Save