forked from nsjcy/frontEnd/nsjcy

liuwh
2020-02-24 2bcd556961208b80af1cb157633c594faab1eca2
小程序代码
4 files added
5 files modified
559 ■■■■ changed files
SunshineLnsMinApp/app.json 1 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js 97 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml 156 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/me/me.js 6 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/me/me.wxml 10 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/myTranslate/myTranslate.js 146 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/myTranslate/myTranslate.json 6 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml 26 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss 111 ●●●●● patch | view | raw | blame | history
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",
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({
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>
SunshineLnsMinApp/pages/me/me.js
@@ -35,6 +35,12 @@
    })
  },
  myTranslate: function() {
    wx.navigateTo({
      url: '../myTranslate/myTranslate',
    })
  },
  onLoad: function() {
    this.notification();
  },
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>
SunshineLnsMinApp/pages/myTranslate/myTranslate.js
New file
@@ -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: '------我是有底线的------'
      })
    }
  },
})
SunshineLnsMinApp/pages/myTranslate/myTranslate.json
New file
@@ -0,0 +1,6 @@
{
  "navigationBarTitleText": "我的活动",
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTextStyle": "black"
}
SunshineLnsMinApp/pages/myTranslate/myTranslate.wxml
New file
@@ -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>
SunshineLnsMinApp/pages/myTranslate/myTranslate.wxss
New file
@@ -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;
}