🎨 接口数据结构变更
This commit is contained in:
parent
77ec373863
commit
c5176326ad
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col v-for="article in articles.articles" :key="article.idArticle" style="padding-top: 1rem;">
|
||||
<el-col v-for="article in articles.list" :key="article.idArticle" style="padding-top: 1rem;">
|
||||
<el-card>
|
||||
<div class="card-body d-flex flex-column">
|
||||
<el-link rel="nofollow" :underline="false" style="margin-bottom: .5rem;">
|
||||
@ -17,8 +17,8 @@
|
||||
<div class="vertical-container text-center" style="padding-top: 10px;">
|
||||
<el-pagination :hide-on-single-page="true"
|
||||
layout="prev, pager, next"
|
||||
:current-page="articles.pagination.currentPage"
|
||||
:total="articles.pagination.total"
|
||||
:current-page="articles.pageNum"
|
||||
:total="articles.total"
|
||||
prev-text="上一页"
|
||||
next-text="下一页"
|
||||
@current-change="currentChange">
|
||||
@ -54,7 +54,7 @@
|
||||
}).then(function (res) {
|
||||
_ts.$set(_ts, 'loading', false);
|
||||
if (res) {
|
||||
_ts.$message(res.message);
|
||||
_ts.$message('绑定成功!');
|
||||
_ts.currentChange(1);
|
||||
}
|
||||
})
|
||||
|
@ -97,7 +97,7 @@
|
||||
sortNo: article.sortNo
|
||||
}).then(function (res) {
|
||||
if (res) {
|
||||
_ts.$message(res.message);
|
||||
_ts.$message("更新成功!");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -118,7 +118,7 @@
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res) {
|
||||
_ts.$message(res.message);
|
||||
_ts.$message('操作成功!');
|
||||
_ts.currentChange(_ts.articles.pageNum);
|
||||
}
|
||||
})
|
||||
|
@ -32,7 +32,7 @@
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col v-for="tag in tags" :key="tag.idTag">
|
||||
<el-col v-for="tag in tags.list" :key="tag.idTag">
|
||||
<el-card style="margin: .5rem;">
|
||||
<el-col :span="1">
|
||||
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
|
||||
@ -56,8 +56,8 @@
|
||||
<div class="vertical-container text-center">
|
||||
<el-pagination :hide-on-single-page="true"
|
||||
layout="prev, pager, next"
|
||||
:current-page="pagination.currentPage"
|
||||
:total="pagination.total"
|
||||
:current-page="tags.pageNum"
|
||||
:total="tags.total"
|
||||
@current-change="currentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
@ -90,8 +90,7 @@ export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
topic: state => state.topic.detail.data,
|
||||
tags: state => state.topic.tags.data.tags,
|
||||
pagination: state => state.topic.tags.data.pagination
|
||||
tags: state => state.topic.tags.data
|
||||
}),
|
||||
hasPermissions() {
|
||||
return this.$store.getters.hasPermissions('topic');
|
||||
@ -100,7 +99,7 @@ export default {
|
||||
methods: {
|
||||
currentChange(page) {
|
||||
let _ts = this;
|
||||
this.$store.dispatch('topic/fetchTopicTags', {
|
||||
_ts.$store.dispatch('topic/fetchTopicTags', {
|
||||
page: page,
|
||||
topic_uri: _ts.topic.topicUri
|
||||
})
|
||||
@ -130,10 +129,8 @@ export default {
|
||||
idTopic: _ts.topic.idTopic
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res && res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
const page = _ts.pagination.currentPage;
|
||||
if (res) {
|
||||
const page = _ts.tags.pageNum;
|
||||
_ts.$store.dispatch('topic/fetchTopicTags', {
|
||||
page: page,
|
||||
topic_uri: _ts.topic.topicUri
|
||||
|
@ -14,7 +14,7 @@
|
||||
<el-button @click="getTags()" slot="append" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col v-for="tag in tags" :key="tag.idTag">
|
||||
<el-col v-for="tag in tags.list" :key="tag.idTag">
|
||||
<el-card style="margin: .5rem;">
|
||||
<el-col :span="1">
|
||||
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
|
||||
@ -38,8 +38,8 @@
|
||||
<div class="vertical-container text-center">
|
||||
<el-pagination :hide-on-single-page="true"
|
||||
layout="prev, pager, next"
|
||||
:current-page="pagination.currentPage"
|
||||
:total="pagination.total"
|
||||
:current-page="tags.pageNum"
|
||||
:total="tags.total"
|
||||
@current-change="currentChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
@ -64,8 +64,7 @@ export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
topic: state => state.topic.detail.data,
|
||||
tags: state => state.topic.tags.data.tags,
|
||||
pagination: state => state.topic.tags.data.pagination
|
||||
tags: state => state.topic.tags.data
|
||||
})
|
||||
},
|
||||
data() {
|
||||
@ -93,18 +92,16 @@ export default {
|
||||
idTag: idTag,
|
||||
idTopic: _ts.topic.idTopic
|
||||
}).then(function (res) {
|
||||
if (res && res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
_ts.currentChange(_ts.pagination.currentPage);
|
||||
if (res) {
|
||||
_ts.currentChange(_ts.tags.pageNum);
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
_ts.currentChange(_ts.pagination.currentPage);
|
||||
_ts.currentChange(_ts.tags.pageNum);
|
||||
});
|
||||
},
|
||||
getTags() {
|
||||
this.currentChange(this.pagination.currentPage);
|
||||
this.currentChange(this.tags.pageNum);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -159,7 +159,7 @@ export default {
|
||||
toggleStatus(index, user) {
|
||||
let _ts = this;
|
||||
let title, status;
|
||||
if (user.status == 0) {
|
||||
if (user.status === '0') {
|
||||
title = '禁用';
|
||||
status = 1;
|
||||
} else {
|
||||
@ -175,9 +175,7 @@ export default {
|
||||
idUser: user.idUser,
|
||||
status: status
|
||||
}).then(function (res) {
|
||||
if (res && res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
if (res) {
|
||||
_ts.$message({
|
||||
type: 'success',
|
||||
message: title + '成功!'
|
||||
@ -213,14 +211,11 @@ export default {
|
||||
idRole: _ts.idRole
|
||||
};
|
||||
_ts.$axios.$patch('/api/admin/user/update-role', data).then(function (res) {
|
||||
if (res && res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
if (res) {
|
||||
_ts.$message({
|
||||
message: '授权成功',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
_ts.$set(_ts, 'dialogVisible', false);
|
||||
_ts.$set(_ts, 'idUser', 0);
|
||||
_ts.$set(_ts, 'idRole', 0);
|
||||
|
@ -372,12 +372,8 @@ export default {
|
||||
idArticle: _ts.article.idArticle
|
||||
}).then(function (res) {
|
||||
if (res) {
|
||||
if (res.success) {
|
||||
_ts.$message.success(res.message);
|
||||
_ts.$store.dispatch('article/updateThumbsUpCount', {thumbsUpNumber: res.thumbsUpNumber})
|
||||
} else {
|
||||
_ts.$message.error(_ts.message);
|
||||
}
|
||||
_ts.$message.success("点赞成功");
|
||||
_ts.$store.dispatch('article/updateThumbsUpCount', {thumbsUpNumber: res})
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -388,12 +384,8 @@ export default {
|
||||
dataId: _ts.article.idArticle
|
||||
}).then(function (res) {
|
||||
if (res) {
|
||||
if (res.success) {
|
||||
_ts.$message.success(res.message);
|
||||
_ts.$message.success('赞赏成功');
|
||||
_ts.$store.dispatch('article/updateSponsorCount', {sponsorNumber: 1})
|
||||
} else {
|
||||
_ts.$message.error(_ts.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -47,13 +47,11 @@ export default {
|
||||
};
|
||||
_ts.$axios.$patch("/api/console/forget-password", data).then(function (res) {
|
||||
if (res) {
|
||||
_ts.$message(res.message);
|
||||
if (res.flag === 1) {
|
||||
_ts.$message("修改成功,正在跳转登录界面!");
|
||||
_ts.$router.push({
|
||||
name: 'login'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -78,6 +78,9 @@
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.commit('setActiveMenu', 'portfolioBind');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -332,15 +332,11 @@ export default {
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res) {
|
||||
if (res.message) {
|
||||
_ts.$message(res.message);
|
||||
} else {
|
||||
_ts.$set(_ts, 'notificationFlag', false);
|
||||
_ts.$router.push({
|
||||
path: '/user/' + _ts.$store.state.userInfo?.account
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
_ts.$message({
|
||||
|
@ -11,20 +11,25 @@
|
||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }]">
|
||||
<el-input v-model="user.email" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password" :rules="[{ required: true, message: '请输入密码', trigger: 'blur' }]">
|
||||
<el-form-item label="密码" prop="password"
|
||||
:rules="[{ required: true, message: '请输入密码', trigger: 'blur' }]">
|
||||
<el-input type="password" v-model="user.password" autocomplete="off" show-password></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword"
|
||||
:rules="[{ required: true, message: '请输入确认密码', trigger: 'blur' }]">
|
||||
<el-input type="password" v-model="user.confirmPassword" autocomplete="off" show-password></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码" prop="code" :rules="[{ required: true, message: '请输入验证码', trigger: 'blur' }]">
|
||||
<el-form-item label="验证码" prop="code"
|
||||
:rules="[{ required: true, message: '请输入验证码', trigger: 'blur' }]">
|
||||
<el-input v-model="user.code" maxlength="6" autocomplete="off">
|
||||
<el-button type="email" size="small" slot="append" @click="sendCode" :loading="loading" plain>{{loadText}}</el-button>
|
||||
<el-button type="email" size="small" slot="append" @click="sendCode" :loading="loading" plain>
|
||||
{{ loadText }}
|
||||
</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button style="width: 60%;" type="primary" @click="register" :loading="registerLoading" plain>立即注册</el-button>
|
||||
<el-button style="width: 60%;" type="primary" @click="register" :loading="registerLoading" plain>立即注册
|
||||
</el-button>
|
||||
<el-button style="width: 32%;" @click="login" plain>登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -33,7 +38,8 @@
|
||||
<div>
|
||||
<h2>欢迎来到 RYMCU</h2>
|
||||
<p><a rel="nofollow" href="/">RYMCU</a> 是一个嵌入式知识学习交流平台,专注于单片机学习。</p>
|
||||
<p>我们正在构建一个小众社区。大家在这里相互<strong>信任</strong>,以<em>平等 • 自由 • 奔放</em>的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。</p>
|
||||
<p>我们正在构建一个小众社区。大家在这里相互<strong>信任</strong>,以<em>平等 • 自由 • 奔放</em>的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
|
||||
</p>
|
||||
<p>最后请大家共同爱护这个<i>自由</i>的交流环境,相信这里一定是你注册过的所有社区中用户体验最好的 😍</p>
|
||||
</div>
|
||||
</el-col>
|
||||
@ -109,16 +115,12 @@
|
||||
_ts.$axios.$post('/api/console/register', data).then(function (res) {
|
||||
_ts.$set(_ts, 'registerLoading', false);
|
||||
if (res) {
|
||||
_ts.$message(res.message);
|
||||
if (res.flag && res.flag === 1) {
|
||||
setTimeout(function () {
|
||||
_ts.$message("注册成功!");
|
||||
_ts.$router.push(
|
||||
{
|
||||
name: 'login'
|
||||
}
|
||||
)
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
@ -20,9 +20,14 @@
|
||||
<el-input type="textarea" v-model="user.signature"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="text-align: right;">
|
||||
<el-button type="primary" round plain @click="updateUserInfo">保存</el-button>
|
||||
<el-button type="primary" round plain @click="updateUserInfo">保存基本信息</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<h1>社交信息</h1>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form :model="userExtend" ref="userExtend" label-width="100px">
|
||||
<el-form-item label="博客" prop="signature">
|
||||
<el-input placeholder="设置后将会公开你的博客" v-model="userExtend.blog">
|
||||
@ -47,7 +52,7 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="text-align: right;">
|
||||
<el-button type="primary" round plain @click="updateUserExtend">保存</el-button>
|
||||
<el-button type="primary" round plain @click="updateUserExtend">保存社交信息</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@ -87,12 +92,12 @@
|
||||
let _ts = this;
|
||||
_ts.$axios.$get('/api/user-info/detail/' + _ts.idUser).then(function (res) {
|
||||
if (res) {
|
||||
if (res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
_ts.$set(_ts, 'user', res.user);
|
||||
_ts.$set(_ts, 'userExtend', res.userExtend);
|
||||
_ts.$set(_ts, 'user', res);
|
||||
}
|
||||
})
|
||||
_ts.$axios.$get('/api/user-info/detail/' + _ts.idUser + '/extend-info').then(function (res) {
|
||||
if (res) {
|
||||
_ts.$set(_ts, 'userExtend', res);
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -104,8 +109,8 @@
|
||||
nickname: _ts.user.nickname
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res && res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
if (!res) {
|
||||
_ts.$message.error('昵称已被占用!');
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -120,14 +125,10 @@
|
||||
if (valid) {
|
||||
_ts.$axios.$patch('/api/user-info/update', user).then(function (res) {
|
||||
if (res) {
|
||||
if (res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
_ts.$set(_ts, 'user', res.user);
|
||||
_ts.$store.commit('setUserInfo', res.user);
|
||||
_ts.$set(_ts, 'user', res);
|
||||
_ts.$store.commit('setUserInfo', res);
|
||||
_ts.$message.success('更新成功 !');
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_ts.$message.error('数据异常 !');
|
||||
@ -139,13 +140,9 @@
|
||||
let userExtend = _ts.userExtend;
|
||||
_ts.$axios.$patch('/api/user-info/update-extend', userExtend).then(function (res) {
|
||||
if (res) {
|
||||
if (res.message) {
|
||||
_ts.$message.error(res.message);
|
||||
} else {
|
||||
_ts.$set(_ts, 'userExtend', res.userExtend);
|
||||
_ts.$set(_ts, 'userExtend', res);
|
||||
_ts.$message.success('更新成功 !');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export const mutations = {
|
||||
state.detail.fetching = action
|
||||
},
|
||||
updateDetailData(state, action) {
|
||||
state.detail.data = action.portfolio
|
||||
state.detail.data = action
|
||||
},
|
||||
updateArticleList(state, action) {
|
||||
state.articles = action
|
||||
|
Loading…
Reference in New Issue
Block a user