forked from nsjcy/frontEnd/nsjcy

1
liuwh
2020-05-26 aba05ff402b2b6a7ed9e3eedee43addc1b7eee44
1
4 files added
6 files modified
564 ■■■■■ changed files
SunshineIns/src/fetch/_fetch.js 4 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/app.json 1 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhgh/zhgh.wxml 30 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js 16 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.wxml 30 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.wxss 61 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.js 212 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.json 6 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.wxml 50 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.wxss 154 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/_fetch.js
@@ -1,8 +1,8 @@
import fetch from 'hife/fetch';
// export const base = 'http://xnwj.gznsjc.gov.cn';
// export const base = 'http://nsjc.vaiwan.com';
export const base = 'http://192.168.16.109:6060/';
export const base = 'http://nsjc.vaiwan.com';
// export const base = 'http://192.168.16.109:6060/';
// export const base = 'http://120.79.193.119:9021/';
// export const base = 'http://localhost:6060';
SunshineLnsMinApp/app.json
@@ -12,6 +12,7 @@
    "pages/zhghLogin/zhghLogin",
    "pages/zhgh/zhgh",
    "pages/zhghInfo/zhghInfo",
    "pages/zhghchildrenInfo/zhghchildrenInfo",
    "pages/zhgk/zhgk",
    "pages/zhdt/zhdt",
    "pages/zhdtInfo/zhdtInfo",
SunshineLnsMinApp/pages/zhgh/zhgh.wxml
@@ -31,10 +31,10 @@
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="zhgh-list-b-left-div">
            <!-- <rich-text nodes="{{item.taskRequire}}"></rich-text> -->
          <!-- <view class="zhgh-list-b-left-div">
            <rich-text nodes="{{item.taskRequire}}"></rich-text>
            地址:{{item.taskAddress}}
          </view>
          </view> -->
          <view class="text-grey">{{item.startTime}}~{{item.endTime}}</view>
        </view>
        <view class="zhgh-list-b-right">
@@ -49,10 +49,10 @@
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="zhgh-list-b-left-div">
            <!-- <rich-text nodes="{{item.taskRequire}}"></rich-text> -->
          <!-- <view class="zhgh-list-b-left-div">
            <rich-text nodes="{{item.taskRequire}}"></rich-text>
            地址:{{item.taskAddress}}
          </view>
          </view> -->
          <view class="text-grey">{{item.startTime}}~{{item.endTime}}</view>
        </view>
        <view class="zhgh-list-b-right">
@@ -67,10 +67,10 @@
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="zhgh-list-b-left-div">
            <!-- <rich-text nodes="{{item.taskRequire}}"></rich-text> -->
          <!-- <view class="zhgh-list-b-left-div">
            <rich-text nodes="{{item.taskRequire}}"></rich-text>
            地址:{{item.taskAddress}}
          </view>
          </view> -->
          <view class="text-grey">{{item.startTime}}~{{item.endTime}}</view>
        </view>
        <view class="zhgh-list-b-right">
@@ -85,10 +85,10 @@
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="zhgh-list-b-left-div">
            <!-- <rich-text nodes="{{item.taskRequire}}"></rich-text> -->
          <!-- <view class="zhgh-list-b-left-div">
            <rich-text nodes="{{item.taskRequire}}"></rich-text>
            地址:{{item.taskAddress}}
          </view>
          </view> -->
          <view class="text-grey">{{item.startTime}}~{{item.endTime}}</view>
        </view>
        <view class="zhgh-list-b-right">
@@ -103,10 +103,10 @@
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="zhgh-list-b-left-div">
            <!-- <rich-text nodes="{{item.taskRequire}}"></rich-text> -->
          <!-- <view class="zhgh-list-b-left-div">
            <rich-text nodes="{{item.taskRequire}}"></rich-text>
            地址:{{item.taskAddress}}
          </view>
          </view> -->
          <view class="text-grey">{{item.startTime}}~{{item.endTime}}</view>
        </view>
        <view class="zhgh-list-b-right">
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
@@ -11,7 +11,7 @@
    del: app.globalData.imgUrl + '/image/del.svg',
    evalList: {},
    id: "",
    status: 4,
    status: null,
    disabled: false,
    socialTaskObject: {}
  },
@@ -52,10 +52,11 @@
              createTime: app.formatDate(res.data.data.createTime),
              startTime: app.formatDate(res.data.data.startTime),
              endTime: app.formatDate(res.data.data.endTime),
              status: res.data.data.status == 0 ? '未开始' : res.data.data.status == 1 ? '进行中' : res.data.data.status == 2 ? '已结束' : res.data.data.status == 99 ? '结束' : '(未知)',
              status: res.data.data.status == 0 ? '正常' : '暂停',
            },
            disabled: res.data.data.status == 2 ? true : false,
            status: res.data.data.status,
            id: res.data.data.id,
            evalList,
            taskReport: res.data.data.taskReport || '',
@@ -149,6 +150,17 @@
    })
  },
  // 跳转
  linkcFunction: function(event) {
    var that = this;
    var status = that.data.status;
    var str = event.currentTarget.dataset['str'];
    var id = event.currentTarget.dataset['id'];
    wx.navigateTo({
      url: '../' + str + '/' + str + '?id=' + id + '&status=' + status
    })
  },
  // 提交
  linkFunction: function() {
    var that = this;
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.wxml
@@ -12,7 +12,25 @@
    </view>
  </view>
  <view class="zhghInfo-center">
  <div class="complain-message">
    <span></span>
    <span>子任务</span>
  </div>
  <view class="zhgh-list" wx:for="{{data.tasks}}" wx:key>
    <view class="zhgh-list1" data-str="zhghchildrenInfo" data-id="{{item.id}}" bindtap='linkcFunction'>
      <view class="zhgh-list-b">
        <view class="zhgh-list-b-left">
          <view class="zhgh-list-b-left-div font-lg">{{item.taskTitle}}</view>
          <view class="text-grey">任务地点:{{item.taskAddress}}</view>
        </view>
        <view class="zhgh-list-b-right">
          <view class="round cu-tag margin-tb-sm lg {{item.status==0?'bg-green':item.status==1?'bg-orange':'bg-grey'}}">{{item.status==0?'未开始':item.status==1?"进行中":"已结束"}}</view>
        </view>
      </view>
    </view>
  </view>
  <!-- <view class="zhghInfo-center">
    <view class="zhghInfo-center-title">任务分派时间:
      <text>{{data.createTime}}</text>
    </view>
@@ -24,9 +42,9 @@
    <view class="zhghInfo-center-txt">
      <rich-text nodes="{{data.taskProcess}}"></rich-text>
    </view>
  </view>
  </view> -->
  <view class="zhghInfo-accessory">
  <!-- <view class="zhghInfo-accessory">
    <view class="zhghInfo-center-title">附件</view>
    <div class="activity-uploadImage">
      <view class="educt_hasupload_pic" wx:for="{{evalList.evalList1000}}" wx:key="index">
@@ -37,13 +55,13 @@
        <image class="activity-uploadImag-icon" src="{{add}}"></image>
      </view>
    </div>
  </view>
  </view> -->
  <view class="zhghInfo-text">
  <!-- <view class="zhghInfo-text">
    <view class="zhghInfo-center-title">任务汇报</view>
    <view class="zhghInfo-center-textarea">
      <textarea data-name="taskReport" value='{{data.socialTaskObject.taskReport}}' bindinput="inputChange" disabled="{{disabled}}" placeholder="学会与老人沟通,耐心积极,心态良好" placeholder-style="color:#9B9B9B;"></textarea>
    </view>
    <view class="{{disabled? 'displayNone':'button-submit'}}" disabled="{{disabled}}" bindtap='linkFunction'>提交</view>
  </view>
  </view> -->
</view>
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.wxss
@@ -1,7 +1,7 @@
/* pages/zhghInfo/zhghInfo.wxss */
.zhghInfo-bg {
  background-color: #f1f1f1;
  /* background-color: #f1f1f1; */
  height: 100%;
}
@@ -138,3 +138,62 @@
  font-size: 16PX;
  margin-top: 12PX;
}
.zhgh-bg {
  background-color: #f1f1f1;
  height: 100vh;
}
.zhgh-list {
  background: #f1f1f1;
  margin: 10PX;
  border-radius: 6PX;
  border: 1px solid rgba(247, 251, 255, 1);
  box-shadow: 0px 4px 8px 1px rgba(136, 136, 136, 0.11);
}
.zhgh-list1 {
  background: #fff;
  border-radius: 6px;
}
.zhgh-list-img {
}
.zhgh-list-img image {
  width: 100%;
}
.zhgh-list-b {
  display: flex;
  justify-content: space-between;
  padding: 8PX 24PX;
  align-items: center;
  font-size: 14PX;
}
.font-lg {
  font-size: 16PX;
  font-weight: 600;
}
.zhgh-list-b-left-div {
  line-height: 26PX;
}
.complain-message {
  display: flex;
  padding: 2vh;
  border-bottom: 1px solid #f2f2f2;
}
.complain-message span:nth-child(1) {
  border-left: 3px solid #2195ff;
}
.complain-message span:nth-child(2) {
  padding-left: 1vh;
  font-size: 18px;
  font-weight: bold;
}
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.js
New file
@@ -0,0 +1,212 @@
// pages/zhghchildrenInfo/zhghchildrenInfo.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    data: {},
    add: app.globalData.imgUrl + '/image/add.svg',
    del: app.globalData.imgUrl + '/image/del.svg',
    evalList: {},
    id: "",
    status: null,
    disabled: false,
    socialTaskObject: {}
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    console.log(options.id)
    console.log('options.status', options.status)
    that.setData({
      status: options.status
    })
    wx.showLoading();
    wx.request({
      url: app.globalData.url + '/api/social/find/' + options.id,
      success: function(res) {
        wx.hideLoading();
        console.log('res', res);
        if (res.data.code == 0) {
          var dataSet = res.data.data;
          var evalList1000 = dataSet.attachments || [];
          console.log('37', evalList1000)
          var evalList = {
            evalList1000,
          };
          for (var i in evalList) {
            evalList[i] = evalList[i].map(({
              url: pic,
              uid: id
            }) => ({
              pic,
              id
            }))
          }
          console.log('48', evalList)
          console.log('48', res.data.data.status)
          that.setData({
            data: {
              ...res.data.data,
              createTime: app.formatDate(res.data.data.createTime),
              startTime: app.formatDate(res.data.data.startTime),
              endTime: app.formatDate(res.data.data.endTime),
              status: res.data.data.status == 0 ? '未开始' : res.data.data.status == 1 ? '进行中' : res.data.data.status == 2 ? '已结束' : res.data.data.status == 99 ? '结束' : '(未知)',
            },
            disabled: options.status == 99 ? true : res.data.data.status !== 0 ? true : false,
            id: res.data.data.id,
            evalList,
            taskReport: res.data.data.taskReport || '',
            socialTaskObject: res.data.data.socialTaskObject
          })
        } else {
          wx.showToast({
            title: res.data.msg,
          })
        }
      }
    })
  },
  //输入框
  inputChange: function(e) {
    console.log(e)
    var that = this;
    var taskReport = e.detail.value;
    this.setData({
      socialTaskObject: {
        ...that.data.socialTaskObject,
        taskReport
      }
    })
  },
  //添加图片
  joinPicture: function(e) {
    console.log(e)
    var that = this;
    console.log(that)
    app.joinPicture(e, that, e.currentTarget.dataset.associatetypeid, that.data.id);
  },
  // 删除图片
  clearImg: function(e) {
    var that = this;
    app.clearImg(e, that);
  },
  //预览图片
  previewImage: function(e) {
    app.previewImage(e);
  },
  onPreview(e) {
    console.log('onPreview', e)
    const {
      file,
      fileList
    } = e.detail
    wx.previewImage({
      current: file.url,
      urls: fileList.map((n) => n.url),
    })
  },
  onRemove(e) {
    const {
      file,
      fileList
    } = e.detail;
    let that = this;
    var id = e.currentTarget.dataset['id'];
    console.log(id);
    let {
      supplyAttachmentList
    } = that.data.item;
    wx.showModal({
      content: '确定删除?',
      success: (res) => {
        if (res.confirm) {
          wx.showLoading();
          wx.request({
            url: app.globalData.url + '/api/v1/attachment/deleteByOwnerAtt',
            method: 'GET',
            data: {
              attId: file.id,
              owenId: id
            },
            success: function(res) {
              console.log('res', res);
              that.data.item.supplyAttachmentList = supplyAttachmentList.filter((n) => n.uid !== file.uid)
              that.setData({
                item: that.data.item
              })
              wx.hideLoading();
            }
          })
        }
      },
    })
  },
  // 跳转
  linkcFunction: function(event) {
    var str = event.currentTarget.dataset['str'];
    var id = event.currentTarget.dataset['id'];
    wx.navigateTo({
      url: '../' + str + '/' + str + '?id=' + id
    })
  },
  // 提交
  linkFunction: function() {
    var that = this;
    wx.showLoading();
    var data = {
      taskId: that.data.id,
      userId: wx.getStorageSync('id'),
      taskReport: that.data.socialTaskObject.taskReport
    }
    console.log(that.data.data.startTime)
    console.log(app.formatDate(new Date()))
    if (app.formatDate(new Date()) < that.data.data.startTime) {
      wx.hideLoading();
      return app.showModal("任务还未开始,暂时无法提交");
    } else {
      wx.request({
        url: app.globalData.url + '/api/social/submitTask',
        method: 'GET',
        data: {
          taskId: that.data.id,
          userId: wx.getStorageSync('id'),
          taskReport: that.data.socialTaskObject.taskReport
        },
        success: function(res) {
          wx.hideLoading();
          console.log('res', res);
          if (res.data.code == 0) {
            wx.showToast({
              title: '提交成功',
              icon: 'success',
              duration: 2000
            })
            wx.navigateBack({
              delta: 1
            })
          } else {
            wx.showToast({
              title: res.data.msg,
            })
          }
        }
      })
    }
  },
})
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.json
New file
@@ -0,0 +1,6 @@
{
  "navigationBarTitleText": "社会观护任务",
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTextStyle": "black"
}
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.wxml
New file
@@ -0,0 +1,50 @@
<!--pages/zhghchildrenInfo/zhghchildrenInfo.wxml-->
<view class="zhghInfo-bg">
  <view class="zhghInfo-main">
    <view class="zhghInfo-main-b">
      <view class="zhghInfo-main-b-left">
        <view class="zhghInfo-main-b-left-div font-lg">{{data.taskTitle}}</view>
        <view class="zhghInfo-main-b-left-div">{{data.startTime}}~{{data.endTime}}</view>
      </view>
      <!-- <view class="zhghInfo-main-b-right">{{data.status}}</view> -->
      <view class="zhghInfo-main-b-right round cu-tag margin-tb-sm lg {{data.status=='未开始'?bg-grey:data.status=='进行中'?bg-red:bg-blue}}">{{data.status}}</view>
    </view>
  </view>
  <view class="zhghInfo-center">
    <view class="zhghInfo-center-title">任务分派时间:
      <text>{{data.createTime}}</text>
    </view>
    <view class="zhghInfo-center-title">任务要求</view>
    <view class="zhghInfo-center-txt">
      <rich-text nodes="{{data.taskRequire}}"></rich-text>
    </view>
    <view class="zhghInfo-center-title">任务流程</view>
    <view class="zhghInfo-center-txt">
      <rich-text nodes="{{data.taskProcess}}"></rich-text>
    </view>
  </view>
  <view class="zhghInfo-accessory">
    <view class="zhghInfo-center-title">附件</view>
    <div class="activity-uploadImage">
      <view class="educt_hasupload_pic" wx:for="{{evalList.evalList1000}}" wx:key="index">
        <image src="{{item.pic}}" class="upload" bindtap="previewImage" data-src="{{item.pic}}"></image>
        <image src="{{del}}" bindtap='clearImg' data-index="{{index}}" id="{{item.id}}" data-associatetypeid="{{1000}}" class="{{disabled? 'displayNone':'activity-uploadImag-del'}}"></image>
      </view>
      <view bindtap="joinPicture" data-index="{{0}}" data-associatetypeid="{{1000}}" class="{{disabled? 'displayNone':'educt_upload_add'}}">
        <image class="activity-uploadImag-icon" src="{{add}}"></image>
      </view>
    </div>
  </view>
  <view class="zhghInfo-text">
    <view class="zhghInfo-center-title">任务汇报</view>
    <view class="zhghInfo-center-textarea">
      <textarea data-name="taskReport" value='{{data.socialTaskObject.taskReport}}' bindinput="inputChange" disabled="{{disabled}}" placeholder="学会与老人沟通,耐心积极,心态良好" placeholder-style="color:#9B9B9B;"></textarea>
    </view>
    <view class="{{disabled? 'displayNone':'button-submit'}}" disabled="{{disabled}}" bindtap='linkFunction'>提交</view>
    <view class="{{!disabled? 'displayNone':'button-submit-c'}}" bindtap='linkFunction'>返回</view>
  </view>
</view>
SunshineLnsMinApp/pages/zhghchildrenInfo/zhghchildrenInfo.wxss
New file
@@ -0,0 +1,154 @@
/* pages/zhghchildrenInfo/zhghchildrenInfo.wxss */
/* pages/zhghInfo/zhghInfo.wxss */
.zhghInfo-bg {
  background-color: #f1f1f1;
  height: 100%;
}
.zhghInfo-main {
  background: #fff;
  /* margin: 10PX;
  border-radius: 6PX; */
}
.zhghInfo-main-img {
}
.zhghInfo-main-img image {
  width: 100%;
}
.zhghInfo-main-b {
  display: flex;
  justify-content: space-between;
  padding: 8PX 24PX;
  align-items: center;
  font-size: 14PX;
}
.zhghInfo-main-b-left {
}
.zhghInfo-main-b-right {
}
.font-lg {
  font-size: 16PX;
  font-weight: 600;
}
.zhghInfo-main-b-left-div {
  line-height: 26PX;
}
.zhghInfo-center {
  background: #fff;
  margin-top: 24PX;
  padding: 12PX;
}
.zhghInfo-center-title {
  font-size: 16PX;
  font-weight: 600;
  margin: 10PX;
}
.upload {
  width: 48px;
  height: 48px;
}
.activity-uploadImag-del {
  width: 20px;
  height: 20px;
  position: absolute;
  left: 28px;
}
.activity-uploadImage {
  display: flex;
  padding: 1vh 2vh;
}
.zhghInfo-center-title text {
  font-size: 14px;
  font-weight: 300;
}
.educt_hasupload_pic {
  display: flex;
  position: relative;
  padding-right: 1vh;
}
.activity-uploadImag-icon {
  width: 48px;
  height: 48px;
}
.zhghInfo-center-txt {
  line-height: 24PX;
  margin-left: 12PX;
}
.zhghInfo-accessory {
  background: #fff;
  margin-top: 12PX;
  padding: 12PX;
}
.zhghInfo-center-img {
  display: flex;
  margin-left: 12PX;
}
.zhghInfo-center-img image {
  width: 60PX;
  height: 60PX;
  margin-right: 8PX;
}
.zhghInfo-text {
  background: #fff;
  margin-top: 12PX;
  padding: 12PX;
}
.zhghInfo-center-textarea {
  border: 1PX solid #e0e0e0;
}
.zhghInfo-center-textarea textarea {
  width: 100%;
  height: 100px;
  display: block;
  position: relative;
  padding: 2vh;
  font-size: 14px;
}
.button-submit {
  padding: 12PX;
  background: #249eff;
  color: #fff;
  height: 50PX;
  border-radius: 2PX;
  text-align: center;
  line-height: 26PX;
  font-size: 16PX;
  margin-top: 12PX;
}
.button-submit-c {
  padding: 12PX;
  height: 50PX;
  color: #249eff;
  border-radius: 2PX;
  text-align: center;
  line-height: 26PX;
  font-size: 16PX;
  margin-top: 12PX;
  border: 1px solid #eee;
}