♻️ 个人中心路径 /user/nickname -> /user/account
This commit is contained in:
parent
cd95f0f9a0
commit
b53ee9dc41
@ -31,7 +31,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="16" :sm="16" :xl="16">
|
<el-col :xs="16" :sm="16" :xl="16">
|
||||||
<div>
|
<div>
|
||||||
<el-link rel="nofollow" @click="onRouter('user', article.articleAuthorName)" :underline="false"
|
<el-link rel="nofollow" @click="onRouter('user', article.articleAuthor.userAccount)" :underline="false"
|
||||||
class="text-default">
|
class="text-default">
|
||||||
{{ article.articleAuthorName }}
|
{{ article.articleAuthorName }}
|
||||||
</el-link>
|
</el-link>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="21">
|
<el-col :span="21">
|
||||||
<div>
|
<div>
|
||||||
<el-link rel="nofollow" @click="onRouter(user.nickname)" :underline="false" class="text-default">
|
<el-link rel="nofollow" @click="onRouter(user.account)" :underline="false" class="text-default">
|
||||||
{{ user.nickname }}
|
{{ user.nickname }}
|
||||||
</el-link>
|
</el-link>
|
||||||
<small class="d-block text-muted">{{ user.signature }}</small>
|
<small class="d-block text-muted">{{ user.signature }}</small>
|
||||||
|
@ -106,6 +106,18 @@
|
|||||||
}
|
}
|
||||||
return _ts.$store.state.userInfo?.nickname;
|
return _ts.$store.state.userInfo?.nickname;
|
||||||
},
|
},
|
||||||
|
account() {
|
||||||
|
let _ts = this;
|
||||||
|
if (isBrowser) {
|
||||||
|
if (!_ts.$store.state.userInfo) {
|
||||||
|
let user = localStorage.getItem('user');
|
||||||
|
if (user) {
|
||||||
|
_ts.$store.commit('setUser', JSON.parse(user))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _ts.$store.state.userInfo?.account;
|
||||||
|
},
|
||||||
hasPermissions() {
|
hasPermissions() {
|
||||||
return this.$store.getters.hasPermissions('blog_admin');
|
return this.$store.getters.hasPermissions('blog_admin');
|
||||||
}
|
}
|
||||||
@ -154,7 +166,7 @@
|
|||||||
switch (item) {
|
switch (item) {
|
||||||
case 'user':
|
case 'user':
|
||||||
_ts.$router.push({
|
_ts.$router.push({
|
||||||
path: '/user/' + _ts.nickname
|
path: '/user/' + _ts.account
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case 'user-info':
|
case 'user-info':
|
||||||
|
@ -142,6 +142,18 @@ export default {
|
|||||||
}
|
}
|
||||||
return _ts.$store.state.userInfo?.nickname;
|
return _ts.$store.state.userInfo?.nickname;
|
||||||
},
|
},
|
||||||
|
account() {
|
||||||
|
let _ts = this;
|
||||||
|
if (isBrowser) {
|
||||||
|
if (!_ts.$store.state.userInfo) {
|
||||||
|
let user = localStorage.getItem('user');
|
||||||
|
if (user) {
|
||||||
|
_ts.$store.commit('setUser', JSON.parse(user))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _ts.$store.state.userInfo?.account;
|
||||||
|
},
|
||||||
hasPermissions() {
|
hasPermissions() {
|
||||||
return this.$store.getters.hasPermissions('blog_admin');
|
return this.$store.getters.hasPermissions('blog_admin');
|
||||||
}
|
}
|
||||||
@ -219,7 +231,7 @@ export default {
|
|||||||
switch (item) {
|
switch (item) {
|
||||||
case 'user':
|
case 'user':
|
||||||
_ts.$router.push({
|
_ts.$router.push({
|
||||||
path: '/user/' + _ts.nickname
|
path: '/user/' + _ts.account
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case 'user-info':
|
case 'user-info':
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
width="180"
|
width="180"
|
||||||
prop="nickname">
|
prop="nickname">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link type="primary" :href="getUserPath(scope.row.nickname)" :underline="false">
|
<el-link type="primary" :href="getUserPath(scope.row.account)" :underline="false">
|
||||||
{{ scope.row.nickname }}
|
{{ scope.row.nickname }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="9" :sm="11" :xl="11">
|
<el-col :xs="9" :sm="11" :xl="11">
|
||||||
<div style="margin-left: 1rem;">
|
<div style="margin-left: 1rem;">
|
||||||
<el-link rel="nofollow" @click="onRouter('user', article.articleAuthorName)" :underline="false"
|
<el-link rel="nofollow" @click="onRouter('user', article.articleAuthor.userAccount)" :underline="false"
|
||||||
class="text-default">{{ article.articleAuthorName }}
|
class="text-default">{{ article.articleAuthorName }}
|
||||||
</el-link>
|
</el-link>
|
||||||
<small class="d-block text-muted">{{ article.timeAgo }}</small>
|
<small class="d-block text-muted">{{ article.timeAgo }}</small>
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import {mapState} from 'vuex';
|
import {mapState} from 'vuex';
|
||||||
import { isBrowser } from '~/environment'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PostArticle",
|
name: "PostArticle",
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col style="margin-top: 2rem;" id="messagesContent">
|
<el-col style="margin-top: 2rem;" id="messagesContent">
|
||||||
<el-col v-for="message in Array.prototype.reverse.call(messages)" :key="message.dataId">
|
<el-col v-for="message in Array.prototype.reverse.call(messages)" :key="message.dataId">
|
||||||
<el-col v-if="message.from === user.nickname">
|
<el-col v-if="message.from === user.account">
|
||||||
<el-col :span="22" style="text-align: right;">
|
<el-col :span="22" style="text-align: right;">
|
||||||
<div class="from-message">
|
<div class="from-message">
|
||||||
<div v-html="message.content"></div>
|
<div v-html="message.content"></div>
|
||||||
@ -156,8 +156,8 @@ export default {
|
|||||||
async send() {
|
async send() {
|
||||||
let _ts = this;
|
let _ts = this;
|
||||||
const message = {
|
const message = {
|
||||||
to: _ts.to.nickname,
|
to: _ts.to.account,
|
||||||
from: _ts.user.nickname,
|
from: _ts.user.account,
|
||||||
dataType: 1,
|
dataType: 1,
|
||||||
dataId: new Date().getTime(),
|
dataId: new Date().getTime(),
|
||||||
content: await _ts.contentEditor.getHTML()
|
content: await _ts.contentEditor.getHTML()
|
||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
_ts.$store.commit('setActiveMenu', 'post-article');
|
_ts.$store.commit('setActiveMenu', 'post-article');
|
||||||
|
|
||||||
let to = {
|
let to = {
|
||||||
nickname: _ts.$route.params?.nickname
|
account: _ts.$route.params?.account
|
||||||
}
|
}
|
||||||
|
|
||||||
_ts.$set(_ts, 'to', to);
|
_ts.$set(_ts, 'to', to);
|
@ -108,7 +108,8 @@ export default {
|
|||||||
|
|
||||||
let user = {
|
let user = {
|
||||||
nickname: res.user.nickname,
|
nickname: res.user.nickname,
|
||||||
avatarURL: res.user.avatarUrl
|
avatarURL: res.user.avatarUrl,
|
||||||
|
account: res.user.account
|
||||||
}
|
}
|
||||||
_ts.$store.commit('setAuth', auth) // mutating to store for client rendering
|
_ts.$store.commit('setAuth', auth) // mutating to store for client rendering
|
||||||
localStorage.setItem('user', JSON.stringify(user))
|
localStorage.setItem('user', JSON.stringify(user))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col style="margin-bottom: .5rem;">
|
<el-col style="margin-bottom: .5rem;">
|
||||||
<span class="text-default" style="padding-right: 1rem;">作者</span>
|
<span class="text-default" style="padding-right: 1rem;">作者</span>
|
||||||
<el-link rel="nofollow" @click="onRouter('user', portfolio.portfolioAuthorName)" :underline="false" class="text-default">
|
<el-link rel="nofollow" @click="onRouter('user', portfolio.portfolioAuthor.userAccount)" :underline="false" class="text-default">
|
||||||
<el-avatar :src="portfolio.portfolioAuthorAvatarUrl" :size="16"></el-avatar>
|
<el-avatar :src="portfolio.portfolioAuthorAvatarUrl" :size="16"></el-avatar>
|
||||||
{{ portfolio.portfolioAuthorName }}
|
{{ portfolio.portfolioAuthorName }}
|
||||||
</el-link>
|
</el-link>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<div v-if="oauth.idUser !== user.idUser">
|
<div v-if="oauth.idUser !== user.idUser">
|
||||||
<el-button type="primary" v-if="isFollow" @click="cancelFollowUser(user.idUser)" plain>取消关注</el-button>
|
<el-button type="primary" v-if="isFollow" @click="cancelFollowUser(user.idUser)" plain>取消关注</el-button>
|
||||||
<el-button type="primary" v-else @click="followUser(user.idUser)" plain>关注</el-button>
|
<el-button type="primary" v-else @click="followUser(user.idUser)" plain>关注</el-button>
|
||||||
<el-button @click="gotoChats" plain>聊天</el-button>
|
<el-button v-show="false" @click="gotoChats" plain>聊天</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
@ -89,7 +89,7 @@ export default {
|
|||||||
name: "User",
|
name: "User",
|
||||||
components: {ArticleList, PortfolioList, UserList},
|
components: {ArticleList, PortfolioList, UserList},
|
||||||
validate({params, store}) {
|
validate({params, store}) {
|
||||||
return params.nickname
|
return params.account
|
||||||
},
|
},
|
||||||
fetch({store, params, query, error}) {
|
fetch({store, params, query, error}) {
|
||||||
params.page = query.page || 1
|
params.page = query.page || 1
|
||||||
@ -112,25 +112,25 @@ export default {
|
|||||||
switch (_ts.activeTab) {
|
switch (_ts.activeTab) {
|
||||||
case "0":
|
case "0":
|
||||||
_ts.$store.dispatch('user/fetchArticleList', {
|
_ts.$store.dispatch('user/fetchArticleList', {
|
||||||
nickname: _ts.$route.params.nickname,
|
account: _ts.$route.params.account,
|
||||||
page: _ts.$route.query.page || 1
|
page: _ts.$route.query.page || 1
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
_ts.$store.dispatch('user/fetchPortfolioList', {
|
_ts.$store.dispatch('user/fetchPortfolioList', {
|
||||||
nickname: _ts.$route.params.nickname,
|
account: _ts.$route.params.account,
|
||||||
page: _ts.$route.query.page || 1
|
page: _ts.$route.query.page || 1
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
_ts.$store.dispatch('user/fetchFollowerList', {
|
_ts.$store.dispatch('user/fetchFollowerList', {
|
||||||
nickname: _ts.$route.params.nickname,
|
account: _ts.$route.params.account,
|
||||||
page: _ts.$route.query.page || 1
|
page: _ts.$route.query.page || 1
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_ts.$store.dispatch('user/fetchFollowingList', {
|
_ts.$store.dispatch('user/fetchFollowingList', {
|
||||||
nickname: _ts.$route.params.nickname,
|
account: _ts.$route.params.account,
|
||||||
page: _ts.$route.query.page || 1
|
page: _ts.$route.query.page || 1
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
@ -181,14 +181,14 @@ export default {
|
|||||||
},
|
},
|
||||||
onRouter(key, page) {
|
onRouter(key, page) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: `/user/${this.$route.params.nickname}?tab=${key}&page=${page}`
|
path: `/user/${this.$route.params.account}?tab=${key}&page=${page}`
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
gotoChats() {
|
gotoChats() {
|
||||||
let _ts = this;
|
let _ts = this;
|
||||||
_ts.$router.push({
|
_ts.$router.push({
|
||||||
path: `/chats/${_ts.user.nickname}`
|
path: `/chats/${_ts.user.account}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
followUser(idUser) {
|
followUser(idUser) {
|
@ -25,14 +25,14 @@ export default {
|
|||||||
}, _ts.headers);
|
}, _ts.headers);
|
||||||
_ts.stompClient.subscribe('/topic/greening', (msg) => {
|
_ts.stompClient.subscribe('/topic/greening', (msg) => {
|
||||||
console.log('pub', JSON.parse(msg.body));
|
console.log('pub', JSON.parse(msg.body));
|
||||||
});
|
}, _ts.headers);
|
||||||
},
|
},
|
||||||
initSocket: function (user) {
|
initSocket: function (user) {
|
||||||
let _ts = this;
|
let _ts = this;
|
||||||
_ts.socket = new SockJS(apiConfig.SOCKET);
|
_ts.socket = new SockJS(apiConfig.SOCKET);
|
||||||
_ts.stompClient = Stomp.over(_ts.socket);
|
_ts.stompClient = Stomp.over(_ts.socket);
|
||||||
let headers = {
|
let headers = {
|
||||||
id: user.nickname
|
id: user.account
|
||||||
}
|
}
|
||||||
_ts.headers = headers;
|
_ts.headers = headers;
|
||||||
_ts.stompClient.connect(_ts.headers, () => {
|
_ts.stompClient.connect(_ts.headers, () => {
|
||||||
|
@ -58,7 +58,7 @@ export const actions = {
|
|||||||
fetchDetail({ commit }, params) {
|
fetchDetail({ commit }, params) {
|
||||||
commit('updateFetching', true);
|
commit('updateFetching', true);
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}`)
|
.$get(`${USER_API_PATH}/${params.account}`)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('updateDetailData', response)
|
commit('updateDetailData', response)
|
||||||
commit('updateFetching', false)
|
commit('updateFetching', false)
|
||||||
@ -70,7 +70,7 @@ export const actions = {
|
|||||||
fetchUserExtend({ commit }, params) {
|
fetchUserExtend({ commit }, params) {
|
||||||
commit('updateFetching', true);
|
commit('updateFetching', true);
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}/user-extend`)
|
.$get(`${USER_API_PATH}/${params.account}/user-extend`)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('updateUserExtendData', response)
|
commit('updateUserExtendData', response)
|
||||||
commit('updateFetching', false)
|
commit('updateFetching', false)
|
||||||
@ -82,7 +82,7 @@ export const actions = {
|
|||||||
fetchArticleList({commit}, params) {
|
fetchArticleList({commit}, params) {
|
||||||
commit('updateFetching', true);
|
commit('updateFetching', true);
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}/articles`, {
|
.$get(`${USER_API_PATH}/${params.account}/articles`, {
|
||||||
params: {
|
params: {
|
||||||
page: params.page
|
page: params.page
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ export const actions = {
|
|||||||
fetchPortfolioList({commit}, params) {
|
fetchPortfolioList({commit}, params) {
|
||||||
commit('updateFetching', true);
|
commit('updateFetching', true);
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}/portfolios`, {
|
.$get(`${USER_API_PATH}/${params.account}/portfolios`, {
|
||||||
params: {
|
params: {
|
||||||
page: params.page
|
page: params.page
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ export const actions = {
|
|||||||
pagination: {}
|
pagination: {}
|
||||||
})
|
})
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}/followers`, {
|
.$get(`${USER_API_PATH}/${params.account}/followers`, {
|
||||||
params: {
|
params: {
|
||||||
page: params.page
|
page: params.page
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ export const actions = {
|
|||||||
pagination: {}
|
pagination: {}
|
||||||
})
|
})
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${USER_API_PATH}/${params.nickname}/followings`, {
|
.$get(`${USER_API_PATH}/${params.account}/followings`, {
|
||||||
params: {
|
params: {
|
||||||
page: params.page
|
page: params.page
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user