no message

This commit is contained in:
kuaifan 2024-01-03 15:23:06 +08:00
parent 0daf06c06d
commit 2a864b6617
11 changed files with 93 additions and 91 deletions

View File

@ -474,10 +474,13 @@ class ReportController extends AbstractController
{
$user = User::auth();
//
$data = Report::whereHas("Receives", function (Builder $query) use ($user) {
$query->where("userid", $user->userid)->where("read", 0);
})->orderByDesc('created_at')->paginate(Base::getPaginate(50, 20));
return Base::retSuccess("success", $data);
$total = Report::select('reports.id')
->join('report_receives', 'report_receives.rid', '=', 'reports.id')
->where('report_receives.userid', $user->userid)
->where('report_receives.read', 0)
->count();
//
return Base::retSuccess("success", compact("total"));
}
/**

View File

@ -1,7 +1,6 @@
<template>
<div class="mobile-back">
<div v-show="windowScrollY > 0" ref="bar" class="back-bar"></div>
<div v-if="show" class="back-semicircle" :style="style"></div>
<div v-if="isVisible" class="back-semicircle" :style="style"></div>
</div>
</template>
@ -20,9 +19,13 @@ export default {
data() {
return {
show: false,
x: 0,
y: 0
y: 0,
isVisible: false,
isTouched: false,
isScrolling: undefined,
touchesStart: {},
};
},
@ -31,14 +34,12 @@ export default {
},
mounted() {
this.$refs.bar.addEventListener('touchmove', this.barListener)
document.addEventListener('touchstart', this.touchstart)
document.addEventListener('touchmove', this.touchmove)
document.addEventListener('touchmove', this.touchmove, { passive: false })
document.addEventListener('touchend', this.touchend)
},
beforeDestroy() {
this.$refs.bar.removeEventListener('touchmove', this.barListener)
document.removeEventListener('touchstart', this.touchstart)
document.removeEventListener('touchmove', this.touchmove)
document.removeEventListener('touchend', this.touchend)
@ -68,46 +69,51 @@ export default {
},
watch: {
show(state) {
if (state) {
document.body.classList.add("touch-back");
} else {
document.body.classList.remove("touch-back");
}
isVisible(state) {
this.$store.state.touchBackInProgress = state;
}
},
methods: {
getXY(event) {
let touch = event.touches[0]
const touch = event.touches[0]
this.x = touch.clientX
this.y = touch.clientY
},
barListener(event) {
event.preventDefault()
},
touchstart(event) {
this.getXY(event)
//
this.show = this.canBack() && this.x < 20;
this.isTouched = this.canBack() && this.x < 20;
this.isScrolling = undefined
this.touchesStart.x = event.type === 'touchstart' ? event.targetTouches[0].pageX : event.pageX;
this.touchesStart.y = event.type === 'touchstart' ? event.targetTouches[0].pageY : event.pageY;
},
touchmove(event) {
if (this.show) {
this.getXY(event)
if (!this.isTouched) {
return;
}
const pageX = event.type === 'touchmove' ? event.targetTouches[0].pageX : event.pageX;
const pageY = event.type === 'touchmove' ? event.targetTouches[0].pageY : event.pageY;
if (typeof this.isScrolling === 'undefined') {
this.isScrolling = !!(this.isScrolling || Math.abs(pageY - this.touchesStart.y) > Math.abs(pageX - this.touchesStart.x));
}
if (this.isScrolling) {
this.isTouched = false;
return;
}
this.isVisible = true
this.getXY(event)
event.preventDefault()
},
touchend() {
//
if (this.x > 90 && this.show) {
if (this.x > 90 && this.isVisible) {
this.onBack();
}
this.x = 0
this.show = false
this.isVisible = false
},
canBack() {

View File

@ -415,8 +415,8 @@ export default {
activated() {
this.$store.dispatch("getUserInfo").catch(_ => {})
this.$store.dispatch("getTaskPriority").catch(_ => {})
this.$store.dispatch("getReportUnread", 0)
this.$store.dispatch("getApproveUnread", 0)
this.$store.dispatch("getReportUnread", 1000)
this.$store.dispatch("getApproveUnread", 1000)
//
this.$store.dispatch("needHome").then(_ => {
this.needStartHome = true
@ -454,8 +454,6 @@ export default {
'wsOpenNum',
'columnTemplate',
'wsMsg',
'clientNewVersion',
'cacheTaskBrowse',
@ -696,25 +694,6 @@ export default {
},
immediate: true
},
wsMsg: {
handler(info) {
const {type, action} = info;
switch (type) {
case 'report':
if (action == 'unreadUpdate') {
this.$store.dispatch("getReportUnread", 1000)
}
break;
case 'approve':
if (action == 'unread') {
this.$store.dispatch("getApproveUnread", 1000)
}
break;
}
},
deep: true,
},
},
methods: {

View File

@ -31,7 +31,7 @@
</div>
<div class="initiate">
<span>{{ $L('由') }}</span>
<UserAvatar :userid="createId" :size="22" :showName="true" tooltipDisabled/>
<UserAvatar :userid="createId" :size="22" :showName="true"/>
<span> {{ $L('发起,参与接龙目前共'+num+'人') }}</span>
</div>
<div class="textarea">

View File

@ -11,12 +11,16 @@
v-longpress="{callback: handleLongpress, delay: 300}">
<!--回复-->
<div v-if="!hideReply && msgData.reply_data" class="dialog-reply no-dark-content" @click="viewReply">
<UserAvatar :userid="msgData.reply_data.userid" :show-icon="false" :show-name="true"/>
<div class="reply-avatar">
<UserAvatar :userid="msgData.reply_data.userid" :show-icon="false" :show-name="true"/>
</div>
<div class="reply-desc" v-html="$A.getMsgSimpleDesc(msgData.reply_data, 'image-preview')"></div>
</div>
<!--转发-->
<div v-if="msgData.forward_show && msgData.forward_data && msgData.forward_data.userid" class="dialog-reply no-dark-content" @click="openDialog(msgData.forward_data.userid)">
<UserAvatar :userid="msgData.forward_data.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/>
<div class="reply-avatar">
<UserAvatar :userid="msgData.forward_data.userid" :show-icon="false" :show-name="true"/>
</div>
</div>
<!--详情-->
<div ref="content" class="dialog-content" :class="contentClass">

View File

@ -419,7 +419,7 @@
<span>{{item.name}}</span>
</div>
</div>
<UserAvatar v-else :userid="item.userid" :size="32" :show-name="forwardData.length == 1" tooltip-disabled />
<UserAvatar v-else :userid="item.userid" :size="32" :show-name="forwardData.length == 1"/>
</li>
</ul>
</Scrollbar>

View File

@ -1922,7 +1922,7 @@ export default {
/**
* 添加任务
* @param state
* @param commit
* @param dispatch
* @param data
* @returns {Promise<unknown>}
*/
@ -3245,9 +3245,8 @@ export default {
* 初始化 websocket
* @param state
* @param dispatch
* @param commit
*/
websocketConnection({state, dispatch, commit}) {
websocketConnection({state, dispatch}) {
clearTimeout(state.wsTimeout);
if (state.ws) {
state.ws.close();
@ -3557,6 +3556,28 @@ export default {
}
})(msgDetail);
break;
/**
* 工作报告
*/
case "report":
(function ({action}) {
if (action == 'unreadUpdate') {
dispatch("getReportUnread", 1000)
}
})(msgDetail);
break;
/**
* 流程审批
*/
case "approve":
(function ({action}) {
if (action == 'unread') {
dispatch("getApproveUnread", 1000)
}
})(msgDetail);
break;
}
break
}

View File

@ -59,6 +59,8 @@ export default {
loadDialogLatestId: 0,
floatSpinnerTimer: [],
floatSpinnerLoad: 0,
// 滑动返回
touchBackInProgress: false,
// User

View File

@ -88,15 +88,6 @@
.mobile-back {
display: none;
.back-bar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 20px;
z-index: 9998;
}
.back-semicircle {
position: fixed;
top: 200px;

View File

@ -1,18 +1,6 @@
body {
overflow: hidden;
&.touch-back {
.scrollbar-container .scrollbar-content,
.dialog-wrapper .vue-recycle-scroller.direction-vertical:not(.page-mode),
.dialog-wrapper .dialog-scroller.scrollbar-virtual,
.common-gantt .gantt-left .gantt-item,
.project-panel .project-column,
.project-panel .project-table,
.ivu-modal-wrap {
overflow: hidden;
}
}
.form-tip {
color: $primary-desc-color;
line-height: 22px;

View File

@ -38,7 +38,7 @@
.original-button {
display: block;
margin: 0 auto;
margin: 0 auto 16px;
box-shadow: none;
}
}
@ -541,7 +541,6 @@
padding-left: 9px;
margin-bottom: 4px;
cursor: pointer;
&:after {
content: "";
position: absolute;
@ -554,10 +553,14 @@
transform-origin: left center;
background-color: rgba($primary-color, 0.7);
}
.common-avatar {
font-weight: 500;
font-size: 13px;
color: $primary-color;
.reply-avatar {
height: 20px;
line-height: 20px;
.common-avatar {
font-weight: 500;
font-size: 13px;
color: $primary-color;
}
}
.reply-desc {
font-size: 13px;
@ -1321,13 +1324,15 @@
.dialog-reply {
color: #ffffff;
.common-avatar,
.bot {
color: #ffffff;
}
&:after {
background-color: #ffffff;
}
.reply-avatar {
.bot,
.common-avatar {
color: #ffffff;
}
}
}
.dialog-content {
@ -1724,8 +1729,11 @@
background-color: rgba(132, 197, 106, 0.7);
}
.bot, .common-avatar {
color: #84C56A !important;
.reply-avatar {
.bot,
.common-avatar {
color: #84C56A !important;
}
}
}