台账、承诺书模块
1. 承诺书模块调试服务器生成文档乱码问题;
2. 台账模块完善上传前后逻辑;
| | |
| | | { |
| | | "pagePath": "pages/module_ledger/ledgerhome/ledgerhome", |
| | | "text": "台账管理", |
| | | "iconPath": "/res/icons/tab_2.png", |
| | | "selectedIconPath": "res/icons/tab_2_select.png" |
| | | "iconPath": "/res/icons/tab_5.png", |
| | | "selectedIconPath": "res/icons/tab_5_select.png" |
| | | }, |
| | | { |
| | | "pagePath": "pages/promise/promise", |
| | |
| | | */ |
| | | data: { |
| | | deadline: '', |
| | | leftday:0 , |
| | | |
| | | currentTab: 0, |
| | | tabList: [], |
| | |
| | | pageheight: '300px' |
| | | }, |
| | | |
| | | //每月台账提交期限日 |
| | | DEADLINEDAY: 10, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | this.getLedgerType() |
| | | |
| | | var deadline = moment().format(`MM-${this.DEADLINEDAY}`) |
| | | var leftday = this.DEADLINEDAY + 1 - moment().date() |
| | | this.setData({ |
| | | deadline: deadline, |
| | | leftday: leftday |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | |
| | | |
| | | getLedgerType () { |
| | | var that = this |
| | | ledgerservice.getLedgerType(app.globalData.userInfo.extension2, { |
| | | var time = moment().format('YYYY-MM-DD') |
| | | ledgerservice.getLedgerSummary(app.globalData.accessToken.userId, app.globalData.userInfo.extension2, time, { |
| | | success (res) { |
| | | // console.log(res); |
| | | let r = that.parseLedgerType(res) |
| | |
| | | subtypes.forEach(s => { |
| | | if (s.upLoad) { |
| | | s.tag = '/res/icons/round_check_fill.png' |
| | | s.color = '#4CAF50' |
| | | } else if (s.ledgerFinished) { |
| | | s.tag = '/res/icons/warning_yellow.png' |
| | | s.color = '#FFEB3B' |
| | | } else if (!s.needUpdate) { |
| | | s.tag = '/res/icons/round_check_fill.png' |
| | | s.color = '#4CAF50' |
| | | } else { |
| | | s.tag = '/res/icons/warning_red.png' |
| | | s.color = 'red' |
| | | } |
| | | if (!map.has(s.ledgerType)) { |
| | | map.set(s.ledgerType, []) |
| | |
| | | events: { |
| | | uploadOver: function (data) { |
| | | let i = data.indexGroup |
| | | let path = `pageList[${i[0]}][${i[1]}].upLoad` |
| | | let pageList = that.data.pageList |
| | | pageList[i[0]][i[1]].upLoad = true |
| | | pageList[i[0]][i[1]].tag = '/res/icons/round_check_fill.png' |
| | | that.setData({ |
| | | [path]: true |
| | | pageList |
| | | }) |
| | | } |
| | | }, |
| | |
| | | <view class="page"> |
| | | <view class="banner-bg"></view> |
| | | <view class="page__hd"> |
| | | <view>本月台账提交日:{{deadline}}</view> |
| | | <view>剩余{{leftday}}天</view> |
| | | <view class="head_1">本月台账提交日:{{deadline}}</view> |
| | | <view wx:if="{{leftday > 0}}" class="head_2">剩余<text>{{leftday}}</text>天</view> |
| | | <view wx:else class="head_2">已逾期,请尽快提交</view> |
| | | <view class="head_3">准时交台账,维护好信用</view> |
| | | </view> |
| | | <view class="page__bd"> |
| | | <view class="swiper-tab"> |
| | |
| | | |
| | | .page__hd { |
| | | height: 30vh; |
| | | text-align: center; |
| | | display: flex; |
| | | flex-flow: column; |
| | | justify-content: space-between; |
| | | color: #50854C; |
| | | } |
| | | |
| | | .head_1 { |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .head_2 { |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .head_2>text { |
| | | font-size: 40px; |
| | | } |
| | | |
| | | .head_3 { |
| | | font-size: 12px; |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .page__bd { |
| | |
| | | // pages/module_ledger/ledgerupload/ledgerupload.js |
| | | const ledgerservice = require("../../../service/ledgerservice") |
| | | const moment = require('../../../utils/moment.min') |
| | | const $f = require('../../../service/baserequest') |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | imgFiles: [] |
| | | imgFiles: [], |
| | | |
| | | remark: '', |
| | | remarkDisable: false |
| | | }, |
| | | |
| | | /** |
| | |
| | | ledger: data.ledger, |
| | | indexGroup: data.indexGroup |
| | | }) |
| | | |
| | | that.checkStatus() |
| | | }) |
| | | }, |
| | | |
| | |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | checkStatus() { |
| | | if (this.data.ledger.upLoad) { |
| | | var that = this |
| | | var userId = app.globalData.accessToken.userId |
| | | var typeId = this.data.ledger.ledgerSubTypeId |
| | | var sceneType = app.globalData.userInfo.extension2 |
| | | var time = moment().format('YYYY-MM-DD') |
| | | ledgerservice.getLedgerDetail(userId, typeId, sceneType, time, { |
| | | success (res) { |
| | | if (res.length > 0) { |
| | | let detail = res[0] |
| | | if (detail.upLoad) { |
| | | let imgFiles = detail.path1.split(';').map((value, index) => { |
| | | return $f.basePicUrl + value |
| | | }) |
| | | let remark = detail.remark1 == null ? '' : detail.remark1 |
| | | let remarkDisable = true |
| | | that.setData({imgFiles, remark, remarkDisable}) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | uploadFile(file) { |
| | |
| | | }, |
| | | |
| | | submitLedger() { |
| | | var that = this |
| | | |
| | | this.setData({ |
| | | showDialog: false, |
| | | }) |
| | | wx.showLoading({ |
| | | title: '上传中', |
| | | title: '提交中', |
| | | mask: true, |
| | | success: (res) => {}, |
| | | fail: (res) => {}, |
| | |
| | | this.data.imgFiles.forEach(f => { |
| | | path.push(f.url) |
| | | }); |
| | | ledgerservice.uploadLedger(app.globalData.accessToken.userId, this.data.ledger, path, { |
| | | let ledger = this.data.ledger |
| | | ledger.remark1 = this.data.remark |
| | | ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, { |
| | | success (res) { |
| | | |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.showToast({ |
| | | title: '提交成功', |
| | | duration: 1000, |
| | | icon: 'success', |
| | | mask: true, |
| | | success: (res) => { |
| | | that.getOpenerEventChannel().emit('uploadOver', { |
| | | indexGroup: that.data.indexGroup |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | complete (res) { |
| | | wx.hideLoading() |
| | | } |
| | | }) |
| | | } |
| | |
| | | {{ledger.ledgerName}} |
| | | </view> |
| | | <view class="page__bd"> |
| | | <textarea class="text-area" name="des" cols="30" rows="10" placeholder="可选则输入台账备注"></textarea> |
| | | <view class="weui-upload-view"> |
| | | <mp-upload title="上传台账图片" titleClass="upload-title-class" max-count="6" files="{{imgFiles}}" binduploadImg="uploadFile" binddelete="delImg"></mp-upload> |
| | | <textarea disabled="{{remarkDisable}}" value="{{remark}}" class="text-area" name="des" cols="30" rows="10" placeholder="可选则输入台账备注"></textarea> |
| | | <view wx:if="{{!ledger.upLoad}}" class="weui-upload-view"> |
| | | <mp-upload title="上传台账图片" titleClass="upload-title-class" max-count="6" files="{{imgFiles}}" |
| | | binduploadImg="uploadFile" binddelete="delImg"></mp-upload> |
| | | </view> |
| | | <view wx:else class="img-group"> |
| | | <view wx:for="{{imgFiles}}" > |
| | | <image class="img-group_img" src="{{item}}"></image> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="page__ft"> |
| | | <view class="submit" bindtap="onSubmit">提交</view> |
| | | <view wx:if="{{!ledger.upLoad}}" class="submit" bindtap="onSubmit">提交</view> |
| | | </view> |
| | | |
| | | <c-dialog show="{{showDialog}}" yes="确认" bindconfirm="submitLedger"> |
| | |
| | | .text-area { |
| | | background-color: rgba(255, 255, 255, 0.185); |
| | | width: 100%; |
| | | } |
| | | |
| | | .img-group { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | .img-group>view { |
| | | width: 30vw; |
| | | text-align: center; |
| | | } |
| | | |
| | | .img-group .img-group_img { |
| | | width: 29vw; |
| | | height: 29vw; |
| | | } |
| | |
| | | */ |
| | | onLoad: function (options) { |
| | | this._initPlanYear() |
| | | this.getCommitment() |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow: function () { |
| | | |
| | | this.getCommitment() |
| | | }, |
| | | |
| | | /** |
| | |
| | | status: 1, |
| | | deadline: `下次承诺时间:${deadline}` |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | text1: "已开启!请及时完成承诺", |
| | | text3: "去承诺", |
| | | status: 0, |
| | | }) |
| | | this._initPlanYear() |
| | | } |
| | | } |
| | | }, |
| | |
| | | if (status == 0) { |
| | | wx.navigateTo({ |
| | | url: '/pages/promiseinfo/promiseinfo' |
| | | }) |
| | | }) |
| | | } else { |
| | | this.gotoResult(0) |
| | | } |
| | |
| | | this.gotoResult(i) |
| | | }, |
| | | |
| | | gotoResult (i) { |
| | | gotoResult(i) { |
| | | var p = this.data.promise[i] |
| | | wx.navigateTo({ |
| | | url: '/pages/promiseresult/promiseresult', |
| | |
| | | fail: (res) => {}, |
| | | complete: (res) => {}, |
| | | }) |
| | | setTimeout(() => { |
| | | wx.hideLoading() |
| | | }, 20000); |
| | | // setTimeout(() => { |
| | | // wx.hideLoading() |
| | | // }, 20000); |
| | | |
| | | let signPic = this.data.imgFiles[0] |
| | | |
| | | promiseservice.createCommitment(app.globalData.accessToken.userId, this.commitmentVo, signPic, { |
| | | success(data) { |
| | | if (data.data.success) { |
| | | if (data.success) { |
| | | wx.navigateTo({ |
| | | url: '/pages/promiseresult/promiseresult', |
| | | success: function (res) { |
| | | console.log(res); |
| | | // 通过 eventChannel 向被打开页面传送数据 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | promise: { |
| | |
| | | complete(res) { |
| | | console.log(res); |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.showToast({ |
| | | title: '生成完成', |
| | | duration: 1500, |
| | | icon: 'success', |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }) |
| | |
| | | <text class="p-sign">法人签名(必填)</text> |
| | | <view class="weui-upload-view"> |
| | | <!-- <mp-upload data-type="0" max-count="1" files="{{imgFiles[0]}}" binduploadImg="uploadFile" binddelete="delImg"></mp-upload> --> |
| | | <view wx:if="{{imgFiles.length == 0}}" class="" > |
| | | <view wx:if="{{imgFiles.length == 0}}" class=""> |
| | | <view class="top-right" bindtap="startSign"> |
| | | <mp-icon bindtap="startSign" class="" type="field" icon="add" color="gray" size="{{25}}"></mp-icon> |
| | | <view class="sign-btn"> |
| | | <mp-icon bindtap="startSign" type="field" icon="add" color="gray" size="{{60}}"></mp-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <image wx:else class="sign-img" src="{{imgFiles[0]}}" mode="aspectFill" /> |
| | |
| | | .page__bd { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .banner-bg { |
| | | position: fixed; |
| | | width: 100%; |
| | |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .p-content{ |
| | | .p-content { |
| | | font-size: 14px; |
| | | } |
| | | |
| | |
| | | padding: 8px; |
| | | } |
| | | |
| | | .sign-btn { |
| | | width: 96px; |
| | | height: 96px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .sign-img { |
| | | float: left; |
| | | margin-right: 8px; |
| | | margin-bottom: 8px; |
| | | width: 96px; |
| | | height: 96px; |
| | | background: no-repeat 50%; |
| | | background-size: cover |
| | | margin-right: 8px; |
| | | margin-bottom: 8px; |
| | | width: 96px; |
| | | height: 96px; |
| | | background: no-repeat 50%; |
| | | background-size: cover |
| | | } |
| | | |
| | | .top-right { |
| | |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload: function () { |
| | | |
| | | var pages = getCurrentPages() |
| | | var d = pages.length - 1 |
| | | wx.navigateBack({ |
| | | delta: d, |
| | | success: (res) => {}, |
| | | fail: (res) => {}, |
| | | complete: (res) => {}, |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | |
| | | |
| | | const originProperties = ['url', 'data', 'header', 'method', 'success', 'fail', 'complete']; |
| | | // const baseUrl = "http://127.0.0.1:8080" |
| | | const baseUrl = "http://192.168.1.106:8080" |
| | | const baseUrl = "http://192.168.0.117:8080" |
| | | // const baseUrl = "https://fyami.com.cn:447" |
| | | // const basePicUrl = baseUrl + "/images/" |
| | | const basePicUrl = "https://fyami.com.cn:447/images/" |
| | |
| | | |
| | | module.exports = { |
| | | //获取台账类型 |
| | | getLedgerType: function (sceneType, fun) { |
| | | getLedgerSummary: function (userId, sceneType, time, fun) { |
| | | let cb = { |
| | | url: `/ledger/type`, |
| | | url: `/ledger/${userId}/summary`, |
| | | params: { |
| | | sceneType: sceneType, |
| | | time: time |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | |
| | | }, |
| | | |
| | | //上传台账 |
| | | // uploadLedger: function (userId, ledger, files, fun) { |
| | | // let formData = new FormData(); |
| | | |
| | | // // 用法 |
| | | // // formData.append("name", "value"); // value 表单值 |
| | | // // formData.appendFile("file", filepath); // filepath 文件路径 |
| | | |
| | | // // formData.append("params", JSON.stringify([ledger])) |
| | | // files.forEach(f => { |
| | | // formData.appendFile("images", f); |
| | | // }); |
| | | |
| | | // // formData.getData() => { |
| | | // // buffer:<ArrayBuffer>[], // buffer 表单数据的ArrayBuffer对象 |
| | | // // contentType: string, // http请求Content-Type头部内容 |
| | | // // } |
| | | // const data = formData.getData(); |
| | | |
| | | // let cb = { |
| | | // url: `/ledger/${userId}/upload`, |
| | | // params: { |
| | | // params: JSON.stringify([ledger]), |
| | | // }, |
| | | // header: { |
| | | // 'content-type': data.contentType |
| | | // }, |
| | | // data: data.buffer, |
| | | // } |
| | | |
| | | // Object.assign(cb, fun) |
| | | // $f.post(cb) |
| | | // } |
| | | uploadLedger: function (userId, ledger, paths, fun) { |
| | | const fields = [{ |
| | | name: 'params', |
| | |
| | | }) |
| | | }); |
| | | console.log(files); |
| | | new Multipart({ |
| | | let p = new Multipart({ |
| | | fields, |
| | | files |
| | | }).submit($f.baseUrl + `/ledger/${userId}/upload`) |
| | | } |
| | | p.then(res => { |
| | | fun.success(res) |
| | | }) |
| | | }, |
| | | |
| | | //获取台账详情 |
| | | getLedgerDetail: function (userId, ledgerSubTypeId, sceneType, time, fun) { |
| | | let cb = { |
| | | url: `/ledger/${userId}/detail2`, |
| | | params: { |
| | | ledgerSubTypeId: ledgerSubTypeId, |
| | | sceneType: sceneType, |
| | | time: time |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | |
| | | $f.get(cb) |
| | | }, |
| | | } |
| | |
| | | userId: userId, |
| | | coVo: JSON.stringify(commitmentVo) |
| | | }, |
| | | success: (result) => {fun.success(result)}, |
| | | success: (result) => {fun.success(JSON.parse(result.data))}, |
| | | fail: (res) => {fun.fail(res)}, |
| | | complete: (res) => {fun.complete(res)}, |
| | | }) |