|
@@ -4,8 +4,8 @@
|
|
|
<image
|
|
|
:src="
|
|
|
messageType
|
|
|
- ? '/static/mission/消息中心未读.png'
|
|
|
- : '/static/mission/消息中心已读.png'
|
|
|
+ ? '/static/message-unread.png'
|
|
|
+ : '/static/message-read.png'
|
|
|
"
|
|
|
mode=""
|
|
|
></image>
|
|
@@ -24,27 +24,30 @@
|
|
|
v-for="(items, index) in item"
|
|
|
class="calendarCon"
|
|
|
@click="dateClick(items, index)"
|
|
|
+ :style="items.greyFlag ? { color: '#B8BECC' } : { color: '#292C33' }"
|
|
|
>
|
|
|
- <view class="date">
|
|
|
- {{
|
|
|
- items.time
|
|
|
- ? items.time.slice(9, 10) == "0"
|
|
|
- ? items.time.slice(10, 11)
|
|
|
- : items.time.slice(9, 11)
|
|
|
- : ""
|
|
|
- }}
|
|
|
+ <view :class="items.specificDate == changedDate ? 'date2' : 'date'">
|
|
|
+ {{ items.day ? items.day : "" }}
|
|
|
</view>
|
|
|
- <view class="yinDate">
|
|
|
- {{ items.yinTime ? items.yinTime : "" }}
|
|
|
+ <view
|
|
|
+ class="yinDate"
|
|
|
+ :style="
|
|
|
+ items.greyFlag ? { color: '#B8BECC' } : { color: '#292C33' }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ items.chineseDay ? items.chineseDay : "" }}
|
|
|
</view>
|
|
|
- <view :class="items.work ? 'work' : ''">
|
|
|
- <view class="sum">{{ items.work ? items.work : "" }}</view>
|
|
|
- <view class="danwei">{{ items.work ? "单位" : "" }}</view>
|
|
|
+ <view :class="items.deptCount != '0' ? 'work' : ''">
|
|
|
+ <view class="sum">{{
|
|
|
+ items.deptCount != "0" ? items.deptCount : ""
|
|
|
+ }}</view>
|
|
|
+ <view class="danwei">{{
|
|
|
+ items.deptCount != "0" ? "单位" : ""
|
|
|
+ }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view v-for=""></view> -->
|
|
|
<change-calendar
|
|
|
v-if="showCC"
|
|
|
:changedYear="changedYear"
|
|
@@ -77,42 +80,32 @@ export default {
|
|
|
dayOfWeek: "",
|
|
|
str_nums: "",
|
|
|
data1: [],
|
|
|
+ changedDate: moment().format("YYYY-MM-DD"),
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
changeCalendar,
|
|
|
},
|
|
|
created() {
|
|
|
- // this.getMissionList();
|
|
|
- // var data = '2021-02-19';
|
|
|
this.changedDay = this.dayArray[new Date().getDay()];
|
|
|
this.init(true);
|
|
|
this.refTimer = setInterval(() => {
|
|
|
this.isInitWs = websocket.ws ? false : true;
|
|
|
this.init(this.isInitWs);
|
|
|
}, 3 * 60 * 1000);
|
|
|
+ this.messStatus();
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
// 关闭ws连接
|
|
|
websocket.close();
|
|
|
clearInterval(this.refTimer);
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.days_per_month = new Array(
|
|
|
- 31,
|
|
|
- 28 + this.isLeap(this.changedYear),
|
|
|
- 31,
|
|
|
- 30,
|
|
|
- 31,
|
|
|
- 30,
|
|
|
- 31,
|
|
|
- 31,
|
|
|
- 30,
|
|
|
- 31,
|
|
|
- 30,
|
|
|
- 31
|
|
|
- ); //创建月份数组
|
|
|
- this.getCanList2();
|
|
|
+ watch:{
|
|
|
+ "$route":{
|
|
|
+ handler(route){
|
|
|
+ this.messStatus();
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
getCanList() {
|
|
@@ -120,10 +113,9 @@ export default {
|
|
|
.dispatch({
|
|
|
type: "calendar/commActions",
|
|
|
payload: {
|
|
|
- key: "getDefault",
|
|
|
+ key: "getCalList",
|
|
|
data: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
+ years: this.changedYear + "-" + this.changedMonth,
|
|
|
},
|
|
|
},
|
|
|
})
|
|
@@ -133,6 +125,13 @@ export default {
|
|
|
let user = uni.getStorageSync("id");
|
|
|
let permission = uni.getStorageSync("nowPermission");
|
|
|
this.isInitWs && this.initWebsocket(hiId, user, permission);
|
|
|
+ this.str_nums = Math.ceil(data.length / 7); //确定日期表格所需的行数
|
|
|
+ let data2 = [];
|
|
|
+ for (let i = 0; i < this.str_nums; i++) {
|
|
|
+ data2[i] = [];
|
|
|
+ data2[i] = data.splice(0, 7);
|
|
|
+ }
|
|
|
+ this.data1 = data2;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -147,10 +146,8 @@ export default {
|
|
|
// 解析websocket返回数据
|
|
|
resolverWsData(type) {
|
|
|
let types = JSON.parse(type);
|
|
|
- console.log(types, "iiiiiii");
|
|
|
switch (types.type) {
|
|
|
case "TO_READ":
|
|
|
- alert("99999");
|
|
|
this.messageType = true;
|
|
|
break;
|
|
|
default:
|
|
@@ -159,6 +156,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
toMessagePage() {
|
|
|
+ // this.messageType = false;
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/messages/messages`,
|
|
|
});
|
|
@@ -175,237 +173,42 @@ export default {
|
|
|
this.changedMonth = month;
|
|
|
let day = year + "-" + month + "-01";
|
|
|
this.changedDay = this.dayArray[new Date(day).getDay()];
|
|
|
- this.getCanList2();
|
|
|
- },
|
|
|
- isLeap(year) {
|
|
|
- return year % 4 == 0
|
|
|
- ? year % 100 != 0
|
|
|
- ? 1
|
|
|
- : year % 400 == 0
|
|
|
- ? 1
|
|
|
- : 0
|
|
|
- : 0;
|
|
|
- },
|
|
|
- getMonth(m) {
|
|
|
- console.log(m);
|
|
|
- if (m.substr(0, 1) == "0") {
|
|
|
- console.log(true);
|
|
|
- return m.substr(1, 2);
|
|
|
- } else {
|
|
|
- return m;
|
|
|
- }
|
|
|
- },
|
|
|
- //获取上个月的天数
|
|
|
- getPreMonthCount(year, month) {
|
|
|
- if (month === 0) {
|
|
|
- return getMonthCount(year - 1, 11);
|
|
|
- } else {
|
|
|
- return getMonthCount(year, month - 1);
|
|
|
- }
|
|
|
- },
|
|
|
- getCanList2() {
|
|
|
- this.$store
|
|
|
- .dispatch({
|
|
|
- type: "calendar/commActions",
|
|
|
- payload: {
|
|
|
- key: "getDefault",
|
|
|
- data: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- .then((data) => {
|
|
|
- let data1 = [
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: 5,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- {
|
|
|
- time: "2021-02-03",
|
|
|
- yinTime: "二十",
|
|
|
- work: null,
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- this.firstday = new Date(
|
|
|
- this.changedYear,
|
|
|
- this.changedMonth.slice(0, 1) == "0"
|
|
|
- ? this.changedMonth.slice(1, 2) - 1
|
|
|
- : this.changedMonth - 1,
|
|
|
- 1
|
|
|
- ); //获取每月第一天
|
|
|
- this.dayOfWeek = this.firstday.getDay(); //判断第一天是星期几(返回[0-6]中的一个,0代表星期天,1代表星期一,以此类推)
|
|
|
- this.str_nums = Math.ceil((this.dayOfWeek + data1.length) / 7); //确定日期表格所需的行数
|
|
|
- let data2 = [];
|
|
|
- for (let i = 0; i < this.str_nums; i++) {
|
|
|
- data2[i] = [];
|
|
|
- if (i == 0 && this.dayOfWeek != 0) {
|
|
|
- for (let j = 0; j < this.dayOfWeek; j++) {
|
|
|
- data2[i].push({});
|
|
|
- }
|
|
|
- let data3 = data1.splice(0, 7 - this.dayOfWeek);
|
|
|
- for (let k = 0; k < data3.length; k++) {
|
|
|
- data2[i].push(data3[k]);
|
|
|
- }
|
|
|
- } else if (i == 0 && this.dayOfWeek == 0) {
|
|
|
- data2[i] = data1.splice(0, 7);
|
|
|
- } else {
|
|
|
- if (i == this.str_nums - 1 && data1.length < 7) {
|
|
|
- data2[i] = data1.splice(0, 7);
|
|
|
- for (let k = 1; k < 7 - data1.length; k++) {
|
|
|
- data2[i].push({});
|
|
|
- }
|
|
|
- } else if (i == this.str_nums - 1 && data1.length == 7) {
|
|
|
- data2[i] = data1.splice(0, 7);
|
|
|
- } else {
|
|
|
- data2[i] = data1.splice(0, 7);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(data2);
|
|
|
- this.data1 = data2;
|
|
|
- });
|
|
|
+ this.getCanList();
|
|
|
},
|
|
|
dateClick(data, i) {
|
|
|
- console.log(data, i);
|
|
|
- if (data && data.work) {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: `/pages/mission-details/mission-details?taskId=${data.businessId}`,
|
|
|
- // });
|
|
|
+ if (data && data.specificDate) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/todayCheck/todayCheck?date=${data.specificDate}`,
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
+ messStatus(){
|
|
|
+ let num = 1;
|
|
|
+ let timer = setInterval(()=>{
|
|
|
+ this.$store.dispatch({
|
|
|
+ type: "calendar/commActions",
|
|
|
+ payload: {
|
|
|
+ key: "messagesList",
|
|
|
+ data: {
|
|
|
+ pageNum: num,
|
|
|
+ pageSize: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }).then((res)=>{
|
|
|
+ if(res && res.list.length == 0){
|
|
|
+ clearInterval(timer)
|
|
|
+ }else if(res && res.list.length != 0){
|
|
|
+ res.list.map((item)=>{
|
|
|
+ if(!item.readStatus){
|
|
|
+ this.messageType = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ num++;
|
|
|
+ },100)
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -459,8 +262,20 @@ export default {
|
|
|
font-size: 35rpx;
|
|
|
color: #292c33;
|
|
|
.date {
|
|
|
- padding-top: 25rpx;
|
|
|
- padding-bottom: 15rpx;
|
|
|
+ margin: 16.25rpx auto 6.25rpx;
|
|
|
+ height: 52.5rpx;
|
|
|
+ width: 52.5rpx;
|
|
|
+ line-height: 52.5rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ .date2 {
|
|
|
+ margin: 16.25rpx auto 6.25rpx;
|
|
|
+ height: 52.5rpx;
|
|
|
+ width: 52.5rpx;
|
|
|
+ line-height: 52.5rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #3377ff;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
.yinDate {
|
|
|
color: #666e80;
|