From 2bcd556961208b80af1cb157633c594faab1eca2 Mon Sep 17 00:00:00 2001 From: liuwh <liuwh@hugeinfo.com.cn> Date: Mon, 24 Feb 2020 00:11:18 +0800 Subject: [PATCH] 小程序代码 --- SunshineLnsMinApp/pages/myTranslate/myTranslate.json | 6 SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml | 26 ++ SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml | 156 ++++++++------- SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss | 111 +++++++++++ SunshineLnsMinApp/app.json | 1 SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js | 97 ++++++--- SunshineLnsMinApp/pages/me/me.js | 6 SunshineLnsMinApp/pages/myTranslate/myTranslate.js | 146 ++++++++++++++ SunshineLnsMinApp/pages/me/me.wxml | 10 + 9 files changed, 453 insertions(+), 106 deletions(-) diff --git a/SunshineLnsMinApp/app.json b/SunshineLnsMinApp/app.json index f91f0a0..68d8872 100644 --- a/SunshineLnsMinApp/app.json +++ b/SunshineLnsMinApp/app.json @@ -58,6 +58,7 @@ "pages/publicSnapshot/publicSnapshot", "pages/scanEvildoing/scanEvildoing", "pages/messageNotification/messageNotification", + "pages/myTranslate/myTranslate", "pages/scanEvildoingInfo/scanEvildoingInfo", "pages/complaintAdvice/complaintAdvice", "pages/videoPreview/videoPreview", diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js index 496552f..1efb2b9 100644 --- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js +++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js @@ -10,17 +10,19 @@ */ data: { loading: false, - peopleInfo: {} + peopleInfo: {}, + signStatus: '', }, /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { var that = this; that.setData({ id: options.id, - flag: options.flag, + signStatus: options.signStatus || '', + flag: options.flag || '', loading: true }); wx.showLoading({ @@ -28,7 +30,7 @@ }) wx.request({ url: app.globalData.url + '/api/activity/find?id=' + options.id, - success: function(res) { + success: function (res) { console.log(res); that.setData({ loading: false @@ -40,42 +42,49 @@ activity: res.data.data }) console.log('传过来', options.flag) + console.log('传过来', options.signStatus) // 处理报名状态 - if (options.flag == 'true') { - //可报名 - console.log('可报名') - if (res.data.data.activityPersonNum < res.data.data.activityPersonQuota) { - if (res.data.data.activityStatus == 1) { - that.setData({ - canApply: true - }) - } - if (res.data.data.activityStatus == 2) { + if (options.signStatus) { + that.setData({ + signStatus: options.signStatus + }) + } else { + if (options.flag == 'true') { + //可报名 + console.log('可报名') + if (res.data.data.activityPersonNum < res.data.data.activityPersonQuota) { + if (res.data.data.activityStatus == 1) { + that.setData({ + canApply: true + }) + } + if (res.data.data.activityStatus == 2) { + that.setData({ + canApply: false, + statusWord: '活动正在进行' + }) + } + if (res.data.data.activityStatus == 3) { + that.setData({ + canApply: false, + statusWord: '活动已结束' + }) + } + } else { that.setData({ canApply: false, - statusWord: '活动正在进行' + statusWord: '报名人数已满' }) } - if (res.data.data.activityStatus == 3) { - that.setData({ - canApply: false, - statusWord: '活动已结束' - }) - } + } else { + //不可报名 + console.log('不可报名') that.setData({ canApply: false, - statusWord: '报名人数已满' + statusWord: '您已报名' }) } - - } else { - //不可报名 - console.log('不可报名') - that.setData({ - canApply: false, - statusWord: '您已报名' - }) } } @@ -84,7 +93,7 @@ }, // 跳转 - linkFunction: function() { + linkFunction: function () { wx.showToast({ title: '抱歉,报名人数已满', icon: 'none', @@ -93,14 +102,14 @@ }, // 呼叫组织方 - makePhoneCall: function(e) { + makePhoneCall: function (e) { var phone = e.currentTarget.dataset['phone']; wx.makePhoneCall({ phoneNumber: phone }) }, - inputChange: function(e) { + inputChange: function (e) { var name = e.currentTarget.dataset.name; this.setData({ peopleInfo: { @@ -110,8 +119,26 @@ }) }, + // 签到 + sign: function () { + // 只允许从相机扫码 + wx.scanCode({ + onlyFromCamera: true, + success(res) { + console.log(res) + } + }) + }, + + // 返回 + goBack: function () { + wx.navigateBack({ + delta: 1 + }); + }, + // 提交报名 - submit: function() { + submit: function () { var peopleInfo = this.data.peopleInfo; var userinfo = wx.getStorageSync("user"); var personId = userinfo.id; @@ -149,7 +176,7 @@ header: { "Content-Type": "application/json" }, - success: function(res) { + success: function (res) { wx.hideLoading(); if (res.data.code == 0) { wx.reLaunch({ diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml index b4aee34..04236e8 100644 --- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml +++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml @@ -1,83 +1,97 @@ <!--pages/fzpxInfo/fzpxInfo.wxml--> <view class="fzpxInfo-bg" wx:if="{{!loading}}"> - <view class="flex1"> - <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500"> - <swiper-item wx:for="{{activity.attList}}" wx:key> - <image src="{{item.imgPath}}" mode="aspectFill"></image> - <!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> --> - </swiper-item> - </swiper> + <view class="flex1"> + <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500"> + <swiper-item wx:for="{{activity.attList}}" wx:key> + <image src="{{item.imgPath}}" mode="aspectFill"></image> + <!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> --> + </swiper-item> + </swiper> - <view class="fzpxInfo-main"> - <view class="fzpxInfo-main-t">{{activity.activityTitle}}</view> - <view class="fzpxInfo-main-group"> - <view class="fzpxInfo-main-group-title">培训时间</view> - <view class="fzpxInfo-main-group-around">{{activity.startTime}}</view> - </view> - <view class="fzpxInfo-main-group"> - <view class="fzpxInfo-main-group-title">报名人数</view> - <view class="fzpxInfo-main-group-around">{{activity.activityPersonNum}}/{{activity.activityPersonQuota}}人</view> - </view> - <view class="fzpxInfo-main-group"> - <view class="fzpxInfo-main-group-title">培训地点</view> - <view class="fzpxInfo-main-group-around">{{activity.activityAddress}}</view> - </view> - <view class="fzpxInfo-main-group"> - <view class="fzpxInfo-main-group-title">组织方</view> - <view style="display: flex; line-height:48rpx;"> - <view class="fzpxInfo-main-group-around">{{activity.host || '无'}}</view> - <text class="cuIcon-dianhua lg text-blue margin-left" data-phone="{{activity.activityPhone}}" bindtap="makePhoneCall"></text> - </view> - </view> - <view class="fzpxInfo-main-group"> - <view class="fzpxInfo-main-group-title">培训对象</view> - <view class="fzpxInfo-main-group-around">{{activity.requirement}}</view> - </view> - <view class="fzpxInfo-main-group" style="display:block;padding: 10rpx 30rpx;"> - <view class="fzpxInfo-main-group-title">培训内容</view> - <view> - <view class="fzpxInfo-main-group-around">{{activity.activityDesc}}</view> - </view> - </view> - </view> + <view class="fzpxInfo-main"> + <view class="fzpxInfo-main-t">{{activity.activityTitle}}</view> + <view class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">培训时间</view> + <view class="fzpxInfo-main-group-around">{{activity.startTime}}</view> + </view> + <view class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">报名人数</view> + <view class="fzpxInfo-main-group-around">{{activity.activityPersonNum}}/{{activity.activityPersonQuota}}人</view> + </view> + <view class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">培训地点</view> + <view class="fzpxInfo-main-group-around">{{activity.activityAddress}}</view> + </view> + <view class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">组织方</view> + <view style="display: flex; line-height:48rpx;"> + <view class="fzpxInfo-main-group-around">{{activity.host || '无'}}</view> + <text class="cuIcon-dianhua lg text-blue margin-left" data-phone="{{activity.activityPhone}}" bindtap="makePhoneCall"></text> + </view> + </view> + <view class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">报名要求</view> + <view class="fzpxInfo-main-group-around">{{activity.requirement}}</view> + </view> + <view class="fzpxInfo-main-group" style="display:block;padding: 10rpx 30rpx;"> + <view class="fzpxInfo-main-group-title">培训内容</view> + <view> + <view class="fzpxInfo-main-group-around">{{activity.activityDesc}}</view> + </view> + </view> + </view> - <block wx:if="{{activity.activityStatus == 1 && flag == 'true'}}"> - <view class="sub-title">报名信息</view> - <form> - <view class="cu-form-group"> - <view class="title">姓名 - <span style="color: red;">*</span> - </view> - <input placeholder="请输入姓名" data-name="proposerName" bindinput="inputChange" value='{{peopleInfo.proposerName}}'></input> - </view> - <view class="cu-form-group"> - <view class="title">电话号码 - <span style="color: red;">*</span> - </view> - <input placeholder="请输入电话号码" data-name="proposerPhone" bindinput="inputChange" value='{{peopleInfo.proposerPhone}}'></input> - </view> - </form> - </block> + <block wx:if="{{activity.activityStatus == 1 && flag == 'true'}}"> + <view class="sub-title">报名信息</view> + <form> + <view class="cu-form-group"> + <view class="title">姓名 + <span style="color: red;">*</span> + </view> + <input placeholder="请输入姓名" data-name="proposerName" bindinput="inputChange" value='{{peopleInfo.proposerName}}'></input> + </view> + <view class="cu-form-group"> + <view class="title">电话号码 + <span style="color: red;">*</span> + </view> + <input placeholder="请输入电话号码" data-name="proposerPhone" bindinput="inputChange" value='{{peopleInfo.proposerPhone}}'></input> + </view> + </form> + </block> - </view> + </view> - <view class="fzpxInfo-foot margin-top"> - <!-- <view class="fzpxInfo-foot-title">报名须知</view> + <view class="fzpxInfo-foot margin-top"> + <view wx:if="{{signStatus}}"> + <view wx:if="{{signStatus == 2}}"> + <view class="fzpxInfo-foot-button bg-grey" bindtap='sign'>签到</view> + </view> + + <view wx:else> + <view class="fzpxInfo-foot-button bg-grey" bindtap='goBack'>返回</view> + </view> + </view> + + <view wx:else> + <!-- <view class="fzpxInfo-foot-title">报名须知</view> <view class="fzpxInfo-foot-txt">请确认所有参赛人员的排列顺序。相关信息会在参赛证件、参赛证明、获取证书等重要比赛文件中提现。</view> <view class="fzpxInfo-foot-txt">由于参赛队信息填报原因产生的任何错误,在相关文件完成制作后一律不予修改;</view> --> - <view wx:if="{{flag == 'false'}}"> - <view class="fzpxInfo-foot-button bg-grey">您已报名</view> - </view> - <view wx:if="{{flag == 'true'}}"> + <view wx:if="{{flag == 'false'}}"> + <view class="fzpxInfo-foot-button bg-grey">您已报名</view> + </view> + <view wx:if="{{flag == 'true'}}"> - <view class="fzpxInfo-foot-button bg-blue" wx:if="{{activity.activityStatus == 1}}" bindtap='submit'>我要报名</view> - <view class="fzpxInfo-foot-button bg-blue" wx:elif="{{activity.activityStatus == 2}}">活动正在进行</view> - <view class="fzpxInfo-foot-button bg-grey" wx:elif="{{activity.activityStatus == 3}}">活动已结束</view> - <view class="fzpxInfo-foot-button bg-grey" wx:else>报名人数已满</view> + <view class="fzpxInfo-foot-button bg-blue" wx:if="{{activity.activityStatus == 1}}" bindtap='submit'>我要报名</view> + <view class="fzpxInfo-foot-button bg-blue" wx:elif="{{activity.activityStatus == 2}}">活动正在进行</view> + <view class="fzpxInfo-foot-button bg-grey" wx:elif="{{activity.activityStatus == 3}}">活动已结束</view> + <view class="fzpxInfo-foot-button bg-grey" wx:else>报名人数已满</view> - </view> - <view> + </view> + </view> - </view> - </view> + + <view> + + </view> + </view> </view> \ No newline at end of file diff --git a/SunshineLnsMinApp/pages/me/me.js b/SunshineLnsMinApp/pages/me/me.js index a5f4278..60e235a 100644 --- a/SunshineLnsMinApp/pages/me/me.js +++ b/SunshineLnsMinApp/pages/me/me.js @@ -35,6 +35,12 @@ }) }, + myTranslate: function() { + wx.navigateTo({ + url: '../myTranslate/myTranslate', + }) + }, + onLoad: function() { this.notification(); }, diff --git a/SunshineLnsMinApp/pages/me/me.wxml b/SunshineLnsMinApp/pages/me/me.wxml index 3c636c0..a8ddf5a 100644 --- a/SunshineLnsMinApp/pages/me/me.wxml +++ b/SunshineLnsMinApp/pages/me/me.wxml @@ -22,6 +22,16 @@ <image class="me-business-right-icon" src="{{user}}" /> </div> + <div class="me-business-nav" bindtap="myTranslate"> + <image class="me-business-icon" src="{{xxtx}}" /> + <div class="me-business-title">我的活动</div> + <block wx:if="{{notRead > 0}}"> + <div class="me-business-info">{{notRead}}</div> + </block> + + <image class="me-business-right-icon" src="{{user}}" /> + </div> + <div class="me-business-nav" bindtap="msg"> <image class="me-business-icon" src="{{xxtx}}" /> <div class="me-business-title">消息提醒</div> diff --git a/SunshineLnsMinApp/pages/myTranslate/myTranslate.js b/SunshineLnsMinApp/pages/myTranslate/myTranslate.js new file mode 100644 index 0000000..5567377 --- /dev/null +++ b/SunshineLnsMinApp/pages/myTranslate/myTranslate.js @@ -0,0 +1,146 @@ +// pages/businessSchedule/businessSchedule.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + loading: app.globalData.imgUrl + '/image/loading.svg', + navbar: ['全部', '未开始', '进行中', '已完成'], + currentTab: 0, + size: 10, + size1: 10, + size2: 10, + size3: 10, + content: '------加载中------', + hasMoreData: true, + createTime: '', + dataSet: [] + }, + + navbarTap: function (e) { + this.setData({ + currentTab: e.currentTarget.dataset.idx + }) + this.showList(this.data.currentTab) + + }, + + showList: function (tab) { + var userinfo = wx.getStorageSync("user"); + var that = this; + var id = userinfo.id + var str; + var sizeQty; + switch (tab) { + case 0: + str = "&status="; + sizeQty = 'size'; + break; + case 1: + str = "&status=1"; + sizeQty = 'size1'; + break; + case 2: + str = "&status=2"; + sizeQty = 'size2'; + break; + case 3: + str = "&status=3"; + sizeQty = 'size3'; + break; + } + wx.request({ + url: app.globalData.url + '/api/activity/myActivities?page=1&size=' + that.data[sizeQty] + '&userId=' + id + str, + success: function (res) { + if (res.data.code == 0) { + (res.data.data.content).forEach(e => { + (e.createTime) = app.formatDate(e.createTime) + switch (e.activityType) { + case 'act_1': + e.activityType = '南检活动'; + break; + case 'act_2': + e.activityType = '法治培训'; + break; + case 'act_3': + e.activityType = '基地参观'; + break; + } + + + }); + if (res.data.data.totalElements < that.data[sizeQty]) { + that.setData({ + dataSet: res.data.data.content, + hasMoreData: false, + content: '------我是有底线的------' + }) + } else { + that.setData({ + dataSet: res.data.data.content, + hasMoreData: true, + content: '------加载更多------', + [sizeQty]: that.data[sizeQty] + 10 + }) + } + } else { + wx.showModal({ + title: '提示', + content: "请求失败!" + }) + } + } + }) + }, + + businessSchedule: function (event) { + var id = event.currentTarget.id; + var activityType = this.data.dataSet[id].activityType; + var signStatus = this.data.dataSet[id].signStatus; + var id = this.data.dataSet[id].id; + + console.log(activityType) + console.log(signStatus); + if (activityType == "法治培训") { + wx.navigateTo({ + url: '../fzpxInfo/fzpxInfo?id=' + id + '&signStatus=' + signStatus, + }) + } else if (activityType == "南检活动") { + wx.navigateTo({ + url: '../scanEvildoing/scanEvildoing?id=' + businessId, + }) + } else if (activityType == "基地参观") { + wx.navigateTo({ + url: '../complaintAdvice/complaintAdvice?id=' + businessId, + }) + } else { + wx.showModal({ + title: '提示', + content: "文件错误!" + }) + } + }, + + onLoad: function () { + this.showList(0) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if (this.data.hasMoreData) { + this.showList(this.data.currentTab) + this.setData({ + content: '------加载更多------' + }) + } else { + this.setData({ + content: '------我是有底线的------' + }) + } + }, + +}) \ No newline at end of file diff --git a/SunshineLnsMinApp/pages/myTranslate/myTranslate.json b/SunshineLnsMinApp/pages/myTranslate/myTranslate.json new file mode 100644 index 0000000..5a26128 --- /dev/null +++ b/SunshineLnsMinApp/pages/myTranslate/myTranslate.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "我的活动", + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" +} \ No newline at end of file diff --git a/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml b/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml new file mode 100644 index 0000000..db24d31 --- /dev/null +++ b/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml @@ -0,0 +1,26 @@ +<!--pages/myTranslate/myTranslate.wxml--> +<!--导航条--> +<view class="navbar"> + <text wx:for="{{navbar}}" data-idx="{{index}}" class="item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap">{{item}}</text> +</view> + +<!--列表数据--> +<view style='flex-direction:column;height:94vh;background-color:rgba(80, 119, 170, 0.06)'> + <div class="businessSchedule" bindtap='businessSchedule' id="{{key}}" wx:for="{{dataSet}}" wx:for-index='key' wx:key="*this"> + <div class="businessSchedule-top"> + <div class="businessSchedule-top-img"> + <image src="{{item.iconSrc}}" class="businessSchedule-top-img"></image> + </div> + <div class="businessSchedule-top-title">{{item.activityType}}</div> + <div class="businessSchedule-top-status backgroundorange-title" wx:if="{{item.signStatus==1}}">未审核</div> + <div class="businessSchedule-top-status backgroundorange-title" wx:if="{{item.signStatus==2}}">未签到</div> + <div class="businessSchedule-top-status backgroundorange-title" wx:if="{{item.signStatus==3}}">已签到</div> + <div class="businessSchedule-top-status backgroundorange-title" wx:if="{{item.signStatus==4}}">不通过</div> + <div class="businessSchedule-top-status backgroundgreen-title" wx:if="{{item.signStatus==99}}">取消</div> + </div> + <div class="businessSchedule-center">{{item.activityDese}}</div> + <div class="businessSchedule-bottom">于 {{item.createTime}} 提交申请</div> + </div> + <div class="businessSchedule-load">------{{content}}------</div> +</view> + diff --git a/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss b/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss new file mode 100644 index 0000000..e0e3e0f --- /dev/null +++ b/SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss @@ -0,0 +1,111 @@ +/* pages/myTranslate/myTranslate.wxss */ +view { + display: flex; +} + +.navbar { + flex: none; + display: flex; + background: #fff; + font-size: 18px; + color: #999; + height: 6vh; +} + +.navbar .item { + position: relative; + flex: auto; + text-align: center; + line-height: 80rpx; +} + +.navbar .item.active { + color: #2195ff; +} + +.navbar .item.active:after { + content: ""; + display: block; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 4rpx; + background: #2195ff; +} + +.businessSchedule { + font-size: 16px; + padding: 2vh; + margin: 2vh; + background-color: #fff; + box-shadow: 0px 6px 6px 0 rgba(80, 119, 170, 0.06); +} + +.businessSchedule-top { + display: flex; + color: #333; + align-items: center; + padding-bottom: 1vh; + border-bottom: 1px solid #f2f2f2; +} + +.businessSchedule-top-img { + width: 3vh; + height: 3vh; +} + +.businessSchedule-top-title { + padding-left: 1vh; +} + +.businessSchedule-top-status { + margin-left: auto; + display: flex; + justify-content: center; + box-shadow: 0px 4px 8px 0px rgba(136, 136, 136, 0.11); + padding: 1vh; + border-radius: 18px; + color: #fff; +} + +.businessSchedule-center { + font-size: 14px; + display: flex; + padding: 1vh 0; + color: #333; +} + +.businessSchedule-bottom { + display: flex; + font-size: 14px; + color: #999; +} + +.loading { + padding: 10rpx; + text-align: center; +} + +.loading:before { + display: inline-block; + margin-right: 5rpx; + vertical-align: middle; + content: ''; + width: 40rpx; + height: 40rpx; + background-size: contain; + animation: rotate 1s linear infinite; +} + +.loading.complete:before { + display: none; +} + +.businessSchedule-load { + display: flex; + justify-content: center; + color: #999; + font-size: 14px; + margin-bottom: 4vh; +} -- Gitblit v1.8.0