This commit is contained in:
ronger 2022-11-01 08:06:18 +08:00
commit 2efafd12c0
6 changed files with 136 additions and 210 deletions

View File

@ -5,7 +5,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="登录 IP" label="登录 IP"
@ -29,11 +29,11 @@
:hide-on-single-page="true" :hide-on-single-page="true"
@current-change="currentChange" @current-change="currentChange"
@size-change="sizeChange" @size-change="sizeChange"
: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>
@ -61,7 +61,7 @@ export default {
let _ts = this; let _ts = this;
let search = { let search = {
size: size, size: size,
page: _ts.records.pagination.currentPage page: _ts.records.pageNum
} }
_ts.$emit('currentChange', search); _ts.$emit('currentChange', search);
}, },
@ -69,7 +69,7 @@ export default {
let _ts = this; let _ts = this;
let search = { let search = {
page: page, page: page,
size: _ts.records.pagination.pageSize size: _ts.records.pageSize
} }
_ts.$emit('currentChange', search); _ts.$emit('currentChange', search);
} }

View File

@ -139,7 +139,7 @@ export default {
handleSizeChange(pageSize) { handleSizeChange(pageSize) {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchArticles', { _ts.$store.dispatch('admin/fetchArticles', {
page: _ts.pagination.currentPage, page: _ts.articles.pageNum,
rows: pageSize rows: pageSize
}) })
}, },
@ -147,7 +147,7 @@ export default {
let _ts = this; let _ts = this;
_ts.$store.dispatch('admin/fetchArticles', { _ts.$store.dispatch('admin/fetchArticles', {
page: page, page: page,
rows: _ts.pagination.pageSize rows: _ts.articles.pageSize
}) })
}, },
toggleStatus() {}, toggleStatus() {},
@ -158,16 +158,14 @@ export default {
articlePerfect: '1' articlePerfect: '1'
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$store.commit('admin/updateArticlePreference', {
_ts.$store.commit('admin/updateArticlePreference', { index: index,
index: index, idArticle: idArticle,
idArticle: idArticle, articlePerfect: '1'
articlePerfect: '1' })
}) _ts.$message.success("设置成功!");
_ts.$message.success("设置成功!"); } else {
} else { _ts.$message.error("设置失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },
@ -178,16 +176,14 @@ export default {
articlePerfect: '0' articlePerfect: '0'
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$store.commit('admin/updateArticlePreference', {
_ts.$store.commit('admin/updateArticlePreference', { index: index,
index: index, idArticle: idArticle,
idArticle: idArticle, articlePerfect: '0'
articlePerfect: '0' })
}) _ts.$message.success("取消成功!");
_ts.$message.success("取消成功!"); } else {
} else { _ts.$message.error("取消失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },

View File

@ -42,143 +42,91 @@
<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 <el-table :data="articles.list" style="width: 100%">
:data="articles.list" <el-table-column label="#" width="60" prop="idArticle">
style="width: 100%">
<el-table-column
label="#"
width="60"
prop="idArticle">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="标题" prop="articleTitle">
label="标题"
prop="articleTitle">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="openLink(scope.row.articlePermalink)">{{ scope.row.articleTitle }}</el-button> <el-button type="text" @click="openLink(scope.row.articlePermalink)">{{ scope.row.articleTitle }}
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="标签" prop="articleTitle">
label="标签"
prop="articleTitle">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag style="margin-left: 0.5rem;" v-for="tag in scope.row.tags" :key="tag.idTag" size="mini"
style="margin-left: 0.5rem;"
v-for="tag in scope.row.tags"
:key="tag.idTag"
size="mini"
effect="plain"> effect="plain">
# {{ tag.tagTitle }} # {{ tag.tagTitle }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="最后更新时间" width="180" prop="updatedTime">
label="最后更新时间"
width="180"
prop="updatedTime">
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="scope.row.articlePerfect === '1'" size="mini" @click="cancelPreference(scope.$index, scope.row.idArticle)" plain>取消优选</el-button> <el-button v-if="scope.row.articlePerfect === '1'" size="mini"
<el-button v-else size="mini" @click="setPreference(scope.$index, scope.row.idArticle)" plain>设为优选</el-button> @click="cancelPreference(scope.$index, scope.row.idArticle)" plain>取消优选</el-button>
<el-button size="mini" type="primary" <el-button v-else size="mini" @click="setPreference(scope.$index, scope.row.idArticle)" plain>设为优选
@click="updateTags(scope.$index, scope.row)" plain>编辑标签 </el-button>
<el-button size="mini" type="primary" @click="updateTags(scope.$index, scope.row)" plain>编辑标签
</el-button> </el-button>
<el-button v-if="scope.row.articleStatus === '0'" size="mini" type="danger" <el-button v-if="scope.row.articleStatus === '0'" size="mini" type="danger"
@click="toggleStatus(scope.$index, scope.row)" plain>下架 @click="toggleStatus(scope.$index, scope.row)" plain>下架
</el-button> </el-button>
<el-button v-else size="mini" type="success" <el-button v-else size="mini" type="success" @click="toggleStatus(scope.$index, scope.row)" plain>上架
@click="toggleStatus(scope.$index, scope.row)" plain>上架
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col> </el-col>
<el-col> <el-col>
<el-pagination <el-pagination :hide-on-single-page="true" @size-change="handleArticleSizeChange"
:hide-on-single-page="true" @current-change="handleArticleCurrentChange" :current-page="articles.pageNum"
@size-change="handleArticleSizeChange" :page-sizes="[10, 20, 50, 100]" :page-size="articles.pageSize"
@current-change="handleArticleCurrentChange" layout="total, sizes, prev, pager, next, jumper" :total="articles.total">
:current-page="articles.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="articles.pageSize"
layout="total, sizes, prev, pager, next, jumper"
: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.list" <el-table :data="users.list" style="width: 100%">
style="width: 100%"> <el-table-column label="#" width="40" prop="idUser">
<el-table-column
label="#"
width="40"
prop="idUser">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="头像" width="60" prop="avatarUrl">
label="头像"
width="60"
prop="avatarUrl">
<template slot-scope="scope"> <template slot-scope="scope">
<el-avatar v-if="scope.row.avatarUrl" size="medium" :src="scope.row.avatarUrl"></el-avatar> <el-avatar v-if="scope.row.avatarUrl" size="medium" :src="scope.row.avatarUrl"></el-avatar>
<el-avatar v-else size="medium" src="https://rymcu.com/article/1578475481946.png"></el-avatar> <el-avatar v-else size="medium" src="https://rymcu.com/article/1578475481946.png"></el-avatar>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="昵称" width="140" prop="nickname">
label="昵称"
width="140"
prop="nickname">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" :href="getUserPath(scope.row.account)" :underline="false"> <el-link type="primary" :href="getUserPath(scope.row.account)" :underline="false">
{{ scope.row.nickname }} {{ scope.row.nickname }}
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="注册时间" width="180" prop="createdTime">
label="注册时间"
width="180"
prop="createdTime">
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col> </el-col>
<el-col> <el-col>
<el-pagination <el-pagination :hide-on-single-page="true" @size-change="handleUserSizeChange"
:hide-on-single-page="true" @current-change="handleUserCurrentChange" :current-page="users.pageNum" :page-sizes="[10, 20, 50, 100]"
@size-change="handleUserSizeChange" :page-size="users.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="users.total">
@current-change="handleUserCurrentChange"
:current-page="users.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="users.pageSize"
layout="total, sizes, prev, pager, next, jumper"
: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.list" <el-table :data="bankAccounts.list" style="width: 100%">
style="width: 100%"> <el-table-column label="#" width="40" prop="idBank">
<el-table-column
label="#"
width="40"
prop="idBank">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="银行账户" width="180" prop="bankAccount">
label="银行账户"
width="180"
prop="bankAccount">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="账户所有者" width="180" prop="accountOwnerName">
label="账户所有者"
width="180"
prop="accountOwnerName">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="账户余额 (巴旦木)" width="180" prop="accountBalance">
label="账户余额 (巴旦木)"
width="180"
prop="accountBalance">
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
@ -188,15 +136,10 @@
</el-table> </el-table>
</el-col> </el-col>
<el-col> <el-col>
<el-pagination <el-pagination :hide-on-single-page="true" @size-change="handleBankAccountSizeChange"
:hide-on-single-page="true" @current-change="handleBankAccountCurrentChange" :current-page="bankAccounts.pageNum"
@size-change="handleBankAccountSizeChange" :page-sizes="[10, 20, 50, 100]" :page-size="bankAccounts.pageSize"
@current-change="handleBankAccountCurrentChange" layout="total, sizes, prev, pager, next, jumper" :total="bankAccounts.total">
:current-page="bankAccounts.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="bankAccounts.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="bankAccounts.total">
</el-pagination> </el-pagination>
</el-col> </el-col>
</div> </div>
@ -229,10 +172,7 @@
</el-col> </el-col>
<el-col> <el-col>
<el-dialog :visible.sync="tagsDialogVisible"> <el-dialog :visible.sync="tagsDialogVisible">
<edit-tags <edit-tags :idArticle="idArticle" :tags="articleTags" @closeDialog="closeTagsDialog">
:idArticle="idArticle"
:tags="articleTags"
@closeDialog="closeTagsDialog">
</edit-tags> </edit-tags>
</el-dialog> </el-dialog>
</el-col> </el-col>
@ -241,7 +181,7 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import {mapState} from 'vuex'; import { mapState } from 'vuex';
import echarts from 'echarts'; import echarts from 'echarts';
import EditTags from '~/components/widget/tags'; import EditTags from '~/components/widget/tags';
@ -253,11 +193,11 @@ export default {
EditTags EditTags
}, },
fetch() { fetch() {
let {store, params, error} = this.$nuxt.context let { store, params, error } = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('dashboard/fetchDashboard', params) .dispatch('dashboard/fetchDashboard', params)
.catch(err => error({statusCode: 404})), .catch(err => error({ statusCode: 404 })),
store.dispatch("dashboard/fetchLastThirtyDays", params), store.dispatch("dashboard/fetchLastThirtyDays", params),
store.dispatch("dashboard/fetchHistory", params), store.dispatch("dashboard/fetchHistory", params),
store.dispatch("dashboard/fetchNewUsers", params), store.dispatch("dashboard/fetchNewUsers", params),
@ -319,13 +259,13 @@ export default {
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}, },
{ {
name: '用户', name: '用户',
data: data.users, data: data.users,
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}] }]
}; };
// 使 // 使
@ -409,13 +349,13 @@ export default {
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}, },
{ {
name: '用户', name: '用户',
data: data.users, data: data.users,
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}] }]
}; };
// 使 // 使
@ -447,19 +387,19 @@ export default {
type: 'value' type: 'value'
}, },
series: [{ series: [{
name: '访客数', name: '访客数',
data: data.visitIps, data: data.visitIps,
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}, },
{ {
name: '浏览量', name: '浏览量',
data: data.visits, data: data.visits,
type: 'line', type: 'line',
smooth: true, smooth: true,
areaStyle: {} areaStyle: {}
}] }]
}; };
// 使 // 使
@ -504,16 +444,14 @@ export default {
articlePerfect: '1' articlePerfect: '1'
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$store.commit('admin/updateArticlePreference', {
_ts.$store.commit('admin/updateArticlePreference', { index: index,
index: index, idArticle: idArticle,
idArticle: idArticle, articlePerfect: '1'
articlePerfect: '1' })
}) _ts.$message.success("设置成功!");
_ts.$message.success("设置成功!"); } else {
} else { _ts.$message.error("设置失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },
@ -524,16 +462,14 @@ export default {
articlePerfect: '0' articlePerfect: '0'
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$store.commit('admin/updateArticlePreference', {
_ts.$store.commit('admin/updateArticlePreference', { index: index,
index: index, idArticle: idArticle,
idArticle: idArticle, articlePerfect: '0'
articlePerfect: '0' })
}) _ts.$message.success("取消成功!");
_ts.$message.success("取消成功!"); } else {
} else { _ts.$message.error("取消失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },
@ -544,7 +480,7 @@ export default {
_ts.$set(_ts, 'articleTags', article.articleTags); _ts.$set(_ts, 'articleTags', article.articleTags);
_ts.$set(_ts, 'tagsDialogVisible', true); _ts.$set(_ts, 'tagsDialogVisible', true);
}, },
toggleStatus() {}, toggleStatus() { },
closeTagsDialog() { closeTagsDialog() {
this.$set(this, 'tagsDialogVisible', false); this.$set(this, 'tagsDialogVisible', false);
}, },
@ -592,11 +528,11 @@ export default {
}, },
}, },
mounted() { mounted() {
let _ts = this this.$store.commit("setActiveMenu", "admin-dashboard");
Vue.nextTick(() => { setTimeout(() => {
_ts.initLastThirtyDaysCharts(_ts.lastThirtyDays) this.initLastThirtyDaysCharts(this.lastThirtyDays)
_ts.initHistoryCharts(_ts.history) this.initHistoryCharts(this.history)
}) }, 500);
} }
} }
</script> </script>

View File

@ -335,19 +335,17 @@ export default {
_ts.gotoLogin(); _ts.gotoLogin();
} }
}, },
setPreference() { setPreference() {
let _ts = this; let _ts = this;
_ts.$axios.$patch("/api/admin/article/update-perfect", { _ts.$axios.$patch("/api/admin/article/update-perfect", {
idArticle: _ts.article.idArticle, idArticle: _ts.article.idArticle,
articlePerfect: '1', articlePerfect: '1',
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$set(_ts, 'isPerfect', true);
_ts.$set(_ts, 'isPerfect', false); _ts.$message.success("设置成功!");
_ts.$message.success("设置成功!"); } else {
} else { _ts.$message.error("设置失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },
@ -358,12 +356,10 @@ export default {
articlePerfect: '0', articlePerfect: '0',
}).then(function (res) { }).then(function (res) {
if (res) { if (res) {
if (res.success) { _ts.$set(_ts, 'isPerfect', false);
_ts.$set(_ts, 'isPerfect', true); _ts.$message.success("取消成功!");
_ts.$message.success("取消成功!"); } else {
} else { _ts.$message.error("设置失败!");
_ts.$message.error(_ts.message);
}
} }
}) })
}, },

View File

@ -47,7 +47,7 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import {mapState} from 'vuex'; import { mapState } from 'vuex';
import echarts from 'echarts'; import echarts from 'echarts';
import gzh from "assets/rymcugzh.jpg"; import gzh from "assets/rymcugzh.jpg";
@ -55,11 +55,11 @@ Vue.prototype.$echarts = echarts;
export default { export default {
name: "openData", name: "openData",
fetch() { fetch() {
let {store, params, error} = this.$nuxt.context let { store, params, error } = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('open-data/fetchLastThirtyDays', params) .dispatch('open-data/fetchLastThirtyDays', params)
.catch(err => error({statusCode: 404})), .catch(err => error({ statusCode: 404 })),
store.dispatch('open-data/fetchDashboard', params) store.dispatch('open-data/fetchDashboard', params)
]) ])
}, },
@ -154,24 +154,22 @@ export default {
} }
}, },
mounted() { mounted() {
let _ts = this this.$store.commit("setActiveMenu", "open-data");
_ts.$store.commit("setActiveMenu", "open-data"); setTimeout(() => {
Vue.nextTick(() => { this.initLastThirtyDaysCharts(this.lastThirtyDays)
_ts.initLastThirtyDaysCharts(_ts.lastThirtyDays) }, 500);
})
} }
} }
</script> </script>
<style scoped> <style scoped>
.article__wrapper { .article__wrapper {
max-width: 980px; max-width: 980px;
margin: 20px auto; margin: 20px auto;
display: block; display: block;
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; padding-right: 1rem;
box-sizing: border-box;; box-sizing: border-box;
} }
.mt-2rem { .mt-2rem {

View File

@ -158,9 +158,9 @@ export default {
if (res.message) { if (res.message) {
_ts.$message.error(res.message); _ts.$message.error(res.message);
} else { } else {
_ts.$set(_ts, 'user', res.user); _ts.$set(_ts, 'user', res);
_ts.$set(_ts, 'avatarUrl', res.user.avatarUrl); _ts.$set(_ts, 'avatarUrl', res.avatarUrl);
_ts.$refs.cropper.replace(res.user.avatarUrl); _ts.$refs.cropper.replace(res.avatarUrl);
// _ts.webImageToBase64(res.user.avatarUrl); // _ts.webImageToBase64(res.user.avatarUrl);
} }
} }
@ -192,9 +192,9 @@ export default {
if (res.message) { if (res.message) {
_ts.$message.error(res.message); _ts.$message.error(res.message);
} else { } else {
_ts.$set(_ts, 'user', res.user); _ts.$set(_ts, 'user', res);
_ts.$set(_ts, 'avatarUrl', res.user.avatarUrl); _ts.$set(_ts, 'avatarUrl', res.avatarUrl);
_ts.$store.commit('setUserInfo', res.user); _ts.$store.commit('setUserInfo', res);
_ts.$message.success('更新成功 !'); _ts.$message.success('更新成功 !');
} }
} }