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

View File

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

View File

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

View File

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

View File

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

View File

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