Skip to content

Commit

Permalink
Revert(SPA): 回滚2.2版本的消息系统
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Mar 5, 2019
1 parent b390b44 commit 8383f41
Show file tree
Hide file tree
Showing 64 changed files with 3,126 additions and 1,891 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getOauthUrl(Request $request)
if ($url === '') {
return response()->json(['message' => '微信配置错误'], 422);
}
$url = urlencode($url);

$originUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$config['appid'].'&redirect_uri='.$url.'&response_type=code&scope=snsapi_userinfo&state=true#wechat_redirect';

return response()->json(['url' => $originUrl], 200);
Expand Down
12 changes: 0 additions & 12 deletions resources/spa/src/api/feeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ export function getFeeds (params) {
return api.get('/feeds', { params, validateStatus: s => s === 200 })
}

/**
* 获取动态详情
*
* @author mutoe <mutoe@foxmail.com>
* @export
* @param {string} feedId
* @returns
*/
export function getFeed (feedId) {
return api.get(`/feeds/${feedId}`)
}

/**
* 申请动态置顶
* @author mutoe <mutoe@foxmail.com>
Expand Down
25 changes: 0 additions & 25 deletions resources/spa/src/api/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,3 @@ export function getPostCommentAudits ({ after = 0, post = 0 }) {
const params = { after, limit, post }
return api.get('/plus-group/pinned/comments', { params })
}

/**
* 获取圈子审核列表
* @author mutoe <mutoe@foxmail.com>
* @export
* @param {Object} payload
* @param {number} [payload.after=0]
* @returns
*/
export function getGroupAudits ({ after }) {
const params = { after, limit }
return api.get('/plus-group/user-group-audit-members', { params })
}

/**
* 批量获取帖子简单数据
*
* @author mutoe <mutoe@foxmail.com>
* @export
* @param {string} ids
* @returns
*/
export function getSimplePosts (ids) {
return api.get('/group/simple-posts', { params: { id: ids } })
}
43 changes: 16 additions & 27 deletions resources/spa/src/api/message.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
import api from './api'
import { limit } from './index'

// 获取系统通知
export function getNotificationStatistics () {
return api.get(`/user/notification-statistics`)
}

// 获取未读审核通知数量
export function getUnreadCounts () {
return api.get('/user/counts')
}

/**
* 获取通知列表
* @author mutoe <mutoe@foxmail.com>
* @export
* @param {Object} params
* @param {string} params.type
* @param {number} [params.page=1]
* @returns
*/
export function getNotification (params) {
return api.get('/user/notifications', { params })
export function getNotifications (offset = 0) {
return api.get(`/user/notifications`, {
params: {
offset,
limit,
},
})
}

/**
* 标记通知已读
* @author mutoe <mutoe@foxmail.com>
* @export
* @param {string} type
* @returns
* 清除未读提示
* @Author Wayne
* @DateTime 2018-05-05
* @Email qiaobin@zhiyicx.com
* @param {String} type [清除的消息类型]
* @return {[type]} [description]
*/
export function resetNotificationCount (type) {
return api.patch('/user/notifications', {}, { params: { type } })
export function resetUserCount (type = '') {
api.patch('/user/counts', { type })
}
4 changes: 2 additions & 2 deletions resources/spa/src/components.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** common components */
import btnSwitch from './components/common/btnSwitch' /* btnSwitch 按钮 */
import BadgeIcon from './components/common/BadgeIcon' /* Badge 徽标 */
import badge from './components/common/badge' /* Badge 徽标 */
import CommonHeader from './components/common/CommonHeader.vue' /* 通用头部 */
import fullSpin from './components/FullSpin' /* 全屏加载动画 */
import loadMore from './components/loadMore'
Expand All @@ -18,7 +18,7 @@ import FormItems from '@/components/form/formItem.js'
export default [
Avatar,
btnSwitch,
BadgeIcon,
badge,
loadMore,
fullSpin,
HeadTop,
Expand Down
7 changes: 5 additions & 2 deletions resources/spa/src/components/DiySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
@click="onClick"
>
<div class="diy-select--label">{{ curSelectValue }}</div>
<div v-show="open" class="diy-select--options">
<div
v-show="open"
class="diy-select--options"
>
<div
v-for="option in options"
:key="option.label"
class="diy-select--option"
@click="setCurVal(option)"
>
<template v-if="option.hasMsg">
<BadgeIcon :dot="option.hasMsg">{{ option.label }}</BadgeIcon>
<VBadge :dot="option.hasMsg">{{ option.label }}</VBadge>
</template>
<span v-else>{{ option.label }}</span>
</div>
Expand Down
38 changes: 26 additions & 12 deletions resources/spa/src/components/FootGuide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@
<section
:class="{active: isCurPath('/message')}"
class="guide-item"
@click="to({name: 'MessageHome'})"
@click="to('/message/info')"
>
<BadgeIcon :dot="notification">
<VBadge :dot="hasMsg">
<svg class="m-style-svg m-svg-def">
<use xlink:href="#icon-foot-message" />
</svg>
</BadgeIcon>
</VBadge>
<span>消息</span>
</section>
<section
:class="{active: isCurPath('profile')}"
class="guide-item"
@click="to('/profile')"
>
<BadgeIcon :dot="profile">
<VBadge :dot="profile">
<svg class="m-style-svg m-svg-def">
<use xlink:href="#icon-foot-profile" />
</svg>
</BadgeIcon>
</VBadge>
<span>我</span>
</section>
</footer>
Expand All @@ -62,23 +62,37 @@ export default {
name: 'FootGuide',
data () {
return {
// has_fans: false,
has_fans: false,
}
},
computed: {
...mapState('message', {
profile: state => state.user.following + state.user.mutual > 0,
}),
...mapGetters('message', {
notification: 'unreadMessage',
...mapState({
has_msg: state =>
state.MESSAGE.NEW_UNREAD_COUNT.commented +
state.MESSAGE.NEW_UNREAD_COUNT['feed-comment-pinned'] +
state.MESSAGE.NEW_UNREAD_COUNT['group-join-pinned'] +
state.MESSAGE.NEW_UNREAD_COUNT.liked +
state.MESSAGE.NEW_UNREAD_COUNT['news-comment-pinned'] +
state.MESSAGE.NEW_UNREAD_COUNT['post-comment-pinned'] +
state.MESSAGE.NEW_UNREAD_COUNT['post-pinned'] +
state.MESSAGE.NEW_UNREAD_COUNT.system >
0,
profile: state =>
state.MESSAGE.NEW_UNREAD_COUNT.following +
state.MESSAGE.NEW_UNREAD_COUNT.mutual >
0,
}),
...mapGetters(['hasUnreadChat']),
hasMsg () {
return this.has_msg || this.hasUnreadChat > 0
},
},
mounted () {
this.$el.parentNode.style.paddingBottom = '1rem'
},
methods: {
to (path) {
this.$router.push(path)
this.$router.push({ path })
},
isCurPath (path) {
return this.$route.fullPath.indexOf(path) > -1
Expand Down
1 change: 0 additions & 1 deletion resources/spa/src/components/ImagePoster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const defaultPoster = {
}
export default {
name: 'ImagePoster',
props: {
/**
* @type {Poster}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
:class="classes"
>
<slot />
<sup :class="dotClasses" />
<sup
v-show="badge"
:class="dotClasses"
/>
</span>

<span
v-else
ref="badge"
Expand All @@ -28,10 +30,10 @@
const prefixCls = 'v-badge'
export default {
name: 'BadgeIcon',
name: 'VBadge',
props: {
count: { type: [Number, String], default: 0 },
dot: { type: [Boolean, Number], default: false },
dot: { type: Boolean, default: false },
overflowCount: { type: [Number, String], default: 99 },
className: { type: String, default: '' },
},
Expand Down Expand Up @@ -88,19 +90,21 @@ export default {
&-count {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
transform: translateX(50%);
top: -10px;
right: 0;
height: 32px;
width: 32px;
border-radius: 32px;
height: 20px;
min-width: 20px;
border-radius: 10px;
background: @error;
border: 1px solid transparent; /*no*/
color: #fff;
font-size: 20px;
line-height: 20px;
text-align: center;
padding: 0 6px;
font-size: 16px;
white-space: nowrap;
// transform-origin: -10% center;
transform-origin: -10% center;
z-index: 10;
box-shadow: 0 0 0 1px @error; /*no*/
Expand All @@ -111,16 +115,17 @@ export default {
&-alone {
top: auto;
display: block;
position: relative;
transform: scale(0.9);
transform: translateX(0);
}
}
&-dot {
position: absolute;
transform: translateX(-50%);
transform-origin: 0 center;
top: 2px; /* no */
top: -3px; /* no */
right: -6px; /* no */
height: 6px; /* no */
width: 6px; /* no */
Expand Down
71 changes: 0 additions & 71 deletions resources/spa/src/components/reference/ReferenceFeed.vue

This file was deleted.

Loading

0 comments on commit 8383f41

Please sign in to comment.