Browse Source

整合学生端和教师端

wangjinbiao 5 years ago
parent
commit
9b530ffc1f

+ 107 - 0
dorm-manager-wx/pages/student/proposal/proposal.js

@@ -0,0 +1,107 @@
+const api = require('../../../utils/api.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    array: ['卫生', '纪律', '日常', '其他'],
+    index: 0,
+  },
+  bindPickerChange(e) {
+    this.setData({
+      index: e.detail.value
+    })
+  },
+  formSubmit:function(e){
+    let that=this
+    if (!e.detail.value.title || !e.detail.value.text){
+      wx.showToast({
+        title: '请完善信息',
+        icon:'none'
+      })
+      return false;
+    }
+    wx.showLoading({
+      title: '正在提交',
+    })
+    wx.request({
+      url: api.submitPropose,
+      data: { loginId: wx.getStorageSync('loginId'), title: e.detail.value.title, message: e.detail.value.text, messageTag: e.detail.value.messageTag},
+      success(res){
+        wx.hideLoading()
+        if(res.data.errno==0){
+          wx.redirectTo({
+            url: '/pages/success/index',
+          })
+        }else{
+          wx.showToast({
+            title: res.data.data.msg,
+            icon:'none'
+          })
+        }
+      },fail(res){
+        wx.showToast({
+          title: '请求出错了',
+        })
+      }
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      user:wx.getStorageSync('user')
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 4 - 0
dorm-manager-wx/pages/student/proposal/proposal.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "投诉建议"
+}

+ 57 - 0
dorm-manager-wx/pages/student/proposal/proposal.wxml

@@ -0,0 +1,57 @@
+<form bindsubmit="formSubmit">
+  <view style="background:#fff;margin-top:30rpx;">
+    <view class="form">
+      <view class="input">
+        <view class="input-name"><text>类</text><text>型</text></view>
+        <view>:</view>
+        <view class="picker">
+          <picker name='messageTag' bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
+              <view class="weui-input">
+                <view>{{array[index]}}</view>
+                <image src='/images/jiantou-bottom.png'></image>
+              </view>
+            </picker>
+        </view>
+      </view>
+      <view class="input">
+        <view class="input-name"><text>标</text><text>题</text></view>
+        <view>:</view>
+        <input bindblur="name" maxlength="25" name='title'></input>
+      </view>
+      <!-- <view class="input">
+        <view class="input-name"><text>身</text><text>份</text><text>类</text><text>型</text></view>
+        <view>:</view>
+        
+      </view> -->
+      <!-- <view class="input">
+        <view class="input-name"><text>投</text><text>诉</text><text>/</text><text>建</text><text>议</text><text>人</text></view>
+        <view>:</view>
+        <input bindblur="idcard" maxlength="18" type="number" name='name'></input>
+      </view> -->
+      <!-- <view class="input">
+        <view class="input-name"><text>验</text><text>证</text><text>码</text></view>
+        <view>:</view>
+        <input maxlength="6" type="number" name='code' style="width:240rpx"></input>
+        <button bindtap="{{codetext>0?'':'code'}}" class="code">{{codetext}}</button>
+      </view> -->
+      <view class="textarea">
+        <view class="input-name"><text>内</text><text>容</text></view>
+        <view>:</view>
+        <textarea maxlength="100" bindblur="text" name='text'></textarea>
+      </view>
+      <view class="input">
+        <view class="input-name"><text>联</text><text>系</text><text>人</text></view>
+        <view>:</view>
+        <input disabled value="{{user.userName}}"></input>
+      </view>
+      <view class="input">
+        <view class="input-name"><text>联</text><text>系</text><text>电</text><text>话</text></view>
+        <view>:</view>
+        <input disabled value="{{user.userPhone}}"></input>
+      </view>
+    </view>
+  </view>
+  <view class="bottom">
+    <button class="next" formType="submit">提交</button>
+  </view>
+</form>

+ 101 - 0
dorm-manager-wx/pages/student/proposal/proposal.wxss

@@ -0,0 +1,101 @@
+page{
+  background: #f5f5f5;
+}
+.form{
+  width: 690rpx;
+  margin: 0 auto;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  /* margin-top: 20rpx; */
+  padding: 30rpx 0rpx 40rpx 0rpx;
+  border-radius: 10rpx;
+}
+.input{
+  display: flex;
+  height: 60rpx;
+  /* justify-content: center; */
+  margin-top: 30rpx;
+  padding: 0rpx 40rpx;
+  line-height: 60rpx;
+}
+.input view{
+  font-size: 30rpx;
+  color:#333;
+}
+.input input{
+  height: 60rpx;
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  padding:0rpx 20rpx;
+  width: 370rpx;
+  font-size: 30rpx;
+}
+.input-name{
+  width: 160rpx;
+  display: flex;
+  justify-content: space-between;
+}
+
+.picker{
+  height: 60rpx;
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  padding-left: 20rpx;
+  width: 388rpx;
+  line-height: 60rpx;
+}
+.weui-input{
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.weui-input image{
+  width: 26rpx;
+  height: 14rpx;
+  margin-right: 54rpx;
+}
+.code{
+  width: 170rpx;
+  height: 60rpx;
+  margin-left: 20rpx;
+  background: #6282f4;
+  border-radius: 20rpx;
+  color: #fff;
+  font-size: 26rpx;
+}
+.textarea{
+  display: flex;
+  /* justify-content: center; */
+  margin-top: 30rpx;
+  padding: 0rpx 40rpx;
+}
+.textarea .input-name{
+  font-size: 30rpx;
+  color:#333;
+}
+textarea{
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  /* margin-left: 6rpx; */
+  padding: 10rpx 20rpx;
+  height: 150rpx;
+  width: 370rpx;
+}
+.bottom{
+  position: fixed;
+  left: 0;
+  right: 0;
+  margin:0 auto;
+  bottom: 60rpx;
+  display: flex;
+}
+.next{
+  width: 100%;
+  height: 90rpx;
+  background: #6282f4;
+  color: #fff;
+  border-radius: 10rpx;
+  margin: 20rpx;
+}

+ 110 - 0
dorm-manager-wx/pages/student/proposalDetails/proposalDetails.js

@@ -0,0 +1,110 @@
+const api = require('../../../utils/api.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    array: ['卫生', '纪律', '日常', '其他'],
+    index: 0,
+  },
+  bindPickerChange(e) {
+    this.setData({
+      index: e.detail.value
+    })
+  },
+  // formSubmit:function(e){
+  //   let that=this
+  //   wx.showLoading({
+  //     title: '正在提交',
+  //   })
+  //   wx.request({
+  //     url: api.submitPropose,
+  //     data: { loginId: wx.getStorageSync('loginId'), title: e.detail.value.title, message: e.detail.value.text, messageTag: that.data.array[e.detail.value.messageTag]},
+  //     success(res){
+  //       wx.hideLoading()
+  //       if(res.data.errno==0){
+  //         wx.redirectTo({
+  //           url: '/pages/success/index',
+  //         })
+  //       }else{
+  //         wx.showToast({
+  //           title: res.data.data.msg,
+  //           icon:'none'
+  //         })
+  //       }
+  //     }
+  //   })
+  // },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      user:wx.getStorageSync('user')
+    })
+    let that=this
+    wx.showLoading({
+      title: '正在加载',
+    })
+    wx.request({
+      url: api.findProposeDetails,
+      data:{id:options.id},
+      success(res){
+        wx.hideLoading();
+        that.setData({
+          data:res.data.data.data
+        })
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 4 - 0
dorm-manager-wx/pages/student/proposalDetails/proposalDetails.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "详情"
+}

+ 56 - 0
dorm-manager-wx/pages/student/proposalDetails/proposalDetails.wxml

@@ -0,0 +1,56 @@
+<view style="background:#fff;margin-top:30rpx;">
+  <view class="form">
+    <view class="input">
+      <view class="input-name"><text>类</text><text>型</text></view>
+      <view>:</view>
+      <view class="picker">
+        <picker name='messageTag' disabled bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
+            <view class="weui-input">
+              <view>{{array[data.messageTag?data.messageTag:0]}}</view>
+              <!-- <image src='/images/jiantou-bottom.png'></image> -->
+            </view>
+          </picker>
+      </view>
+    </view>
+    <view class="input">
+      <view class="input-name"><text>标</text><text>题</text></view>
+      <view>:</view>
+      <input disabled value="{{data.title}}"></input>
+    </view>
+    <!-- <view class="input">
+      <view class="input-name"><text>身</text><text>份</text><text>类</text><text>型</text></view>
+      <view>:</view>
+      
+    </view> -->
+    <!-- <view class="input">
+      <view class="input-name"><text>投</text><text>诉</text><text>/</text><text>建</text><text>议</text><text>人</text></view>
+      <view>:</view>
+      <input bindblur="idcard" maxlength="18" type="number" name='name'></input>
+    </view> -->
+    <!-- <view class="input">
+      <view class="input-name"><text>验</text><text>证</text><text>码</text></view>
+      <view>:</view>
+      <input maxlength="6" type="number" name='code' style="width:240rpx"></input>
+      <button bindtap="{{codetext>0?'':'code'}}" class="code">{{codetext}}</button>
+    </view> -->
+    <view class="textarea">
+      <view class="input-name"><text>内</text><text>容</text></view>
+      <view>:</view>
+      <textarea style="font-size:30rpx;" disabled value="{{data.message}}" bindblur="text" name='text'></textarea>
+    </view>
+    <view class="input">
+      <view class="input-name"><text>联</text><text>系</text><text>人</text></view>
+      <view>:</view>
+      <input disabled value="{{user.userName}}"></input>
+    </view>
+    <view class="input">
+      <view class="input-name"><text>联</text><text>系</text><text>电</text><text>话</text></view>
+      <view>:</view>
+      <input disabled value="{{user.userPhone}}"></input>
+    </view>
+  </view>
+</view>
+<view style="background:#fff;margin-top:30rpx;padding:20rpx 0rpx;">
+  <view style="margin:40rpx;color:red;">回复内容:</view>
+  <view style="margin:40rpx;">{{data.answer?data.answer:'无'}}</view>
+</view>

+ 101 - 0
dorm-manager-wx/pages/student/proposalDetails/proposalDetails.wxss

@@ -0,0 +1,101 @@
+page{
+  background: #f5f5f5;
+}
+.form{
+  width: 690rpx;
+  margin: 0 auto;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  /* margin-top: 20rpx; */
+  padding: 30rpx 0rpx 40rpx 0rpx;
+  border-radius: 10rpx;
+}
+.input{
+  display: flex;
+  height: 60rpx;
+  /* justify-content: center; */
+  margin-top: 30rpx;
+  padding: 0rpx 40rpx;
+  line-height: 60rpx;
+}
+.input view{
+  font-size: 30rpx;
+  color:#333;
+}
+.input input{
+  height: 60rpx;
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  padding:0rpx 20rpx;
+  width: 370rpx;
+  font-size: 30rpx;
+}
+.input-name{
+  width: 160rpx;
+  display: flex;
+  justify-content: space-between;
+}
+
+.picker{
+  height: 60rpx;
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  padding-left: 20rpx;
+  width: 388rpx;
+  line-height: 60rpx;
+}
+.weui-input{
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.weui-input image{
+  width: 26rpx;
+  height: 14rpx;
+  margin-right: 54rpx;
+}
+.code{
+  width: 170rpx;
+  height: 60rpx;
+  margin-left: 20rpx;
+  background: #6282f4;
+  border-radius: 20rpx;
+  color: #fff;
+  font-size: 26rpx;
+}
+.textarea{
+  display: flex;
+  /* justify-content: center; */
+  margin-top: 30rpx;
+  padding: 0rpx 40rpx;
+}
+.textarea .input-name{
+  font-size: 30rpx;
+  color:#333;
+}
+textarea{
+  border:1rpx solid #999;
+  border-radius: 14rpx;
+  /* margin-left: 6rpx; */
+  padding: 10rpx 20rpx;
+  height: 150rpx;
+  width: 370rpx;
+}
+.bottom{
+  position: fixed;
+  left: 0;
+  right: 0;
+  margin:0 auto;
+  bottom: 60rpx;
+  display: flex;
+}
+.next{
+  width: 100%;
+  height: 90rpx;
+  background: #6282f4;
+  color: #fff;
+  border-radius: 10rpx;
+  margin: 20rpx;
+}

+ 133 - 0
dorm-manager-wx/pages/student/proposalList/proposalList.js

@@ -0,0 +1,133 @@
+const api = require('../../../utils/api.js');
+const util = require('../../../utils/util.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    index: 0,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.req()
+  },
+  req(){
+    let that=this
+    wx.request({
+      url: api.findProposeList,
+      data: { loginId: wx.getStorageSync('loginId'), page: 1, rows:1000},
+      success(res){
+        let yesData=0,noData=0
+        for(let index in res.data.data.data){
+          if (res.data.data.data[index].newreply){
+            yesData++
+          }
+          if (!res.data.data.data[index].newreply){
+            noData++
+          }
+        }
+        if (that.data.index==0){//全部
+          if (res.data.data.Total<20){
+            that.data.nodata=false
+          }
+          that.data.allMsg = res.data.data.data
+          that.setData({
+            ['allMsg']: res.data.data.data,
+            ['yesMsg']: yesData>0?res.data.data.data:'',
+            ['noMsg']: noData>0?res.data.data.data:'',
+
+          })
+        }
+        // if (that.data.index == 1){//已回复
+        //   if (res.data.data.Total < 20) {
+        //     that.data.nodata = false
+        //   }
+        //   that.data.yesMsg = res.data.data.data
+        //   that.setData({
+        //     ['yesMsg']: res.data.data.data
+        //   })
+        // }
+        // if (that.data.index == 1) {//未回复
+        //   if (res.data.data.Total < 20) {
+        //     that.data.nodata = false
+        //   }
+        //   that.data.noMsg = res.data.data.data
+        //   that.setData({
+        //     ['noMsg']: res.data.data.data
+        //   })
+        // }
+      }
+    })
+  },
+  // 左右滑动切换
+  swiper: function (e) {
+    this.setData({
+      index: e.detail.current
+    })
+  },
+  // tab切换
+  tab: function (e) {
+    let that = this
+    that.setData({
+      index: e.currentTarget.dataset.index,
+      current_index: e.currentTarget.dataset.index,
+    })
+  },
+  detail:function(e){
+    wx.navigateTo({
+      url: '../proposalDetails/proposalDetails?id='+e.currentTarget.dataset.id,
+    })
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 4 - 0
dorm-manager-wx/pages/student/proposalList/proposalList.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "投诉建议列表"
+}

+ 66 - 0
dorm-manager-wx/pages/student/proposalList/proposalList.wxml

@@ -0,0 +1,66 @@
+<view class='tab'>
+  <view class='top'>
+    <view class="{{index==0?'select':''}}" catchtap='tab' data-index='0'>全部</view>
+    <view class="{{index==1?'select':''}}" catchtap='tab' data-index='1'>已回复</view>
+    <view class="{{index==2?'select':''}}" catchtap='tab' data-index='2'>未回复</view>
+  </view>
+</view>
+<swiper style="height: 100%;" current='{{current_index}}' bindchange='swiper'>
+  <!-- 办事指南模块 -->
+  <swiper-item>
+    <scroll-view scroll-y="{{true}}" style="height: 100%;">
+      <block wx:for='{{allMsg}}' wx:key='{{index}}'>
+        <view class="list" bindtap="detail" data-id="{{item.id}}">
+          <view class="list-left">
+            <view>主题:{{item.title}}</view>
+            <view>{{item.userName}}</view>
+            <view>{{item.create_date}}</view>
+          </view>
+          <view class="list-right">
+            <view wx:if='{{item.newreply}}' style="font-size:28rpx;color:#6282f4">已回复</view>
+            <view wx:if='{{!item.newreply}}' style="font-size:28rpx;color:red;">未回复</view>
+          </view>
+        </view>
+      </block>
+      <view wx:if='{{allMsg.length==0}}'>暂无数据</view>
+    </scroll-view>
+  </swiper-item>
+  <swiper-item>
+    <scroll-view scroll-y="{{true}}" style="height: 100%;">
+      <block wx:for='{{yesMsg}}' wx:key='{{index}}'>
+        <view class="list" wx:if='{{item.newreply}}' bindtap="detail" data-id="{{item.id}}">
+          <view class="list-left">
+            <view>主题:{{item.title}}</view>
+            <view>{{item.userName}}</view>
+            <view>{{item.create_date}}</view>
+          </view>
+          <!-- <view class="list-right">
+            <view>投诉</view>
+          </view> -->
+        </view>
+      </block>
+      <view wx:if='{{!yesMsg}}' class="nodata">
+        <text>暂无数据</text>
+      </view>
+    </scroll-view>
+  </swiper-item>
+  <swiper-item>
+    <scroll-view scroll-y="{{true}}" style="height: 100%;">
+      <block wx:for='{{noMsg}}' wx:key='{{index}}'>
+        <view class="list" wx:if='{{!item.newreply}}' bindtap="detail" data-id="{{item.id}}">
+          <view class="list-left">
+            <view>主题:{{item.title}}</view>
+            <view>{{item.userName}}</view>
+            <view>{{item.create_date}}</view>
+          </view>
+          <!-- <view class="list-right">
+            <view>投诉</view>
+          </view> -->
+        </view>
+      </block>
+      <view wx:if='{{!noMsg}}' class="nodata">
+        <text>暂无数据</text>
+      </view>
+    </scroll-view>
+  </swiper-item>
+</swiper>

+ 76 - 0
dorm-manager-wx/pages/student/proposalList/proposalList.wxss

@@ -0,0 +1,76 @@
+page{
+  background-color: #f2f2f2;
+  height: 100%;
+}
+
+.tab{
+  height: 130rpx;
+  display: flex;
+  align-items: center;
+  background: #fff;
+}
+.top{
+  width: 690rpx;
+  margin: 0 auto;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  border-radius: 10rpx;
+  /* overflow: hidden; */
+}
+.top :first-child{
+  border-radius: 10rpx 0rpx 0rpx 10rpx;
+}
+.top :last-child{
+  border-radius: 0rpx 10rpx 10rpx 0rpx;
+}
+.top view{
+  width: 40%;
+  height: 70rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 30rpx;
+  border-collapse: collapse;
+  border:1rpx solid #6282f4;
+  margin-right: -1rpx
+}
+.select{
+  color: #fff;
+  background-color: #6282f4;
+}
+
+.list{
+  width: 100%;
+  display: flex;
+  background-color: #fff;
+  justify-content: space-between;
+  margin-top: 20rpx;
+}
+.list-left{
+  display: flex;
+  flex-direction: column;
+  padding: 20rpx 20rpx 20rpx 40rpx;
+}
+.list-left view{
+  margin: 10rpx;
+}
+.list-right{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  padding-right: 30rpx;
+}
+.list-right view{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 100rpx;
+  height: 100rpx;
+  border:1rpx solid #6282f4;
+  border-radius: 50%;
+}
+.nodata{
+  text-align: center;
+  margin-top: 30rpx;
+}