Merge pull request #41 from rymcu/format

🎨 代码优化
This commit is contained in:
ronger 2022-09-03 14:49:33 +08:00 committed by GitHub
commit 7c2456a033
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 651 additions and 453 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

BIN
assets/wangbei.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -2,7 +2,7 @@
<el-row class="wrapper"> <el-row class="wrapper">
<el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;"> <el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
<el-carousel :interval="5000" height="210px" indicator-position="outside" arrow="always"> <el-carousel :interval="5000" height="210px" indicator-position="outside" arrow="always">
<el-carousel-item v-for="article in announcements.articles" :key="article.idArticle"> <el-carousel-item v-for="article in announcements.list" :key="article.idArticle">
<el-card> <el-card>
<div class="card-body d-flex flex-column"> <div class="card-body d-flex flex-column">
<el-link :href="article.articleLink" style="margin-bottom: .7rem;"> <el-link :href="article.articleLink" style="margin-bottom: .7rem;">

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row class="wrapper"> <el-row class="wrapper">
<el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;"> <el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
<el-col v-for="article in articles.articles" :key="article.idArticle" style="padding-bottom: 1rem;"> <el-col v-for="article in articles.list" :key="article.idArticle" style="padding-bottom: 1rem;">
<el-card> <el-card>
<div class="card-body d-flex flex-column"> <div class="card-body d-flex flex-column">
<el-link :href="article.articleLink" style="margin-bottom: .5rem;"> <el-link :href="article.articleLink" style="margin-bottom: .5rem;">
@ -50,11 +50,11 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="articles.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:page-size="articles.pagination.pageSize" :page-size="articles.pageSize"
:current-page="articles.pagination.currentPage" :current-page="articles.pageNum"
:total="articles.pagination.total" :total="articles.total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="currentChange"> @current-change="currentChange">

View File

@ -19,7 +19,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="records.records" :data="records.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="流水号" label="流水号"
@ -89,11 +89,11 @@
<el-pagination <el-pagination
:hide-on-single-page="true" :hide-on-single-page="true"
@current-change="currentChange" @current-change="currentChange"
:current-page="records.pagination.currentPage" :current-page="records.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="records.pagination.pageSize" :page-size="records.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="records.pagination.total"> :total="records.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -1,6 +1,6 @@
<template> <template>
<el-row> <el-row>
<el-col v-for="article in articles.articles" :key="article.idArticle"> <el-col v-for="article in articles.list" :key="article.idArticle">
<el-col> <el-col>
<el-link rel="nofollow" @click="onRouter(article.articleLink)" :underline="false"> <el-link rel="nofollow" @click="onRouter(article.articleLink)" :underline="false">
<h2 v-html="article.articleTitle"></h2> <h2 v-html="article.articleTitle"></h2>
@ -13,15 +13,15 @@
<el-divider></el-divider> <el-divider></el-divider>
</el-col> </el-col>
</el-col> </el-col>
<el-col v-if="articles.articles.length == 0" class="text-center"> <el-col v-if="articles.list.length == 0" class="text-center">
<span class="text-default">这里什么也没有!</span> <span class="text-default">这里什么也没有!</span>
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="articles.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="articles.pagination.currentPage" :current-page="articles.pageNum"
:total="articles.pagination.total" :total="articles.total"
@current-change="currentChange"> @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>

View File

@ -7,7 +7,7 @@
<i class="el-icon-check"></i> 一键标记已读 <i class="el-icon-check"></i> 一键标记已读
</el-link> </el-link>
</el-col> </el-col>
<el-col v-for="notification in notifications.notifications" :key="notification.idNotification"> <el-col v-for="notification in notifications.list" :key="notification.idNotification">
<el-col v-if="notification.dataType == 0"> <el-col v-if="notification.dataType == 0">
<el-col :xs="16" :sm="20" :xl="20"> <el-col :xs="16" :sm="20" :xl="20">
<el-link rel="nofollow" :underline="false" @click="onRouter(notification)" style="font-size: 1.1em;" <el-link rel="nofollow" :underline="false" @click="onRouter(notification)" style="font-size: 1.1em;"
@ -63,11 +63,11 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="notifications.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:page-size="notifications.pagination.pageSize" :page-size="notifications.pageSize"
:current-page="notifications.pagination.currentPage" :current-page="notifications.pageNum"
:total="notifications.pagination.total" :total="notifications.total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="currentChange"> @current-change="currentChange">
@ -89,7 +89,7 @@ export default {
computed: { computed: {
hasUnReadNotification: function () { hasUnReadNotification: function () {
let nums = 0; let nums = 0;
let notifications = this.notifications.notifications; let notifications = this.notifications.list;
for (const index in notifications) { for (const index in notifications) {
if (notifications[index].hasRead === '0') { if (notifications[index].hasRead === '0') {
nums++; nums++;

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<el-row class="row-cards row-deck" :gutter="20"> <el-row class="row-cards row-deck" :gutter="20">
<el-col :xs="24" :sm="12" :md="12" v-for="portfolio in portfolios.portfolios" :key="portfolio.idPortfolio"> <el-col :xs="24" :sm="12" :md="12" v-for="portfolio in portfolios.list" :key="portfolio.idPortfolio">
<el-col v-if="portfolio.headImgUrl" style="margin-bottom: 20px;"> <el-col v-if="portfolio.headImgUrl" style="margin-bottom: 20px;">
<el-card :body-style="{ padding: '20px' }"> <el-card :body-style="{ padding: '20px' }">
<el-col :span="12"> <el-col :span="12">
@ -45,10 +45,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center" style="padding-top: 10px;"> <div class="vertical-container text-center" style="padding-top: 10px;">
<el-pagination :hide-on-single-page="true" v-model="portfolios.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="portfolios.pagination.currentPage" :current-page="portfolios.pageNum"
:total="portfolios.pagination.total" :total="portfolios.total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="currentChange"> @current-change="currentChange">

View File

@ -1,6 +1,6 @@
<template> <template>
<el-row> <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> <el-card>
<div class="card-body d-flex flex-column"> <div class="card-body d-flex flex-column">
<el-link rel="nofollow" :underline="false" style="margin-bottom: .5rem;"> <el-link rel="nofollow" :underline="false" style="margin-bottom: .5rem;">
@ -15,10 +15,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center" style="padding-top: 10px;"> <div class="vertical-container text-center" style="padding-top: 10px;">
<el-pagination :hide-on-single-page="true" v-model="articles.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="articles.pagination.currentPage" :current-page="articles.pageNum"
:total="articles.pagination.total" :total="articles.total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="currentChange"> @current-change="currentChange">
@ -54,7 +54,7 @@
}).then(function (res) { }).then(function (res) {
_ts.$set(_ts, 'loading', false); _ts.$set(_ts, 'loading', false);
if (res) { if (res) {
_ts.$message(res.message); _ts.$message('绑定成功!');
_ts.currentChange(1); _ts.currentChange(1);
} }
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row> <el-row>
<el-col> <el-col>
<el-table :data="articles.articles" style="width: 100%"> <el-table :data="articles.list" style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
width="40" width="40"
@ -34,10 +34,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center" style="padding-top: 10px;"> <div class="vertical-container text-center" style="padding-top: 10px;">
<el-pagination :hide-on-single-page="true" v-model="articles.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="articles.pagination.currentPage" :current-page="articles.pageNum"
:total="articles.pagination.total" :total="articles.total"
prev-text="上一页" prev-text="上一页"
next-text="下一页" next-text="下一页"
@current-change="currentChange"> @current-change="currentChange">
@ -72,11 +72,6 @@
data() { data() {
return { return {
articles: { articles: {
articles: [],
pagination: {
total: 0,
currentPage: 1
}
} }
} }
}, },
@ -88,7 +83,7 @@
let _ts = this; let _ts = this;
const responseTopData = await this.$axios.$get('/api/console/portfolio/' + _ts.idPortfolio + '/articles?page='+page); const responseTopData = await this.$axios.$get('/api/console/portfolio/' + _ts.idPortfolio + '/articles?page='+page);
if (responseTopData) { if (responseTopData) {
responseTopData.pagination.currentPage = page; responseTopData.pageNum = page;
_ts.$set(_ts, 'articles', responseTopData); _ts.$set(_ts, 'articles', responseTopData);
window.scrollTo(0, 0); window.scrollTo(0, 0);
} }
@ -102,7 +97,7 @@
sortNo: article.sortNo sortNo: article.sortNo
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
_ts.$message(res.message); _ts.$message("更新成功!");
} }
}) })
} else { } else {
@ -123,8 +118,8 @@
} }
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
_ts.$message(res.message); _ts.$message('操作成功!');
_ts.currentChange(_ts.articles.pagination.currentPage); _ts.currentChange(_ts.articles.pageNum);
} }
}) })
}).catch(() => { }).catch(() => {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<el-row class="row-cards row-deck" :gutter="20"> <el-row class="row-cards row-deck" :gutter="20">
<el-col :span="8" v-for="product in products.products" :key="product.idProduct" style="margin-right: 20px;"> <el-col :span="8" v-for="product in products.list" :key="product.idProduct" style="margin-right: 20px;">
<el-card :body-style="{ padding: '20px' }"> <el-card :body-style="{ padding: '20px' }">
<el-col :span="24"> <el-col :span="24">
<el-image :src="product.productImgUrl" <el-image :src="product.productImgUrl"

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8" v-for="user in users.users" :key="user.idUser" style="margin-bottom: 1rem;"> <el-col :span="8" v-for="user in users.list" :key="user.idUser" style="margin-bottom: 1rem;">
<el-card shadow="always" :body-style="{textAlign: 'center', paddingBottom: '20'}"> <el-card shadow="always" :body-style="{textAlign: 'center', paddingBottom: '20'}">
<el-col :span="24"> <el-col :span="24">
<el-link target="_blank" :href="'/user/' + user.account" class="text-default" :underline="false"> <el-link target="_blank" :href="'/user/' + user.account" class="text-default" :underline="false">
@ -30,10 +30,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="users.pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="users.pagination.currentPage" :current-page="users.pageNum"
:total="users.pagination.total" :total="users.total"
@current-change="currentChange"> @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>

View File

@ -3,16 +3,26 @@
<el-col style="text-align: center;"> <el-col style="text-align: center;">
<el-col :xs="24" :sm="24" :xl="12"> <el-col :xs="24" :sm="24" :xl="12">
<span>{{ slogan }}</span> <span>{{ slogan }}</span>
<span>{{ slogan_en }}</span>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :xl="12"> <el-col :xs="24" :sm="24" :xl="12">
<el-col class="row align-items-center"> <el-col class="row align-items-center">
<el-col class="col-auto"> <el-col class="col-auto">
Copyright © 2020 Copyright © 2020
<el-link rel="nofollow" :underline="false" href="/" style="vertical-align: baseline;"><span>{{ systemName }}</span> <el-link rel="nofollow" :underline="false" href="/" style="vertical-align: baseline;"><span>{{
systemName
}}</span>
</el-link> </el-link>
. .
<el-link rel="nofollow" :underline="false" href="http://www.beian.miit.gov.cn/" style="vertical-align: baseline;"><span>{{ beiAn }}</span> </el-col>
<el-col>
<el-link rel="nofollow" :underline="false" :href="wangBeiUrl" target="_blank"
style="vertical-align: baseline;"><img
:src="wangBeiImage" style="float:left;"/><span>{{ wangBei }}</span>
</el-link>
</el-col>
<el-col>
<el-link rel="nofollow" :underline="false" href="http://www.beian.miit.gov.cn/" target="_blank"
style="vertical-align: baseline;"><span>{{ beiAn }}</span>
</el-link> </el-link>
</el-col> </el-col>
</el-col> </el-col>
@ -22,25 +32,30 @@
</template> </template>
<script> <script>
export default { import wangBeiImage from '~/assets/wangbei.png'
export default {
name: "MobileFooter", name: "MobileFooter",
data() { data() {
return { return {
systemTitle: '\u7f57\u5409\u7f51\u0020\u002d\u0020\u5185\u5bb9\u5206\u4eab\u751f\u6001\u5e73\u53f0', systemTitle: '\u7f57\u5409\u7f51\u0020\u002d\u0020\u5185\u5bb9\u5206\u4eab\u751f\u6001\u5e73\u53f0',
systemName: 'RYMCU', systemName: 'RYMCU',
systemUrl: 'https://rymcu.com', systemUrl: 'https://rymcu.com',
slogan: 'rymcu · 嵌入式知识学习交流平台 ', slogan: 'RYMCU · 嵌入式知识学习交流平台 ',
slogan_en: 'Embedded knowledge learning exchange platform', slogan_en: 'Embedded knowledge learning exchange platform',
beiAn: '沪ICP备19042611号' beiAn: '赣ICP备2021003088号-1',
} wangBeiUrl: 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=36012302000055',
wangBei: '赣公网安备 36012302000055号',
wangBeiImage: wangBeiImage
} }
} }
}
</script> </script>
<style scoped> <style scoped>
.footer { .footer {
font-size: 14px; font-size: 14px;
align-items: center; align-items: center;
display: flex; display: flex;
} }
</style> </style>

View File

@ -7,23 +7,36 @@
</el-col> </el-col>
</el-col> </el-col>
<el-col :span="12" style="text-align: left;"> <el-col :span="12" style="text-align: left;">
<el-link class="footer-link" rel="nofollow" :underline="false" :href="markdownGuide" style="vertical-align: baseline;"><span>Markdown 教程</span></el-link> <el-link class="footer-link" rel="nofollow" :underline="false" :href="markdownGuide" target="_blank"
<el-link class="footer-link" rel="nofollow" :underline="false" :href="rules" style="vertical-align: baseline;"><span>社区规章</span></el-link> style="vertical-align: baseline;"><span>Markdown 教程</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="currencyRule" style="vertical-align: baseline;"><span>货币规则</span></el-link> <el-link class="footer-link" rel="nofollow" :underline="false" :href="rules" target="_blank" style="vertical-align: baseline;">
<el-link class="footer-link" rel="nofollow" :underline="false" :href="email" style="vertical-align: baseline;"><span>意见反馈</span></el-link> <span>社区规章</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="aboutMe" style="vertical-align: baseline;"><span>关于我们</span></el-link> <el-link class="footer-link" rel="nofollow" :underline="false" :href="currencyRule" target="_blank"
<el-link class="footer-link" rel="nofollow" :underline="false" :href="github" style="vertical-align: baseline;"><span>GitHub</span></el-link> style="vertical-align: baseline;"><span>货币规则</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="gitee" style="vertical-align: baseline;"><span>Gitee</span></el-link> <el-link class="footer-link" rel="nofollow" :underline="false" :href="email" style="vertical-align: baseline;">
<span>意见反馈</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="aboutMe" target="_blank"
style="vertical-align: baseline;"><span>关于我们</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="github" target="_blank" style="vertical-align: baseline;">
<span>GitHub</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="gitee" target="_blank" style="vertical-align: baseline;">
<span>Gitee</span></el-link>
</el-col> </el-col>
<el-col :span="12" style="text-align: right;"> <el-col :span="12" style="text-align: right;">
<el-col> <el-col>
<el-col class="row align-items-center"> <el-col class="row align-items-center">
<el-col class="col-auto"> <el-col class="col-auto">
Copyright © 2020 Copyright © 2020
<el-link rel="nofollow" :underline="false" href="/" style="vertical-align: baseline;"><span>{{ systemName }}</span> <el-link rel="nofollow" :underline="false" href="/" style="vertical-align: baseline;"><span>{{
systemName
}}</span>
</el-link> </el-link>
. .
<el-link rel="nofollow" :underline="false" href="https://beian.miit.gov.cn/" style="vertical-align: baseline;"><span>{{ beiAn }}</span> <el-link rel="nofollow" :underline="false" :href="wangBeiUrl" target="_blank" style="vertical-align: baseline;padding-left: 10px;"><img
:src="wangBeiImage" style="float:left;"/><span style="padding-left: 3px;">{{ wangBei }}</span>
</el-link>
<el-link rel="nofollow" :underline="false" href="https://beian.miit.gov.cn/" target="_blank"
style="vertical-align: baseline;padding-left: 10px;"><span>{{ beiAn }}</span>
</el-link> </el-link>
</el-col> </el-col>
</el-col> </el-col>
@ -34,7 +47,9 @@
</template> </template>
<script> <script>
export default { import wangBeiImage from '~/assets/wangbei.png'
export default {
name: "PcFooter", name: "PcFooter",
data() { data() {
return { return {
@ -49,19 +64,23 @@
aboutMe: '/article/115', aboutMe: '/article/115',
github: 'https://github.com/rymcu', github: 'https://github.com/rymcu',
gitee: 'https://gitee.com/rymcu-community', gitee: 'https://gitee.com/rymcu-community',
currencyRule: '/rules/currency' currencyRule: '/rules/currency',
} wangBeiUrl: 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=36012302000055',
wangBei: '赣公网安备 36012302000055号',
wangBeiImage: wangBeiImage
} }
} }
}
</script> </script>
<style scoped> <style scoped>
.footer { .footer {
font-size: 14px; font-size: 14px;
align-items: center; align-items: center;
display: flex; display: flex;
} }
.footer .footer-link {
.footer .footer-link {
margin-left: 2rem; margin-left: 2rem;
} }
</style> </style>

View File

@ -290,8 +290,8 @@ export default {
if (_ts.user) { if (_ts.user) {
_ts.$axios.$get('/api/notification/unread').then(function (res) { _ts.$axios.$get('/api/notification/unread').then(function (res) {
if (res) { if (res) {
_ts.$set(_ts, 'notifications', res.notifications); _ts.$set(_ts, 'notifications', res.list);
_ts.$set(_ts, 'notificationNumbers', res.pagination.total === 0 ? "" : res.pagination.total); _ts.$set(_ts, 'notificationNumbers', res.total === 0 ? "" : res.total);
} }
}) })
} }

View File

@ -76,15 +76,12 @@ export default {
idArticle: _ts.idArticle, idArticle: _ts.idArticle,
articleTags: _ts.articleTags.join(',') articleTags: _ts.articleTags.join(',')
}).then(function (res) { }).then(function (res) {
console.log(res)
if (res) { if (res) {
if (res.success) {
_ts.$emit('closeDialog'); _ts.$emit('closeDialog');
} else { } else {
_ts.$message(res.message) _ts.$message(res.message)
} }
} else {
_ts.$message("更新失败!")
}
}) })
} }
}, },

View File

@ -117,6 +117,13 @@ export default {
path: '/admin/currency-rules', path: '/admin/currency-rules',
icon: 'el-icon-document', icon: 'el-icon-document',
closable: true closable: true
},
{
title: '产品管理',
name: 'admin-products',
path: '/admin/products',
icon: 'el-icon-box',
closable: true
} }
] ]
} }

View File

@ -11,16 +11,16 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="articles.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="articles.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="articles.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="articles" :data="articles.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -82,11 +82,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="articles.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="articles.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="articles.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
@ -119,8 +119,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
articles: state => state.admin.article.articles, articles: state => state.admin.articles
pagination: state => state.admin.article.pagination
}) })
}, },
data() { data() {

View File

@ -8,7 +8,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="bankAccounts" :data="bankAccounts.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -54,11 +54,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="bankAccounts.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="bankAccounts.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="bankAccounts.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-dialog :title="'卡号:' + bankAccount + ' 的交易记录'" :visible.sync="dialogVisible"> <el-dialog :title="'卡号:' + bankAccount + ' 的交易记录'" :visible.sync="dialogVisible">
@ -85,8 +85,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
bankAccounts: state => state["bank-account"].list.data.bankAccounts, bankAccounts: state => state["bank-account"].list.data,
pagination: state => state["bank-account"].list.data.pagination,
records: state => state["bank-account"].records.data records: state => state["bank-account"].records.data
}) })
}, },
@ -108,7 +107,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank-account/fetchList', { _ts.$store.dispatch('bank-account/fetchList', {
page: _ts.pagination.currentPage, page: _ts.bankAccounts.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -116,7 +115,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank-account/fetchList', { _ts.$store.dispatch('bank-account/fetchList', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.bankAccounts.pageSize
}) })
}, },
transactionRecords(index, bankAccount) { transactionRecords(index, bankAccount) {

View File

@ -8,7 +8,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="banks" :data="banks.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -52,11 +52,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="banks.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="banks.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="banks.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
@ -96,8 +96,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
banks: state => state.bank.list.data.banks, banks: state => state.bank.list.data
pagination: state => state.bank.list.data.pagination
}) })
}, },
data() { data() {
@ -120,7 +119,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank/fetchList', { _ts.$store.dispatch('bank/fetchList', {
page: _ts.pagination.currentPage, page: _ts.banks.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -128,7 +127,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank/fetchList', { _ts.$store.dispatch('bank/fetchList', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.banks.pageSize
}) })
}, },
showTransfer(index, bank) { showTransfer(index, bank) {

View File

@ -11,15 +11,15 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="comments.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="comments.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="comments.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
<el-col v-for="comment in comments" :key="comment.idComment"> <el-col v-for="comment in comments.list" :key="comment.idComment">
<el-card style="margin-top: 1rem;padding-bottom: 10px;" :id="'comment-' + comment.idComment"> <el-card style="margin-top: 1rem;padding-bottom: 10px;" :id="'comment-' + comment.idComment">
<el-col style="margin-bottom: 1rem;"> <el-col style="margin-bottom: 1rem;">
<el-link :href="comment.commentSharpUrl"> <el-link :href="comment.commentSharpUrl">
@ -82,11 +82,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="comments.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="comments.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="comments.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
</el-row> </el-row>
@ -106,8 +106,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
comments: state => state.admin.comment.comments, comments: state => state.admin.comments
pagination: state => state.admin.comment.pagination
}) })
}, },
data() { data() {
@ -137,7 +136,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchComments', { _ts.$store.dispatch('admin/fetchComments', {
page: _ts.pagination.currentPage, page: _ts.comments.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -145,7 +144,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchComments', { _ts.$store.dispatch('admin/fetchComments', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.comments.pageSize
}) })
}, },
toggleStatus() {} toggleStatus() {}

View File

@ -8,7 +8,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="rules" :data="rules.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="规则名称" label="规则名称"
@ -45,11 +45,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="rules.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="rules.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="rules.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
@ -90,8 +90,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
rules: state => state["currency-rule"].list.data.rules, rules: state => state["currency-rule"].list.data
pagination: state => state["currency-rule"].list.data.pagination
}) })
}, },
data() { data() {
@ -114,7 +113,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank/fetchList', { _ts.$store.dispatch('bank/fetchList', {
page: _ts.pagination.currentPage, page: _ts.rules.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -122,7 +121,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('bank/fetchList', { _ts.$store.dispatch('bank/fetchList', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.rules.pageSize
}) })
}, },
showTransfer(index, bank) { showTransfer(index, bank) {

View File

@ -43,7 +43,7 @@
<h3>新增文章列表</h3> <h3>新增文章列表</h3>
</el-col> </el-col>
<el-table <el-table
:data="articles.articles" :data="articles.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -98,18 +98,18 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleArticleSizeChange" @size-change="handleArticleSizeChange"
@current-change="handleArticleCurrentChange" @current-change="handleArticleCurrentChange"
:current-page="articles.pagination.currentPage" :current-page="articles.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="articles.pagination.pageSize" :page-size="articles.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="articles.pagination.total"> :total="articles.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-col :span="24" style="text-align: left;"> <el-col :span="24" style="text-align: left;">
<h3>新增用户列表</h3> <h3>新增用户列表</h3>
</el-col> </el-col>
<el-table :data="users.users" <el-table :data="users.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -147,18 +147,18 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleUserSizeChange" @size-change="handleUserSizeChange"
@current-change="handleUserCurrentChange" @current-change="handleUserCurrentChange"
:current-page="users.pagination.currentPage" :current-page="users.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="users.pagination.pageSize" :page-size="users.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="users.pagination.total"> :total="users.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-col :span="24" style="text-align: left;"> <el-col :span="24" style="text-align: left;">
<h3>新增账户列表</h3> <h3>新增账户列表</h3>
</el-col> </el-col>
<el-table :data="bankAccounts.bankAccounts" <el-table :data="bankAccounts.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -192,11 +192,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleBankAccountSizeChange" @size-change="handleBankAccountSizeChange"
@current-change="handleBankAccountCurrentChange" @current-change="handleBankAccountCurrentChange"
:current-page="bankAccounts.pagination.currentPage" :current-page="bankAccounts.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="bankAccounts.pagination.pageSize" :page-size="bankAccounts.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="bankAccounts.pagination.total"> :total="bankAccounts.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
</div> </div>
@ -549,7 +549,7 @@ export default {
handleArticleSizeChange(pageSize) { handleArticleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewArticles', { _ts.$store.dispatch('dashboard/fetchNewArticles', {
page: _ts.pagination.currentPage, page: _ts.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -557,13 +557,13 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewArticles', { _ts.$store.dispatch('dashboard/fetchNewArticles', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.pageSize
}) })
}, },
handleUserSizeChange(pageSize) { handleUserSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewUsers', { _ts.$store.dispatch('dashboard/fetchNewUsers', {
page: _ts.pagination.currentPage, page: _ts.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -571,13 +571,13 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewUsers', { _ts.$store.dispatch('dashboard/fetchNewUsers', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.pageSize
}) })
}, },
handleBankAccountSizeChange(pageSize) { handleBankAccountSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewBankAccounts', { _ts.$store.dispatch('dashboard/fetchNewBankAccounts', {
page: _ts.pagination.currentPage, page: _ts.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -585,7 +585,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewBankAccounts', { _ts.$store.dispatch('dashboard/fetchNewBankAccounts', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.pageSize
}) })
}, },
}, },

166
pages/admin/products.vue Normal file
View File

@ -0,0 +1,166 @@
<template>
<el-row style="margin-top: 20px;">
<el-col style="margin-bottom: 1rem;">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/admin/dashboard' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>产品管理</el-breadcrumb-item>
</el-breadcrumb>
</el-col>
<el-col>
<el-table
:data="products.list"
style="width: 100%">
<el-table-column
label="#"
width="40"
prop="idProduct">
</el-table-column>
<el-table-column
label="主图"
width="60"
prop="productImgUrl">
<template slot-scope="scope">
<el-avatar size="medium" :src="scope.row.productImgUrl"></el-avatar>
</template>
</el-table-column>
<el-table-column
label="商品名称"
width="140"
prop="productTitle">
<template slot-scope="scope">
<el-link type="primary" :href="'/product/' + scope.row.idProduct" :underline="false">
{{ scope.row.productTitle }}
</el-link>
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="180"
prop="createdTime">
</el-table-column>
<el-table-column
label="状态"
width="180"
prop="status">
<template slot-scope="scope">
<el-tag type="primary" disable-transitions>
{{ scope.row.status === '0' ? '正常' : '禁用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)" plain>编辑</el-button>
<el-button v-if="scope.row.status == 1" size="mini" type="primary"
@click="toggleStatus(scope.$index, scope.row)" plain>上架
</el-button>
<el-button v-else size="mini" type="danger" @click="toggleStatus(scope.$index, scope.row)" plain>下架
</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col>
<el-pagination
:hide-on-single-page="true"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="products.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="products.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="products.total">
</el-pagination>
</el-col>
</el-row>
</template>
<script>
import {mapState} from 'vuex';
export default {
name: "products",
fetch({store, params, error}) {
return Promise.all([
store
.dispatch('admin/fetchProducts', params)
.catch(err => error({statusCode: 404}))
])
},
computed: {
...mapState({
products: state => state.admin.products
})
},
data() {
return {
order: 'desc'
}
},
methods: {
onRouter(name, data) {
this.$router.push({
path: `/${name}/${data}`
})
},
toggleStatus(index, product) {
let _ts = this;
let title, status;
if (product.status == 0) {
title = '下架';
status = 1;
} else {
title = '上架';
status = 0;
}
_ts.$confirm('确定' + title + '产品 ' + product.productTitle + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_ts.$axios.$patch('/api/admin/product/update-status', {
idProduct: product.idProduct,
status: status
}).then(function (res) {
if (res && res.message) {
_ts.$message.error(res.message);
} else {
_ts.$message({
type: 'success',
message: title + '成功!'
});
_ts.handleCurrentChange(1);
}
});
}).catch(() => {
_ts.$message({
type: 'info',
message: '已取消'
});
});
},
handleSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('admin/fetchProducts', {
page: _ts.products.pageNum,
rows: pageSize
})
},
handleCurrentChange(page) {
let _ts = this;
_ts.$store.dispatch('admin/fetchProducts', {
page: page,
rows: _ts.products.pageSize
})
},
handleEdit(index ,row) {}
},
mounted() {
this.$store.commit("setActiveMenu", "admin-products");
}
}
</script>
<style scoped>
</style>

View File

@ -9,7 +9,7 @@
<el-col> <el-col>
<el-button type="primary" @click="showAddDialog" plain>添加角色</el-button> <el-button type="primary" @click="showAddDialog" plain>添加角色</el-button>
<el-table <el-table
:data="roles" :data="roles.list"
style="width: 100%;margin-top: 1rem;"> style="width: 100%;margin-top: 1rem;">
<el-table-column <el-table-column
label="#" label="#"
@ -57,11 +57,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="roles.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="roles.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="roles.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
@ -100,8 +100,7 @@
}, },
computed: { computed: {
...mapState({ ...mapState({
pagination: state => state.admin.role.pagination, roles: state => state.admin.roles
roles: state => state.admin.role.roles
}) })
}, },
data() { data() {
@ -181,7 +180,7 @@
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', { _ts.$store.dispatch('admin/fetchRoles', {
page: _ts.pagination.currentPage, page: _ts.roles.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -189,7 +188,7 @@
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', { _ts.$store.dispatch('admin/fetchRoles', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.roles.pageSize
}) })
} }
} }

View File

@ -10,7 +10,7 @@
<el-button size="small" @click="createTag" plain>创建标签</el-button> <el-button size="small" @click="createTag" plain>创建标签</el-button>
<el-button size="small" @click="cleanUnusedTag" plain>清除未使用标签</el-button> <el-button size="small" @click="cleanUnusedTag" plain>清除未使用标签</el-button>
</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-card style="margin: .5rem;">
<el-col :span="1"> <el-col :span="1">
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar> <el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
@ -32,10 +32,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="pagination.currentPage" :current-page="tags.pageNum"
:total="pagination.total" :total="tags.total"
@current-change="currentChange"> @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>
@ -57,8 +57,7 @@
}, },
computed: { computed: {
...mapState({ ...mapState({
tags: state => state.tag.list.data.tags, tags: state => state.tag.list.data
pagination: state => state.tag.list.data.pagination
}) })
}, },
methods: { methods: {
@ -73,7 +72,7 @@
if (res && res.message){ if (res && res.message){
_ts.$message.error(res.message); _ts.$message.error(res.message);
} else { } else {
const p = _ts.pagination.currentPage; const p = _ts.tags.pageNum;
_ts.currentChange(p); _ts.currentChange(p);
_ts.$message({ _ts.$message({
type: 'success', type: 'success',

View File

@ -32,7 +32,7 @@
</el-col> </el-col>
</el-col> </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-card style="margin: .5rem;">
<el-col :span="1"> <el-col :span="1">
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar> <el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
@ -54,10 +54,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="pagination.currentPage" :current-page="tags.pageNum"
:total="pagination.total" :total="tags.total"
@current-change="currentChange"> @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>
@ -90,8 +90,7 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
topic: state => state.topic.detail.data, topic: state => state.topic.detail.data,
tags: state => state.topic.tags.data.tags, tags: state => state.topic.tags.data
pagination: state => state.topic.tags.data.pagination
}), }),
hasPermissions() { hasPermissions() {
return this.$store.getters.hasPermissions('topic'); return this.$store.getters.hasPermissions('topic');
@ -100,7 +99,7 @@ export default {
methods: { methods: {
currentChange(page) { currentChange(page) {
let _ts = this; let _ts = this;
this.$store.dispatch('topic/fetchTopicTags', { _ts.$store.dispatch('topic/fetchTopicTags', {
page: page, page: page,
topic_uri: _ts.topic.topicUri topic_uri: _ts.topic.topicUri
}) })
@ -130,10 +129,8 @@ export default {
idTopic: _ts.topic.idTopic idTopic: _ts.topic.idTopic
} }
}).then(function (res) { }).then(function (res) {
if (res && res.message) { if (res) {
_ts.$message.error(res.message); const page = _ts.tags.pageNum;
} else {
const page = _ts.pagination.currentPage;
_ts.$store.dispatch('topic/fetchTopicTags', { _ts.$store.dispatch('topic/fetchTopicTags', {
page: page, page: page,
topic_uri: _ts.topic.topicUri topic_uri: _ts.topic.topicUri

View File

@ -14,7 +14,7 @@
<el-button @click="getTags()" slot="append" icon="el-icon-search"></el-button> <el-button @click="getTags()" slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
</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-card style="margin: .5rem;">
<el-col :span="1"> <el-col :span="1">
<el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar> <el-avatar shape="square" :src="tag.tagIconPath" fit="scale-down"></el-avatar>
@ -36,10 +36,10 @@
</el-col> </el-col>
<el-col> <el-col>
<div class="vertical-container text-center"> <div class="vertical-container text-center">
<el-pagination :hide-on-single-page="true" v-model="pagination" <el-pagination :hide-on-single-page="true"
layout="prev, pager, next" layout="prev, pager, next"
:current-page="pagination.currentPage" :current-page="tags.pageNum"
:total="pagination.total" :total="tags.total"
@current-change="currentChange"> @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>
@ -64,8 +64,7 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
topic: state => state.topic.detail.data, topic: state => state.topic.detail.data,
tags: state => state.topic.tags.data.tags, tags: state => state.topic.tags.data
pagination: state => state.topic.tags.data.pagination
}) })
}, },
data() { data() {
@ -93,18 +92,16 @@ export default {
idTag: idTag, idTag: idTag,
idTopic: _ts.topic.idTopic idTopic: _ts.topic.idTopic
}).then(function (res) { }).then(function (res) {
if (res && res.message) { if (res) {
_ts.$message.error(res.message); _ts.currentChange(_ts.tags.pageNum);
} else {
_ts.currentChange(_ts.pagination.currentPage);
} }
}) })
}).catch(() => { }).catch(() => {
_ts.currentChange(_ts.pagination.currentPage); _ts.currentChange(_ts.tags.pageNum);
}); });
}, },
getTags() { getTags() {
this.currentChange(this.pagination.currentPage); this.currentChange(this.tags.pageNum);
} }
}, },
mounted() { mounted() {

View File

@ -9,7 +9,7 @@
<el-col style="margin: .5rem;"> <el-col style="margin: .5rem;">
<el-button size="small" @click="createTopic" plain>创建专题</el-button> <el-button size="small" @click="createTopic" plain>创建专题</el-button>
</el-col> </el-col>
<el-col :span="8" style="margin-bottom: .5rem;" v-for="topic in topics" :key="topic.idTopic"> <el-col :span="8" style="margin-bottom: .5rem;" v-for="topic in topics.list" :key="topic.idTopic">
<el-card> <el-card>
<div class="card-body d-flex flex-column"> <div class="card-body d-flex flex-column">
<el-col :span="4" style="text-align: right;"> <el-col :span="4" style="text-align: right;">
@ -48,8 +48,7 @@
}, },
computed: { computed: {
...mapState({ ...mapState({
topics: state => state.topic.list.data.topics, topics: state => state.topic.list.data
pagination: state => state.topic.list.data.pagination
}) })
}, },
methods: { methods: {

View File

@ -8,7 +8,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-table <el-table
:data="users" :data="users.list"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="#" label="#"
@ -89,11 +89,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pagination.currentPage" :current-page="users.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize" :page-size="users.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"> :total="users.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
<el-col> <el-col>
@ -129,9 +129,8 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
users: state => state.admin.user.users, users: state => state.admin.users,
pagination: state => state.admin.user.pagination, roles: state => state.admin.roles.list
roles: state => state.admin.role.roles
}) })
}, },
data() { data() {
@ -160,7 +159,7 @@ export default {
toggleStatus(index, user) { toggleStatus(index, user) {
let _ts = this; let _ts = this;
let title, status; let title, status;
if (user.status == 0) { if (user.status === '0') {
title = '禁用'; title = '禁用';
status = 1; status = 1;
} else { } else {
@ -176,9 +175,7 @@ export default {
idUser: user.idUser, idUser: user.idUser,
status: status status: status
}).then(function (res) { }).then(function (res) {
if (res && res.message) { if (res) {
_ts.$message.error(res.message);
} else {
_ts.$message({ _ts.$message({
type: 'success', type: 'success',
message: title + '成功!' message: title + '成功!'
@ -196,7 +193,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', { _ts.$store.dispatch('admin/fetchUsers', {
page: _ts.pagination.currentPage, page: _ts.users.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -204,7 +201,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', { _ts.$store.dispatch('admin/fetchUsers', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.users.pageSize
}) })
}, },
updateRole() { updateRole() {
@ -214,9 +211,7 @@ export default {
idRole: _ts.idRole idRole: _ts.idRole
}; };
_ts.$axios.$patch('/api/admin/user/update-role', data).then(function (res) { _ts.$axios.$patch('/api/admin/user/update-role', data).then(function (res) {
if (res && res.message) { if (res) {
_ts.$message.error(res.message);
} else {
_ts.$message({ _ts.$message({
message: '授权成功', message: '授权成功',
type: 'success' type: 'success'

View File

@ -69,7 +69,7 @@
</client-only> </client-only>
</el-col> </el-col>
<el-col v-if="isShare" style="margin-bottom: 1rem;"> <el-col v-if="isShare" style="margin-bottom: 1rem;">
<share-box :url="shareData.shareUrl"></share-box> <share-box :url="shareUrl"></share-box>
</el-col> </el-col>
<el-col v-if="article.portfolios && article.portfolios.length > 0"> <el-col v-if="article.portfolios && article.portfolios.length > 0">
<portfolios-widget :portfolios="article.portfolios"></portfolios-widget> <portfolios-widget :portfolios="article.portfolios"></portfolios-widget>
@ -257,7 +257,7 @@ export default {
isShare: false, isShare: false,
dialogVisible: false, dialogVisible: false,
isPerfect: false, isPerfect: false,
shareData: {} shareUrl: ''
} }
}, },
methods: { methods: {
@ -283,12 +283,12 @@ export default {
if (_ts.user) { if (_ts.user) {
_ts.$axios.$get('/api/article/' + _ts.article.idArticle + '/share').then(function (res) { _ts.$axios.$get('/api/article/' + _ts.article.idArticle + '/share').then(function (res) {
if (res) { if (res) {
_ts.$set(_ts, 'shareData', res); _ts.$set(_ts, 'shareUrl', res);
_ts.$set(_ts, 'isShare', true); _ts.$set(_ts, 'isShare', true);
} }
}); });
} else { } else {
_ts.$set(_ts, 'shareData', {shareUrl: _ts.article.articlePermalink}); _ts.$set(_ts, 'shareUrl', _ts.article.articlePermalink);
_ts.$set(_ts, 'isShare', true); _ts.$set(_ts, 'isShare', true);
} }
} }
@ -372,12 +372,8 @@ export default {
idArticle: _ts.article.idArticle idArticle: _ts.article.idArticle
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$message.success("点赞成功");
_ts.$message.success(res.message); _ts.$store.dispatch('article/updateThumbsUpCount', {thumbsUpNumber: res})
_ts.$store.dispatch('article/updateThumbsUpCount', {thumbsUpNumber: res.thumbsUpNumber})
} else {
_ts.$message.error(_ts.message);
}
} }
}) })
}, },
@ -388,12 +384,8 @@ export default {
dataId: _ts.article.idArticle dataId: _ts.article.idArticle
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$message.success('赞赏成功');
_ts.$message.success(res.message);
_ts.$store.dispatch('article/updateSponsorCount', {sponsorNumber: 1}) _ts.$store.dispatch('article/updateSponsorCount', {sponsorNumber: 1})
} else {
_ts.$message.error(_ts.message);
}
} }
}) })
}, },

View File

@ -306,7 +306,7 @@
_ts.$store.commit('article/clearDetailData') _ts.$store.commit('article/clearDetailData')
_ts.$set(_ts, 'notificationFlag', false); _ts.$set(_ts, 'notificationFlag', false);
_ts.$router.push({ _ts.$router.push({
path: `/article/${res.id}` path: `/article/${res}`
}) })
} }
}) })
@ -343,7 +343,7 @@
_ts.contentEditor.setValue(''); _ts.contentEditor.setValue('');
_ts.$set(_ts, 'notificationFlag', false); _ts.$set(_ts, 'notificationFlag', false);
_ts.$router.push({ _ts.$router.push({
path: `/draft/${res.id}` path: `/draft/${res}`
}) })
} }
}) })

View File

@ -47,13 +47,11 @@ export default {
}; };
_ts.$axios.$patch("/api/console/forget-password", data).then(function (res) { _ts.$axios.$patch("/api/console/forget-password", data).then(function (res) {
if (res) { if (res) {
_ts.$message(res.message); _ts.$message("修改成功,正在跳转登录界面!");
if (res.flag === 1) {
_ts.$router.push({ _ts.$router.push({
name: 'login' name: 'login'
}) })
} }
}
}) })
} }
}, },

View File

@ -101,15 +101,15 @@ export default {
return false; return false;
} }
let auth = { let auth = {
accessToken: res.user.token, accessToken: res.token,
idUser: res.user.idUser, idUser: res.idUser,
role: res.user.weights role: res.weights
} }
let user = { let user = {
nickname: res.user.nickname, nickname: res.nickname,
avatarURL: res.user.avatarUrl, avatarURL: res.avatarUrl || 'https://static.rymcu.com/article/1578475481946.png',
account: res.user.account account: res.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))

View File

@ -78,6 +78,9 @@
) )
} }
} }
},
mounted() {
this.$store.commit('setActiveMenu', 'portfolioBind');
} }
} }
</script> </script>

View File

@ -332,15 +332,11 @@ export default {
} }
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.message) {
_ts.$message(res.message);
} else {
_ts.$set(_ts, 'notificationFlag', false); _ts.$set(_ts, 'notificationFlag', false);
_ts.$router.push({ _ts.$router.push({
path: '/user/' + _ts.$store.state.userInfo?.account path: '/user/' + _ts.$store.state.userInfo?.account
}) })
} }
}
}) })
}).catch(() => { }).catch(() => {
_ts.$message({ _ts.$message({

View File

@ -11,20 +11,25 @@
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }]"> { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }]">
<el-input v-model="user.email" autocomplete="off"></el-input> <el-input v-model="user.email" autocomplete="off"></el-input>
</el-form-item> </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-input type="password" v-model="user.password" autocomplete="off" show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirmPassword" <el-form-item label="确认密码" prop="confirmPassword"
:rules="[{ required: true, message: '请输入确认密码', trigger: 'blur' }]"> :rules="[{ required: true, message: '请输入确认密码', trigger: 'blur' }]">
<el-input type="password" v-model="user.confirmPassword" autocomplete="off" show-password></el-input> <el-input type="password" v-model="user.confirmPassword" autocomplete="off" show-password></el-input>
</el-form-item> </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-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-input>
</el-form-item> </el-form-item>
<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-button style="width: 32%;" @click="login" plain>登录</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -33,7 +38,8 @@
<div> <div>
<h2>欢迎来到 RYMCU</h2> <h2>欢迎来到 RYMCU</h2>
<p><a rel="nofollow" href="/">RYMCU</a> 是一个嵌入式知识学习交流平台专注于单片机学习</p> <p><a rel="nofollow" href="/">RYMCU</a> 是一个嵌入式知识学习交流平台专注于单片机学习</p>
<p>我们正在构建一个小众社区大家在这里相互<strong>信任</strong><em>平等 自由 奔放</em>的价值观进行分享交流最终希望大家能够找到与自己志同道合的伙伴共同成长</p> <p>我们正在构建一个小众社区大家在这里相互<strong>信任</strong><em>平等 自由 奔放</em>的价值观进行分享交流最终希望大家能够找到与自己志同道合的伙伴共同成长
</p>
<p>最后请大家共同爱护这个<i>自由</i>的交流环境相信这里一定是你注册过的所有社区中用户体验最好的 😍</p> <p>最后请大家共同爱护这个<i>自由</i>的交流环境相信这里一定是你注册过的所有社区中用户体验最好的 😍</p>
</div> </div>
</el-col> </el-col>
@ -41,7 +47,7 @@
</template> </template>
<script> <script>
export default { export default {
name: "register", name: "register",
data() { data() {
return { return {
@ -83,15 +89,15 @@
let _ts = this; let _ts = this;
_ts.$set(_ts, 'loading', true); _ts.$set(_ts, 'loading', true);
let times = 30; let times = 30;
_ts.timeClock = setInterval(function (){ _ts.timeClock = setInterval(function () {
times --; times--;
_ts.$set(_ts, 'loadText', times + ' s'); _ts.$set(_ts, 'loadText', times + ' s');
if (times == 0) { if (times == 0) {
clearInterval(_ts.timeClock); clearInterval(_ts.timeClock);
_ts.$set(_ts, 'loading', false); _ts.$set(_ts, 'loading', false);
_ts.$set(_ts, 'loadText', '发送验证码'); _ts.$set(_ts, 'loadText', '发送验证码');
} }
},1000) }, 1000)
}, },
register() { register() {
let _ts = this; let _ts = this;
@ -109,16 +115,12 @@
_ts.$axios.$post('/api/console/register', data).then(function (res) { _ts.$axios.$post('/api/console/register', data).then(function (res) {
_ts.$set(_ts, 'registerLoading', false); _ts.$set(_ts, 'registerLoading', false);
if (res) { if (res) {
_ts.$message(res.message); _ts.$message("注册成功!");
if (res.flag && res.flag === 1) {
setTimeout(function () {
_ts.$router.push( _ts.$router.push(
{ {
name: 'login' name: 'login'
} }
) )
}, 1000);
}
} }
}) })
} else { } else {
@ -138,37 +140,37 @@
mounted() { mounted() {
this.$store.commit('setActiveMenu', 'register') this.$store.commit('setActiveMenu', 'register')
} }
} }
</script> </script>
<style scoped> <style scoped>
.icon-rymcu { .icon-rymcu {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
height: 4rem; height: 4rem;
} }
.verify .verify-wrap { .verify .verify-wrap {
/*width: 60%;*/ /*width: 60%;*/
} }
.flex-inline { .flex-inline {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.verify .intro { .verify .intro {
padding: 50px; padding: 50px;
background-color: #f1f7fe; background-color: #f1f7fe;
/*width: 40%;*/ /*width: 40%;*/
color: #616161; color: #616161;
} }
.verify__sign { .verify__sign {
background-color: transparent !important; background-color: transparent !important;
} }
.vditor-reset { .vditor-reset {
font-variant-ligatures: no-common-ligatures; font-variant-ligatures: no-common-ligatures;
font-family: Helvetica Neue, Luxi Sans, DejaVu Sans, Tahoma, Hiragino Sans GB, Microsoft Yahei, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; font-family: Helvetica Neue, Luxi Sans, DejaVu Sans, Tahoma, Hiragino Sans GB, Microsoft Yahei, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
word-wrap: break-word; word-wrap: break-word;
@ -176,5 +178,5 @@
line-height: 1.5; line-height: 1.5;
font-size: 16px; font-size: 16px;
word-break: break-word; word-break: break-word;
} }
</style> </style>

View File

@ -7,13 +7,13 @@
</el-col> </el-col>
<el-col> <el-col>
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane :label="'文章 (' + getLength(articles.pagination) + ')'" name="articles"> <el-tab-pane :label="'文章 (' + getLength(articles) + ')'" name="articles">
<article-list :articles="articles" @currentChange="currentChangeArticle"/> <article-list :articles="articles" @currentChange="currentChangeArticle"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'用户 (' + getLength(users.pagination) + ')'" name="users"> <el-tab-pane :label="'用户 (' + getLength(users) + ')'" name="users">
<user-list :users="users" @currentChange="currentChangeUser"/> <user-list :users="users" @currentChange="currentChangeUser"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'作品集 (' + getLength(portfolios.pagination) + ')'" name="portfolios"> <el-tab-pane :label="'作品集 (' + getLength(portfolios) + ')'" name="portfolios">
<portfolio-list :portfolios="portfolios" @currentChange="currentChangePortfolio"/> <portfolio-list :portfolios="portfolios" @currentChange="currentChangePortfolio"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>

View File

@ -20,9 +20,14 @@
<el-input type="textarea" v-model="user.signature"></el-input> <el-input type="textarea" v-model="user.signature"></el-input>
</el-form-item> </el-form-item>
<el-form-item style="text-align: right;"> <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-item>
</el-form> </el-form>
</el-col>
<el-col>
<h1>社交信息</h1>
</el-col>
<el-col>
<el-form :model="userExtend" ref="userExtend" label-width="100px"> <el-form :model="userExtend" ref="userExtend" label-width="100px">
<el-form-item label="博客" prop="signature"> <el-form-item label="博客" prop="signature">
<el-input placeholder="设置后将会公开你的博客" v-model="userExtend.blog"> <el-input placeholder="设置后将会公开你的博客" v-model="userExtend.blog">
@ -47,7 +52,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item style="text-align: right;"> <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-item>
</el-form> </el-form>
</el-col> </el-col>
@ -87,12 +92,12 @@
let _ts = this; let _ts = this;
_ts.$axios.$get('/api/user-info/detail/' + _ts.idUser).then(function (res) { _ts.$axios.$get('/api/user-info/detail/' + _ts.idUser).then(function (res) {
if (res) { if (res) {
if (res.message) { _ts.$set(_ts, 'user', res);
_ts.$message.error(res.message);
} else {
_ts.$set(_ts, 'user', res.user);
_ts.$set(_ts, 'userExtend', res.userExtend);
} }
})
_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 nickname: _ts.user.nickname
} }
}).then(function (res) { }).then(function (res) {
if (res && res.message) { if (!res) {
_ts.$message.error(res.message); _ts.$message.error('昵称已被占用!');
} }
}) })
}, },
@ -120,14 +125,10 @@
if (valid) { if (valid) {
_ts.$axios.$patch('/api/user-info/update', user).then(function (res) { _ts.$axios.$patch('/api/user-info/update', user).then(function (res) {
if (res) { if (res) {
if (res.message) { _ts.$set(_ts, 'user', res);
_ts.$message.error(res.message); _ts.$store.commit('setUserInfo', res);
} else {
_ts.$set(_ts, 'user', res.user);
_ts.$store.commit('setUserInfo', res.user);
_ts.$message.success('更新成功 !'); _ts.$message.success('更新成功 !');
} }
}
}) })
} else { } else {
_ts.$message.error('数据异常 !'); _ts.$message.error('数据异常 !');
@ -139,13 +140,9 @@
let userExtend = _ts.userExtend; let userExtend = _ts.userExtend;
_ts.$axios.$patch('/api/user-info/update-extend', userExtend).then(function (res) { _ts.$axios.$patch('/api/user-info/update-extend', userExtend).then(function (res) {
if (res) { if (res) {
if (res.message) { _ts.$set(_ts, 'userExtend', res);
_ts.$message.error(res.message);
} else {
_ts.$set(_ts, 'userExtend', res.userExtend);
_ts.$message.success('更新成功 !'); _ts.$message.success('更新成功 !');
} }
}
}) })
} }
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -28,13 +28,21 @@ const getDefaultCommentsData = () => {
} }
} }
const getDefaultProductsData = () => {
return {
products: [],
pagination: {}
}
}
export const state = () => { export const state = () => {
return { return {
fetching: false, fetching: false,
user: getDefaultUsersData(), users: getDefaultUsersData(),
role: getDefaultRolesData(), roles: getDefaultRolesData(),
article: getDefaultArticlesData(), articles: getDefaultArticlesData(),
comment: getDefaultCommentsData(), comments: getDefaultCommentsData(),
products: getDefaultProductsData(),
tabs: [ tabs: [
{ {
title: 'Dashboard', title: 'Dashboard',
@ -53,25 +61,24 @@ export const mutations = {
state.fetching = action state.fetching = action
}, },
updateUsersData(state, action) { updateUsersData(state, action) {
state.user.users = action.users state.users = action
state.user.pagination = action.pagination
}, },
updateRolesData(state, action) { updateRolesData(state, action) {
state.role.roles = action.roles state.roles = action
state.role.pagination = action.pagination
}, },
updateArticlesData(state, action) { updateArticlesData(state, action) {
state.article.articles = action.articles state.articles = action
state.article.pagination = action.pagination
}, },
updateCommentsData(state, action) { updateCommentsData(state, action) {
state.comment.comments = action.comments state.comments = action
state.comment.pagination = action.pagination },
updateProductsData(state, action) {
state.products = action
}, },
updateArticlePreference(state, action) { updateArticlePreference(state, action) {
let article = state.article.articles[action.index] let articles = state.articles.list[action.index]
if (article.idArticle === action.idArticle) { if (articles.idArticle === action.idArticle) {
article.articlePerfect = action.articlePerfect articles.articlePerfect = action.articlePerfect
} }
}, },
updateTags(state, action) { updateTags(state, action) {
@ -171,7 +178,7 @@ export const actions = {
return true; return true;
} }
// 清空已有数据 // 清空已有数据
commit('updateCommentsData', getDefaultArticlesData()) commit('updateCommentsData', getDefaultCommentsData())
commit('updateFetching', true) commit('updateFetching', true)
let data = { let data = {
@ -191,5 +198,31 @@ export const actions = {
console.log(error); console.log(error);
commit('updateFetching', false); commit('updateFetching', false);
}); });
},
fetchProducts({commit}, params = {}) {
if (params && params.reset === '0') {
return true;
}
// 清空已有数据
commit('updateProductsData', getDefaultProductsData())
commit('updateFetching', true)
let data = {
page: params.page || 1,
rows: params.rows || 10
}
return this.$axios
.$get(`${ADMIN_API_PATH}/products`, {
params: data
})
.then(response => {
commit('updateFetching', false);
commit('updateProductsData', response);
})
.catch(error => {
console.log(error);
commit('updateFetching', false);
});
} }
} }

View File

@ -51,7 +51,7 @@ export const mutations = {
state.detail.fetching = action state.detail.fetching = action
}, },
updateDetailData(state, action) { updateDetailData(state, action) {
state.detail.data = action.article state.detail.data = action
}, },
clearDetailData(state, action) { clearDetailData(state, action) {
state.detail.data = {} state.detail.data = {}
@ -103,7 +103,7 @@ export const actions = {
// 当前页判断 // 当前页判断
let currentData = JSON.parse(JSON.stringify(state)).list.data let currentData = JSON.parse(JSON.stringify(state)).list.data
let topicUri = JSON.parse(JSON.stringify(state)).topicUri let topicUri = JSON.parse(JSON.stringify(state)).topicUri
if (Number(params.page) === currentData.pagination.currentPage) { if (Number(params.page) === currentData.pageNum) {
if (topicUri && topicUri === params.topic_uri) { if (topicUri && topicUri === params.topic_uri) {
commit('updateListFetching', false) commit('updateListFetching', false)
return return

View File

@ -29,7 +29,7 @@ export const mutations = {
}, },
updateListData(state, action) { updateListData(state, action) {
state.data = { state.data = {
data: action.comments, data: action,
pagination: { pagination: {
page: 1 page: 1
} }
@ -76,7 +76,7 @@ export const actions = {
// 清空数据 // 清空数据
// isRestart && commit('updateListData', getDefaultListData()) // isRestart && commit('updateListData', getDefaultListData())
commit('updateListData', getDefaultListData()) // commit('updateListData', getDefaultListData())
commit('updateListFetching', true) commit('updateListFetching', true)
return this.$axios return this.$axios

View File

@ -26,6 +26,7 @@ export const mutations = {
state.list.fetching = action state.list.fetching = action
}, },
updateListData(state, action) { updateListData(state, action) {
console.log(action)
state.list.data = action state.list.data = action
}, },
// 文章详情 // 文章详情
@ -33,7 +34,7 @@ export const mutations = {
state.detail.fetching = action state.detail.fetching = action
}, },
updateDetailData(state, action) { updateDetailData(state, action) {
state.detail.data = action.article state.detail.data = action
} }
} }

View File

@ -39,7 +39,7 @@ export const actions = {
let currentData = JSON.parse(JSON.stringify(state)).list.data let currentData = JSON.parse(JSON.stringify(state)).list.data
let updateState = state.updateState let updateState = state.updateState
if (!updateState) { if (!updateState) {
if (Number(params.page) === currentData?.pagination.currentPage) { if (Number(params.page) === currentData?.pageNum) {
commit('updateListFetching', false) commit('updateListFetching', false)
return return
} }

View File

@ -1,5 +1,3 @@
import {DASHBOARD_API_PATH} from "@/store/dashboard";
/** /**
* Created on 2022/3/14 13:54. * Created on 2022/3/14 13:54.
* @author ronger * @author ronger

View File

@ -50,15 +50,13 @@ export const mutations = {
state.detail.fetching = action state.detail.fetching = action
}, },
updateDetailData(state, action) { updateDetailData(state, action) {
state.detail.data = action.portfolio state.detail.data = action
}, },
updateArticleList(state, action) { updateArticleList(state, action) {
state.articles.articles = action.articles state.articles = action
state.articles.pagination = action.pagination
}, },
updateUnbindArticleList(state, action) { updateUnbindArticleList(state, action) {
state.unbindArticles.articles = action.articles state.unbindArticles = action
state.unbindArticles.pagination = action.pagination
}, },
// 更新作品集阅读全文状态 // 更新作品集阅读全文状态
@ -78,7 +76,7 @@ export const actions = {
// 清空已有数据 // 清空已有数据
commit('updateListFetching', true) commit('updateListFetching', true)
let currentData = JSON.parse(JSON.stringify(state)).list.data let currentData = JSON.parse(JSON.stringify(state)).list.data
if (Number(params.page) === currentData.pagination.currentPage) { if (Number(params.page) === currentData.pageNum) {
commit('updateListFetching', false) commit('updateListFetching', false)
return return
} }

View File

@ -61,7 +61,7 @@ export const actions = {
// 清空已有数据 // 清空已有数据
commit('updateListFetching', true) commit('updateListFetching', true)
let currentData = JSON.parse(JSON.stringify(state)).list.data let currentData = JSON.parse(JSON.stringify(state)).list.data
if (Number(params.page) === currentData.pagination.currentPage) { if (Number(params.page) === currentData.pageNum) {
commit('updateListFetching', false) commit('updateListFetching', false)
return return
} }