From 91f7d372fa318e859efd20d71eafbd34274902c4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 20 一月 2026 17:29:43 +0800
Subject: [PATCH] 2026.1.20
---
pages/mSelfPatrol/components/self-patrol/index.wxml | 15 +
pages/mSelfPatrol/components/self-patrol/index.wxss | 28 ++
config/loadConfig.js | 4
pages/mLedger/home/summary.wxml | 4
pages/mLedger/home/summary.wxss | 2
service/selfpatrolservice.js | 21 ++
app.json | 3
/dev/null | 172 -------------------
pages/mSelfPatrol/patrolpromise/index.js | 81 +++++++++
model/ledger.js | 3
service/baserequest.js | 17 +
pages/mSelfPatrol/components/self-patrol/index.js | 67 ++++++-
pages/mSelfPatrol/patrolpromise/index.wxml | 43 ++++
pages/mSelfPatrol/patrolpromise/index.json | 6
pages/mSelfPatrol/patrolpromise/index.wxss | 72 ++++++++
15 files changed, 333 insertions(+), 205 deletions(-)
diff --git a/app.json b/app.json
index df36a76..4e2935a 100644
--- a/app.json
+++ b/app.json
@@ -58,7 +58,8 @@
"pages/mSelfPatrol/patrolhome/index",
"pages/mUser/sceneauthentication/industrial/index",
"pages/mExtra/pSupervisionSummary/index",
- "pages/mLedger/home/index"
+ "pages/mLedger/home/index",
+ "pages/mSelfPatrol/patrolpromise/index"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/config/loadConfig.js b/config/loadConfig.js
index 011d97a..ba9f4ac 100644
--- a/config/loadConfig.js
+++ b/config/loadConfig.js
@@ -25,6 +25,10 @@
if (app.globalData.userSetting.selfPatrolPromise == undefined) {
app.globalData.userSetting.selfPatrolPromise = false
}
+ // 鑷贰鏌ユ壙璇轰功鏂囨湰鎹㈣绗︽牸寮忓寲
+ if (app.globalData.userSetting.spPromiseContent != undefined) {
+ app.globalData.userSetting.spPromiseContent = app.globalData.userSetting.spPromiseContent.replaceAll('\\n', '\n')
+ }
wx.setStorage({
key: 'user_setting',
data: res.data,
diff --git a/model/ledger.js b/model/ledger.js
index 4d3a254..9aece9d 100644
--- a/model/ledger.js
+++ b/model/ledger.js
@@ -1,8 +1,8 @@
const moment = require('../utils/moment.min');
const app = getApp();
+const DEADLINEDAY = app.globalData.userSetting.ledgerDeadline;
function name(params) {
- const DEADLINEDAY = app.globalData.userSetting.ledgerDeadline;
let monthInfo = {
totalMust: 0,
finishedMust: 0,
@@ -111,7 +111,6 @@
* @param {Boolean} isSelfPatrol 鏄惁缁熻鑷贰鏌ョ被鍨�
*/
function _parse(subtypes, isSelfPatrol) {
- const DEADLINEDAY = 10;
// 鏈堝害缁熻
let monthInfo = {
// 鍏ㄩ儴蹇呭~鏁�
diff --git a/pages/mLedger/home/summary.wxml b/pages/mLedger/home/summary.wxml
index c8eadea..95dc36c 100644
--- a/pages/mLedger/home/summary.wxml
+++ b/pages/mLedger/home/summary.wxml
@@ -43,8 +43,8 @@
<view class="head_row">
<view class="head_tag">鏈湡鍙拌处鎻愪氦鏃ワ細{{deadline}}</view>
<block wx:if="{{thisMonthInfo.percent < 1}}">
- <view wx:if="{{leftday > 0}}" class="head_tag"
- >鍓╀綑<text>{{leftday}}</text>澶�</view
+ <view wx:if="{{leftday >= 0}}" class="head_tag"
+ >鍓╀綑<text>{{leftday + 1}}</text>澶�</view
>
<view wx:else class="head_tag"
>閫炬湡 <text>{{thisMonthInfo.overtime}}</text>澶�</view
diff --git a/pages/mLedger/home/summary.wxss b/pages/mLedger/home/summary.wxss
index ce9128c..e4b2cf6 100644
--- a/pages/mLedger/home/summary.wxss
+++ b/pages/mLedger/home/summary.wxss
@@ -1,4 +1,4 @@
-@import '../ledgerhome/ledgerhome.wxss';.banner-bg {
+.banner-bg {
position: fixed;
width: 100%;
height: 60%;
diff --git a/pages/mLedger/ledgerhome/ledgerhome.js b/pages/mLedger/ledgerhome/ledgerhome.js
deleted file mode 100644
index d4156e9..0000000
--- a/pages/mLedger/ledgerhome/ledgerhome.js
+++ /dev/null
@@ -1,314 +0,0 @@
-const ledgerservice = require('../../../service/ledgerservice');
-const moment = require('../../../utils/moment.min');
-const app = getApp();
-
-Page({
- /**
- * 椤甸潰鐨勫垵濮嬫暟鎹�
- */
- data: {
- thisMonth: '',
- lastMonth: '',
-
- //鎻愪氦鏈熼檺
- deadline: '',
- //鍓╀綑鎻愪氦澶╂暟
- leftday: 0,
-
- //鏈湀姹囨��
- thisMonthInfo: {
- //蹇呭~椤规�绘暟
- totalMust: 0,
- //蹇呭~椤规彁浜ゆ暟
- finishedMust: 0,
- //閫夊~椤规�绘暟
- totalSelect: 0,
- //閫夊~椤规彁浜ゆ暟
- finishedSelect: 0,
- //鎻愪氦鎯呭喌
- status: '',
- //瓒呮椂鎯呭喌
- overtime: '',
- //寤鸿
- suggestion: '',
- },
- //涓婃湀姹囨��
- lastMonthInfo: {
- totalMust: 0,
- finishedMust: 0,
- totalSelect: 0,
- finishedSelect: 0,
- status: '',
- overtime: '',
- suggestion: '',
- },
-
- //閫夐」鍗$浉鍏�
- currentTab: 0,
- tabList: [],
- pageList: [],
- pageheight: '300px',
-
- //褰撳墠鏄剧ず鏈堜唤
- showThisMonth: true,
- },
-
- //姣忔湀鍙拌处鎻愪氦鏈熼檺鏃�
- DEADLINEDAY: 10,
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
- */
- onLoad(options) {
- let now = moment();
- let limitTime = moment().date(this.DEADLINEDAY);
- //濡傛灉鏄柊娉ㄥ唽鐢ㄦ埛涓嶅埌涓�涓湀锛屽垯涓嶆彁閱掓湰鏈堟儏鍐碉紝鐩存帴鎻愰啋涓嬩釜鏈堢殑鎯呭喌
- if (app.globalData.newUser) {
- limitTime.add(1, 'M');
- }
- let deadline = limitTime.format(`MM-${this.DEADLINEDAY}`);
- let leftday = limitTime.diff(now, 'days');
- let thisMonth = now.format('YYYY-MM');
- let lastMonth = now.add(-1, 'M').format('YYYY-MM');
- this.setData({
- deadline,
- leftday,
- thisMonth,
- lastMonth,
- });
-
- now = moment();
- this.getLedgerType(now.format('YYYY-MM-DD'), r => {
- this.setData({
- tabList: r[0],
- pageList: r[1],
- thisMonthInfo: r[2],
- });
- this.tabsHeight('.page0');
- }); //鏈湀
- this.getLedgerType(
- now.add(-1, 'M').format('YYYY-MM-DD'),
- r => {
- this.setData({
- lastMonthInfo: r[2],
- });
- },
- true,
- ); //涓婃湀
- },
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
- */
- onReady() {},
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
- */
- onShow() {},
-
- getLedgerType(time, success, lastMonth) {
- var that = this;
- // var time = moment().format('YYYY-MM-DD')
- ledgerservice.getLedgerSummary(
- app.globalData.accessToken.userId,
- app.globalData.userInfo.extension2,
- time,
- {
- success(res) {
- let r = that.parseLedgerType(res, lastMonth);
- success(r);
- },
- },
- );
- },
-
- parseLedgerType(subtypes, lastMonth) {
- let monthInfo = {
- totalMust: 0,
- finishedMust: 0,
- totalSelect: 0,
- finishedSelect: 0,
- status: '',
- overtime: '',
- suggestion: '',
- };
- let map = new Map();
- subtypes.forEach(s => {
- //鏈堝害缁熻
- if (s.ledgerTypeId != -1 && s.needUpdate) {
- monthInfo.totalMust++;
- if (s.upLoad) {
- monthInfo.finishedMust++;
- }
- } else {
- monthInfo.totalSelect++;
- if (s.upLoad) {
- monthInfo.finishedSelect++;
- }
- }
-
- //閫夐」鍗�
- if (s.upLoad) {
- s.tag = '/res/icons/round_check_fill.png';
- s.opacity = 0.7;
- } else if (s.ledgerFinished) {
- s.tag = '/res/icons/warning_yellow.png';
- s.opacity = 1;
- } else if (!s.needUpdate) {
- s.tag = '/res/icons/warning_selected.png';
- s.opacity = 0.8;
- } else {
- s.tag = '/res/icons/warning_red.png';
- s.opacity = 1;
- }
- if (!map.has(s.ledgerType)) {
- map.set(s.ledgerType, []);
- }
- map.get(s.ledgerType).push(s);
- });
-
- //
- if (monthInfo.finishedMust == 0) {
- monthInfo.status = '鏈彁浜�';
- if (lastMonth) {
- monthInfo.suggestion =
- '寤鸿锛氬綋鏈熷彴璐﹀畬鍏ㄦ湭鎻愪氦锛屼弗閲嶅奖鍝嶈瘎浼扮粨鏋滐紝鍚庣画璇锋敞鎰�';
- } else {
- monthInfo.suggestion = '寤鸿锛氳灏藉揩鎻愪氦鍙拌处';
- }
- } else if (monthInfo.finishedMust < monthInfo.totalMust) {
- monthInfo.status = '閮ㄥ垎鎻愪氦';
- if (lastMonth) {
- monthInfo.suggestion =
- '寤鸿锛氬綋鏈熷彴璐﹂儴鍒嗘湭鎻愪氦锛屼細褰卞搷璇勪及缁撴灉锛屽悗缁灏介噺鎻愪氦鎵�鏈夊彴璐�';
- } else {
- monthInfo.suggestion = '寤鸿锛氬綋鍓嶅凡鎻愪氦閮ㄥ垎鍙拌处锛岃琛ュ叏鍓╀綑鍙拌处';
- }
- } else {
- monthInfo.status = '宸叉彁浜�';
- if (lastMonth) {
- monthInfo.suggestion = '褰撴湡鍙拌处宸插叏閮ㄦ彁浜わ紝璇蜂繚鎸�';
- } else {
- monthInfo.suggestion = '鏈湡鍙拌处宸插叏閮ㄦ彁浜�';
- }
- }
- monthInfo.overtime = moment().date() - this.DEADLINEDAY;
- monthInfo.percent = Math.round(
- (monthInfo.finishedMust / monthInfo.totalMust) * 100,
- );
-
- //閫夐」鍗�
- var t = [];
- var p = [];
- for (let item of map) {
- if (item[1][0].ledgerTypeId == -1) {
- continue;
- }
- let notUpload = 0;
- item[1].forEach(l => {
- if (l.needUpdate && !l.upLoad) {
- notUpload++;
- }
- });
- t.push({
- name: item[0],
- tag: notUpload,
- total: item[1].length,
- });
- p.push(item[1]);
- }
-
- return [t, p, monthInfo];
- },
-
- gotoLedgerDetail(e) {
- var i = e.currentTarget.dataset.index.split(',');
- var indexGroup = [parseInt(i[0]), parseInt(i[1])];
- var ledger = this.data.pageList[indexGroup[0]][indexGroup[1]];
-
- var that = this;
- wx.navigateTo({
- url: '/pages/mLedger/ledgerupload/ledgerupload',
- events: {
- uploadOver: function (data) {
- let i = data.indexGroup;
- let { pageList, tabList } = that.data;
- tabList[i[0]].tag--;
- pageList[i[0]][i[1]].upLoad = true;
- pageList[i[0]][i[1]].tag = '/res/icons/round_check_fill.png';
- pageList[i[0]][i[1]].opacity = 0.7;
- that.setData({
- pageList,
- tabList,
- });
- },
- },
- success: res => {
- // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- ledger: ledger,
- indexGroup: indexGroup,
- type: 0,
- });
- },
- });
- },
-
- gotoHistory() {
- let tabList = this.data.tabList;
- wx.navigateTo({
- url: '/pages/mLedger/ledgerhistory/ledgerhistory',
- success: res => {
- // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- tabList: tabList,
- });
- },
- });
- },
-
- //璁$畻swiper楂樺害鏂规硶锛堝湪鍒囨崲鐨勬椂鍊欒皟鐢級
- tabsHeight(element) {
- let that = this;
- let query = wx.createSelectorQuery(); //蹇呴』瑕佸厛鍒涘缓涓�涓煡璇�
- query
- .select(element)
- .boundingClientRect(function (rect) {
- let pageheight = that.data.pageheight.split('px')[0];
- pageheight = parseInt(pageheight);
- if (rect.height > pageheight) {
- that.setData({
- pageheight: rect.height + 'px',
- });
- }
- })
- .exec();
- },
- swichNav: function (e) {
- var that = this;
- if (this.data.currentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentTab: e.target.dataset.current,
- navScrollLeft:
- e.target.dataset.current >= 3 ? e.target.dataset.current * 60 : 0, //鍒ゆ柇褰撳墠閫変腑鐨勪釜鏁版槸鍚︽槸绗�5涓�
- });
- // that.tabsHeight('.page' + e.target.dataset.current); //鏌ヨ鍝竴涓厓绱�
- }
- },
- bindChange: function (e) {
- var that = this;
- that.setData({
- currentTab: e.detail.current,
- navScrollLeft: e.detail.current >= 3 ? e.detail.current * 60 : 0, //鍒ゆ柇褰撳墠閫変腑鐨勪釜鏁版槸鍚︽槸绗�5涓�
- });
- that.tabsHeight('.page' + e.detail.current); //鏌ヨ鍝竴涓厓绱�
- },
-
- changeMonth() {
- let showThisMonth = !this.data.showThisMonth;
- this.setData({ showThisMonth });
- },
-});
diff --git a/pages/mLedger/ledgerhome/ledgerhome.json b/pages/mLedger/ledgerhome/ledgerhome.json
deleted file mode 100644
index b012b03..0000000
--- a/pages/mLedger/ledgerhome/ledgerhome.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "navigationBarTitleText": "鍙拌处绠$悊",
- "navigationBarBackgroundColor": "#57E4CB",
- "usingComponents": {
- "mp-icon": "/component/icon/icon"
- }
-}
\ No newline at end of file
diff --git a/pages/mLedger/ledgerhome/ledgerhome.wxml b/pages/mLedger/ledgerhome/ledgerhome.wxml
deleted file mode 100644
index 6aadc75..0000000
--- a/pages/mLedger/ledgerhome/ledgerhome.wxml
+++ /dev/null
@@ -1,159 +0,0 @@
-<view class="page">
- <view class="banner-bg"></view>
- <view class="page__hd">
- <!-- <view class="fyui-panel"> -->
- <view class="">
- <view bindtap="changeMonth">
- <text class="head_tag"
- >{{showThisMonth ? thisMonth + '鏈湀' : lastMonth + '涓婃湀'}}姹囨��</text
- >
- <mp-icon
- style="margin-left: 4px"
- icon="transfer2"
- color="white"
- size="{{20}}"
- ></mp-icon>
- </view>
- </view>
- <view class="card">
- <block wx:if="{{showThisMonth}}">
- <view class="head_row">
- <view class="head_row_item">
- <view class="head_tag">瀹屾垚搴�</view>
- <view class="head_1 head_1_big"
- >{{thisMonthInfo.percent}}<text class="head_row_item_tag"
- >%</text
- ></view
- >
- </view>
- <view class="head_row_item">
- <view class="head_tag">蹇呭~椤�</view>
- <view class="head_1"
- >{{thisMonthInfo.finishedMust}}<text class="head_row_item_tag"
- >/{{thisMonthInfo.totalMust}}</text
- ></view
- >
- </view>
- <view class="head_row_item">
- <view class="head_tag">閫夊~椤�</view>
- <view class="head_1"
- >{{thisMonthInfo.finishedSelect}}<text class="head_row_item_tag"
- >/{{thisMonthInfo.totalSelect}}</text
- ></view
- >
- </view>
- </view>
- <view class="head_row">
- <view class="head_tag">鏈湡鍙拌处鎻愪氦鏃ワ細{{deadline}}</view>
- <block wx:if="{{thisMonthInfo.percent < 1}}">
- <view wx:if="{{leftday > 0}}" class="head_tag"
- >鍓╀綑<text>{{leftday}}</text>澶�</view
- >
- <view wx:else class="head_tag"
- >閫炬湡 <text>{{thisMonthInfo.overtime}}</text>澶�</view
- >
- </block>
- </view>
- <view class="head_tag">{{thisMonthInfo.suggestion}}</view>
- </block>
- <block wx:else>
- <view class="head_row">
- <view class="head_row_item">
- <view class="head_tag">瀹屾垚搴�</view>
- <view class="head_1"
- >{{lastMonthInfo.percent}}<text class="head_row_item_tag"
- >%</text
- ></view
- >
- </view>
- <view class="head_row_item">
- <view class="head_tag">蹇呭~椤�</view>
- <view class="head_1"
- >{{lastMonthInfo.finishedMust}}<text class="head_row_item_tag"
- >/{{lastMonthInfo.totalMust}}</text
- ></view
- >
- </view>
- <view class="head_row_item">
- <view class="head_tag">閫夊~椤�</view>
- <view class="head_1"
- >{{lastMonthInfo.finishedSelect}}<text class="head_row_item_tag"
- >/{{lastMonthInfo.totalSelect}}</text
- ></view
- >
- </view>
- </view>
- <view class="head_row">
- <view class="head_tag">鎻愪氦鎯呭喌锛歿{lastMonthInfo.status}}</view>
- </view>
- <view class="head_tag">寤鸿锛歿{lastMonthInfo.suggestion}}</view>
- </block>
- </view>
- <view class="head_right">
- <text class="head_btn" bindtap="gotoHistory">鍘嗗彶璁板綍 ></text>
- </view>
- </view>
- <!-- </view> -->
- <view class="page__bd">
- <view class="swiper-tab">
- <scroll-view
- class="swiper-tab_view"
- scroll-into-view="item{{currentTab}}"
- scroll-x="true"
- show-scrollbar="true"
- scroll-with-animation="true"
- >
- <block wx:for="{{tabList}}" wx:key="i">
- <view
- id="item{{index}}"
- class="swiper-tab-list {{currentTab==index ? 'on' : ''}}"
- data-current="{{index}}"
- bindtap="swichNav"
- >
- {{item.name}}
- <text wx:if="{{item.tag > 0}}" class="swiper-tab-list__tag"
- >{{item.tag}}</text
- >
- </view>
- </block>
- </scroll-view>
- </view>
- <swiper
- current="{{currentTab}}"
- class="swiper-box"
- duration="300"
- bindchange="bindChange"
- style="height: {{pageheight}};"
- >
- <block
- wx:for="{{pageList}}"
- wx:for-item="page"
- wx:key="n"
- wx:for-index="i1"
- >
- <swiper-item>
- <view class="ledger-group page{{i1}}">
- <view
- wx:for="{{page}}"
- wx:for-item="ledger"
- wx:key="t"
- class="ledger-item"
- wx:for-index="i2"
- data-index="{{i1}},{{i2}}"
- bindtap="gotoLedgerDetail"
- style="opacity: {{ledger.opacity}};"
- >
- <image
- class="ledger-tag"
- src="{{ledger.tag}}"
- mode="aspectFit"
- ></image>
- <image class="ledger-icon" src="{{ledger.iconUrl}}"></image>
- <view style="padding: 0 10px">{{ledger.ledgerName}}</view>
- </view>
- </view>
- </swiper-item>
- </block>
- </swiper>
- </view>
-</view>
diff --git a/pages/mLedger/ledgerhome/ledgerhome.wxss b/pages/mLedger/ledgerhome/ledgerhome.wxss
deleted file mode 100644
index dfdf761..0000000
--- a/pages/mLedger/ledgerhome/ledgerhome.wxss
+++ /dev/null
@@ -1,172 +0,0 @@
-.banner-bg {
- position: fixed;
- width: 100%;
- height: 60%;
- background: linear-gradient(to bottom, #57E4CB, #83b6ae);
-}
-
-.page__hd {
- /* text-align: center; */
- display: flex;
- flex-flow: column;
- justify-content: flex-start;
- /* color: #50854C; */
- color: white;
- padding: 8px 16px;
-}
-
-.card{
- height: 26vh;
- /* background-color: royalblue; */
-}
-
-.head_row{
- display: flex;
- /* padding: 0 30px; */
- justify-content: space-between;
- align-items: baseline;
-}
-
-.head_row_item{
- text-align: center;
- /* width: 20vw; */
- flex: 1;
- /* background-color: red; */
-}
-
-.head_row_item_tag{
- font-size: 12px;
- font-weight: 559;
-}
-
-.head_right {
- text-align: end;
- font-size: 12px;
- /* background-color: brown; */
- margin-bottom: 8px;
- vertical-align: middle;
-}
-
-.head_tag{
- font-size: 12px;
- color: white;
-}
-
-.head_btn{
- background-color: rgb(11, 90, 77);
- padding: 4px 6px;
- border-radius: 4px;
-}
-
-.head_btn:active{
- background-color: rgba(11, 90, 77, 0.5);
-}
-
-.head_tag>text {
- font-size: 40px;
- font-weight: 600;
-}
-
-.head_1 {
- font-size: 30px;
-}
-
-.head_1_big{
- font-size: 30px;
-}
-
-.head_3 {
- font-size: 12px;
- margin-bottom: 16px;
-}
-
-.page__bd {
- padding-bottom: 0;
-}
-
-.swiper-tab{
- width: 100%;
- text-align: center;
- line-height: 80rpx;
- white-space: nowrap;
- z-index: 2;
- /* background-color: #65EAD2; */
- /* background-color: #70ea65; */
- /* padding: 2px; */
-}
-
-.swiper-tab_view{
- /* background-color: blueviolet; */
-}
-
-.swiper-tab-list{
- position: relative;
- font-size: 30rpx;
- display: inline-block;
- min-width: 18%;
- padding: 0 16px;
- color: rgba(255, 255, 255, 0.658);
-}
-
-.swiper-tab-list__tag{
- position: absolute;
- top: 2px;
- right: 4px;
- font-size: 10px;
- line-height: 16px;
- width: 16px;
- background-color: brown;
- border-radius: 50%;
-}
-
-.on{
- color: white;
- font-weight: bold;
- border-bottom: 4rpx solid white;
-}
-
-.swiper-box{
- display: block;
- top: 80rpx;
- width: 100%;
- margin-top: 1px;
- background-color: white;
-}
-
-.ledger-group {
- display: flex;
- flex-wrap: wrap;
- /* background-color: white; */
- justify-content: flex-start;
-}
-
-.ledger-item {
- position: relative;
- width: 33.33333vw;
- text-align: center;
- /* background-color: teal; */
- margin-top: 16px;
- margin-bottom: 16px;
- font-size: x-small;
-}
-
-.ledger-item:active{
- background-color: var(--fyui-BG-COLOR-ACTIVE);
-}
-
-.ledger-icon {
- width: 60px;
- height: 60px;
-}
-
-.ledger-tag {
- position: absolute;
- right: 6vw;
- top: 6px;
- width: 32px;
- height: 16px;
- color: white;
- padding: 1px;
- border-radius: 50%;
- font-size: 10px;
-}
\ No newline at end of file
diff --git a/pages/mSelfPatrol/components/self-patrol/index.js b/pages/mSelfPatrol/components/self-patrol/index.js
index 6a27a13..4d471f4 100644
--- a/pages/mSelfPatrol/components/self-patrol/index.js
+++ b/pages/mSelfPatrol/components/self-patrol/index.js
@@ -1,4 +1,7 @@
-import { parseSelfPatrol, refreshLedgerStatus } from '../../../../model/ledger';
+import {
+ parseSelfPatrol,
+ refreshLedgerStatus
+} from '../../../../model/ledger';
import configservice from '../../../../service/configservice';
const ledgerservice = require('../../../../service/ledgerservice');
const moment = require('../../../../utils/moment.min');
@@ -16,11 +19,14 @@
data: {
refresh: false,
thisMonth: '',
- tags1: { count: 0 },
+ tags1: {
+ count: 0
+ },
pageList1: [],
// 鏄惁鏈夋潈闄愬彲浠ヨ繘琛岃嚜宸℃煡鎵胯
promiseValid: app.globalData.userSetting.selfPatrolPromise,
- promised: false
+ // 鏄惁宸叉壙璇�
+ promised: false,
},
lifetimes: {
@@ -37,7 +43,9 @@
const now = moment();
const nowStr = now.format('YYYY-MM-DD');
const thisMonth = now.format('YYYY骞碝M鏈�');
- this.setData({ thisMonth });
+ this.setData({
+ thisMonth
+ });
this.getLedgerType(nowStr, r => {
this.setData({
tags1: {
@@ -50,14 +58,24 @@
refresh: false,
});
});
+ this.getPromise()
},
+ /**
+ * 鏌ヨ鐢ㄦ埛鏄惁瀹屾垚鑷贰鏌ユ壙璇�
+ */
getPromise() {
- configservice.fetchUserSettingRecord(app.globalData.accessToken.userId, {
- success: res => {
-
- },
- })
+ if (this.data.promiseValid) {
+ configservice.fetchUserSettingRecord(app.globalData.accessToken.userId, {
+ success: res => {
+ const nowYear = moment().year()
+ const promiseYear = moment(res.data?.lastPromisedTime).year()
+ this.setData({
+ promised: (res.data?.selfPatrolPromised == true) && (nowYear == promiseYear)
+ })
+ },
+ })
+ }
},
getLedgerType(time, success, lastMonth) {
@@ -65,8 +83,7 @@
ledgerservice.getLedgerSummary(
app.globalData.accessToken.userId,
app.globalData.userInfo.extension2,
- time,
- {
+ time, {
success(res) {
let r = parseSelfPatrol(res);
success(r);
@@ -76,7 +93,9 @@
},
gotoLedgerDetail(e) {
- const { index } = e.currentTarget.dataset;
+ const {
+ index
+ } = e.currentTarget.dataset;
const indexGroup = index;
var ledger = this.data.pageList1[index];
var that = this;
@@ -118,5 +137,27 @@
},
});
},
+
+ /**
+ * 璺宠浆鑷宠嚜宸℃煡鎵胯鐣岄潰
+ */
+ gotoPromise() {
+ wx.navigateTo({
+ url: '/pages/mSelfPatrol/patrolpromise/index',
+ events: {
+ doPromiseDone: (data)=> {
+ this.setData({
+ promised: data.promised
+ })
+ },
+ },
+ success: (res)=> {
+ // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+ // res.eventChannel.emit('acceptDataFromOpenerPage', {
+
+ // });
+ },
+ });
+ },
},
-});
+});
\ No newline at end of file
diff --git a/pages/mSelfPatrol/components/self-patrol/index.wxml b/pages/mSelfPatrol/components/self-patrol/index.wxml
index 2f71c5d..dc0a5e1 100644
--- a/pages/mSelfPatrol/components/self-patrol/index.wxml
+++ b/pages/mSelfPatrol/components/self-patrol/index.wxml
@@ -1,8 +1,19 @@
-<view class="self-patrol-promise" bindtap="gotoPromise">
- <t-icon name="notification-error" size="32rpx"/>
+<view
+ wx:if="{{promiseValid && !promised}}"
+ class="self-patrol-promise"
+ bindtap="gotoPromise"
+>
+ <t-icon name="notification-error" size="32rpx" />
<text class="promise-text"></text>
<text class="promise_btn">鍘绘壙璇� ></text>
</view>
+<view
+ wx:else
+ class="self-patrol-promise-done"
+>
+ <t-icon name="check" size="32rpx" />
+ <text class="promise-done-text">鑷贰鏌ユ壙璇哄凡绛剧讲</text>
+</view>
<view class="self-patrol-static">
<view class="head_right">
<view style="font-size: 14px"> {{thisMonth}} </view>
diff --git a/pages/mSelfPatrol/components/self-patrol/index.wxss b/pages/mSelfPatrol/components/self-patrol/index.wxss
index 2c6f50b..83b7b8f 100644
--- a/pages/mSelfPatrol/components/self-patrol/index.wxss
+++ b/pages/mSelfPatrol/components/self-patrol/index.wxss
@@ -1,11 +1,11 @@
.self-patrol-promise {
- color: var(--fyui-text-color_1);
+ color: white;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
padding: 8rpx 8rpx;
- background-color: var(--fyui-primary-color-2);
+ background-color: #c44e00;
}
.promise_btn {
font-weight: 600;
@@ -43,6 +43,30 @@
}
}
+.self-patrol-promise-done {
+ color: white;
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+ font-size: 12px;
+ padding: 8rpx 8rpx;
+ background-color: #51be82;
+}
+.promise-done-text {
+ /* white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis; */
+ position: relative;
+ display: -webkit-box;
+ -webkit-line-clamp: 1;
+ -webkit-box-orient: vertical;
+ overflow-x: hidden;
+ text-overflow: ellipsis;
+ width: 100%;
+ height: 20px;
+ line-height: 20px;
+}
+
.self-patrol-static {
margin: 16rpx 32rpx;
padding: 4rpx;
diff --git a/pages/mSelfPatrol/patrolpromise/index.js b/pages/mSelfPatrol/patrolpromise/index.js
new file mode 100644
index 0000000..36971b9
--- /dev/null
+++ b/pages/mSelfPatrol/patrolpromise/index.js
@@ -0,0 +1,81 @@
+import selfpatrolservice from "../../../service/selfpatrolservice";
+import moment from "../../../utils/moment.min";
+const app = getApp()
+
+Page({
+
+ /**
+ * 椤甸潰鐨勫垵濮嬫暟鎹�
+ */
+ data: {
+ date: '2026骞�01鏈�20鏃�',
+ promiseText: app.globalData.userSetting.spPromiseContent,
+ showDialog: false,
+ promiseContent: '灏婃暚鐨勭敤鎴凤細\n绛剧讲鏈壙璇轰功鍚庯紝鎮ㄦ湰骞村害鍐呭凡涓婁紶鐨勬湁鏁堣嚜宸℃煡璁板綍灏嗘棤闇�姣忔湀閲嶅涓婁紶锛岀郴缁熷皢瑙嗗叾涓洪暱鏈熸湁鏁堛�傛偍浠嶅彲闅忔椂涓婁紶鏂扮殑宸℃煡璁板綍銆俓n璇风‘淇濆~鍐欎俊鎭噯纭紝鎵胯鍐呭鐪熷疄銆傝櫄鍋囨壙璇哄彲鑳藉鑷存湇鍔$粓姝㈠苟鎵挎媴鐩稿簲璐d换銆�',
+ agree: false,
+ confirmBtn: {
+ content: '纭',
+ variant: 'base'
+ },
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+ */
+ onLoad(options) {
+ var now = moment();
+ this.setData({
+ date: now.format('YYYY骞碝M鏈圖D鏃�'),
+ });
+ },
+
+ checkboxChange(e) {
+ var a = !this.data.agree;
+ this.setData({
+ agree: a,
+ });
+ },
+
+ waitAgree() {
+ if (this.data.agree) {
+ return true;
+ } else {
+ wx.showToast({
+ title: '璇峰嬀閫夊悓鎰忔潯娆�',
+ icon: 'none',
+ });
+ return false;
+ }
+ },
+
+ showCheckDialog() {
+ if (this.waitAgree()) {
+ this.setData({
+ showDialog: true
+ })
+ }
+ },
+ closeCheckDialog() {
+ this.setData({
+ showDialog: false
+ })
+ },
+
+ /**
+ * 绛剧讲鑷贰鏌ユ壙璇轰功
+ */
+ doPromise() {
+ selfpatrolservice.signPromise(app.globalData.accessToken.userId, {
+ success: res => {
+ // app.globalData.userSetting = res.data
+ this.getOpenerEventChannel().emit('doPromiseDone', {
+ promised: res.data.selfPatrolPromised,
+ promiseTime: res.data.lastPromisedTime,
+ });
+ wx.navigateBack({
+ delta: 1,
+ });
+ }
+ })
+ },
+})
\ No newline at end of file
diff --git a/pages/mSelfPatrol/patrolpromise/index.json b/pages/mSelfPatrol/patrolpromise/index.json
new file mode 100644
index 0000000..bf8cdfa
--- /dev/null
+++ b/pages/mSelfPatrol/patrolpromise/index.json
@@ -0,0 +1,6 @@
+{
+ "navigationBarTitleText": "鑷贰鏌ユ壙璇�",
+ "navigationBarBackgroundColor": "#57E4CB",
+ "navigationBarTextStyle": "white",
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/mSelfPatrol/patrolpromise/index.wxml b/pages/mSelfPatrol/patrolpromise/index.wxml
new file mode 100644
index 0000000..f993255
--- /dev/null
+++ b/pages/mSelfPatrol/patrolpromise/index.wxml
@@ -0,0 +1,43 @@
+<view class="page">
+ <view class="banner-bg"></view>
+ <view class="page__bd">
+ <view class="fyui-panel">
+ <view class="p-title">鐜繚鑷贰鏌ユ壙璇轰功</view>
+ <text class="p-content"> {{promiseText}} </text>
+ <text style="text-align: end">\n绛剧讲鏃堕棿锛歿{date}}</text>
+ <text style="font-weight: 600"
+ >\n*璇蜂粩缁嗛槄璇讳互涓婃壙璇烘潯娆撅紝纭鏃犺鍚庤鍦ㄤ笅鏂圭缃�</text
+ >
+ </view>
+ </view>
+ <view class="page__ft">
+ <view class="weui-agree">
+ <label bindtap="checkboxChange">
+ <checkbox
+ class="weui-agree__checkbox-check"
+ value="{{agree}}"
+ checked="{{agree}}"
+ />
+ <span class="weui-agree__checkbox"></span>
+ <span class="weui-agree__text"
+ >鎴戝凡闃呰銆佺悊瑙e苟鍚屾剰浠ヤ笂銆婄幆淇濊嚜宸℃煡鎵胯涔︺�嬬殑鍏ㄩ儴鍐呭銆�</span
+ >
+ </label>
+ </view>
+ <view class="submit" bindtap="showCheckDialog">绛剧讲</view>
+ </view>
+</view>
+<t-dialog
+ visible="{{showDialog}}"
+ prevent-scroll-through
+ confirm-btn="{{confirmBtn}}"
+ cancel-btn="鍙栨秷"
+ bind:confirm="doPromise"
+ bind:cancel="closeCheckDialog"
+>
+ <scroll-view slot="content" scroll-y class="long-content">
+ <text class="content-container" user-select="{{true}}"
+ >{{promiseContent}}
+ </text>
+ </scroll-view>
+</t-dialog>
diff --git a/pages/mSelfPatrol/patrolpromise/index.wxss b/pages/mSelfPatrol/patrolpromise/index.wxss
new file mode 100644
index 0000000..1d7b05c
--- /dev/null
+++ b/pages/mSelfPatrol/patrolpromise/index.wxss
@@ -0,0 +1,72 @@
+.page__bd {
+ font-size: 14px;
+}
+
+.banner-bg {
+ position: fixed;
+ width: 100%;
+ height: 5vh;
+ background-color: #57E4CB;
+}
+
+.fyui-panel {
+ padding: 8px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+
+.p-title {
+ text-align: center;
+ padding-top: 16px;
+ font-size: 20px;
+ font-weight: 600;
+}
+
+.p-content {
+ font-size: 14px;
+}
+
+.p-sign {
+ font-size: 12px;
+ color: var(--fyui-text-color_2);
+}
+
+.submit {
+ border-radius: 4px;
+ background: linear-gradient(to right, #6DF1A9, #62EBCF);
+ margin: 8px;
+ color: white;
+ 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
+}
+
+.top-right {
+ margin-top: 6px;
+ margin-right: 6px;
+}
+
+.weui-agree {
+ /* font-size: 12px; */
+ text-align: left;
+}
+
+.weui-agree__text {
+ color: var(--fyui-primary-color-1);
+ font-weight: 600;
+}
\ No newline at end of file
diff --git a/service/baserequest.js b/service/baserequest.js
index 7449b7e..09b2742 100644
--- a/service/baserequest.js
+++ b/service/baserequest.js
@@ -44,15 +44,13 @@
fun.url = bUrl + url;
}
var fun1 = util.deepCopy(fun);
- if (mode == 'debug') {
- console.log(
- '|------------------------------------------------------------------------------------------------------------',
- );
- console.log('|--璁块棶: ', fun.url);
- console.log('|--鍙傛暟: ', fun.data);
- }
fun1.success = function (res) {
if (mode == 'debug') {
+ console.log(
+ '|------------------------------------------------------------------------------------------------------------',
+ );
+ console.log('|--璁块棶: ', fun.url);
+ console.log('|--鍙傛暟: ', fun.data);
console.log('|--缁撴灉: ', res);
}
@@ -76,6 +74,11 @@
};
fun1.fail = function (error) {
if (mode == 'debug') {
+ console.log(
+ '|------------------------------------------------------------------------------------------------------------',
+ );
+ console.log('|--璁块棶: ', fun.url);
+ console.log('|--鍙傛暟: ', fun.data);
console.log('|--閿欒: ', error);
}
wx.showToast({
diff --git a/service/selfpatrolservice.js b/service/selfpatrolservice.js
index b21d782..02e5350 100644
--- a/service/selfpatrolservice.js
+++ b/service/selfpatrolservice.js
@@ -49,8 +49,7 @@
//涓婁紶鑷贰鏌�
uploadSelfPatrol: function (userId, taskId, selfPatrol, paths, fun) {
- const fields = [
- {
+ const fields = [{
name: 'params',
value: JSON.stringify([selfPatrol]),
},
@@ -129,4 +128,20 @@
$f.get(fun1);
},
-};
+
+ // 绛剧讲鑷贰鏌ユ壙璇�
+ signPromise: function (
+ userId,
+ fun,
+ ) {
+ let cb = {
+ url: '/selfPatrol/promise',
+ params: {
+ userId: userId,
+ },
+ };
+ Object.assign(cb, fun);
+
+ $f.post(cb);
+ },
+};
\ No newline at end of file
--
Gitblit v1.9.3