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(); $user = User::auth();
// //
$data = Report::whereHas("Receives", function (Builder $query) use ($user) { $total = Report::select('reports.id')
$query->where("userid", $user->userid)->where("read", 0); ->join('report_receives', 'report_receives.rid', '=', 'reports.id')
})->orderByDesc('created_at')->paginate(Base::getPaginate(50, 20)); ->where('report_receives.userid', $user->userid)
return Base::retSuccess("success", $data); ->where('report_receives.read', 0)
->count();
//
return Base::retSuccess("success", compact("total"));
} }
/** /**

View File

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

View File

@ -415,8 +415,8 @@ export default {
activated() { activated() {
this.$store.dispatch("getUserInfo").catch(_ => {}) this.$store.dispatch("getUserInfo").catch(_ => {})
this.$store.dispatch("getTaskPriority").catch(_ => {}) this.$store.dispatch("getTaskPriority").catch(_ => {})
this.$store.dispatch("getReportUnread", 0) this.$store.dispatch("getReportUnread", 1000)
this.$store.dispatch("getApproveUnread", 0) this.$store.dispatch("getApproveUnread", 1000)
// //
this.$store.dispatch("needHome").then(_ => { this.$store.dispatch("needHome").then(_ => {
this.needStartHome = true this.needStartHome = true
@ -454,8 +454,6 @@ export default {
'wsOpenNum', 'wsOpenNum',
'columnTemplate', 'columnTemplate',
'wsMsg',
'clientNewVersion', 'clientNewVersion',
'cacheTaskBrowse', 'cacheTaskBrowse',
@ -696,25 +694,6 @@ export default {
}, },
immediate: true 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: { methods: {

View File

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

View File

@ -11,12 +11,16 @@
v-longpress="{callback: handleLongpress, delay: 300}"> v-longpress="{callback: handleLongpress, delay: 300}">
<!--回复--> <!--回复-->
<div v-if="!hideReply && msgData.reply_data" class="dialog-reply no-dark-content" @click="viewReply"> <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 class="reply-desc" v-html="$A.getMsgSimpleDesc(msgData.reply_data, 'image-preview')"></div>
</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)"> <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>
<!--详情--> <!--详情-->
<div ref="content" class="dialog-content" :class="contentClass"> <div ref="content" class="dialog-content" :class="contentClass">

View File

@ -419,7 +419,7 @@
<span>{{item.name}}</span> <span>{{item.name}}</span>
</div> </div>
</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> </li>
</ul> </ul>
</Scrollbar> </Scrollbar>

View File

@ -1922,7 +1922,7 @@ export default {
/** /**
* 添加任务 * 添加任务
* @param state * @param state
* @param commit * @param dispatch
* @param data * @param data
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
@ -3245,9 +3245,8 @@ export default {
* 初始化 websocket * 初始化 websocket
* @param state * @param state
* @param dispatch * @param dispatch
* @param commit
*/ */
websocketConnection({state, dispatch, commit}) { websocketConnection({state, dispatch}) {
clearTimeout(state.wsTimeout); clearTimeout(state.wsTimeout);
if (state.ws) { if (state.ws) {
state.ws.close(); state.ws.close();
@ -3557,6 +3556,28 @@ export default {
} }
})(msgDetail); })(msgDetail);
break; 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 break
} }

View File

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

View File

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

View File

@ -1,18 +1,6 @@
body { body {
overflow: hidden; 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 { .form-tip {
color: $primary-desc-color; color: $primary-desc-color;
line-height: 22px; line-height: 22px;

View File

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