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-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
<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>
<div class="card-body d-flex flex-column">
<el-link :href="article.articleLink" style="margin-bottom: .7rem;">

View File

@ -1,7 +1,7 @@
<template>
<el-row class="wrapper">
<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>
<div class="card-body d-flex flex-column">
<el-link :href="article.articleLink" style="margin-bottom: .5rem;">
@ -50,11 +50,11 @@
</el-col>
<el-col>
<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"
:page-size="articles.pagination.pageSize"
:current-page="articles.pagination.currentPage"
:total="articles.pagination.total"
:page-size="articles.pageSize"
:current-page="articles.pageNum"
:total="articles.total"
prev-text="上一页"
next-text="下一页"
@current-change="currentChange">

View File

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

View File

@ -1,6 +1,6 @@
<template>
<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-link rel="nofollow" @click="onRouter(article.articleLink)" :underline="false">
<h2 v-html="article.articleTitle"></h2>
@ -13,15 +13,15 @@
<el-divider></el-divider>
</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>
</el-col>
<el-col>
<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"
:current-page="articles.pagination.currentPage"
:total="articles.pagination.total"
:current-page="articles.pageNum"
:total="articles.total"
@current-change="currentChange">
</el-pagination>
</div>

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<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-card :body-style="{ padding: '20px' }">
<el-col :span="12">
@ -45,10 +45,10 @@
</el-col>
<el-col>
<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"
:current-page="portfolios.pagination.currentPage"
:total="portfolios.pagination.total"
:current-page="portfolios.pageNum"
:total="portfolios.total"
prev-text="上一页"
next-text="下一页"
@current-change="currentChange">

View File

@ -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;">
@ -15,10 +15,10 @@
</el-col>
<el-col>
<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"
: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);
}
})

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<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-col :span="24">
<el-image :src="product.productImgUrl"

View File

@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<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-col :span="24">
<el-link target="_blank" :href="'/user/' + user.account" class="text-default" :underline="false">
@ -30,10 +30,10 @@
</el-col>
<el-col>
<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"
:current-page="users.pagination.currentPage"
:total="users.pagination.total"
:current-page="users.pageNum"
:total="users.total"
@current-change="currentChange">
</el-pagination>
</div>

View File

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

View File

@ -7,23 +7,36 @@
</el-col>
</el-col>
<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="rules" style="vertical-align: baseline;"><span>社区规章</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="email" style="vertical-align: baseline;"><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="github" style="vertical-align: baseline;"><span>GitHub</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="markdownGuide" target="_blank"
style="vertical-align: baseline;"><span>Markdown 教程</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="rules" target="_blank" style="vertical-align: baseline;">
<span>社区规章</span></el-link>
<el-link class="footer-link" rel="nofollow" :underline="false" :href="currencyRule" target="_blank"
style="vertical-align: baseline;"><span>货币规则</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 :span="12" style="text-align: right;">
<el-col>
<el-col class="row align-items-center">
<el-col class="col-auto">
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 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-col>
</el-col>
@ -34,34 +47,40 @@
</template>
<script>
export default {
name: "PcFooter",
data() {
return {
systemTitle: '\u7f57\u5409\u7f51\u0020\u002d\u0020\u5185\u5bb9\u5206\u4eab\u751f\u6001\u5e73\u53f0',
systemName: 'RYMCU',
systemUrl: 'https://rymcu.com',
slogan: 'RYMCU · 嵌入式知识学习交流平台 ',
beiAn: '赣ICP备2021003088号-1',
markdownGuide: '/guides/markdown',
rules: '/article/20',
email: 'mailto:support@rymcu.com',
aboutMe: '/article/115',
github: 'https://github.com/rymcu',
gitee: 'https://gitee.com/rymcu-community',
currencyRule: '/rules/currency'
}
import wangBeiImage from '~/assets/wangbei.png'
export default {
name: "PcFooter",
data() {
return {
systemTitle: '\u7f57\u5409\u7f51\u0020\u002d\u0020\u5185\u5bb9\u5206\u4eab\u751f\u6001\u5e73\u53f0',
systemName: 'RYMCU',
systemUrl: 'https://rymcu.com',
slogan: 'RYMCU · 嵌入式知识学习交流平台 ',
beiAn: '赣ICP备2021003088号-1',
markdownGuide: '/guides/markdown',
rules: '/article/20',
email: 'mailto:support@rymcu.com',
aboutMe: '/article/115',
github: 'https://github.com/rymcu',
gitee: 'https://gitee.com/rymcu-community',
currencyRule: '/rules/currency',
wangBeiUrl: 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=36012302000055',
wangBei: '赣公网安备 36012302000055号',
wangBeiImage: wangBeiImage
}
}
}
</script>
<style scoped>
.footer {
font-size: 14px;
align-items: center;
display: flex;
}
.footer .footer-link {
margin-left: 2rem;
}
.footer {
font-size: 14px;
align-items: center;
display: flex;
}
.footer .footer-link {
margin-left: 2rem;
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@
<h3>新增文章列表</h3>
</el-col>
<el-table
:data="articles.articles"
:data="articles.list"
style="width: 100%">
<el-table-column
label="#"
@ -98,18 +98,18 @@
:hide-on-single-page="true"
@size-change="handleArticleSizeChange"
@current-change="handleArticleCurrentChange"
:current-page="articles.pagination.currentPage"
:current-page="articles.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="articles.pagination.pageSize"
:page-size="articles.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="articles.pagination.total">
:total="articles.total">
</el-pagination>
</el-col>
<el-col :span="24">
<el-col :span="24" style="text-align: left;">
<h3>新增用户列表</h3>
</el-col>
<el-table :data="users.users"
<el-table :data="users.list"
style="width: 100%">
<el-table-column
label="#"
@ -147,18 +147,18 @@
:hide-on-single-page="true"
@size-change="handleUserSizeChange"
@current-change="handleUserCurrentChange"
:current-page="users.pagination.currentPage"
:current-page="users.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="users.pagination.pageSize"
:page-size="users.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="users.pagination.total">
:total="users.total">
</el-pagination>
</el-col>
<el-col :span="24">
<el-col :span="24" style="text-align: left;">
<h3>新增账户列表</h3>
</el-col>
<el-table :data="bankAccounts.bankAccounts"
<el-table :data="bankAccounts.list"
style="width: 100%">
<el-table-column
label="#"
@ -192,11 +192,11 @@
:hide-on-single-page="true"
@size-change="handleBankAccountSizeChange"
@current-change="handleBankAccountCurrentChange"
:current-page="bankAccounts.pagination.currentPage"
:current-page="bankAccounts.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="bankAccounts.pagination.pageSize"
:page-size="bankAccounts.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="bankAccounts.pagination.total">
:total="bankAccounts.total">
</el-pagination>
</el-col>
</div>
@ -549,7 +549,7 @@ export default {
handleArticleSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewArticles', {
page: _ts.pagination.currentPage,
page: _ts.pageNum,
rows: pageSize
})
},
@ -557,13 +557,13 @@ export default {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewArticles', {
page: page,
rows: _ts.pagination.pageSize
rows: _ts.pageSize
})
},
handleUserSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewUsers', {
page: _ts.pagination.currentPage,
page: _ts.pageNum,
rows: pageSize
})
},
@ -571,13 +571,13 @@ export default {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewUsers', {
page: page,
rows: _ts.pagination.pageSize
rows: _ts.pageSize
})
},
handleBankAccountSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewBankAccounts', {
page: _ts.pagination.currentPage,
page: _ts.pageNum,
rows: pageSize
})
},
@ -585,7 +585,7 @@ export default {
let _ts = this;
_ts.$store.dispatch('dashboard/fetchNewBankAccounts', {
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-button type="primary" @click="showAddDialog" plain>添加角色</el-button>
<el-table
:data="roles"
:data="roles.list"
style="width: 100%;margin-top: 1rem;">
<el-table-column
label="#"
@ -57,11 +57,11 @@
:hide-on-single-page="true"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pagination.currentPage"
:current-page="roles.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize"
:page-size="roles.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total">
:total="roles.total">
</el-pagination>
</el-col>
<el-col>
@ -100,8 +100,7 @@
},
computed: {
...mapState({
pagination: state => state.admin.role.pagination,
roles: state => state.admin.role.roles
roles: state => state.admin.roles
})
},
data() {
@ -181,7 +180,7 @@
handleSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', {
page: _ts.pagination.currentPage,
page: _ts.roles.pageNum,
rows: pageSize
})
},
@ -189,7 +188,7 @@
let _ts = this;
_ts.$store.dispatch('admin/fetchRoles', {
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="cleanUnusedTag" plain>清除未使用标签</el-button>
</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>
@ -32,10 +32,10 @@
</el-col>
<el-col>
<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"
:current-page="pagination.currentPage"
:total="pagination.total"
:current-page="tags.pageNum"
:total="tags.total"
@current-change="currentChange">
</el-pagination>
</div>
@ -57,8 +57,7 @@
},
computed: {
...mapState({
tags: state => state.tag.list.data.tags,
pagination: state => state.tag.list.data.pagination
tags: state => state.tag.list.data
})
},
methods: {
@ -73,7 +72,7 @@
if (res && res.message){
_ts.$message.error(res.message);
} else {
const p = _ts.pagination.currentPage;
const p = _ts.tags.pageNum;
_ts.currentChange(p);
_ts.$message({
type: 'success',

View File

@ -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>
@ -54,10 +54,10 @@
</el-col>
<el-col>
<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"
: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

View File

@ -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>
@ -36,10 +36,10 @@
</el-col>
<el-col>
<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"
: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() {

View File

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

View File

@ -8,7 +8,7 @@
</el-col>
<el-col>
<el-table
:data="users"
:data="users.list"
style="width: 100%">
<el-table-column
label="#"
@ -89,11 +89,11 @@
:hide-on-single-page="true"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pagination.currentPage"
:current-page="users.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize"
:page-size="users.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total">
:total="users.total">
</el-pagination>
</el-col>
<el-col>
@ -129,9 +129,8 @@ export default {
},
computed: {
...mapState({
users: state => state.admin.user.users,
pagination: state => state.admin.user.pagination,
roles: state => state.admin.role.roles
users: state => state.admin.users,
roles: state => state.admin.roles.list
})
},
data() {
@ -160,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 {
@ -176,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 + '成功!'
@ -196,7 +193,7 @@ export default {
handleSizeChange(pageSize) {
let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', {
page: _ts.pagination.currentPage,
page: _ts.users.pageNum,
rows: pageSize
})
},
@ -204,7 +201,7 @@ export default {
let _ts = this;
_ts.$store.dispatch('admin/fetchUsers', {
page: page,
rows: _ts.pagination.pageSize
rows: _ts.users.pageSize
})
},
updateRole() {
@ -214,9 +211,7 @@ 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'

View File

@ -69,7 +69,7 @@
</client-only>
</el-col>
<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 v-if="article.portfolios && article.portfolios.length > 0">
<portfolios-widget :portfolios="article.portfolios"></portfolios-widget>
@ -257,7 +257,7 @@ export default {
isShare: false,
dialogVisible: false,
isPerfect: false,
shareData: {}
shareUrl: ''
}
},
methods: {
@ -283,12 +283,12 @@ export default {
if (_ts.user) {
_ts.$axios.$get('/api/article/' + _ts.article.idArticle + '/share').then(function (res) {
if (res) {
_ts.$set(_ts, 'shareData', res);
_ts.$set(_ts, 'shareUrl', res);
_ts.$set(_ts, 'isShare', true);
}
});
} else {
_ts.$set(_ts, 'shareData', {shareUrl: _ts.article.articlePermalink});
_ts.$set(_ts, 'shareUrl', _ts.article.articlePermalink);
_ts.$set(_ts, 'isShare', true);
}
}
@ -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.$store.dispatch('article/updateSponsorCount', {sponsorNumber: 1})
} else {
_ts.$message.error(_ts.message);
}
_ts.$message.success('赞赏成功');
_ts.$store.dispatch('article/updateSponsorCount', {sponsorNumber: 1})
}
})
},

View File

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

View File

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

View File

@ -101,15 +101,15 @@ export default {
return false;
}
let auth = {
accessToken: res.user.token,
idUser: res.user.idUser,
role: res.user.weights
accessToken: res.token,
idUser: res.idUser,
role: res.weights
}
let user = {
nickname: res.user.nickname,
avatarURL: res.user.avatarUrl,
account: res.user.account
nickname: res.nickname,
avatarURL: res.avatarUrl || 'https://static.rymcu.com/article/1578475481946.png',
account: res.account
}
_ts.$store.commit('setAuth', auth) // mutating to store for client rendering
localStorage.setItem('user', JSON.stringify(user))

View File

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

View File

@ -332,14 +332,10 @@ 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
})
}
_ts.$set(_ts, 'notificationFlag', false);
_ts.$router.push({
path: '/user/' + _ts.$store.state.userInfo?.account
})
}
})
}).catch(() => {

View File

@ -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>
@ -41,140 +47,136 @@
</template>
<script>
export default {
name: "register",
data() {
return {
user: {
email: '',
code: '',
password: '',
confirmPassword: ''
},
registerLoading: false,
loading: false,
loadText: '发送验证码',
timeClock: null
}
},
methods: {
sendCode() {
let _ts = this;
_ts.timerHandler();
let email = _ts.user.email;
if (!email) {
return false
}
let data = {
email: email
}
_ts.$axios.$get('/api/console/get-email-code', {
params: data
}).then(response => {
if (response.message) {
_ts.$message(response.message);
}
}).catch(error => {
console.log(error);
_ts.$message("邮件发送失败,请检查邮箱是否正确!");
})
export default {
name: "register",
data() {
return {
user: {
email: '',
code: '',
password: '',
confirmPassword: ''
},
timerHandler() {
let _ts = this;
_ts.$set(_ts, 'loading', true);
let times = 30;
_ts.timeClock = setInterval(function (){
times --;
_ts.$set(_ts, 'loadText', times + ' s');
if (times == 0) {
clearInterval(_ts.timeClock);
_ts.$set(_ts, 'loading', false);
_ts.$set(_ts, 'loadText', '发送验证码');
}
},1000)
},
register() {
let _ts = this;
_ts.$refs.user.validate((valid) => {
if (valid) {
_ts.$set(_ts, 'registerLoading', true);
setTimeout(function () {
_ts.$set(_ts, 'registerLoading', false);
}, 10000);
let data = {
email: _ts.user.email,
password: _ts.user.password,
code: _ts.user.code
}
_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.$router.push(
{
name: 'login'
}
)
}, 1000);
}
}
})
} else {
return false;
}
});
},
login() {
this.$router.push(
{
name: 'login'
}
)
}
},
mounted() {
this.$store.commit('setActiveMenu', 'register')
registerLoading: false,
loading: false,
loadText: '发送验证码',
timeClock: null
}
},
methods: {
sendCode() {
let _ts = this;
_ts.timerHandler();
let email = _ts.user.email;
if (!email) {
return false
}
let data = {
email: email
}
_ts.$axios.$get('/api/console/get-email-code', {
params: data
}).then(response => {
if (response.message) {
_ts.$message(response.message);
}
}).catch(error => {
console.log(error);
_ts.$message("邮件发送失败,请检查邮箱是否正确!");
})
},
timerHandler() {
let _ts = this;
_ts.$set(_ts, 'loading', true);
let times = 30;
_ts.timeClock = setInterval(function () {
times--;
_ts.$set(_ts, 'loadText', times + ' s');
if (times == 0) {
clearInterval(_ts.timeClock);
_ts.$set(_ts, 'loading', false);
_ts.$set(_ts, 'loadText', '发送验证码');
}
}, 1000)
},
register() {
let _ts = this;
_ts.$refs.user.validate((valid) => {
if (valid) {
_ts.$set(_ts, 'registerLoading', true);
setTimeout(function () {
_ts.$set(_ts, 'registerLoading', false);
}, 10000);
let data = {
email: _ts.user.email,
password: _ts.user.password,
code: _ts.user.code
}
_ts.$axios.$post('/api/console/register', data).then(function (res) {
_ts.$set(_ts, 'registerLoading', false);
if (res) {
_ts.$message("注册成功!");
_ts.$router.push(
{
name: 'login'
}
)
}
})
} else {
return false;
}
});
},
login() {
this.$router.push(
{
name: 'login'
}
)
}
},
mounted() {
this.$store.commit('setActiveMenu', 'register')
}
}
</script>
<style scoped>
.icon-rymcu {
margin: 0 auto;
display: block;
height: 4rem;
}
.icon-rymcu {
margin: 0 auto;
display: block;
height: 4rem;
}
.verify .verify-wrap {
/*width: 60%;*/
}
.verify .verify-wrap {
/*width: 60%;*/
}
.flex-inline {
display: flex;
align-items: center;
}
.flex-inline {
display: flex;
align-items: center;
}
.verify .intro {
padding: 50px;
background-color: #f1f7fe;
/*width: 40%;*/
color: #616161;
}
.verify .intro {
padding: 50px;
background-color: #f1f7fe;
/*width: 40%;*/
color: #616161;
}
.verify__sign {
background-color: transparent !important;
}
.verify__sign {
background-color: transparent !important;
}
.vditor-reset {
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;
word-wrap: break-word;
overflow: auto;
line-height: 1.5;
font-size: 16px;
word-break: break-word;
}
.vditor-reset {
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;
word-wrap: break-word;
overflow: auto;
line-height: 1.5;
font-size: 16px;
word-break: break-word;
}
</style>

View File

@ -7,13 +7,13 @@
</el-col>
<el-col>
<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"/>
</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"/>
</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"/>
</el-tab-pane>
</el-tabs>

View File

@ -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,13 +125,9 @@
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.$message.success('更新成功 !');
}
_ts.$set(_ts, 'user', res);
_ts.$store.commit('setUserInfo', res);
_ts.$message.success('更新成功 !');
}
})
} else {
@ -139,12 +140,8 @@
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.$message.success('更新成功 !');
}
_ts.$set(_ts, 'userExtend', res);
_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 = () => {
return {
fetching: false,
user: getDefaultUsersData(),
role: getDefaultRolesData(),
article: getDefaultArticlesData(),
comment: getDefaultCommentsData(),
users: getDefaultUsersData(),
roles: getDefaultRolesData(),
articles: getDefaultArticlesData(),
comments: getDefaultCommentsData(),
products: getDefaultProductsData(),
tabs: [
{
title: 'Dashboard',
@ -53,25 +61,24 @@ export const mutations = {
state.fetching = action
},
updateUsersData(state, action) {
state.user.users = action.users
state.user.pagination = action.pagination
state.users = action
},
updateRolesData(state, action) {
state.role.roles = action.roles
state.role.pagination = action.pagination
state.roles = action
},
updateArticlesData(state, action) {
state.article.articles = action.articles
state.article.pagination = action.pagination
state.articles = action
},
updateCommentsData(state, action) {
state.comment.comments = action.comments
state.comment.pagination = action.pagination
state.comments = action
},
updateProductsData(state, action) {
state.products = action
},
updateArticlePreference(state, action) {
let article = state.article.articles[action.index]
if (article.idArticle === action.idArticle) {
article.articlePerfect = action.articlePerfect
let articles = state.articles.list[action.index]
if (articles.idArticle === action.idArticle) {
articles.articlePerfect = action.articlePerfect
}
},
updateTags(state, action) {
@ -171,7 +178,7 @@ export const actions = {
return true;
}
// 清空已有数据
commit('updateCommentsData', getDefaultArticlesData())
commit('updateCommentsData', getDefaultCommentsData())
commit('updateFetching', true)
let data = {
@ -191,5 +198,31 @@ export const actions = {
console.log(error);
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
},
updateDetailData(state, action) {
state.detail.data = action.article
state.detail.data = action
},
clearDetailData(state, action) {
state.detail.data = {}
@ -103,7 +103,7 @@ export const actions = {
// 当前页判断
let currentData = JSON.parse(JSON.stringify(state)).list.data
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) {
commit('updateListFetching', false)
return

View File

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

View File

@ -26,6 +26,7 @@ export const mutations = {
state.list.fetching = action
},
updateListData(state, action) {
console.log(action)
state.list.data = action
},
// 文章详情
@ -33,7 +34,7 @@ export const mutations = {
state.detail.fetching = 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 updateState = state.updateState
if (!updateState) {
if (Number(params.page) === currentData?.pagination.currentPage) {
if (Number(params.page) === currentData?.pageNum) {
commit('updateListFetching', false)
return
}

View File

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

View File

@ -50,15 +50,13 @@ export const mutations = {
state.detail.fetching = action
},
updateDetailData(state, action) {
state.detail.data = action.portfolio
state.detail.data = action
},
updateArticleList(state, action) {
state.articles.articles = action.articles
state.articles.pagination = action.pagination
state.articles = action
},
updateUnbindArticleList(state, action) {
state.unbindArticles.articles = action.articles
state.unbindArticles.pagination = action.pagination
state.unbindArticles = action
},
// 更新作品集阅读全文状态
@ -78,7 +76,7 @@ export const actions = {
// 清空已有数据
commit('updateListFetching', true)
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)
return
}

View File

@ -61,7 +61,7 @@ export const actions = {
// 清空已有数据
commit('updateListFetching', true)
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)
return
}