forked from nsjcy/frontEnd/nsjcy

liuwh
2020-02-24 2bcd556961208b80af1cb157633c594faab1eca2
小程序代码
4 files added
5 files modified
353 ■■■■■ changed files
SunshineLnsMinApp/app.json 1 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js 31 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml 16 ●●●●● 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,7 +10,8 @@
   */
  data: {
    loading: false,
    peopleInfo: {}
    peopleInfo: {},
    signStatus: '',
  },
  /**
@@ -20,7 +21,8 @@
    var that = this;
    that.setData({
      id: options.id,
      flag: options.flag,
      signStatus: options.signStatus || '',
      flag: options.flag || '',
      loading: true
    });
    wx.showLoading({
@@ -40,7 +42,13 @@
            activity: res.data.data
          })
          console.log('传过来', options.flag)
          console.log('传过来', options.signStatus)
          // 处理报名状态
          if (options.signStatus) {
            that.setData({
              signStatus: options.signStatus
            })
          } else {
          if (options.flag == 'true') {
            //可报名
            console.log('可报名')
@@ -77,6 +85,7 @@
              statusWord: '您已报名'
            })
          }
          }
        }
      }
@@ -110,6 +119,24 @@
    })
  },
  // 签到
  sign: function () {
    // 只允许从相机扫码
    wx.scanCode({
      onlyFromCamera: true,
      success(res) {
        console.log(res)
      }
    })
  },
  // 返回
  goBack: function () {
    wx.navigateBack({
      delta: 1
    });
  },
  // 提交报名
  submit: function() {
    var peopleInfo = this.data.peopleInfo;
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml
@@ -30,7 +30,7 @@
        </view>
      </view>
      <view class="fzpxInfo-main-group">
        <view class="fzpxInfo-main-group-title">培训对象</view>
                <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;">
@@ -62,6 +62,17 @@
  </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> -->
@@ -76,6 +87,9 @@
      <view class="fzpxInfo-foot-button bg-grey" wx:else>报名人数已满</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;
}