y595705120 4 år sedan
förälder
incheckning
0cd2aff7e1

+ 21 - 9
app.js

@@ -60,11 +60,13 @@ App({
             if( errCode == 0){
               let {user, token} = data
               user.token = token;
-              wx.setStorageSync('@yunyuanqu', user);
+              this.globalData.userInfo = user
+              wx.setStorageSync("@yunyuanqu", user)
+              cb&&cb( user )
             }else{
               util.showMsg( data )
+              cb&&cb( {} )
             }
-            cb&&cb(errCode, data );
           });
         } else {
           console.log('登录失败!' + res.errMsg)
@@ -73,19 +75,16 @@ App({
     })
   },
   checkLogin:function( cb ){
-    var info = wx.getStorageSync('@yunyuanqu')||{};
-    let isLogin =  !!info.token;
-    this.globalData.userInfo = info;
-    if (!isLogin){
+    let info = this.globalData.userInfo;
+    if (!info.token){
       this.doLogin( cb )
     }else{
-      cb&&cb( )
+      cb&&cb( info )
     }
   },
   getSysInfo: function (cb) {
     wx.getSystemInfo({
       success: function (res) {
-        console.log(res)
         typeof cb == "function" && cb(res);
       }
     })
@@ -140,13 +139,15 @@ App({
   },
   setUserInfo( userInfo ){
     userInfo = Object.assign(this.globalData.userInfo, userInfo )
-    wx.setStorageSync('@flogin', userInfo);
     this.globalData.userInfo = userInfo;
   },
   setMakerInfo( maker ){
     maker = Object.assign(this.globalData.maker, maker )
     this.globalData.maker = maker;
   },
+  identifyUser(){
+    this.globalData.userInfo.identify=1
+  },
   getMakerInfo( cb ){
     if( this.globalData.maker.id ){
       cb&&cb( this.globalData.maker);
@@ -161,7 +162,18 @@ App({
       })
     }
   },
+  setTaskTab(val){
+    this.globalData.taskTab = val||0;
+  },
+  setAction(val){
+    this.globalData.action = val;
+  },
+  getAction(){
+    return this.globalData.action;
+  },
   globalData: {
+    taskTab:0,
+    action: false,
     userInfo: {},
     location: {},
     maker: {},

+ 9 - 4
app.json

@@ -1,12 +1,17 @@
 {
   "pages": [
+    "pages/index/index",
+    "pages/task/lyg/index",
+    "pages/task/submit/subtask",
+    
+    "pages/tool/sign/signature",
+    "pages/tool/agree/agree",
     "pages/me/index",
+    "pages/login/login",
+    "pages/task/info/info",
     "pages/user/info/index",
-    "pages/tool/sign/signature",
-    "pages/index/index",
     "pages/tool/identify/index",
-    "pages/task/rob/index",
-    "pages/task/lyg/index",
+    
     "pages/task/trade/index",
     "pages/task/demand/index",
     "pages/task/supply/index",

+ 3 - 0
app.wxss

@@ -9,8 +9,11 @@
 .p10{padding: 10rpx;}
 
 .ml20{margin-left: 20rpx;}
+.ml40{margin-left: 40rpx;}
 .ml50{margin-left: 50rpx;}
+
 .mt10{margin-top: 10rpx;}
+.mt20{margin-top: 20rpx;}
 .mt30{margin-top: 30rpx;}
 .tc{text-align: center;}
 .tl{text-align: left;}

BIN
img/sign/handwriting.gif


BIN
img/yz.png


+ 13 - 0
pages/account/index.js

@@ -25,6 +25,18 @@ Page({
       url: `/pages/log/log?month=${monthStr}`,
     })
   },
+  loadData(){
+    let nd = this.data.nd
+    util.http("/wx/incomeInfo", {}, (err, res) =>{
+      if( err == 0){
+        nd = Object.assign( nd, res )
+        this.setData({ nd })
+      }
+    });
+  },
+  onShow: function(){
+    this.loadData()
+  },
   onLoad: function (options) {
     var date = new Date();
     let year=date.getFullYear();
@@ -34,5 +46,6 @@ Page({
       picker[year+'-'+month+'01'] = year+'年'+i+'月';
     }
     this.setData({submit:false,picker,year, month})
+    this.loadData()
   }
 })

+ 2 - 2
pages/account/index.wxml

@@ -1,5 +1,5 @@
-<cu-custom isBack="{{true}}">
-  <view slot="backText">返回</view>
+<cu-custom isCustom="{{true}}">
+  <view slot="backText">主页</view>
   <view slot="content">账单管理</view>
 </cu-custom>
 

+ 8 - 0
pages/index/index.js

@@ -33,6 +33,14 @@ Page({
   },
   onShow: function(){
     this.data.info.id || this.loadData( );
+  },
+  gotoIdentify:()=>{
+    wx.navigateTo({
+      url: '/pages/tool/identify/index',
+    })
+  },
+  onShareAppMessage: function () {
+
   }
   
 })

+ 11 - 8
pages/index/index.wxml

@@ -33,7 +33,7 @@
     </view>
   </navigator>
 
-  <navigator url="/pages/task/rob/index" hover-class="none" open-type="navigate">
+  <navigator url="/pages/task/lyg/index" hover-class="none" open-type="switchTab">
     <view class="cate-item">
       <image src="/img/4.png"></image>
       <text>任务大厅</text>
@@ -52,14 +52,17 @@
 
 
 <view class="ml50">
-  <view class="cu-card" data-id="1" bindtap="getDetail">
-    <view class="p20 tl">1、如何注册以及实名认证</view>
-  </view>
-  <view class="cu-card" data-id="1" bindtap="getDetail">
-    <view class="p20 tl">2、接单的完整流程</view>
+  <view class="cu-card" >
+    <view class="anw-title" bindtap="gotoIdentify">1、如何实名认证</view>
+    <view class="anw-content">
+      登陆后,打开个人中心-我的资料,实名认证上传身份证手机号,然后绑定银行卡和签署电子合同。
+    </view>
   </view>
-  <view class="cu-card" data-id="1" bindtap="getDetail">
-    <view class="p20 tl">3、名词解释</view>
+  <view class="cu-card">
+    <view class="anw-title">2、接单的完整流程</view>
+    <view class="anw-content">
+      在“任务大厅”的“待接任务”进行抢单,在“已确认”中进行任务交付,然后在“已交付”和“已完成”中查看完结和打款进度。
+    </view>
   </view>
 </view>
 

+ 12 - 0
pages/index/index.wxss

@@ -238,4 +238,16 @@ session
     border-radius: 10px;
     overflow: hidden;
     margin-right: 8rpx;
+}
+
+.anw-title{
+    font-size: 32rpx;
+    font-weight: 900;
+    padding:8rpx;
+}
+.anw-content{
+    font-size: 25rpx;
+    padding:24rpx;
+    color:#fa436a;
+    line-height:150%;
 }

+ 19 - 0
pages/login/login.js

@@ -0,0 +1,19 @@
+const app = getApp();
+const util = require("../../util/util.js")
+Page({
+  data: {
+    StatusBar: app.globalData.StatusBar,
+    CustomBar: app.globalData.CustomBar,
+  },
+  login( ){
+    wx.setStorageSync("@yunyuanqu", {})
+    app.doLogin( (res)=>{
+      wx.navigateBack({
+        delta: 1,
+      })
+    })
+  },
+  onLoad: function (options) {
+
+  }
+})

+ 0 - 0
pages/task/rob/index.json → pages/login/login.json


+ 15 - 0
pages/login/login.wxml

@@ -0,0 +1,15 @@
+
+<view class='container' style="margin-top: {{CustomBar}}px;">
+  <view class='userinfo'>
+    <view class='userinfo-avatar' >
+      <open-data type="userAvatarUrl"></open-data>
+    </view>
+    <view class='userinfo-name'>
+      <open-data type="userNickName"></open-data>
+    </view>
+    <button class="cu-btn bg-green tc fc mt20" bindtap="login" >
+      点击登入
+    </button>
+  </view>
+  
+</view>

+ 21 - 0
pages/login/login.wxss

@@ -0,0 +1,21 @@
+.userinfo {
+  position: relative;
+  width: 100%;
+  background: #fff;
+  text-align: center;
+  padding: 30rpx 0;
+}
+.userinfo .userinfo-avatar {
+  overflow: hidden;
+  display: block;
+  width: 160rpx;
+  height: 160rpx;
+  border-radius: 50%;
+  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
+  margin: auto;
+}
+.userinfo .userinfo-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  margin-top: 20rpx;
+}

+ 17 - 5
pages/me/index.js

@@ -6,22 +6,26 @@ Page({
     CustomBar: app.globalData.CustomBar,
     mytask:[{
       img: "../../img/server/order.png",
-      openpath: "/pages/task/rob/index?tab=0",
+      openpath: "/pages/task/lyg/index",
+      tab:0,
       text: "任务中心"
     },
     {
       img: "../../img/server/doing.png",
-      openpath: "/pages/task/rob/index?tab=1",
+      openpath: "/pages/task/lyg/index",
+      tab:1,
       text: "待交付"
     },
     {
       img: "../../img/server/account.png",
-      openpath: "/pages/task/rob/index?tab=2",
+      openpath: "/pages/task/lyg/index",
+      tab:2,
       text: "已交付"
     },
     {
       img: "../../img/server/history.png",
-      openpath: "/pages/task/rob/index?tab=3",
+      openpath: "/pages/task/lyg/index",
+      tab:3,
       text: "已完成"
     }
     ],
@@ -43,7 +47,7 @@ Page({
     },
     {
       img: "../../img/server/info.png",
-      openpath: "/pages/tool/sign/signature",
+      openpath: "/pages/tool/agree/agree",
       text: "电子合同"
     }
     
@@ -66,6 +70,14 @@ Page({
       }
     ]
   },
+  selectTag(e){
+    let {tab, url} = e.currentTarget.dataset;
+    console.log( {tab, url} )
+    app.setTaskTab( tab );
+    wx.switchTab({
+      url: url,
+    })
+  },
 
   onLoad: function (options) {
     app.getMakerInfo()

+ 5 - 6
pages/me/index.wxml

@@ -1,6 +1,5 @@
-<!--pages/me/index.wxml-->
-<cu-custom isBack="{{true}}">
-  <view slot="backText">返回</view>
+<cu-custom isCustom="{{true}}">
+  <view slot="backText">主页</view>
   <view slot="content">个人中心</view>
 </cu-custom>
 
@@ -23,14 +22,14 @@
   </view>
   <view class="list-server">
     <view class="listbox" wx:for="{{mytask}}" wx:key="img">
-      <navigator url="{{item.openpath}}" hover-class="none" open-type="navigate">
-        <view>
+      <!-- <navigator url="{{item.openpath}}" hover-class="none" open-type="switchTab"> -->
+        <view data-url="{{item.openpath}}" data-tab="{{item.tab}}" bindtap="selectTag">
           <image src="{{item.img}}" class="listimg" />
         </view>
         <view class="fs28">
           {{item.text}}
         </view>
-      </navigator>
+      <!-- </navigator> -->
     </view>
   </view>
   <view class="clear"></view>

+ 19 - 9
pages/task/demand/index.wxml

@@ -7,32 +7,40 @@
   <view class="tark-list" wx:for="{{list}}" wx:key="id" wx:for-index="index">
     <view class="cu-list menu-avatar">
       <view class="cu-item">
-        <image src="/img/1.png" class="cu-avatar round lg"></image>
+        <view class="cu-avatar round lg">需</view>
         <view class="content flex-sub">
           <view>{{item.product}}</view>
           <view class="text-gray text-sm flex justify-between">
-            {{item.company}}
+            企业:{{item.company}}
           </view>
         </view>
       </view>
       <!-- 任务详情 -->
       <view class="padding text-grey bg-white">
         <view class="text-cut">
-          <view class="fl w100">任务编号 : </view>
+          <view class="fl w100"> 需求编号: </view>
           <text class="text-blue">{{item.id}}</text>
         </view>
         <view class="margin-top-sm">
-          <view class="fl w100">交易金额 : </view>
-          <text class="text-blue">¥{{item.fee/100}}元</text>
+          <view class="fl w100">产品单价 : </view>
+          <text class="text-blue">  {{item.unit_fee}}  {{item.unit_fee=='面议'?'':('元/'+item.unit)}} 
+          </text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">任务类型 : </view>
-          <text class="text-blue">{{item.type}}</text>
+          <view class="fl w100">产品数量 : </view>
+          <text class="text-blue">{{item.amount}}{{item.unit}} </text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">关联公司 : </view>
-          <text class="text-blue">{{item.target||'---'}}</text>
+          <view class="fl w100"> 联 系 人 : </view>
+          <text class="text-blue">{{item.contact}}</text>
         </view>
+        <view class="margin-top-sm">
+          <view class="fl w100">联系电话 : </view>
+          <text class="text-blue">{{item.phone}}</text>
+        </view>
+        
       </view>
     </view>
   </view>
@@ -40,8 +48,10 @@
     <view class="padding">没有更多了</view>
     <view class='cu-tabbar-height'></view>
   </view>
+  
   <view class='cu-tabbar-height'></view>
 </scroll-view>
+
 <view class='cu-load load-modal' wx:if="{{loadModal}}">
   <view class='cuIcon-emojifill text-orange'></view>
   <view class='gray-text'>加载中...</view>

+ 28 - 0
pages/task/info/info.js

@@ -0,0 +1,28 @@
+// pages/user/info/index.js
+const app = getApp();
+const util = require("../../../util/util.js")
+Page({
+  data: {
+    info:{}
+  },
+  onLoad: function (options) {
+    let id = +options.id||200123;
+    util.http('/wx/getWxTaskInfo', {id}, (err,res)=>{
+      if( err != 0) return;
+      console.log( "res", res)
+      this.setData({info: res})
+    })
+  },
+  previewImage: function (e) {
+    var current = e.target.dataset.src;
+    wx.previewImage({
+      current: current, 
+      urls: [current]
+    })
+  },
+  gotoSign(){
+    wx.navigateTo({
+      url: '/pages/tool/sign/signature',
+    })
+  }
+})

+ 3 - 0
pages/task/info/info.json

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

+ 76 - 0
pages/task/info/info.wxml

@@ -0,0 +1,76 @@
+<cu-custom isBack="{{true}}">
+  <view slot="backText">返回</view>
+  <view slot="content">任务详情</view>
+</cu-custom>
+
+<view class="cu-list menu" style="margin-top:{{StatusBar}}px;">
+  <view class="cu-form-group">
+    <view class="title solids-right">任务标题</view>
+    <input  class="ml20" value="{{info.title}}" disabled></input>
+  </view>
+  <view class="cu-form-group">
+    <view class="title solids-right">发布企业</view>
+    <input  class="ml20" value="{{info.company}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group">
+    <view class="title solids-right">任务类型</view>
+    <input  class="ml20" value="{{info.category}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group">
+    <view class="title solids-right">预算费用</view>
+    <input  class="ml20" value="{{info.budget_fee/100}}元" disabled></input>
+  </view>
+
+  <view class="cu-form-group">
+    <view class="title solids-right">预算费用</view>
+    <input  class="ml20" value="{{info.budget_fee/100}}元" disabled></input>
+  </view>
+
+  <view class="cu-form-group" wx:if="{{info.confirm}}">
+    <view class="title solids-right">实际费用</view>
+    <input  class="ml20" value="{{info.fee/100}}元" disabled></input>
+  </view>
+
+  <view class="cu-form-group" wx:if="{{info.maker}}">
+    <view class="title solids-right">接单人员</view>
+    <input class="ml20" value="{{info.maker}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group" wx:if="{{info.maker}}">
+    <view class="title solids-right">联系方式</view>
+    <input class="ml20" value="{{info.contact}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group" wx:if="{{info.maker}}">
+    <view class="title solids-right">联系电话</view>
+    <input class="ml20" value="{{info.phone}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group">
+    <view class="title solids-right">是否完成</view>
+    <input class="ml20" value="{{info.finish?'是':'否'}}" disabled></input>
+  </view>
+
+  <view class="cu-form-group" wx:if="{{info.maker}}">
+    <view class="title solids-right">发布时间</view>
+    <input class="ml20" value="{{info.created_at}}" disabled></input>
+  </view>
+
+
+
+  <view class="cu-form-group" wx:if="{{info.maker}}">
+    <view class="title">任务详情</view>
+  </view>
+
+  <view class="cu-form-group">
+    <rich-text  nodes="{{info.content}}"></rich-text>
+  </view>
+
+  
+  
+
+
+
+</view>

+ 1 - 0
pages/task/info/info.wxss

@@ -0,0 +1 @@
+/* pages/task/info/info.wxss */

+ 53 - 18
pages/task/lyg/index.js

@@ -9,6 +9,7 @@ Page({
     size:6,
     TabCur:0,
     scrollLeft:0,
+    userInfo:{},
     tabList:["待接任务","已确认","已交付","已完成"],
     list:[
     ]
@@ -17,16 +18,24 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function ( opt) {
-    let TabCur = +opt.tab||0
+    let TabCur = app.globalData.taskTab||0;
+    console.log( "TabCur", TabCur)
     this.setData( {TabCur} )
     app.checkLogin( ()=>{
-      this.loadData()
+      this.getuserInfo( this.loadData)
+    } )
+  },
+  getuserInfo( cb ){
+    app.getMakerInfo( (userInfo)=>{
+      this.setData({userInfo})
+        cb&&cb()
     } )
   },
   tabSelect(e){
     this.setData({
       TabCur: e.currentTarget.dataset.id,
       list:[],
+      from:0,
       scrollLeft: (e.currentTarget.dataset.id - 1) * 80
     })
     this.getTaskList(0)
@@ -36,17 +45,29 @@ Page({
     let item = this.data.list[index]
     util.http("/wx/applyWxTask", {id:item.id}, (err, res) =>{
       if( err != 0) return;
-      item.is_bid = 1
+      item.maker_id = 1
       this.setData({ list: this.data.list})
-      util.showMsg("抢单子成功");
+      util.showSuccess("抢单子成功");
     })
   },
-
   onPullDownRefresh: function () {
+    console.log( "onPullDownRefresh")
     this.getTaskList( 0, ()=>{
       wx.stopPullDownRefresh();
     })
   },
+  onShow(){
+    let action = app.getAction()
+    if( action && action.action=="addDeliverImg"){
+      let list = this.data.list;
+      let {id, url} = action.data;
+      list = list.map((item)=>{
+        if( item.id == id) item.deliver_img = url
+        return item
+      })
+      this.setData({list});
+    }
+  },
   onReachBottom: function () {
     var that = this
     let newFrom = that.data.from
@@ -78,6 +99,8 @@ Page({
       if( err != 0) return;
       if (newFrom == 0) list = [];
       let newlist = res.list.map( item =>{
+        item.created_at = item.created_at&&item.created_at.substr(0,19).replace("T", " ")||'---';
+        item.finish_at = item.finish_at&&item.finish_at.substr(0,19).replace("T", " ")||'---';
         return item
       });
       that.setData({
@@ -90,6 +113,12 @@ Page({
   loadData :function( ){
     this.getTaskList(0)
   },
+  goDetail(e){
+    let id = e.target.dataset.id;
+    wx.navigateTo({
+      url: `/pages/task/info/info?id=${id}`,
+    })
+  },
   previewImage: function (e) {
     var current = e.target.dataset.src;
     wx.previewImage({
@@ -99,19 +128,25 @@ Page({
   } ,
   uplodImg: function(e ){
     let index = e.currentTarget.dataset.index;
-    console.log("uplodImg", e.currentTarget.dataset)
-    this.setData({index});
-    wx.chooseImage({  
-      count: 1,  
-      sizeType: ['compressed'], 
-      sourceType: ['album', 'camera'],
-      success:  (res) =>{
-        var tempImagePath = res.tempFilePaths[0];
-        util.uploadFile( tempImagePath, this.doUpload )
-      },
-      fail:()=>{
-        app.showMsg('选择失败')
-      }
+    let {id,title} = this.data.list[index]
+    wx.navigateTo({
+      url: `/pages/task/submit/subtask?id=${id}&title=${title}`,
     })
+
+
+    // console.log("uplodImg", e.currentTarget.dataset)
+    // this.setData({index});
+    // wx.chooseImage({  
+    //   count: 1,  
+    //   sizeType: ['compressed'], 
+    //   sourceType: ['album', 'camera'],
+    //   success:  (res) =>{
+    //     var tempImagePath = res.tempFilePaths[0];
+    //     util.uploadFile( tempImagePath, this.doUpload )
+    //   },
+    //   fail:()=>{
+    //     app.showMsg('选择失败')
+    //   }
+    // })
   }
 })

+ 20 - 10
pages/task/lyg/index.wxml

@@ -1,5 +1,5 @@
-<cu-custom isBack="{{true}}">
-  <view slot="backText">返回</view>
+<cu-custom isCustom="{{true}}">
+  <view slot="backText">主页</view>
   <view slot="content">任务大厅</view>
 </cu-custom>
 
@@ -14,7 +14,7 @@
     <view class="cu-list menu-avatar">
       <view class="cu-item">
         <image src="/img/1.png" class="cu-avatar round lg"></image>
-        <view class="content flex-sub">
+        <view class="content flex-sub" bindtap="goDetail" data-id="{{item.id}}">
           <view>{{item.title}}</view>
           <view class="text-gray text-sm flex justify-between">
             {{item.company}}
@@ -30,15 +30,20 @@
           <view class="text-left margin-top-sm">预算金额 : 
             <text class="text-blue">¥{{item.budget_fee/100}}元</text>
           </view>
-          <view class="text-left margin-top-sm" wx:if="{{item.fee}}">实际金额 : 
+
+          <view class="text-left margin-top-sm" wx:if="{{item.confirm>0 && item.fee}}">实际金额 : 
             <text class="text-blue">¥{{item.fee/100}}元</text>
           </view>
 
           <view class="text-left margin-top-sm">任务分类 : 
             <text class="text-blue">{{item.category}}</text>
           </view>
+
+          <view class="text-left margin-top-sm">发布时间 : 
+            <text class="text-blue">{{item.created_at}}</text>
+          </view>
           
-          <view class="text-left margin-top-sm" wx:if="{{item.finish}}">完成时间 : 
+          <view class="text-left margin-top-sm" wx:if="{{TabCur==3}}">完成时间 : 
             <text class="text-blue ">{{item.finish_at}}</text>
           </view>
 
@@ -56,12 +61,17 @@
  
           <!-- 未接任务 -->
           <view wx:if="{{TabCur==0}}" class="margin-top-sm">
-            <button type="text" class="text-blue bg-white" wx:if="{{item.is_bid==0}}" bindtap="bidTask" data-index="{{index}}" >
-              抢单
-            </button>
-            <button type="text" class="text-gray bg-white" wx:else >
-              已经抢过
+            <button type="text" class="text-blue bg-white" wx:if="{{!userInfo.identify}}">
+              还未实名认证
             </button>
+            <view wx:else>
+              <button type="text" class="text-blue bg-white" wx:if="{{item.maker_id==0}}" bindtap="bidTask" data-index="{{index}}" >
+                抢单
+              </button>
+              <button type="text" class="text-gray bg-white" wx:else >
+                已经抢过
+              </button>
+            </view>
           </view>
         </view>
       </view>

+ 0 - 117
pages/task/rob/index.js

@@ -1,117 +0,0 @@
-const app = getApp();
-const util = require("../../../util/util.js")
-Page({
-  data: {
-    StatusBar: app.globalData.StatusBar,
-    CustomBar: app.globalData.CustomBar,
-    loadModal:false,
-    from:0,
-    size:6,
-    TabCur:0,
-    scrollLeft:0,
-    tabList:["待接任务","已确认","已交付","已完成"],
-    list:[
-    ]
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function ( opt) {
-    let TabCur = +opt.tab||0
-    this.setData( {TabCur} )
-    app.checkLogin( ()=>{
-      this.loadData()
-    } )
-  },
-  tabSelect(e){
-    this.setData({
-      TabCur: e.currentTarget.dataset.id,
-      list:[],
-      scrollLeft: (e.currentTarget.dataset.id - 1) * 80
-    })
-    this.getTaskList(0)
-  },
-  bidTask: function( e ){
-    let index = e.currentTarget.dataset.index;
-    let item = this.data.list[index]
-    util.http("/wx/applyWxTask", {id:item.id}, (err, res) =>{
-      if( err != 0) return;
-      item.is_bid = 1
-      this.setData({ list: this.data.list})
-      util.showMsg("抢单子成功");
-    })
-  },
-
-  onPullDownRefresh: function () {
-    this.getTaskList( 0, ()=>{
-      wx.stopPullDownRefresh();
-    })
-  },
-  onReachBottom: function () {
-    var that = this
-    let newFrom = that.data.from
-    if (newFrom == -1) {
-      wx.stopPullDownRefresh();
-      return;
-    }
-    this.getTaskList(newFrom, wx.stopPullDownRefresh);
-  },
-  doUpload( err, {url} ){
-    if( err !=0 || !url ) {
-      util.showMsg("图片上传失败")
-      return
-    }
-    let {index,list} = this.data
-    let id = list[index].id
-    util.http( '/maker/addDeliverImg', {id, url}, (err,res)=>{
-      if( err!= 0 ) return;
-      list[index].deliver_img = url;
-      this.setData({list});
-    })
-  },
-  getTaskList: function( newFrom, cb){
-    let type = this.data.TabCur +1;
-    let param = { from: newFrom, size:this.data.size, type }
-    let list = this.data.list
-    let that = this
-    util.http("/wx/getWxTaskList", param, function (err, res) {
-      if( err != 0) return;
-      if (newFrom == 0) list = [];
-      let newlist = res.list.map( item =>{
-        return item
-      });
-      that.setData({
-        from: res.from || -1,
-        list: list.concat(newlist)
-      })
-      cb && cb()
-    });
-  },
-  loadData :function( ){
-    this.getTaskList(0)
-  },
-  previewImage: function (e) {
-    var current = e.target.dataset.src;
-    wx.previewImage({
-      current: current, 
-      urls: [current]
-    })
-  } ,
-  uplodImg: function(e ){
-    let index = e.currentTarget.dataset.index;
-    console.log("uplodImg", e.currentTarget.dataset)
-    this.setData({index});
-    wx.chooseImage({  
-      count: 1,  
-      sizeType: ['compressed'], 
-      sourceType: ['album', 'camera'],
-      success:  (res) =>{
-        var tempImagePath = res.tempFilePaths[0];
-        util.uploadFile( tempImagePath, this.doUpload )
-      },
-      fail:()=>{
-        app.showMsg('选择失败')
-      }
-    })
-  }
-})

+ 0 - 81
pages/task/rob/index.wxml

@@ -1,81 +0,0 @@
-<cu-custom isBack="{{true}}">
-  <view slot="backText">返回</view>
-  <view slot="content">任务大厅</view>
-</cu-custom>
-
-<scroll-view scroll-x class="text-center" scroll-with-animation scroll-left="{{scrollLeft}}" >
-  <view class="nav bg-white nav-list">
-    <view class="cu-item {{index==TabCur?'text-green cur':''}}" wx:for="{{tabList}}" bindtap="tabSelect" wx:key="index" data-id="{{index}}">
-      {{tabList[index]}}
-    </view>
-  </view>
-
-  <view class="tark-list" wx:for="{{list}}" wx:key="id" wx:for-index="index">
-    <view class="cu-list menu-avatar">
-      <view class="cu-item">
-        <image src="/img/1.png" class="cu-avatar round lg"></image>
-        <view class="content flex-sub">
-          <view>{{item.title}}</view>
-          <view class="text-gray text-sm flex justify-between">
-            {{item.company}}
-          </view>
-        </view>
-      </view>
-      <!-- 任务详情 -->
-      <view class="text-grey bg-white">
-        <view class="padding bg-white ">
-          <view class="text-left">任务编号 : 
-            <text class="text-blue">{{item.id}}</text>
-          </view>
-          <view class="text-left margin-top-sm">预算金额 : 
-            <text class="text-blue">¥{{item.budget_fee/100}}元</text>
-          </view>
-          <view class="text-left margin-top-sm" wx:if="{{item.fee}}">实际金额 : 
-            <text class="text-blue">¥{{item.fee/100}}元</text>
-          </view>
-
-          <view class="text-left margin-top-sm">任务分类 : 
-            <text class="text-blue">{{item.category}}</text>
-          </view>
-          
-          <view class="text-left margin-top-sm" wx:if="{{item.finish}}">完成时间 : 
-            <text class="text-blue ">{{item.finish_at}}</text>
-          </view>
-
-           <!-- 已经交付 -->
-          <view class="text-left margin-top-sm" wx:if="{{TabCur==2}}"> 企业付款 : 
-            <text class="text-blue ">{{item.pay_time?'已经付款':'未付款'}}</text>
-          </view>
-
-          <!-- 待交付 -->
-          <view data-index="{{index}}" wx:if="{{TabCur==1}}" class="margin-top-sm">
-            <button class="cu-btn bg-blue " style="margin-right:30rpx;" wx:if="{{item.deliver_img}}" 
-                data-src="{{item.deliver_img}}" bindtap="previewImage">查看交付</button>
-            <button class="cu-btn bg-blue" data-index="{{index}}" bindtap="uplodImg">任务交付</button>
-          </view>
- 
-          <!-- 未接任务 -->
-          <view wx:if="{{TabCur==0}}" class="margin-top-sm">
-            <button type="text" class="text-blue bg-white" wx:if="{{item.is_bid==0}}" bindtap="bidTask" data-index="{{index}}" >
-              抢单
-            </button>
-            <button type="text" class="text-gray bg-white" wx:else >
-              已经抢过
-            </button>
-          </view>
-        </view>
-      </view>
-    </view>
-  </view>
-  <view wx:if="{{from==-1}}"  class="flex-sub text-center">
-    <view class="padding">没有更多了</view>
-    <view class='cu-tabbar-height'></view>
-  </view>
-  <view class='cu-tabbar-height'></view>
-</scroll-view>
-
-
-<view class='cu-load load-modal' wx:if="{{loadModal}}">
-  <view class='cuIcon-emojifill text-orange'></view>
-  <view class='gray-text'>加载中...</view>
-</view>

+ 0 - 16
pages/task/rob/index.wxss

@@ -1,16 +0,0 @@
-
-.tark-list{
-  border-radius: 20rpx;
-  margin-top:16rpx;
-  padding-left: 20rpx;
-  padding-right: 20rpx;
-}
-.w100{
-  width: 100rpx;
-}
-.ml100{
-  margin-left: 100rp;
-}
-.nav-list{
-  position: static;
-}

+ 45 - 0
pages/task/submit/subtask.js

@@ -0,0 +1,45 @@
+const app = getApp();
+const util = require("../../../util/util.js")
+Page({
+  data: {
+    info:{
+      id:0,
+      title:"",
+    },
+    url : ""
+  },
+  onLoad: function (options) {
+    let id = +options.id||200123;
+    let title = options.title||"";
+    let url = ""
+    this.setData({info: {id,title, url}})
+  },
+  okUpload( err, {url}){
+    this.setData({url})
+  },
+  confirm( e  ){
+    let id = this.data.info.id
+    let url = this.data.url
+    let {marks} =  e.detail.value;
+    let param = {id, marks,url}
+    util.http( '/maker/addDeliverImg', param, (err,res)=>{
+      if( err!= 0 ) return;
+      util.showSuccess("交付成功");
+      app.setAction( {action:"addDeliverImg",data:param})
+    })
+  },
+  ChooseImage() {
+    let that = this
+    wx.chooseImage({
+      count: 1, //默认9
+      sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+      sourceType: ['album', 'camera'], //从相册选择
+      
+      success: (res) => {
+        util.uploadFile(res.tempFilePaths[0], that.okUpload );
+      }
+    });
+  },
+  onShareAppMessage: function () {
+  }
+})

+ 3 - 0
pages/task/submit/subtask.json

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

+ 63 - 0
pages/task/submit/subtask.wxml

@@ -0,0 +1,63 @@
+<cu-custom  isBack="{{true}}">
+  <view slot="backText">返回</view>
+  <view slot="content">任务交付</view>
+</cu-custom>
+
+<form bindsubmit="confirm" class='bg-white' style="margin-top:{{StatusBar}}px;">
+  <view class="cu-form-group">
+    <view class="title solids-right">任务名称</view>
+    <input  value="{{info.title}}"  name="title" disabled></input>
+  </view>
+
+  <view class="cu-form-group">
+    <view class="title solids-right">交付描述</view>
+    <textarea  maxlength="-1" value="{{info.marks}}"  name="marks"></textarea>
+  </view>
+
+  <view class="cu-form-group margin-top">
+    <view class="content">
+      <text class="cuIcon-btn text-blue"></text>
+      <text class="text-grey">选择交付图片</text>
+    </view>
+    <view class="action">
+      <button class="cu-btn  bg-blue shadow" bindtap="ChooseImage">
+        <text class="cuIcon-upload"></text>点击上传</button>
+    </view>
+  </view>
+
+  <view class="cu-card case no-card">
+    <view class="cu-item shadow">
+      <view  class="image" bindtap="ViewImage" data-url="{{url}}" wx:if="{{url!=''}}">
+        <image src='{{url}}' mode='aspectFill'></image>
+      </view>
+    </view>
+  </view>
+
+  <view class="margin-top-xl" >
+    <button class="bg-blue radius text-center text-xl" form-type="submit"> 确认交付 </button>
+  </view>
+  <view class='cu-tabbar-height'></view>
+</form> 
+
+<view class='cu-load load-modal' wx:if="{{loadModal}}">
+  <view class='cuIcon-emojifill text-orange'></view>
+  <view class='gray-text'>加载中...</view>
+</view>
+
+
+<view class="cu-modal bottom-modal {{modalName=='ChooseModal'?'show':''}}" bindtap="hideModal">
+  <view class="cu-dialog" catchtap>
+    <view class="cu-bar bg-white">
+      <view class="action text-blue" bindtap="hideModal">取消</view>
+      <view class="action text-green" bindtap="hideModal">确定</view>
+    </view>
+    <view class="grid col-2 padding-sm">
+      <view wx:for="{{classList}}" class="padding-xs" wx:key="id">
+        <button class="cu-btn blue lg block {{item.checked?'bg-blue':'line-blue'}}" 
+        bindtap="ChooseCheckbox" data-value="{{item.id}}"> 
+          {{item.name}}
+        </button>
+      </view>
+    </view>
+  </view>
+</view>

+ 7 - 0
pages/task/submit/subtask.wxss

@@ -0,0 +1,7 @@
+textarea {
+  width: 700rpx;
+  height: 700rpx;
+  margin-left: 10rpx;
+  margin-right: 10rpx;
+  margin-top: 10rpx;
+}

+ 27 - 9
pages/task/supply/index.wxml

@@ -3,11 +3,21 @@
   <view slot="content">供应大厅</view>
 </cu-custom>
 
-<scroll-view scroll-y class="scrollPage">
+<!-- <view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px;">
+  <view class="search-form round">
+    <text class="cuIcon-search"></text>
+    <input type="text" placeholder="输入搜索的关键词" confirm-type="search"></input>
+  </view>
+  <view class="action">
+    <button class="cu-btn bg-gradual-green shadow-blur round">搜索</button>
+  </view>
+</view> -->
+
+<scroll-view scroll-y class="scrollPage" style="top:{{CustomBar}}px;">
   <view class="tark-list" wx:for="{{list}}" wx:key="id" wx:for-index="index">
     <view class="cu-list menu-avatar">
       <view class="cu-item">
-        <image src="/img/1.png" class="cu-avatar round lg"></image>
+        <view class="cu-avatar round lg">供</view>
         <view class="content flex-sub">
           <view>{{item.product}}</view>
           <view class="text-gray text-sm flex justify-between">
@@ -18,20 +28,28 @@
       <!-- 任务详情 -->
       <view class="padding text-grey bg-white">
         <view class="text-cut">
-          <view class="fl w100">任务编号 : </view>
+          <view class="fl w100">供应编号: </view>
           <text class="text-blue">{{item.id}}</text>
         </view>
+
+        <view class="margin-top-sm">
+          <view class="fl w100">产品单价: </view>
+          <text class="text-blue">  {{item.unit_fee}}  {{item.unit_fee=='面议'?'':('元/'+item.unit)}} 
+          </text>
+        </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">交易费用 : </view>
-          <text class="text-blue">{{item.fee/100}}元</text>
+          <view class="fl w100">产品数量: </view>
+          <text class="text-blue">{{item.amount}}{{item.unit}} </text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">任务类型 : </view>
-          <text class="text-blue">{{item.type}}</text>
+          <view class="fl w100">联 系 人: </view>
+          <text class="text-blue">{{item.contact}}</text>
         </view>
         <view class="margin-top-sm">
-          <view class="fl w100">关联公司 : </view>
-          <text class="text-blue">{{item.target||'---'}}</text>
+          <view class="fl w100">联系电话 : </view>
+          <text class="text-blue">{{item.phone}}</text>
         </view>
       </view>
     </view>

+ 17 - 21
pages/task/trade/index.wxml

@@ -6,42 +6,37 @@
 <scroll-view scroll-y class="scrollPage">
   <view class="tark-list" wx:for="{{list}}" wx:key="id" wx:for-index="index">
     <view class="cu-list menu-avatar">
-      <view class="cu-item">
-        <image src="/img/1.png" class="cu-avatar round lg"></image>
-        <view class="content flex-sub">
-          <view>{{item.product}}</view>
-          <view class="text-gray text-sm flex justify-between">
-            企业:{{item.company}}
-          </view>
-        </view>
-      </view>
       <!-- 任务详情 -->
       <view class="padding text-grey bg-white">
         <view class="text-cut">
-          <view class="fl w100">任务编号 : </view>
+          <view class="fl w100"> 供应编号: </view>
           <text class="text-blue">{{item.id}}</text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">交易费用 : </view>
-          <text class="text-blue">{{item.fee/100}}元</text>
+          <view class="fl w100">公司名称 : </view>
+          <text class="text-blue"> {{item.company}} </text>
         </view>
         <view class="margin-top-sm">
-          <view class="fl w100">交易类型 : </view>
-          <text class="text-blue">{{item.type}}</text>
+          <view class="fl w100">交易产品 : </view>
+          <text class="text-blue"> {{item.product}} </text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">关联公司 : </view>
-          <text class="text-blue">{{item.target||'---'}}</text>
+          <view class="fl w100">交易数量 : </view>
+          <text class="text-blue">{{item.amount}}{{item.unit}} </text>
         </view>
+
         <view class="margin-top-sm">
-          <view class="fl w100">业务员 : </view>
-          <text class="text-blue">{{item.saleman||'---'}}</text>
+          <view class="fl w100">交易金额: </view>
+          <text class="text-blue">¥{{item.fee/100}}元</text>
         </view>
+        
         <view class="margin-top-sm">
-          <view class="fl w100">完成时间 : </view>
-          <text class="text-blue">{{item.finish_at||'---'}}</text>
+          <view class="fl w100">交易时间 : </view>
+          <text class="text-blue">{{item.finish_at}}</text>
         </view>
-
+        
       </view>
     </view>
   </view>
@@ -52,6 +47,7 @@
   
   <view class='cu-tabbar-height'></view>
 </scroll-view>
+
 <view class='cu-load load-modal' wx:if="{{loadModal}}">
   <view class='cuIcon-emojifill text-orange'></view>
   <view class='gray-text'>加载中...</view>

+ 43 - 0
pages/tool/agree/agree.js

@@ -0,0 +1,43 @@
+const signUrl="https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg"
+Page({
+  data:{
+    currentTime:10,
+  },
+  onLoad:function(options){
+    // 页面初始化 options为页面跳转所带来的参数
+    this.shartTick()
+  },
+  onReady:function(){
+    // 页面渲染完成
+  },
+
+  gotoSign(){
+    wx.navigateTo({
+      url: '/pages/tool/sign/signature',
+    })
+  },
+  preview(){
+      wx.previewImage({
+        urls: ["https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg"], //预览图片 数组
+      })
+  },
+  shartTick:function(){
+    let currentTime= 10
+    let _this = this
+    let interval = setInterval(function() {
+      currentTime--;
+      _this.setData({ currentTime})
+      if( currentTime <1){
+        clearInterval( interval )
+      }
+      console.log( currentTime )
+    }, 1000)
+    // 页面显示
+  },
+  onHide:function(){
+    // 页面隐藏
+  },
+  onUnload:function(){
+    // 页面关闭
+  }
+})

+ 3 - 0
pages/tool/agree/agree.json

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

+ 13 - 0
pages/tool/agree/agree.wxml

@@ -0,0 +1,13 @@
+<cu-custom isBack="{{true}}">
+  <view slot="backText">返回</view>
+  <view slot="content">服务条款</view>
+</cu-custom>
+
+<view class="container">
+  <image src="https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg" mode="widthFix" style="width:100%" bindtap="preview">
+  </image>
+  <view style="padding:20rpx">
+    <button wx:if="{{currentTime>0}}" type="info">{{currentTime}}秒后可以进入签名</button>
+    <button wx:else type="primary" bindtap="gotoSign">点击进入签名</button>
+  </view>
+</view>

+ 23 - 0
pages/tool/agree/agree.wxss

@@ -0,0 +1,23 @@
+.title{
+  display: flex;
+  flex-direction: column;
+  padding: 40rpx 30rpx;
+  color: #010101;
+  line-height: 1;
+}
+.view-list{
+  display: flex;
+  flex-direction: row;
+  height: 120rpx;
+  padding: 0 30rpx;
+  align-items: center;
+  background-color: #fff;
+  color: #333333;
+}
+.view-list  .list-text{
+  display: flex;
+  justify-content: space-between;
+  flex: 1;
+  padding-right: 36rpx;
+  align-items: center;
+}

+ 13 - 5
pages/tool/identify/index.js

@@ -53,12 +53,13 @@ Page({
       util.showMsg("图片上传失败")
       return
     }
+    util.showBusy("识别图片中")
     let info = this.data.info
     let method=this.data.type=='card'?'/maker/addMakerCard':'/maker/addMakerBackCard';
     let showcamara= false
     util.http( method, {url}, (err,res)=>{
       if( err!= 0 ) return;
-      console.log("http",err, res)
+      util.showBusy("上传成功")
       Object.assign( info, res)
       this.setData({info,showcamara})
     })
@@ -70,23 +71,28 @@ Page({
       sizeType: ['compressed'],
       sourceType: ['album'], 
       success: function (res) {
+        that.setData( {showcamara:false})
+        util.showBusy("图片上传中")
         util.uploadFile( res.tempFilePaths[0], that.identify )
+      },
+      fail:(res)=>{
+        console.log( res)
+        util.showMsg("图片选择失败")
       }
     })
   },
   takePhoto() {
     var that = this
     var ctx = this.data.ctx
-    that.setData({ hidden: false })
     ctx.takePhoto({
       quality: 'low',
       success: (res) => {
+        util.showSuccess("图片上传中")
+        that.setData( {showcamara:false})
         var tempImagePath = res.tempImagePath
         util.uploadFile( tempImagePath, that.identify )
       },
-      fail: function (res) {
-        cosole.log('take error', res)
-        that.setData({ hidden: true })
+      fail:  (res)=> {
         app.showMsg('拍照失败')
       }
     })
@@ -100,6 +106,8 @@ Page({
     if( !phone || phone.length != 11 ) return util.showMsg( "手机号码有误");
     util.http( '/maker/identifyMaker', {phone}, (err,res)=>{
       if( err!= 0 ) return;
+      info.identify = 1
+      app.identifyUser( )
       this.setData({info})
     })
 

+ 6 - 5
pages/tool/identify/index.wxml

@@ -29,16 +29,19 @@
   <view class='container' style="top: {{StatusBar}}px;">
 
     <view class="pt20">
-      <view class="fs36 ml20">请上传身份证照片</view>
+      <view class="fs36 ml20 tc">请上传身份证照片</view>
     </view>
 
     <view class="identify-box" style="heigth:300rpx;">
       <view class="identify-list" >
-        <image wx:if="{{info.card_img}}" src="{{info.card_img+'?x-oss-process=image/resize,w_200'}}" data-src="{{info.card_img}}" class="identify-img" bindtap="previewImage"/>
+        <image wx:if="{{info.card_img}}" src="{{info.card_img+'?x-oss-process=image/resize,w_200'}}" 
+        bindlongpress="takeCard"
+        data-src="{{info.card_img}}" class="identify-img" bindtap="previewImage"/>
         <image wx:else src="/img/card.png" class="identify-img" bindtap="takeCard"/>
       </view>
       <view class="identify-list" >
-        <image wx:if="{{info.card_back_img}}" src="{{info.card_back_img+'?x-oss-process=image/resize,w_200'}}" data-src="{{info.card_back_img}}" class="identify-img" bindtap="previewImage"/>
+        <image wx:if="{{info.card_back_img}}" src="{{info.card_back_img+'?x-oss-process=image/resize,w_200'}}" data-src="{{info.card_back_img}}" class="identify-img" 
+        bindtap="previewImage" bindlongpress="takeCardBack"/>
         <image  wx:else src="/img/cardback.png" class="identify-img" bindtap="takeCardBack" />
       </view>
     </view>
@@ -71,7 +74,5 @@
         </view>
       </form>
     </view>
-
-    
   </view>
 </scroll-view>

+ 27 - 17
pages/tool/sign/signature.js

@@ -8,6 +8,7 @@ Page({
   data: {
     canvasName: 'handWriting',
     ctx: '',
+    okLook:false,
     canvasWidth: 0,
     canvasHeight: 0,
     transparent: 1, // 透明度
@@ -28,6 +29,7 @@ Page({
       bottom: 0,
       left: 0
     }, //裁剪区域
+    prevUrl: '',
     bethelPoint: [], //保存所有线条 生成的贝塞尔点;
     lastPoint: 0,
     chirography: [], //笔迹
@@ -378,26 +380,19 @@ Page({
 
   //将Canvas内容转成 临时图片 --> cb 为回调函数 形参 tempImgPath 为 生成的图片临时路径
   canvasToImg(cb) { //这种写法移动端 出不来
-
     this.data.ctx.draw(true, () => {
       wx.canvasToTempFilePath({
         canvasId: 'handWriting',
         fileType: 'png',
         quality: 1, //图片质量
         success(res) {
-          // console.log(res.tempFilePath, 'canvas生成图片地址');
-
           wx.showToast({
             title: '执行了吗?',
           })
-
           cb(res.tempFilePath);
         }
-
       })
     });
-
-
   },
   doSaveServer( err, {url} ){
     let method='/maker/addContractImg';
@@ -410,10 +405,11 @@ Page({
   subCanvas() {	
     wx.canvasToTempFilePath({
       canvasId: 'handWriting',
-      fileType: 'jpg',
-      quality: 1, //图片质量
+      fileType: 'png',
+      destWidth: 300,
+      destHeight:600,
       success: (res)=> {
-        util.uploadFile(res.tempFilePath, this.doSaveServer)
+        util.uploadFile(res.tempFilePath, this.doSaveServer, true)
       }
     })
   },
@@ -438,28 +434,42 @@ Page({
   },
   //预览
   previewCanvasImg() {
+    let that = this
     wx.canvasToTempFilePath({
       canvasId: 'handWriting',
-      fileType: 'jpg',
+      fileType: 'png',
       quality: 1, //图片质量
       success(res) {
-        wx.previewImage({
-          urls: [res.tempFilePath], //预览图片 数组
-        })
+        console.log("temp", res.tempFilePath)
+        that.prevViewSign( res.tempFilePath  )
+        // wx.previewImage({
+        //   urls: [res.tempFilePath], //预览图片 数组
+        // })
       }
     })
   },
-  
+  previewSign(e){
+    let url= "https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg"
+    wx.previewImage({
+      urls: [url], //预览图片 数组
+    })
+  },
   //设置canvas背景色  不设置  导出的canvas的背景为透明 
   //@params:字符串  color
   setCanvasBg(color) {
     /* 将canvas背景设置为 白底,不设置  导出的canvas的背景为透明 */
     //rect() 参数说明  矩形路径左上角的横坐标,左上角的纵坐标, 矩形路径的宽度, 矩形路径的高度
     //这里是 canvasHeight - 4 是因为下边盖住边框了,所以手动减了写
+    
+
     this.data.ctx.rect(0, 0, this.data.canvasWidth, this.data.canvasHeight - 4);
+    // console.log("drag image")
+    // this.data.ctx.drawImage(bgPicturePath, 0, 0, this.data.canvasWidth, this.data.canvasHeight - 4);
+    // 
+   
     // ctx.setFillStyle('red')
-    this.data.ctx.setFillStyle(color)
-    this.data.ctx.fill() //设置填充
+    // this.data.ctx.setFillStyle(color)
+    // this.data.ctx.fill() //设置填充
     this.data.ctx.draw() //开画
   },
   /*======所有自定义函数=END=====*/

+ 6 - 4
pages/tool/sign/signature.wxml

@@ -8,7 +8,7 @@
     <button catchtap="retDraw" class="delBtn">重写</button>
     <!-- <button catchtap="subCanvas" class="subBtn">完成</button> -->
 		<button catchtap="saveCanvasAsImg" class="saveBtn">保存</button>
-    <button catchtap="previewCanvasImg" class="previewBtn">预览</button>
+    <!-- <button catchtap="previewCanvasImg" class="saveBtn">预览</button> -->
     <button catchtap="goBack" class="previewBtn">返回</button>
     <button catchtap="subCanvas" class="subBtn">完成</button>
   </view>
@@ -17,7 +17,9 @@
       bindtouchend="uploadScaleEnd" bindtap="mouseDown" canvas-id="handWriting">
     </canvas>
   </view>
-  <view class="handRight">
-    <view class="handTitle">电子合同</view>
+  <view class="handRight" >
+    <view class="handTitle"  bindtap="previewSign" >电子合同</view>
   </view>
-</view>
+</view>
+
+<canvas canvas-id="preview"></canvas>

+ 8 - 0
pages/tool/sign/signature.wxss

@@ -100,6 +100,14 @@ page {
   color: #666;
 }
 
+.pdfBtn {
+  position: absolute;
+  top: 630rpx;
+  left: 0rpx;
+  transform: rotate(90deg);
+  color: #666;
+}
+
 .uploadBtn {
 	position: absolute;
   top: 625rpx;

+ 44 - 3
util/util.js

@@ -2,8 +2,8 @@ var env = 'development';
 const md5 = require('./md5.js');
 var wiki = require('./wiki.js');
 var location = require('./location.js');
-const baseUrl = "https://edu.ndjsxh.cn:8443/api"
-// const baseUrl = "http://localhost:8888"
+// const baseUrl = "https://edu.ndjsxh.cn:8443/api"
+const baseUrl = "http://localhost:8888"
 
 const formatTime = date => {
   const year = date.getFullYear()
@@ -38,7 +38,7 @@ const formatNumber = n => {
 var showBusy = text => wx.showToast({
     title: text,
     icon: 'loading',
-    duration: 10000
+    duration: 2000
 })
 
 // 显示成功提示
@@ -96,6 +96,12 @@ var http = (method, data, fun) => {
         if( code == 0 ){
           fun&&fun(code, data)
         }else{
+          if( data && data.reload ){
+            wx.navigateTo({
+              url: '/pages/login/login',
+            })
+            return
+          }
           showModel("请求异常", msg)
           fun&&fun(code, msg)
         }  
@@ -142,6 +148,41 @@ var uploadFile = (tempFilePaths, fun) =>{
     })
 }
 
+var uploadFile = (tempFilePaths, fun, sign) =>{
+    let authDB = wx.getStorageSync("@yunyuanqu");
+    let user_id = authDB&&authDB.ID||0;
+    let token=authDB&&authDB.token||''
+    let header={}
+    if( user_id && token ){
+      header['x-token'] = token
+      header['x-user-id']= user_id
+    }
+    let murl = `${baseUrl}/wx/upload`
+    if( sign ) murl = murl+"Sign"
+    wx.uploadFile({
+      url: murl,
+      filePath: tempFilePaths,
+      name: "file",
+      header:header,
+      success: function (res) {
+        if( res.statusCode === 200){
+          let { code, data, msg} = JSON.parse(res.data)
+          console.log( code, data, msg )
+          if( code == 0 ){
+            fun&&fun(code, data)
+          }else{
+            fun&&fun(code, msg)
+          }  
+        }else{
+          fun&&fun(404, "请求异常")
+        }
+      },
+      fail: function (res) {
+        fun&&fun(404, "" );
+      }
+    })
+}
+
 module.exports = { 
   formatTime, 
   curDate,