ソースを参照

首页待办任务

xiaohaizhao 3 ヶ月 前
コミット
643fcebbaa

+ 6 - 1
pages/tabbar/home/index.js

@@ -7,12 +7,13 @@ import {
 } from "../../../utils/work/work";
 Page({
     data: {
-        appid: 'wx197f219a82a89d7b',
+        appid: 'wxb00809948b4c8038',
         bannerList: [], //banner列表
         gridList: [],
         notice: "",
         msgCount: 1,
         msgList: [], //消息列表
+        isShowTask: false
     },
     onLoad(options) {
         this.setData({ //获取胶囊位置信息
@@ -63,6 +64,10 @@ Page({
         })
         if (wx.getStorageSync('userauth').length != 0) {
             initWorkbench(this)
+            let crm = this.data.entrance.find(v => v.label == "应用");
+            this.setData({
+                isShowTask: crm.list.some(v => v.name == '行事历')
+            })
         } else {
             setTimeout(this.refreshData, 100);
             return;

+ 1 - 1
pages/tabbar/home/index.wxml

@@ -35,5 +35,5 @@
         </view>
     </block>
 </view>
-<!-- <waitToBeDone /> -->
+<waitToBeDone wx:if="{{isShowTask}}" />
 <view style="height: 160rpx;" />

+ 73 - 34
pages/tabbar/home/waitToBeDone/index.js

@@ -1,42 +1,81 @@
+let _Http = getApp().globalData.http;
 Component({
-    properties: {
-
-    },
     data: {
-        tasks: [{
-                id: 1,
-                title: '参加扬州大学附属医院产品推介会',
-                date: '2025-12-15'
-            },
-            {
-                id: 2,
-                title: '跟台上海天伦医院手术3场',
-                date: '2025-12-15'
-            }
-        ],
-        records: [{
-                id: 1,
-                title: '参加扬州大学附属医院产品推介会',
-                date: '2025-12-15'
-            },
-            {
-                id: 2,
-                title: '跟台上海天伦医院手术3场',
-                date: '2025-12-15'
+        tasks: [],
+        content: {
+            "year": '',
+            "month": '',
+            "day": '',
+            "taskUserid": wx.getStorageSync('userMsg').userid,
+            "where": {
+                "condition": ""
             }
-        ],
+        },
+        list: {}
     },
     methods: {
-        handleCalendarLoad(e) {
-            console.log("加载", e)
-            // 1. 拿到今日日期 把年月记录到data中
-            // 2. 获取当月数据给日期打标记
-            // 3. 获取当日数据
-        },
         handleCalendarDateChange(e) {
-            console.log("切换日期", e)
-            // 1. 获取当日数据
-            // 2. 判断选中日的年月是否与data中的相同;不相同获取当月数据打标记
-        }
+            const {
+                year,
+                month,
+                day
+            } = e.detail.date,
+                key = `${year}-${month>10?month:'0'+month}-${day>10?day:'0'+day}`;
+            try {
+                const obj = this.data.list[key];
+                this.setData({
+                    tasks: obj.task,
+                })
+            } catch (error) {
+                this.getList(year, month, day, key)
+            }
+        },
+        getList(year, month, day, key) {
+            let content = this.data.content;
+            if (year == content.year && month == content.month) return;
+            content.year = year;
+            content.month = month;
+            content.day = day;
+            _Http.basic({
+                "id": 2025122210193402,
+                content
+            }).then(res => {
+                console.log("任务列表", res)
+                if (res.code == 1) {
+                    this.setData({
+                        tasks: res.data[key].task,
+                        list: Object.assign(this.data.list, res.data)
+                    })
+                    this.setMarkers()
+                }
+            })
+        },
+        setMarkers() {
+            let list = this.data.list,
+                rw = [],
+                gj = [];
+            for (const key in list) {
+                const item = list[key];
+                const ymd = key.split("-");
+                item.year = ymd[0];
+                item.month = ymd[1];
+                item.day = ymd[2];
+                item.key = key;
+                if (item.task.length) rw.push({
+                    ...item,
+                    type: "schedule",
+                    color: '#2a97ff',
+                    bgColor: '#cce6ff'
+                })
+                // if (item.follow.length) gj.push(item)
+            }
+            this.selectComponent("#calendar").setMarkers(rw)
+        },
+        taskSelect(item) {
+            let data = item.currentTarget.dataset.data
+            wx.navigateTo({
+                url: '/prsx/calendar/task/detail?id=' + data.sys_taskid
+            })
+        },
     }
 })

+ 1 - 2
pages/tabbar/home/waitToBeDone/index.scss

@@ -1,9 +1,8 @@
 .section {
-	margin: 20rpx;
 	background-color: white;
 	border-radius: 10rpx;
 	padding: 20rpx;
-	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
+	margin-bottom: 40rpx;
 
 	.section-title {
 		font-size: 32rpx;

+ 4 - 16
pages/tabbar/home/waitToBeDone/index.wxml

@@ -1,22 +1,10 @@
-<view class="">
-	<calendar id="calendar" _vibrate='{{false}}' view='week' bindload="handleCalendarLoad" binddatechange="handleCalendarDateChange">
-		<!-- 任务列表 -->
-		<view class="section">
-			<view class="section-title">任务</view>
+<view class="" style="background-color: #fff;">
+	<calendar id="calendar" _vibrate='{{false}}' view='week' binddatechange="handleCalendarDateChange">
+		<view class="section" wx:if="{{tasks.length}}">
 			<view class="section-date">{{ selectedDate }}</view>
-			<view wx:for="{{ tasks }}" wx:key="id" class="task-item">
+			<view wx:for="{{ tasks }}" wx:key="key" class="task-item" data-data="{{item}}" bind:tap="taskSelect">
 				<text class="task-text">{{ item.title }}</text>
 			</view>
 		</view>
-
-		<!-- 跟进记录 -->
-		<view class="section">
-			<view class="section-title">跟进记录</view>
-			<view class="section-date">{{ selectedDate }}</view>
-			<view wx:for="{{ records }}" wx:key="id" class="record-item">
-				<text class="record-text">{{ item.title }}</text>
-			</view>
-		</view>
-
 	</calendar>
 </view>

+ 1 - 1
pages/tabbar/message/details.js

@@ -1,7 +1,7 @@
 const _Http = getApp().globalData.http;
 Page({
     data: {
-        appid: 'wx197f219a82a89d7b',
+        appid: 'wxb00809948b4c8038',
         detailsData: {}
     },
     onLoad(options) {

+ 1 - 1
pages/tabbar/mine/index.js

@@ -179,7 +179,7 @@ Page({
                                 "wechat_code": res.code,
                                 isbinging, // 0解绑 1绑定
                                 wechatuserinfo: userInfo,
-                                "appid": "wx197f219a82a89d7b"
+                                "appid": "wxb00809948b4c8038"
                             }
                         }).then(s => {
                             console.log("微信绑定", isbinging, s)

+ 2 - 2
utils/work/work.js

@@ -4,11 +4,11 @@ async function initWorkbench(that) {
     let entrance = [{
         label: "通用",
         icon: "work-tongyong",
-        appid: "wx197f219a82a89d7b",
+        appid: "wxb00809948b4c8038",
         list: apps.getapps()
     },{
         label: "应用",
-        appid: "wx197f219a82a89d7b",
+        appid: "wxb00809948b4c8038",
         icon: "work-CRM",
         list: apps.getcrm()
     }];