Browse Source

deal

zhangtao
zhangtao 1 year ago
parent
commit
7c81e1dfe1
17 changed files with 284 additions and 153 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. +4
    -2
      package_first/pages/AttentionMethod/index.wxss
  5. +17
    -2
      package_first/pages/LearningVideo/index.js
  6. +3
    -1
      package_first/pages/LearningVideo/index.wxss
  7. +1
    -1
      package_first/pages/ProtectionActivity/index.js
  8. +17
    -7
      package_first/pages/ProtectionSuggestion/index.js
  9. +1
    -1
      package_first/pages/ProtectionSuggestion/index.wxml
  10. +21
    -18
      package_first/pages/VolunteerActivity/index.js
  11. +2
    -4
      package_first/pages/VolunteerActivity/index.wxml
  12. +21
    -10
      package_first/pages/VolunteerActivity/index.wxss
  13. +47
    -18
      package_first/pages/VolunteerDetail/index.js
  14. +4
    -6
      package_first/pages/VolunteerDetail/index.wxml
  15. +7
    -4
      package_first/pages/VolunteerDetail/index.wxss
  16. +19
    -17
      package_first/pages/videoDetail/index.js
  17. +0
    -1
      package_first/pages/videoDetail/index.wxss

+ 7
- 0
api/volunteer.js View File

@@ -20,4 +20,11 @@ export const activityGetApply = function (data) {
method: 'GET',
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

@@ -7,6 +7,8 @@ Page({
*/
data: {
activityId: null,
activityInfo:{},
tobegin:true,
userInfo: {
applyName: '',
applyPhone: ''
@@ -17,9 +19,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const activityId = options.id
const activityInfo = JSON.parse(decodeURIComponent(options.activityInfo))
this.setData({
activityId
activityInfo
})
},

@@ -35,9 +37,10 @@ Page({
},

handleSubmit(){
if(this.data.userInfo.applyName=='' || this.data.userInfo.applyPhone==''){
wx.showToast({
title: '请填写完整',
title: '请输入姓名/电话',
icon:'none'
})
return
@@ -50,15 +53,40 @@ Page({
})
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 userInfo = wx.getStorageSync('userInfo')
const params = {
...this.data.userInfo,
openid,
activityId: this.data.activityId
nickname:userInfo.nickname,
activityId: this.data.activityInfo.id,
activityTitle:this.data.activityInfo.activityTitle
}
activitySubmit(params)
.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

@@ -9,8 +9,17 @@ Page({
* 页面的初始数据
*/
data: {
ossForm: {},
imageList:[],
imagePreviewList: [],
formRules: {
imageList: {
validator: function (value) {
return value.length!=0;
},
warning: false
}
}
},

/**
@@ -176,68 +185,83 @@ validateForm() {
},
/* 表单上传 */
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('图片上传失败')
}
},
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()
})
}
}
})
}
})

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

@@ -2,10 +2,12 @@
.attention_container{
position: relative;
width: 100%;
background-color: RGBA(224, 235, 255, 1);
}
.main{
width: 100%;
height: 2640rpx;
height: 1940rpx;
padding-bottom: 40rpx;
}
.button{
width: calc(100% - 60rpx);
@@ -19,6 +21,6 @@
text-align: center;
line-height: 95rpx;
position: fixed;
bottom: 55rpx;
bottom: 30rpx;
left: 30rpx;
}

+ 17
- 2
package_first/pages/LearningVideo/index.js View File

@@ -10,6 +10,10 @@ Page({
params: {
openid: null
},
userPage:{
page:1,
limit:10
},
current: ''
},

@@ -74,7 +78,13 @@ Page({
* 页面上拉触底事件的处理函数
*/
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()
}
},

/**
@@ -92,7 +102,12 @@ Page({
...this.data.userPage
}
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
this.setData({
total,

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

@@ -77,11 +77,13 @@
background-color: #1BE9BC;
}
.bottom{
width: 100%;
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #C5C5C5;
line-height: 36rpx;
text-align: center;
margin-top: 27rpx;
padding-top: 27rpx;
background: #F2F6F9;
}

+ 1
- 1
package_first/pages/ProtectionActivity/index.js View File

@@ -96,7 +96,7 @@ Page({
const entersList = this.data.entersList
const {tenantId} = wx.getStorageSync('tenant')
const openid = wx.getStorageSync('openid')
if(tenantId === null){
if(tenantId !== 5){
entersList[0].isShow = false
this.setData({ entersList })
}else{

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

@@ -1,5 +1,4 @@
// package_first/pages/ProtectionSuggestion/ProtectionSuggestion.js
// import { PostProcess } from 'XrFrame/xrFrameSystem';

import { api_westreamSuggest,
api_getUserInfo
} from '../../../api/suggestion';
@@ -12,6 +11,7 @@ Page({
form : {
content:''
},
tobegin:true,
dialogShow:false,
userInfo:{},
formRules: {
@@ -120,6 +120,16 @@ Page({
icon:'none'
})
}else{
if(!this.data.tobegin){
return
}
this.data.tobegin = false
setTimeout(()=>{
this.data.tobegin = true
this.setData({
tobegin:this.data.tobegin
})
},2000)
let data = {
tenantId:tenantObj.tenantId,
openid : openid,
@@ -128,18 +138,18 @@ Page({
}
api_westreamSuggest(data).then(res=>{
// let dialogShow = true
// this.setData({
// dialogShow,
// })
this.setData({
tobegin:this.data.tobegin
})
wx.showToast({
title: '提交成功',
title: '您的宝贵意见已提交',
icon:'none'
})
setTimeout(()=>{
wx.switchTab({
url: '/pages/FirstPage/index',
})
},1000)
},2000)
})
}
}

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

@@ -10,7 +10,7 @@
<view class="bottom">
<view class="suggestion">护河建议</view>
<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 class="button" bindtap="submit">
提交

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

@@ -1,13 +1,13 @@
// package_first/pages/volunteerActivity/index.js
import {api_westreamActivity,activitySubmit,} from '../../../api/volunteer';
import {api_westreamActivity,activitySubmit,api_getApply} from '../../../api/volunteer';
Page({

/**
* 页面的初始数据
*/
data: {
activityId: null,
list:[],
activityId:'',
nickname:'',
activityTitle:'',
applyName:'',
@@ -23,7 +23,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {

const activityId = options.id
this.setData({
activityId
})
console.log(options);
},

/**
@@ -65,7 +69,13 @@ Page({
* 页面上拉触底事件的处理函数
*/
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()
}
},

/**
@@ -91,26 +101,24 @@ Page({
}
api_westreamActivity(data).then(res=>{
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,{
...item,
activityBeginTime:this.formatDate(item.activityBeginTime),
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({
total,
list,
}),
console.log(res);
})
},

@@ -120,9 +128,4 @@ Page({
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

@@ -18,12 +18,10 @@
</view>
</view>
<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>
</view>
</view>
<view class="bottom">- 更多视频 敬请期待 -</view>
<view class="bottom">- 更多活动 敬请期待 -</view>
</view>
</view>

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

@@ -1,7 +1,7 @@
/* package_first/pages/volunteerActivity/index.wxss */
.volunteerActivity_container{
width: 100%;
height: 100vh;
height: 100%;
background: #F2F6F9;
padding: 30rpx;
}
@@ -9,22 +9,30 @@
width: calc(100%-60rpx);
background-color:#FFFFFF ;
margin-bottom: 19rpx;
padding-bottom: 19rpx;
border-radius: 10rpx;
padding-bottom: 41rpx;
}
.activity_image{
width: 100%;
height: 277rpx;
border-radius: 10rpx;
border-top-right-radius: 10rpx;
border-top-left-radius: 10rpx;

}
.activity{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.activity_name{
width: 300rpx;
font-size: 34rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.part_middle{
margin: 31rpx 31rpx 22rpx 27rpx;
@@ -39,9 +47,10 @@
font-family: Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
line-height: 36rpx;
line-height: 42rpx;
text-align: center;
margin-left: 39rpx;
align-items: center;
}
.is_apply{
background: #006DF7;
@@ -69,21 +78,23 @@
border-radius: 10px;
}
.activity_bottom{
position: relative;
padding: 0 30rpx 35rpx 33rpx;
padding: 22rpx 30rpx 35rpx 33rpx;
}
.join{
position: absolute;
top: 0;
right: 0;
display: block;
float: right;
font-size: 32rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #3275E9;
line-height: 36rpx;
padding-bottom: 41rpx;

}
.apply{
display: block;
float: left;
width: 125rpx;
height: 42rpx;
background: #006DF7;
@@ -92,7 +103,7 @@
font-family: Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
line-height: 36rpx;
line-height: 42rpx;
text-align: center;
}
.bottom{

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

@@ -1,5 +1,5 @@
// package_first/pages/VolunteerDetail/index.js
import {api_westreamActivity,activitySubmit} from '../../../api/volunteer';
import {api_westreamActivity,activitySubmit,api_getApply} from '../../../api/volunteer';

Page({

@@ -9,6 +9,7 @@ Page({
data: {
status:false,
activityInfo:{},
dataSource: {},
list:[],
userPage:{
page:1,
@@ -27,6 +28,23 @@ Page({
this.setData({
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()
},

/**
@@ -40,7 +58,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.activitySubmit()
// this.activitySubmit()
this.getApplyStatus()
},

/**
@@ -70,6 +89,21 @@ Page({
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(){
let tenantObj = wx.getStorageSync('tenant')
@@ -98,29 +132,24 @@ Page({
return `${year}年${month}月${day}日`;
},
goApply(e){

if(this.data.status){
if(this.data.status === 1){
wx.showToast({
title: '您已参加该活动',
icon:"none"
})
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() {
}
})

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

@@ -1,11 +1,9 @@
<!--package_first/pages/VolunteerDetail/index.wxml-->
<view class="VolunteerDetail_container">
<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 >
<image class="Volunteer_image" src="{{activityInfo.imageUrl}}" mode=""/>
<!-- <image class="Volunteer_image" src="{{activityInfo.imageUrl}}" mode=""/> -->
</view>
<view class="apply_time">
<view class="apply">报名时间:</view>
@@ -16,7 +14,7 @@
<view class="time_act">{{activityInfo.activityBeginTime}}~{{activityInfo.activityEndTime}}</view>
</view>
</view>
<view class="button" bindtap="goApply">
{{status==3?'已报名':'报名'}}
<view wx:if="{{activityInfo.status==2}}" class="button" bindtap="goApply">
{{status === 2 ?'已报名':'立即报名'}}
</view>
</view>

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

@@ -7,6 +7,9 @@
}
.main{
width: 100%;
height: calc(100vh - 170rpx);
overflow: hidden;
overflow-y: scroll;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 14rpx 2rpx rgba(43,93,184,0.09);
border-radius: 20rpx;
@@ -36,24 +39,24 @@
.time_act{
width: 645rpx;
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;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #3275E9;
text-align: center;
line-height:66rpx;
}
.time{
width: 645rpx;
height: 66rpx;
background: rgba(16, 177, 255, 0.2);
border-radius: 4rpx;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: rgba(16, 177, 255, 1);
background: rgba(50, 117, 233, 0.2);
color: #3275E9;
text-align: center;
line-height:66rpx;
}

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

@@ -6,33 +6,30 @@ Page({
videoProgress: 0,
openid: null,
initialTime: 0,
control:false,
statusList:{
0: '待学习',
1: '学习中',
// 1: '学习中',
2: '已学习',
},
classList:{
0: 'no--sutdy',
1: 'is--sutdy',
0: 'no--study',
// 1: 'is--study',
2: 'is--finish',
},
detail: {}
},
onLoad(options){
let data = JSON.parse(decodeURIComponent(options.data))
data.status = data.status === 0 ? 0 : data.status
const openid = wx.getStorageSync('openid')
this.setData({
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){
let time = e.detail.currentTime
this.setData({
@@ -46,26 +43,31 @@ Page({
}
getVideoProgress(data).then(res=>{
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 = {
status: status === 1 ? 1 : 2,
status: 2,
videoId: this.data.detail.id,
openid: this.data.openid,
videoProgress: typeof(status) === 'number' ? this.data.videoProgress : 0
videoProgress: isNumber ? this.data.videoProgress : 0
}
updateProgress(params)
.then(res=>{
let initialTime = null
if(res.code == 0){
if(res.code == 0){
initialTime = res.data==null?0:res.data
}
this.setData({
'detail.status': status === 1 ? 1 : 2,
'detail.status': params.status,
control : true
})
})
}

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

@@ -1,4 +1,3 @@

.video__header{
width: 100%;
}

Loading…
Cancel
Save