diff --git a/app/Http/Controllers/Api/ReportController.php b/app/Http/Controllers/Api/ReportController.php index 634ebda81..cbb2be17c 100755 --- a/app/Http/Controllers/Api/ReportController.php +++ b/app/Http/Controllers/Api/ReportController.php @@ -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")); } /** diff --git a/resources/assets/js/components/Mobile/Back.vue b/resources/assets/js/components/Mobile/Back.vue index 5422cdca7..ac747614d 100644 --- a/resources/assets/js/components/Mobile/Back.vue +++ b/resources/assets/js/components/Mobile/Back.vue @@ -1,7 +1,6 @@ @@ -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() { diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 67b2ae482..2a213b96e 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -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: { diff --git a/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue b/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue index 55ec2867b..02d230c60 100644 --- a/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue +++ b/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue @@ -31,7 +31,7 @@
{{ $L('由') }} - + {{ $L('发起,参与接龙目前共'+num+'人') }}
diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 88328ac1c..19f1a80ef 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -11,12 +11,16 @@ v-longpress="{callback: handleLongpress, delay: 300}">
- +
+ +
- +
+ +
diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index bf1eb052e..595a09ce0 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -419,7 +419,7 @@ {{item.name}}
- + diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 6d32c9396..bf1990e3a 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1922,7 +1922,7 @@ export default { /** * 添加任务 * @param state - * @param commit + * @param dispatch * @param data * @returns {Promise} */ @@ -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 } diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index e7c2b02a7..c4014853d 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -59,6 +59,8 @@ export default { loadDialogLatestId: 0, floatSpinnerTimer: [], floatSpinnerLoad: 0, + + // 滑动返回 touchBackInProgress: false, // User diff --git a/resources/assets/sass/components/mobile.scss b/resources/assets/sass/components/mobile.scss index 3458973ce..6e6ee4ef3 100644 --- a/resources/assets/sass/components/mobile.scss +++ b/resources/assets/sass/components/mobile.scss @@ -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; diff --git a/resources/assets/sass/pages/common.scss b/resources/assets/sass/pages/common.scss index 02011b5e2..6dda6d1af 100755 --- a/resources/assets/sass/pages/common.scss +++ b/resources/assets/sass/pages/common.scss @@ -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; diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss index 1b2e1333c..0af3afae8 100644 --- a/resources/assets/sass/pages/components/dialog-wrapper.scss +++ b/resources/assets/sass/pages/components/dialog-wrapper.scss @@ -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; + } } }