Quellcode durchsuchen

第一个可用版本
体验版本

y595705120 vor 3 Jahren
Ursprung
Commit
429fe296db

+ 1 - 1
app.js

@@ -58,7 +58,7 @@ App({
     }
     let _this = this
     let token = wx.getStorageSync('@token');
-    if(!token) return;
+    if(!token) return cb && cb({});
     wx.login({
       success(wxres) {
         if( !wxres.code){

+ 2 - 1
app.json

@@ -1,9 +1,10 @@
 {
   "pages": [
     "pages/rili/index",
+    "pages/detail/visit/index",
+    "pages/detail/out/index",
     "pages/index/index",
     "pages/user/index/index"
-    
   ],
   "tabBar": {
     "color": "#6e6d6b",

+ 34 - 0
pages/detail/out/index.js

@@ -0,0 +1,34 @@
+const util = require("../../../utils/util")
+const app = getApp()
+
+Page({
+  data: {
+    id:0,
+    info:{}
+  },
+  onLoad: function (options) {
+    let id = +options.id||2;
+    this.setData({id});
+  },
+  onShow: function(){
+    app.checkLogin( this.loadData )
+  },
+  loadData(){
+    let id = this.data.id
+    app.formPost( "User.getOutInfo", {id}).then( res=>{
+      if( res.code == 200 ){
+        this.setData({info: res.data})
+      }
+    })
+  },
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+    let {id, username} = this.data.info;
+    return {
+      title: `【${username}】外出信息`,
+      path: `/pages/detail/out/index?id=${id}`
+    }
+  }
+})

+ 8 - 0
pages/detail/out/index.json

@@ -0,0 +1,8 @@
+{
+  "usingComponents": {
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index"
+  },
+  "navigationBarTitleText": "外出详情"
+
+}

+ 13 - 0
pages/detail/out/index.wxml

@@ -0,0 +1,13 @@
+
+<view>
+
+<i-cell-group i-class="my-group-margin" style="width:400rpx">  
+  <i-cell title="姓名"  value="{{info.username}}"></i-cell>
+  <i-cell title="职务"  value="{{info.post}}"></i-cell>
+  <i-cell title="外出事由"  value="{{info.reasons}}"></i-cell>
+  <i-cell title="时间"  value="{{info.fromDate}} 到 {{info.toDate}}"></i-cell>
+  <i-cell title="签批人1"  value="{{info.signName}}"></i-cell>
+  <i-cell title="签批人2"  value="{{info.signConfirm}}"></i-cell>
+  <i-cell title="导入时间"  value="{{info.createAt}}"></i-cell>
+</i-cell-group>
+</view>

+ 3 - 0
pages/detail/out/index.wxss

@@ -0,0 +1,3 @@
+.title{
+  min-width: 150rpx;
+}

+ 34 - 0
pages/detail/visit/index.js

@@ -0,0 +1,34 @@
+const util = require("../../../utils/util")
+const app = getApp()
+
+Page({
+  data: {
+    id:0,
+    info:{}
+  },
+  onLoad: function (options) {
+    let id = +options.id||2;
+    this.setData({id});
+  },
+  onShow: function(){
+    app.checkLogin( this.loadData )
+  },
+  loadData(){
+    let id = this.data.id
+    app.formPost( "User.getVisitInfo", {id}).then( res=>{
+      if( res.code == 200 ){
+        this.setData({info: res.data})
+      }
+    })
+  },
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+    let {id, username} = this.data.info;
+    return {
+      title: `【${username}】莅临信息`,
+      path: `/pages/detail/visit/index?id=${id}`
+    }
+  }
+})

+ 7 - 0
pages/detail/visit/index.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index"
+  },
+  "navigationBarTitleText": "莅临详情"
+}

+ 14 - 0
pages/detail/visit/index.wxml

@@ -0,0 +1,14 @@
+
+<view>
+
+<i-cell-group i-class="my-group-margin" style="width:400rpx">  
+  <i-cell title="姓名"  value="{{info.username}}"></i-cell>
+  <i-cell title="职务"  value="{{info.post}}"></i-cell>
+  <i-cell title="行程概要"  label="{{info.tripSummary}}"></i-cell>
+  <i-cell title="行程周期"  value="{{info.fromDate}} 到 {{info.toDate}}"></i-cell>
+  <i-cell title="陪同情况"  value="{{info.accompany}}"></i-cell>
+  <i-cell title="来文日期"  value="{{info.recvDate}}"></i-cell>
+  <i-cell title="拟办意见"  value="{{info.marks||'-'}}"></i-cell>
+  <i-cell title="导入时间"  value="{{info.createAt}}"></i-cell>
+</i-cell-group>
+</view>

+ 3 - 0
pages/detail/visit/index.wxss

@@ -0,0 +1,3 @@
+.title{
+  min-width: 150rpx;
+}

+ 1 - 1
pages/index/index.js

@@ -76,7 +76,7 @@ Page({
   },
   goDefaultPage(){
     wx.switchTab({
-      url: 'pages/rili/index',
+      url: '/pages/rili/index',
     })
   },
   onShareAppMessage: function(){

+ 37 - 8
pages/rili/index.js

@@ -5,7 +5,7 @@ import timeRange from '../../component/v2/plugins/time-range'
 import week from '../../component/v2/plugins/week'
 import holidays from '../../component/v2/plugins/holidays/index'
 import plugin from '../../component/v2/plugins/index'
-import util, {formatDate, sec2Date} from '../../utils/util.js'
+import util, {formatDate, object2Date} from '../../utils/util.js'
 const app = getApp()
 plugin
   .use(todo)
@@ -19,6 +19,8 @@ const conf = {
   data: {
     outList:[],
     visitList:[],
+    tableData: [],
+    curDate: '',
     calendarConfig: {
       theme: 'elegant',
       // showHolidays: true,
@@ -101,39 +103,66 @@ const conf = {
     ]
   },
   afterTapDate(e) {
-    console.log('afterTapDate', e.detail)
+    let curDate = object2Date( e.detail );
+    this.setData({curDate});
+    this.filterData()
   },
-  onLoad: function(){
+  onShow: function(){
     app.checkLogin(res=>{
       if( !res.userId ){
         wx.navigateTo({
           url: '/pages/index/index',
         })
       }else{
-        console.log("loadData", res )
         this.loadData()
       }
     })
   },
+  filterData(){
+    let {curDate, outList, visitList} = this.data;
+    let allList = outList.map( item=>{
+        item.isOut= true
+        return item;
+      }).concat( visitList );
+
+    let tableData = []
+    for( let i in  allList){
+      if( allList[i].fromDate <= curDate && allList[i].toDate >= curDate){
+        tableData.push( allList[i] );
+      }
+    }
+    console.log("tableData", curDate, allList, tableData)
+    this.setData({tableData})
+  },
+  gotoDetail( e ){
+    let {id,out} = e.currentTarget.dataset;
+    if( out ){
+      wx.navigateTo({
+        url: `/pages/detail/out/index?id=${id}`,
+      })
+    }else{
+      wx.navigateTo({
+        url: `/pages/detail/visit/index?id=${id}`,
+      })
+    }
+  },
   loadData(){
     let curDate = this.data.calendarConfig.defaultDate;
     let fromDate = curDate.substr(0,8)+ "01"
     let toDate = curDate.substr(0,8)+ "31"
-    
     app.formPost("User.loadData", {fromDate, toDate}).then( res=>{
-      console.log("loadData", res )
       if( res.code == 200){
         let outList = res.data.outList||[];
         let visitList = res.data.visitList||[];
         this.setData({outList, visitList});
-        this.loadMarks()
+        this.filterData();
+        this.loadMarks();
       }
     })
   },
   loadMarks(){
     const calendar = this.selectComponent('#calendar').calendar
     let {outList, visitList} = this.data;
-    console.log("loadMarks", outList, visitList )
     var dateMap = {};
     // 外出
     for(let i in outList ){

+ 4 - 1
pages/rili/index.json

@@ -1,6 +1,9 @@
 {
   "navigationBarTitleText": "莅临&外出",
   "usingComponents": {
-    "calendar": "../../component/v2/index"
+    "calendar": "../../component/v2/index",
+    "i-panel": "/component/iView/panel/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-cell-group": "/component/iView/cell-group/index"
   }
 }

+ 17 - 0
pages/rili/index.wxml

@@ -11,6 +11,23 @@
   ></calendar>
 </view>
 
+<view wx:for="{{tableData}}" wx:key="index">
+  <view class="i-class i-card i-card-full" data-id="{{item.id}}" data-out="{{item.isOut}}"  bindtap="gotoDetail" >
+    <view class="i-class i-card-header">
+      <view class="i-card-header-title">
+        {{item.username}} 
+        <text wx:if="{{item.isOut}}" style="color:orange;">【外出】</text>
+        <text wx:else style="color:green;">【莅临】</text>
+      </view>
+      <view class="i-card-header-extra" >
+        {{item.post}}
+      </view>
+    </view>
+    <view class="i-card-footer">
+      {{item.fromDate}} 到 {{item.toDate}}  
+    </view>
+  </view>
+</view>
 <!-- <view class='b cc wrap btn-wrap'>
     <button
       class='b cc btn btn-{{item.color}} btn-action-{{item.action}}'

+ 2 - 1
pages/rili/index.wxss

@@ -1 +1,2 @@
-@import '../calendarComponent/index.wxss'
+@import '../calendarComponent/index.wxss';
+@import '/component/iView/card/index.wxss';

+ 0 - 66
pages/search/file/index.js

@@ -1,66 +0,0 @@
-// pages/search/file/index.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
-})

+ 0 - 3
pages/search/file/index.json

@@ -1,3 +0,0 @@
-{
-  "usingComponents": {}
-}

+ 0 - 2
pages/search/file/index.wxml

@@ -1,2 +0,0 @@
-<!--pages/search/file/index.wxml-->
-<text>pages/search/file/index.wxml</text>

+ 0 - 1
pages/search/file/index.wxss

@@ -1 +0,0 @@
-/* pages/search/file/index.wxss */

+ 6 - 1
utils/util.js

@@ -1,4 +1,4 @@
-const baseUrl = "http://localhost:8000/"
+const baseUrl = "https://ndzx.hqedust.com/"
 const ossUrl = "https://sm-sign.oss-cn-shanghai.aliyuncs.com/cert/"
 const md5 = require('./md5.js');
 
@@ -20,6 +20,10 @@ const formatDate = date => {
   return [year, month, day].map(formatNumber).join('-') 
 }
 
+const object2Date = ({year, month, date}) => {
+  return [year, month, date].map(formatNumber).join('-') 
+}
+
 const sec2Date = sec => {
   let date = new Date( sec * 1000 );
   const year = date.getFullYear()
@@ -187,5 +191,6 @@ module.exports = {
   sec2Date,
   nextDate,
   formatDate,
+  object2Date,
   showBusy
 }