提交 c222f0bb 编写于 作者: 檀越@新空间's avatar 檀越@新空间 🐭

fix:更新前端

上级 231cfdce
import axios from 'axios' import axios from 'axios'
const BASE_URL = 'http://localhost:80' const BASE_URL = 'http://localhost:80'
// 创建一个名为 ApiService 的对象,包含您的异步方法 // 创建一个名为 ApiService 的对象,包含您的异步方法
const ApiService = { const ApiService = {
...@@ -107,19 +108,26 @@ const ApiService = { ...@@ -107,19 +108,26 @@ const ApiService = {
return await axios.get(BASE_URL + '/csdn/followFans/deleteFollow') return await axios.get(BASE_URL + '/csdn/followFans/deleteFollow')
}, },
//我的图片 //我的图片
async queryPic(currentPage, pageSize, picType) { async queryPic(currentPage, pageSize, formInline) {
return await axios.get(BASE_URL + '/picInfo/page', { return await axios.post(BASE_URL + '/picInfo/page', {
params: { page: currentPage,
page: currentPage, pageSize: pageSize,
pageSize: pageSize, type: formInline.type == '全部' ? '' : formInline.type,
picType: picType, picName: formInline.picName,
},
}) })
}, },
async editPicConfirm(currentRowId, type) { async editPicConfirm(currentRowId, type, picName) {
return await axios.post(BASE_URL + '/picInfo/update', { return await axios.post(BASE_URL + '/picInfo/update', {
id: currentRowId, id: currentRowId,
type: type, type: type,
picName: picName,
})
},
async batchUpdatePic(ids, type) {
return await axios.post(BASE_URL + '/picInfo/batchUpdatePic', {
ids: ids,
type: type,
}) })
}, },
//余额管理 //余额管理
...@@ -149,5 +157,38 @@ const ApiService = { ...@@ -149,5 +157,38 @@ const ApiService = {
endDate: formInline.accountDate != null ? formInline.accountDate[1] : '', endDate: formInline.accountDate != null ? formInline.accountDate[1] : '',
}) })
}, },
//用户管理
async multiTriplet(userNames) {
return await axios.post(BASE_URL + '/csdn/multiTriplet', userNames)
},
async autoReply() {
return await axios.get(BASE_URL + '/csdn/autoReply')
},
async singleTriplet(userName) {
return await axios.get(BASE_URL + '/csdn/singleTriplet?username=' + userName)
},
//私信管理
async dealMessageOne(userName) {
return await axios.get(BASE_URL + '/csdn/message/dealMessageOne?userName=' + userName)
},
async dealMessage() {
return await axios.get(BASE_URL + '/csdn/message/dealMessage')
},
async dealLikeCollect() {
return await axios.get(BASE_URL + '/csdn/likeCollect/dealLikeCollect')
},
async acquireMessage() {
return await axios.get(BASE_URL + '/csdn/message/acquireMessage')
},
async messagePage(currentPage, pageSize, formInline) {
return await axios.post('http://localhost:80/csdn/message/page', {
page: currentPage,
pageSize: pageSize,
userName: formInline.userName,
nickName: formInline.nickName,
hasReplied: formInline.hasRepliedInfo == -1 ? null : formInline.hasRepliedInfo,
})
},
} }
export default ApiService export default ApiService
<template> <template>
<div class="login-container"> <div class="login-container">
<div class="login-box"> <div class="login-box">
<!-- 头像区域 --> <!-- 头像区域 -->
<div class="text-center avatar-box"> <div class="text-center avatar-box">
<img src="../assets/kwan.png" class="img-thumbnail avatar" alt="kwan的解忧杂货铺" /> <img src="../assets/kwan.png" class="img-thumbnail avatar" alt="kwan的解忧杂货铺"/>
</div> </div>
<!-- 表单区域 --> <!-- 表单区域 -->
<div class="form-login p-4"> <div class="form-login p-4">
<!-- 登录名称 --> <!-- 登录名称 -->
<div class="form-group form-inline"> <div class="form-group form-inline">
<label for="username">登录名称</label> <label for="username">登录名称</label>
<input type="text" class="form-control ml-2" id="username" placeholder="请输入登录名称" autocomplete="off" v-model.trim="username" /> <input type="text" class="form-control ml-2" id="username" placeholder="请输入登录名称" autocomplete="off"
</div> v-model.trim="username"/>
<!-- 登录密码 --> </div>
<div class="form-group form-inline"> <!-- 登录密码 -->
<label for="password">登录密码</label> <div class="form-group form-inline">
<input type="password" class="form-control ml-2" id="password" placeholder="请输入登录密码" v-model.trim="password" /> <label for="password">登录密码</label>
</div> <input type="password" class="form-control ml-2" id="password" placeholder="请输入登录密码" v-model.trim="password"/>
<!-- 登录和重置按钮 --> </div>
<div class="form-group form-inline d-flex justify-content-end"> <!-- 登录和重置按钮 -->
<button type="button" class="btn btn-secondary mr-2" @click="reset">重置</button> <div class="form-group form-inline d-flex justify-content-end">
<button type="button" class="btn btn-primary" @click="login">登录</button> <button type="button" class="btn btn-secondary mr-2" @click="reset">重置</button>
</div> <button type="button" class="btn btn-primary" @click="login">登录</button>
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
export default { export default {
name: 'MyLogin', name: 'MyLogin',
data() { data() {
return { return {
username: '', username: '',
password: '', password: '',
} }
},
methods: {
reset() {
this.username = ''
this.password = ''
}, },
methods: { login() {
reset() { if (this.username === 'admin' && this.password === '716288') {
this.username = '' // 登录成功
this.password = '' // 1. 存储 token
}, localStorage.setItem('token', 'Bearer xxxx')
login() { // 2. 跳转到后台主页
if (this.username === 'admin' && this.password === '888888') { this.$router.push('/home')
// 登录成功 } else {
// 1. 存储 token // 登录失败
localStorage.setItem('token', 'Bearer xxxx') localStorage.removeItem('token')
// 2. 跳转到后台主页 this.errorMsg('登录失败,请检查您的用户名或密码;由于用户名密码是写死的,需要在项目中查看!!!')
this.$router.push('/home') }
} else {
// 登录失败
localStorage.removeItem('token')
this.errorMsg('登录失败,请检查您的用户名或密码;由于用户名密码是写死的,需要在项目中查看!!!')
}
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
}, },
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
},
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.login-container { .login-container {
background-color: #35495e; background-color: #35495e;
height: 100%; height: 100%;
.login-box {
width: 400px; .login-box {
height: 250px; width: 400px;
background-color: #fff; height: 250px;
border-radius: 3px; background-color: #fff;
position: absolute; border-radius: 3px;
left: 50%; position: absolute;
top: 50%; left: 50%;
transform: translate(-50%, -50%); top: 50%;
box-shadow: 0 0 6px rgba(255, 255, 255, 0.5); transform: translate(-50%, -50%);
.form-login { box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
position: absolute;
bottom: 0; .form-login {
left: 0; position: absolute;
width: 100%; bottom: 0;
box-sizing: border-box; left: 0;
} width: 100%;
} box-sizing: border-box;
}
}
} }
.form-control { .form-control {
flex: 1; flex: 1;
} }
.avatar-box { .avatar-box {
position: absolute; position: absolute;
width: 100%; width: 100%;
top: -65px; top: -65px;
left: 0; left: 0;
.avatar {
width: 120px; .avatar {
height: 120px; width: 120px;
border-radius: 50% !important; height: 120px;
box-shadow: 0 0 6px #efefef; border-radius: 50% !important;
} box-shadow: 0 0 6px #efefef;
}
} }
</style> </style>
\ No newline at end of file
...@@ -2,73 +2,14 @@ ...@@ -2,73 +2,14 @@
<div> <div>
<el-container> <el-container>
<el-main> <el-main>
<el-dialog title="新增算法问题" :visible.sync="dialogFormVisible" style="width: 100%">
<el-form :model="form" class="custom-form">
<el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.questionName" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="问题类型" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.questionType" placeholder="请选择问题类型">
<el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>
<el-form-item label="重要程度" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.degreeOfImportance" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="难易程度" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.degreeOfDifficulty" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="难易分数" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.difficultyOfScore" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="力扣题号" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.leetcodeNumber" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="力扣链接" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.leetcodeLink" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm(0)">确 定</el-button>
</div>
</el-dialog>
<el-dialog class="red-title" :visible.sync="dialogMutiFormVisible">
<div class="red-title" slot="title">批量新增算法问题(多个问题换行填写)</div>
<el-form :model="form" class="custom-form">
<el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item">
<el-input type="textarea" v-model="form.questionName" autocomplete="off" :rows="5" :cols="30" style="width: 100%"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogMutiFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm(1)">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="随机一题" :visible.sync="randomFormVisible" style="width: 100%">
<el-descriptions class="margin-top" title="随机选择的题目如下:" :column="3" border>
<el-descriptions-item v-model="randomAlgorithmic.questionName">
<template slot="label">题目名称</template>
{{ randomAlgorithmic.questionName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">力扣题号</template>
{{ randomAlgorithmic.leetcodeNumber }}
</el-descriptions-item>
<el-descriptions-item show-overflow-tooltip>
<template slot="label">力扣链接</template>
<a :href="randomAlgorithmic.leetcodeLink" target="_blank">{{ randomAlgorithmic.leetcodeLink }}</a>
</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button @click="randomFormVisible = false">取 消</el-button>
</div>
</el-dialog>
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item> <el-form-item>
<el-input clearable v-model="formInline.questionName" placeholder="请输入问题" @keydown.enter.native="algorithmPage"></el-input> <el-input clearable v-model="formInline.questionName" placeholder="请输入问题" @keydown.enter.native="algorithmPage"></el-input>
</el-form-item> </el-form-item>
<el-select v-model="formInline.questionType" placeholder="请选择" @change="algorithmPage"> <el-select v-model="formInline.questionType" clearable placeholder="请选择" @change="algorithmPage">
<el-option v-for="item in questionType" :key="item" :label="item" :value="item"></el-option>
</el-select>
<el-select v-model="formInline.tag" clearable multiple placeholder="请选择">
<el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option> <el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
<el-form-item> <el-form-item>
...@@ -76,12 +17,79 @@ ...@@ -76,12 +17,79 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="prepareRandom">随机一题</el-button> <el-button type="primary" @click="prepareRandom">随机一题</el-button>
<el-dialog title="随机一题" :visible.sync="randomFormVisible" style="width: 100%">
<el-descriptions class="margin-top" title="随机选择的题目如下:" :column="3" border>
<el-descriptions-item v-model="randomAlgorithmic.questionName">
<template slot="label">题目名称</template>
{{ randomAlgorithmic.questionName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">力扣题号</template>
{{ randomAlgorithmic.leetcodeNumber }}
</el-descriptions-item>
<el-descriptions-item show-overflow-tooltip>
<template slot="label">力扣链接</template>
<a :href="randomAlgorithmic.leetcodeLink" target="_blank">{{ randomAlgorithmic.leetcodeLink }}</a>
</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button @click="randomFormVisible = false">取 消</el-button>
</div>
</el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="prepareAdd">新增</el-button> <el-button type="primary" @click="prepareAdd">新增</el-button>
<el-dialog title="新增算法问题" :visible.sync="dialogFormVisible" style="width: 100%">
<el-form :model="form" class="custom-form">
<el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.questionName" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="问题标签" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.tag" multiple placeholder="请选择">
<el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>
<el-form-item label="问题集" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.questionType" placeholder="请选择">
<el-option v-for="item in questionType" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>
<el-form-item label="重要程度" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.degreeOfImportance" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="难易程度" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.degreeOfDifficulty" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="难易分数" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.difficultyOfScore" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="力扣题号" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.leetcodeNumber" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
<el-form-item label="力扣链接" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.leetcodeLink" autocomplete="off" style="width: 100%"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm(0)">确 定</el-button>
</div>
</el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="prepareMutiAdd">批量新增</el-button> <el-button type="primary" @click="prepareMutiAdd">批量新增</el-button>
<el-dialog class="red-title" :visible.sync="dialogMutiFormVisible">
<div class="red-title" slot="title">批量新增算法问题(多个问题换行填写)</div>
<el-form :model="form" class="custom-form">
<el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item">
<el-input type="textarea" v-model="form.questionName" autocomplete="off" :rows="5" :cols="30" style="width: 100%"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogMutiFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm(1)">确 定</el-button>
</div>
</el-dialog>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table border :data="algorithmicList" v-loading="loading"> <el-table border :data="algorithmicList" v-loading="loading">
...@@ -92,11 +100,23 @@ ...@@ -92,11 +100,23 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="leetcodeNumber" label="力扣题号" width="100" show-overflow-tooltip></el-table-column> <el-table-column prop="leetcodeNumber" label="力扣题号" width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="questionType" label="问题类型" show-overflow-tooltip align="center">
<el-table-column prop="tags" label="标签" width="150px" show-overflow-tooltip>
<template slot-scope="scope">
<div class="tag-flex">
<div :style="{ 'margin-left': index > 0 ? '2px' : '0', 'margin-bottom': '2px' }" v-for="(tag, index) in scope.row.tags" :key="index">
<el-tag :type="getTagType(tag)">{{ tag }}</el-tag>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="questionType" label="问题集" show-overflow-tooltip align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{ color: getColorForValue(scope.row.questionType) }" v-html="scope.row.questionType"></span> <span :style="{ color: getColorForValue(scope.row.questionType) }" v-html="scope.row.questionType"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column sortable prop="degreeOfImportance" label="重要程度" show-overflow-tooltip></el-table-column> <el-table-column sortable prop="degreeOfImportance" label="重要程度" show-overflow-tooltip></el-table-column>
<el-table-column prop="degreeOfDifficulty" label="难易程度" show-overflow-tooltip></el-table-column> <el-table-column prop="degreeOfDifficulty" label="难易程度" show-overflow-tooltip></el-table-column>
<el-table-column prop="difficultyOfScore" label="难易分数" show-overflow-tooltip></el-table-column> <el-table-column prop="difficultyOfScore" label="难易分数" show-overflow-tooltip></el-table-column>
...@@ -108,17 +128,25 @@ ...@@ -108,17 +128,25 @@
</el-table-column> </el-table-column>
<el-table-column prop="操作" label="操作"> <el-table-column prop="操作" label="操作">
<template slot-scope="props"> <template slot-scope="props">
<el-button type="success" @click.prevent="preEdit(props.row.id, props.row.questionName, props.row.questionType, props.row.degreeOfImportance, props.row.degreeOfDifficulty, props.row.difficultyOfScore, props.row.leetcodeNumber, props.row.leetcodeLink)" width="200">编辑</el-button> <el-button type="success" @click.prevent="preEdit(props.row.id, props.row.questionName, props.row.questionType, props.row.tags, props.row.degreeOfImportance, props.row.degreeOfDifficulty, props.row.difficultyOfScore, props.row.leetcodeNumber, props.row.leetcodeLink)" width="200">编辑</el-button>
<el-dialog title="编辑算法问题" :visible.sync="editVisible"> <el-dialog title="编辑算法问题" :visible.sync="editVisible">
<el-form :model="form"> <el-form :model="form">
<el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item"> <el-form-item label="算法问题" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.questionName" autocomplete="off" style="width: 100%"></el-input> <el-input v-model="form.questionName" autocomplete="off" style="width: 100%"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="问题类型" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.questionType" placeholder="请选择活动区域"> <el-form-item label="问题标签" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.tag" multiple placeholder="请选择">
<el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option> <el-option v-for="item in allOptions" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="问题集" :label-width="formLabelWidth" class="form-item">
<el-select v-model="form.questionType" placeholder="请选择">
<el-option v-for="item in questionType" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>
<el-form-item label="重要程度" :label-width="formLabelWidth" class="form-item"> <el-form-item label="重要程度" :label-width="formLabelWidth" class="form-item">
<el-input v-model="form.degreeOfImportance" autocomplete="off" style="width: 100%"></el-input> <el-input v-model="form.degreeOfImportance" autocomplete="off" style="width: 100%"></el-input>
</el-form-item> </el-form-item>
...@@ -161,326 +189,358 @@ ...@@ -161,326 +189,358 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'MyInterview', name: 'MyInterview',
data() {
return {
// 用户列表数据
algorithmicList: [],
randomAlgorithmic: {
questionName: '',
leetcodeNumber: '',
leetcodeLink: '',
},
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('algorithmLastPage')) || 1,
pageSize: 9,
total: 0,
formInline: {
questionName: '',
questionType: '',
tag: [],
},
allOptions: ['hash表', '递归', '数组', '', '回溯', '双指针', '二分法', '滑动窗口', '动态规划', '链表', '二叉树', '组合'],
questionType: ['HOT-100', '周赛', '网络'],
// 新增的内容
dialogFormVisible: false,
randomFormVisible: false,
dialogMutiFormVisible: false,
form: {
questionName: '',
questionType: '',
degreeOfImportance: 5,
degreeOfDifficulty: 1,
difficultyOfScore: 1200,
leetcodeNumber: '',
leetcodeLink: '',
tag: [],
},
formLabelWidth: '120px',
dialogVisible: false,
editVisible: false,
currentRowId: null,
colorMap: {}, // 创建一个空的颜色映射关系对象
}
},
watch: {
formInline: {
handler(newVal, oldVal) {
this.currentPage = 1
localStorage.setItem('algorithmLastPage', this.currentPage)
this.algorithmPage()
},
deep: true,
},
// 监听currentPage的变化,将新值保存到localStorage中
currentPage(newPage) {
localStorage.setItem('algorithmLastPage', newPage.toString())
},
},
created() {
//获取问题类型的枚举
this.algorithmPage()
},
mounted() {
this.currentPage = 1
},
methods: {
prepareAdd() {
this.form.questionName = ''
this.form.questionType = ''
this.dialogFormVisible = true
},
prepareRandom() {
this.randomAlgorithmic = []
this.randomFormVisible = true
this.interviewRandom()
},
prepareMutiAdd() {
this.form.questionName = ''
this.form.questionType = ''
this.dialogMutiFormVisible = true
},
prepareDelete(id) {
this.currentRowId = id
this.dialogVisible = true
},
preEdit(id, questionName, questionType, tags, degreeOfImportance, degreeOfDifficulty, difficultyOfScore, leetcodeNumber, leetcodeLink) {
this.form.questionName = questionName
this.form.degreeOfImportance = degreeOfImportance
this.form.degreeOfDifficulty = degreeOfDifficulty
this.form.difficultyOfScore = difficultyOfScore
this.form.leetcodeNumber = leetcodeNumber
this.form.leetcodeLink = leetcodeLink
this.form.questionType = questionType
this.form.tag = tags
this.currentRowId = id
this.editVisible = true
},
handleClose(done) {
this.$confirm('确认关闭?')
.then((_) => {
done()
})
.catch((_) => {})
},
handleConfirm(addType) {
this.dialogFormVisible = false // 关闭对话框
this.dialogMutiFormVisible = false
this.addQuestion(addType) // 发送请求
},
data() { async algorithmPage() {
return { this.loading = true
// 用户列表数据 const { data: res } = await axios.post('http://localhost:80/algorithmicProblem/page', {
algorithmicList: [], page: this.currentPage,
randomAlgorithmic: { pageSize: this.pageSize,
questionName: '', questionName: this.formInline.questionName,
leetcodeNumber: '', questionType: this.formInline.questionType,
leetcodeLink: '', tag: this.formInline.tag,
}, })
loading: false, if (res.code === 200) {
elementui_page_component_key: 0, this.total = res.result.totalElements
currentPage: Number(localStorage.getItem('algorithmLastPage')) || 1, res.result.content.forEach((item) => {
pageSize: 9, item.tags = item && item.tag ? item.tag.split(',') : []
total: 0, })
formInline: { this.algorithmicList = res.result.content
questionName: '', }
questionType: '', this.loading = false
}, },
allOptions: ['hash表', '回溯', '双指针', '二分法', '滑动窗口', '动态规划', '链表', '二叉树'],
// 新增的内容
dialogFormVisible: false,
randomFormVisible: false,
dialogMutiFormVisible: false,
form: {
questionName: '',
questionType: '',
degreeOfImportance: 5,
degreeOfDifficulty: 1,
difficultyOfScore: 1200,
leetcodeNumber: '',
leetcodeLink: '',
},
formLabelWidth: '120px',
dialogVisible: false,
editVisible: false,
currentRowId: null,
colorMap: {}, // 创建一个空的颜色映射关系对象
}
},
watch: {
formInline: {
handler(newVal, oldVal) {
this.currentPage = 1
localStorage.setItem('algorithmLastPage', this.currentPage)
this.algorithmPage()
},
deep: true,
},
// 监听currentPage的变化,将新值保存到localStorage中
currentPage(newPage) {
localStorage.setItem('algorithmLastPage', newPage.toString())
},
},
created() {
//获取问题类型的枚举
this.algorithmPage()
},
mounted() {
this.currentPage = 1
},
methods: {
prepareAdd() {
this.form.questionName = ''
this.form.questionType = ''
this.dialogFormVisible = true
},
prepareRandom() {
this.randomAlgorithmic = []
this.randomFormVisible = true
this.interviewRandom()
},
prepareMutiAdd() {
this.form.questionName = ''
this.form.questionType = ''
this.dialogMutiFormVisible = true
},
prepareDelete(id) { async addQuestion(addType) {
this.currentRowId = id try {
this.dialogVisible = true this.loading = true
}, const { data: res } = await axios.post('http://localhost:80/algorithmicProblem/add', {
preEdit(id, questionName, questionType, degreeOfImportance, degreeOfDifficulty, difficultyOfScore, leetcodeNumber, leetcodeLink) { addType: addType,
this.form.questionName = questionName questionName: this.form.questionName,
this.form.degreeOfImportance = degreeOfImportance questionType: this.form.questionType,
this.form.degreeOfDifficulty = degreeOfDifficulty tag: this.form.tag,
this.form.difficultyOfScore = difficultyOfScore degreeOfImportance: this.form.degreeOfImportance,
this.form.leetcodeNumber = leetcodeNumber degreeOfDifficulty: this.form.degreeOfDifficulty,
this.form.leetcodeLink = leetcodeLink difficultyOfScore: this.form.difficultyOfScore,
this.form.questionType = questionType leetcodeNumber: this.form.leetcodeNumber,
this.currentRowId = id leetcodeLink: this.form.leetcodeLink,
this.editVisible = true })
}, if (res.code === 200) {
handleClose(done) { this.currentPage = 1
this.$confirm('确认关闭?') this.form.questionName = ''
.then((_) => { this.form.questionType = 0
done() this.form.degreeOfImportance = 5
}) this.form.degreeOfDifficulty = 1
.catch((_) => {}) this.form.difficultyOfScore = 1200
}, this.form.leetcodeNumber = ''
handleConfirm(addType) { this.form.leetcodeLink = ''
this.dialogFormVisible = false // 关闭对话框 this.form.tag = []
this.dialogMutiFormVisible = false this.algorithmPage()
this.addQuestion(addType) // 发送请求 } else {
}, console.error('Received non-200 status code', res)
this.errorMsg(res.message)
}
} catch (error) {
console.error('An error occurred while adding the questionName:', error)
// 异常处理逻辑
} finally {
this.loading = false
}
},
async addQuestion(addType) { async editConfirm() {
try { try {
this.loading = true this.loading = true
const { data: res } = await axios.post('http://localhost:80/algorithmicProblem/add', { const { data: res } = await axios.post('http://localhost:80/algorithmicProblem/update', {
addType: addType, id: this.currentRowId,
questionName: this.form.questionName, questionName: this.form.questionName,
questionType: this.form.questionType, questionType: this.form.questionType,
degreeOfImportance: this.form.degreeOfImportance, degreeOfImportance: this.form.degreeOfImportance,
degreeOfDifficulty: this.form.degreeOfDifficulty, degreeOfDifficulty: this.form.degreeOfDifficulty,
difficultyOfScore: this.form.difficultyOfScore, difficultyOfScore: this.form.difficultyOfScore,
leetcodeNumber: this.form.leetcodeNumber, leetcodeNumber: this.form.leetcodeNumber,
leetcodeLink: this.form.leetcodeLink, leetcodeLink: this.form.leetcodeLink,
}) tag: this.form.tag,
if (res.code === 200) { })
this.currentPage = 1 if (res.code === 200) {
this.form.questionName = '' this.form.questionName = ''
this.form.questionType = 0 this.form.questionType = 0
this.form.degreeOfImportance = 5 this.editVisible = false
this.form.degreeOfDifficulty = 1 currentRowId: null
this.form.difficultyOfScore = 1200 this.algorithmPage()
this.form.leetcodeNumber = '' } else {
this.form.leetcodeLink = '' console.error('Received non-200 status code', res)
this.algorithmPage() }
} else { } catch (error) {
console.error('Received non-200 status code', res) console.error('An error occurred while adding the questionName:', error)
this.errorMsg(res.message) // 异常处理逻辑
} } finally {
} catch (error) { this.loading = false
console.error('An error occurred while adding the questionName:', error) }
// 异常处理逻辑 },
} finally {
this.loading = false
}
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://localhost:80/algorithmicProblem/update', {
id: this.currentRowId,
questionName: this.form.questionName,
questionType: this.form.questionType,
degreeOfImportance: this.form.degreeOfImportance,
degreeOfDifficulty: this.form.degreeOfDifficulty,
difficultyOfScore: this.form.difficultyOfScore,
leetcodeNumber: this.form.leetcodeNumber,
leetcodeLink: this.form.leetcodeLink,
})
if (res.code === 200) {
this.form.questionName = ''
this.form.questionType = 0
this.editVisible = false
currentRowId: null
this.algorithmPage()
} else {
console.error('Received non-200 status code', res)
}
} catch (error) {
console.error('An error occurred while adding the questionName:', error)
// 异常处理逻辑
} finally {
this.loading = false
}
},
async onDelete(id) { async onDelete(id) {
this.dialogVisible = false this.dialogVisible = false
this.loading = true this.loading = true
const { data: res } = await axios.get('http://localhost:80/algorithmicProblem/delete', { const { data: res } = await axios.get('http://localhost:80/algorithmicProblem/delete', {
params: { params: {
id: id, id: id,
}, },
}) })
this.algorithmPage() this.algorithmPage()
this.loading = false this.loading = false
}, },
refreshPage() { refreshPage() {
//获取问题类型的枚举 //获取问题类型的枚举
this.algorithmPage() this.algorithmPage()
location.reload() location.reload()
}, },
async algorithmPage() { async interviewRandom() {
this.loading = true this.loading = true
const { data: res } = await axios.get('http://localhost:80/algorithmicProblem/page', { const { data: res } = await axios.get('http://localhost:80/algorithmicProblem/random', { params: {} })
params: { if (res.code === 200) {
page: this.currentPage, this.randomAlgorithmic.questionName = res.result.questionName
pageSize: this.pageSize, this.randomAlgorithmic.leetcodeNumber = res.result.leetcodeNumber
questionName: this.formInline.questionName, this.randomAlgorithmic.leetcodeLink = res.result.leetcodeLink
questionType: this.formInline.questionType, }
}, this.loading = false
}) },
if (res.code === 200) { handleCurrentChange(currentPage) {
this.total = res.result.totalElements this.currentPage = currentPage
this.algorithmicList = res.result.content this.algorithmPage()
} },
this.loading = false getColorForValue(value) {
}, // 检查颜色映射关系中是否已经有该值对应的颜色
async interviewRandom() { if (!this.colorMap[value]) {
this.loading = true // 如果没有,随机生成一个颜色并将其关联到该值
const { data: res } = await axios.get('http://localhost:80/algorithmicProblem/random', { params: {} }) this.colorMap[value] = this.getRandomColor()
if (res.code === 200) { }
this.randomAlgorithmic.questionName = res.result.questionName // 返回值对应的颜色
this.randomAlgorithmic.leetcodeNumber = res.result.leetcodeNumber return this.colorMap[value]
this.randomAlgorithmic.leetcodeLink = res.result.leetcodeLink },
} getTagType(tag) {
this.loading = false switch (tag.trim()) {
}, case '链表':
handleCurrentChange(currentPage) { case '二叉树':
this.currentPage = currentPage case '':
this.algorithmPage() case '数组':
}, return 'primary'
getColorForValue(value) { case 'hash表':
// 检查颜色映射关系中是否已经有该值对应的颜色 case '回溯':
if (!this.colorMap[value]) { case '双指针':
// 如果没有,随机生成一个颜色并将其关联到该值 case '二分法':
this.colorMap[value] = this.getRandomColor() return 'success'
} case '滑动窗口':
// 返回值对应的颜色 case '动态规划':
return this.colorMap[value] return 'danger'
}, case '组合':
getRandomColor() { return 'warning'
// 从颜色数组中随机选取一个颜色 default:
const colorArray = [ return 'info'
'red', }
'blue', },
'green', getRandomColor() {
'purple', // 从颜色数组中随机选取一个颜色
'orange', const colorArray = [
'pink', 'red',
'brown', 'blue',
'magenta', 'green',
'maroon', 'purple',
'navy', 'orange',
'olive', 'pink',
'teal', 'brown',
'silver', 'magenta',
'gray', 'maroon',
'indigo', 'navy',
'violet', 'olive',
'coral', 'teal',
'salmon', 'silver',
'orchid', 'gray',
'slategray', 'indigo',
'thistle', 'violet',
'burlywood', 'coral',
'cadetblue', 'salmon',
'chocolate', 'orchid',
'crimson', 'slategray',
'darkblue', 'thistle',
'darkcyan', 'burlywood',
'darkgoldenrod', 'cadetblue',
'darkgray', 'chocolate',
'darkgreen', 'crimson',
'darkkhaki', 'darkblue',
'darkmagenta', 'darkcyan',
'darkolivegreen', 'darkgoldenrod',
'darkorange', 'darkgray',
'darkorchid', 'darkgreen',
'darkred', 'darkkhaki',
'darksalmon', 'darkmagenta',
'darkseagreen', 'darkolivegreen',
'darkslateblue', 'darkorange',
'darkslategray', 'darkorchid',
'darkturquoise', 'darkred',
'darkviolet', 'darksalmon',
'deeppink', 'darkseagreen',
'deepskyblue', 'darkslateblue',
'dodgerblue', 'darkslategray',
'firebrick', 'darkturquoise',
'forestgreen', 'darkviolet',
'fuchsia', 'deeppink',
'hotpink', 'deepskyblue',
'indianred', 'dodgerblue',
'lightcoral', 'firebrick',
'lightpink', 'forestgreen',
'lightsalmon', 'fuchsia',
'lightseagreen', 'hotpink',
'lightskyblue', 'indianred',
'lightslategray', 'lightcoral',
'lightsteelblue', 'lightpink',
'mediumaquamarine', 'lightsalmon',
'mediumblue', 'lightseagreen',
'mediumorchid', 'lightskyblue',
'mediumpurple', 'lightslategray',
'mediumslateblue', 'lightsteelblue',
'mediumturquoise', 'mediumaquamarine',
'mediumvioletred', 'mediumblue',
'midnightblue', 'mediumorchid',
'orangered', 'mediumpurple',
'palevioletred', 'mediumslateblue',
'peru', 'mediumturquoise',
'rosybrown', 'mediumvioletred',
'saddlebrown', 'midnightblue',
'seagreen', 'orangered',
'sienna', 'palevioletred',
'skyblue', 'peru',
'slateblue', 'rosybrown',
'tan', 'saddlebrown',
'thistle', 'seagreen',
'tomato', 'sienna',
'violet', 'skyblue',
] 'slateblue',
const randomIndex = Math.floor(Math.random() * colorArray.length) 'tan',
return colorArray[randomIndex] 'thistle',
}, 'tomato',
}, 'violet',
]
const randomIndex = Math.floor(Math.random() * colorArray.length)
return colorArray[randomIndex]
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
},
} }
</script> </script>
...@@ -499,6 +559,7 @@ export default { ...@@ -499,6 +559,7 @@ export default {
margin-top: 16px; margin-top: 16px;
text-align: right; text-align: right;
} }
.header-button-item { .header-button-item {
margin-right: 15px; margin-right: 15px;
font-size: 20px; font-size: 20px;
...@@ -524,11 +585,19 @@ export default { ...@@ -524,11 +585,19 @@ export default {
cursor: pointer; cursor: pointer;
z-index: 999; z-index: 999;
} }
.custom-textarea { .custom-textarea {
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
.backtop:hover { .backtop:hover {
background-color: #0050a0; background-color: #0050a0;
} }
.tag-flex {
display: flex;
width: 150px;
flex-wrap: wrap;
}
</style> </style>
\ No newline at end of file
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table ref="multipleTable" v-loading="loading" :data="articleInfoList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange"> <el-table border ref="multipleTable" v-loading="loading" :data="articleInfoList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50"></el-table-column> <el-table-column type="selection" width="50"></el-table-column>
<el-table-column prop="articleId" label="文章id" show-overflow-tooltip></el-table-column> <el-table-column prop="articleId" label="文章id" show-overflow-tooltip></el-table-column>
<el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column> <el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column>
...@@ -282,7 +282,7 @@ export default { ...@@ -282,7 +282,7 @@ export default {
{ type: 2, name: '评论已满' }, { type: 2, name: '评论已满' },
{ type: 3, name: '禁言' }, { type: 3, name: '禁言' },
{ type: 4, name: '评论太快' }, { type: 4, name: '评论太快' },
{ type: 5, name: '评论已经到了40条' }, { type: 5, name: '评论已40条' },
{ type: 8, name: '其他错误' }, { type: 8, name: '其他错误' },
{ type: 9, name: '评论成功' }, { type: 9, name: '评论成功' },
], ],
...@@ -605,7 +605,7 @@ export default { ...@@ -605,7 +605,7 @@ export default {
return 'info' return 'info'
} else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') { } else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') {
return 'success' return 'success'
} else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已经到了40条') { } else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已40条') {
return 'danger' return 'danger'
} else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') { } else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') {
return 'success' return 'success'
......
...@@ -80,18 +80,9 @@ ...@@ -80,18 +80,9 @@
</div> </div>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="prepareAllTriplet">三连</el-button> <el-button size="small" type="primary" @click="multiTriplet">三连</el-button>
<el-dialog title="提示" :visible.sync="allTripletDialogVisible" width="30%" :before-close="handleClose">
<span>确认三连吗?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="allTripletDialogVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="allTriplet()">确 定</el-button>
</span>
</el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="warning" @click="prepareResetLikesComment">核验状态</el-button> <el-button size="small" type="warning" @click="prepareResetLikesComment">核验状态</el-button>
<el-dialog title="提示" :visible.sync="resetLikesCommentDialogVisible" width="30%" :before-close="handleClose"> <el-dialog title="提示" :visible.sync="resetLikesCommentDialogVisible" width="30%" :before-close="handleClose">
...@@ -104,17 +95,10 @@ ...@@ -104,17 +95,10 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="success" @click="prepareAutoReply">自动评论</el-button> <el-button size="small" type="success" @click="autoReply">自动评论</el-button>
<el-dialog title="提示" :visible.sync="autoReplyDialogVisible" width="30%" :before-close="handleClose">
<span>确认自动评论吗?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="autoReplyDialogVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="autoReply()">确 定</el-button>
</span>
</el-dialog>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table ref="multipleTable" v-loading="loading" :data="csdnUserList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange"> <el-table border ref="multipleTable" v-loading="loading" :data="csdnUserList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column> <el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="nickName" label="用户昵称" show-overflow-tooltip> <el-table-column prop="nickName" label="用户昵称" show-overflow-tooltip>
...@@ -143,7 +127,12 @@ ...@@ -143,7 +127,12 @@
<el-table-column prop="userWeightName" label="用户权重" show-overflow-tooltip></el-table-column> <el-table-column prop="userWeightName" label="用户权重" show-overflow-tooltip></el-table-column>
<el-table-column prop="articleType" label="文章类型" show-overflow-tooltip></el-table-column> <el-table-column prop="articleType" label="文章类型" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag :type="getArticleType(scope.row.articleType)">{{ scope.row.articleType }}</el-tag>
</template>
</el-table-column>
<el-table-column label="更新时间"> <el-table-column label="更新时间">
<template slot-scope="props"> <template slot-scope="props">
{{ props.row.updateTime | dateFormat }} {{ props.row.updateTime | dateFormat }}
...@@ -151,22 +140,8 @@ ...@@ -151,22 +140,8 @@
</el-table-column> </el-table-column>
<el-table-column prop="操作" label="操作" width="380px"> <el-table-column prop="操作" label="操作" width="380px">
<template slot-scope="props"> <template slot-scope="props">
<el-button type="primary" @click="prepareTriplet(props.row.userName)" size="small">三连</el-button> <el-button type="primary" @click="triplet(props.row.userName)" size="small">三连</el-button>
<el-dialog title="提示" :visible.sync="tripletVisible" width="30%" :before-close="handleClose"> <el-button type="warning" @click="resetUserDayStatus(props.row.userName)" size="small">重置</el-button>
<span>确认三连?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="tripletVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="triplet(currentUserName)">确 定</el-button>
</span>
</el-dialog>
<el-button type="warning" @click="prepareResetUserDayStatus(props.row.userName)" size="small">重置</el-button>
<el-dialog title="提示" :visible.sync="resetUserDayStatusVisible" width="30%" :before-close="handleClose">
<span>确认重置?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="resetUserDayStatusVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="resetUserDayStatus(currentUserName)">确 定</el-button>
</span>
</el-dialog>
<el-button type="success" @click.prevent="preEdit(props.row.id, props.row.userName, props.row.nickName, props.row.userHomeUrl, props.row.userWeight)" width="200" size="small">编辑</el-button> <el-button type="success" @click.prevent="preEdit(props.row.id, props.row.userName, props.row.nickName, props.row.userHomeUrl, props.row.userWeight)" width="200" size="small">编辑</el-button>
<el-dialog title="编辑用户信息" :visible.sync="editVisible"> <el-dialog title="编辑用户信息" :visible.sync="editVisible">
<el-form :model="form"> <el-form :model="form">
...@@ -209,7 +184,7 @@ ...@@ -209,7 +184,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[8, 10, 50, 100, 200, 400]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[ 10, 50, 100, 200, 400]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
</el-main> </el-main>
<el-backtop class="backtop"></el-backtop> <el-backtop class="backtop"></el-backtop>
</el-container> </el-container>
...@@ -218,419 +193,416 @@ ...@@ -218,419 +193,416 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import ApiService from '../../api/ApiService'
export default { export default {
name: 'MyCsdnUser', name: 'MyCsdnUser',
data() {
return {
form: {
userName: '',
nickName: '',
userHomeUrl: '',
userWeight: null,
},
formInline: {
userName: '',
nickName: '',
articleType: '',
likeStatus: null,
collectStatus: null,
commentStatus: null,
},
allOptions: [
{
type: -1,
name: '全部',
},
{
type: 9,
name: '铁子',
},
{ type: 8, name: '闺蜜' },
{ type: 7, name: '基友' },
{ type: 0, name: '默认' },
],
articleType: ['全部', 'blog', 'blink', 'download', 'ask'],
likeStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经点过赞' },
{ type: 2, name: '点赞已满' },
{ type: 3, name: '取消点赞' },
{ type: 4, name: '文章状态不能点赞' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '点赞成功' },
],
collectStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经收藏过' },
{ type: 2, name: '收藏已满' },
{ type: 3, name: '参数缺失' },
{ type: 4, name: '收藏夹不存在' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '收藏成功' },
],
commentStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经评论过' },
{ type: 2, name: '评论已满' },
{ type: 3, name: '禁言' },
{ type: 4, name: '评论太快' },
{ type: 5, name: '评论已到40条' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '评论成功' },
],
dialogFormVisible: false,
dialogMutiFormVisible: false,
dialogVisible: false,
editVisible: false,
blog10DialogVisible: false,
resetLikesCommentDialogVisible: false,
// 用户列表数据
csdnUserList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('csdnUserPage')) || 1,
pageSize: 10,
total: 0,
// 新增的内容
formLabelWidth: '120px',
currentRowId: null,
currentUserName: null,
multipleSelection: [],
}
},
watch: {
formInline: {
handler(newVal, oldVal) {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
},
deep: true,
},
// 监听currentPage的变化,将新值保存到localStorage中
currentPage(newPage) {
localStorage.setItem('csdnUserPage', newPage.toString())
},
},
created() {
//获取问题类型的枚举
this.userPage()
},
mounted() {
this.currentPage = 1
},
methods: {
prepareAdd() {
this.form.userName = ''
this.form.nickName = ''
this.dialogFormVisible = true
},
prepareBlog10(userName) {
this.blog10DialogVisible = true
this.currentUserName = userName
},
prepareResetLikesComment() {
this.resetLikesCommentDialogVisible = true
},
prepareMutiAdd() {
this.form.userName = ''
this.dialogMutiFormVisible = true
},
prepareDelete(id) {
this.currentRowId = id
this.dialogVisible = true
},
preEdit(id, userName, nickName, userHomeUrl, userWeight) {
this.form.userName = userName
this.form.nickName = nickName
this.form.userHomeUrl = userHomeUrl
this.form.userWeight = userWeight
this.currentRowId = id
this.editVisible = true
},
handleClose(done) {
this.$confirm('确认关闭?')
.then((_) => {
done()
})
.catch((_) => {})
},
handleConfirm(addType) {
this.dialogFormVisible = false // 关闭对话框
this.dialogMutiFormVisible = false
this.addUser(addType) // 发送请求
},
handleSelectionChange(val) {
this.multipleSelection = val
},
async addUser(addType) {
try {
this.loading = true
const { data: res } = await axios.post('http://localhost:80/csdn/user/add', {
addType: addType,
userName: this.form.userName,
nickName: this.form.nickName,
userWeight: this.form.userWeight,
})
if (res.code === 200) {
this.currentPage = 1
this.form.userName = ''
this.form.nickName = ''
this.form.userWeight = null
this.userPage()
} else {
this.errorMsg(res.message)
console.error('Received non-200 status code', res)
}
} catch (error) {
console.error('An error occurred while adding the questionName:', error)
// 异常处理逻辑
} finally {
this.loading = false
}
},
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://localhost:80/csdn/user/update', {
id: this.currentRowId,
userName: this.form.userName,
nickName: this.form.nickName,
userWeight: this.form.userWeight,
userHomeUrl: this.form.userHomeUrl,
})
if (res.code === 200) {
this.form.userName = ''
this.form.nickName = ''
this.form.userHomeUrl = ''
this.form.userWeight = null
this.editVisible = false
currentRowId: null
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
} catch (error) {
console.error('An error occurred while adding the questionName:', error)
// 异常处理逻辑
} finally {
this.loading = false
}
},
async multiTriplet() {
this.loading = true
if (this.multipleSelection && this.multipleSelection.length === 0) {
this.loading = false
this.errorMsg('请选择需要处理项')
} else {
let userNames = this.multipleSelection.map((item) => item.userName)
const { data: res } = await ApiService.multiTriplet(userNames)
if (res.code === 200) {
this.multipleSelection = []
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
}
this.loading = false
},
data() { async autoReply() {
return { this.loading = true
form: { const { data: res } = await ApiService.autoReply()
userName: '', if (res.code === 200) {
nickName: '', this.userPage()
userHomeUrl: '', } else {
userWeight: null, console.error('Received non-200 status code', res)
}, }
formInline: { this.loading = false
userName: '', },
nickName: '',
articleType: '',
likeStatus: null,
collectStatus: null,
commentStatus: null,
},
allOptions: [
{
type: -1,
name: '全部',
},
{
type: 9,
name: '铁子',
},
{ type: 8, name: '闺蜜' },
{ type: 7, name: '基友' },
{ type: 0, name: '默认' },
],
articleType: ['全部', 'blog', 'blink', 'download', 'ask'],
likeStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经点过赞' },
{ type: 2, name: '点赞已满' },
{ type: 3, name: '取消点赞' },
{ type: 4, name: '文章状态不能点赞' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '点赞成功' },
],
collectStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经收藏过' },
{ type: 2, name: '收藏已满' },
{ type: 3, name: '参数缺失' },
{ type: 4, name: '收藏夹不存在' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '收藏成功' },
],
commentStatus: [
{
type: -1,
name: '全部',
},
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经评论过' },
{ type: 2, name: '评论已满' },
{ type: 3, name: '禁言' },
{ type: 4, name: '评论太快' },
{ type: 5, name: '评论已经到了40条' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '评论成功' },
],
dialogFormVisible: false,
dialogMutiFormVisible: false,
dialogVisible: false,
editVisible: false,
tripletVisible: false,
allTripletDialogVisible: false,
autoReplyDialogVisible: false,
resetUserDayStatusVisible: false,
blog10DialogVisible: false,
resetLikesCommentDialogVisible: false,
// 用户列表数据
csdnUserList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('csdnUserPage')) || 1,
pageSize: 8,
total: 0,
// 新增的内容
formLabelWidth: '120px',
currentRowId: null,
currentUserName: null,
multipleSelection: [],
}
},
watch: {
formInline: {
handler(newVal, oldVal) {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
},
deep: true,
},
// 监听currentPage的变化,将新值保存到localStorage中
currentPage(newPage) {
localStorage.setItem('csdnUserPage', newPage.toString())
},
},
created() {
//获取问题类型的枚举
this.userPage()
},
mounted() {
this.currentPage = 1
},
methods: {
prepareAdd() {
this.form.userName = ''
this.form.nickName = ''
this.dialogFormVisible = true
},
prepareAllTriplet() {
this.allTripletDialogVisible = true
},
prepareResetUserDayStatus(userName) {
this.resetUserDayStatusVisible = true
this.currentUserName = userName
},
prepareBlog10(userName) {
this.blog10DialogVisible = true
this.currentUserName = userName
},
prepareResetLikesComment() {
this.resetLikesCommentDialogVisible = true
},
prepareAutoReply() {
this.autoReplyDialogVisible = true
},
prepareMutiAdd() {
this.form.userName = ''
this.dialogMutiFormVisible = true
},
prepareDelete(id) {
this.currentRowId = id
this.dialogVisible = true
},
prepareTriplet(userName) {
this.currentUserName = userName
this.tripletVisible = true
},
preEdit(id, userName, nickName, userHomeUrl, userWeight) {
this.form.userName = userName
this.form.nickName = nickName
this.form.userHomeUrl = userHomeUrl
this.form.userWeight = userWeight
this.currentRowId = id
this.editVisible = true
},
handleClose(done) {
this.$confirm('确认关闭?')
.then((_) => {
done()
})
.catch((_) => {})
},
handleConfirm(addType) {
this.dialogFormVisible = false // 关闭对话框
this.dialogMutiFormVisible = false
this.addUser(addType) // 发送请求
},
handleSelectionChange(val) {
this.multipleSelection = val
},
async addUser(addType) { async triplet(userName) {
try { this.loading = true
this.loading = true const { data: res } = await ApiService.singleTriplet(userName)
const { data: res } = await axios.post('http://localhost:80/csdn/user/add', { if (res.code === 200) {
addType: addType, this.currentUserName = null
userName: this.form.userName, this.userPage()
nickName: this.form.nickName, } else {
userWeight: this.form.userWeight, console.error('Received non-200 status code', res)
}) }
if (res.code === 200) { this.loading = false
this.currentPage = 1 },
this.form.userName = '' async fixUserLikesStatus() {
this.form.nickName = '' this.loading = true
this.form.userWeight = null this.resetLikesCommentDialogVisible = false
this.userPage() const { data: res } = await axios.get('http://localhost:80/csdn/user/fixUserLikesStatus')
} else { if (res.code === 200) {
this.errorMsg(res.message) this.userPage()
console.error('Received non-200 status code', res) } else {
} console.error('Received non-200 status code', res)
} catch (error) { }
console.error('An error occurred while adding the questionName:', error) this.loading = false
// 异常处理逻辑 },
} finally { async onBlog10(userName) {
this.loading = false this.loading = true
} this.blog10DialogVisible = false
}, const { data: res } = await axios.get('http://localhost:80/csdn/user/add10Blog?username=' + userName)
errorMsg(msg) { if (res.code === 200) {
this.$message({ this.currentUserName = null
showClose: true, this.userPage()
message: msg, } else {
type: 'error', console.error('Received non-200 status code', res)
}) }
}, this.loading = false
async editConfirm() { },
try { async resetUserDayStatus(userName) {
this.loading = true this.loading = true
const { data: res } = await axios.post('http://localhost:80/csdn/user/update', { const { data: res } = await axios.get('http://localhost:80/csdn/user/resetCsdnUserInfo?username=' + userName)
id: this.currentRowId, if (res.code === 200) {
userName: this.form.userName, this.currentUserName = null
nickName: this.form.nickName, this.userPage()
userWeight: this.form.userWeight, } else {
userHomeUrl: this.form.userHomeUrl, console.error('Received non-200 status code', res)
}) }
if (res.code === 200) { this.loading = false
this.form.userName = '' },
this.form.nickName = '' async onDelete(id) {
this.form.userHomeUrl = '' this.loading = true
this.form.userWeight = null const { data: res } = await axios.get('http://localhost:80/csdn/user/delete', {
this.editVisible = false params: {
currentRowId: null id: id,
this.userPage() },
} else { })
console.error('Received non-200 status code', res) this.dialogVisible = false
} this.userPage()
} catch (error) { this.loading = false
console.error('An error occurred while adding the questionName:', error) },
// 异常处理逻辑 refreshPage() {
} finally { //获取问题类型的枚举
this.loading = false this.userPage()
} location.reload()
}, },
async userPage() {
this.loading = true
const { data: res } = await axios.post('http://localhost:80/csdn/user/page', {
page: this.currentPage,
pageSize: this.pageSize,
userName: this.formInline.userName,
nickName: this.formInline.nickName,
articleType: this.formInline.articleType == '全部' ? '' : this.formInline.articleType,
userWeight: this.formInline.userWeight == -1 ? null : this.formInline.userWeight,
likeStatus: this.formInline.likeStatus == -1 ? null : this.formInline.likeStatus,
collectStatus: this.formInline.collectStatus == -1 ? null : this.formInline.collectStatus,
commentStatus: this.formInline.commentStatus == -1 ? null : this.formInline.commentStatus,
})
if (res.code === 200) {
this.total = res.result.totalElements
async allTriplet() { const userWeightMap = {}
this.loading = true this.allOptions.forEach((option) => {
this.allTripletDialogVisible = false userWeightMap[option.type] = option.name
if (this.multipleSelection && this.multipleSelection.length === 0) { })
console.error('请选择需要处理的项') res.result.content.forEach((item) => {
} else { item.userWeightName = userWeightMap[item.userWeight]
let userNames = this.multipleSelection.map((item) => item.userName) })
const { data: res } = await axios.post('http://localhost:80/csdn/multiTriplet', userNames)
if (res.code === 200) {
this.multipleSelection = []
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
}
this.loading = false
},
async triplet(userName) {
this.loading = true
this.tripletVisible = false
const { data: res } = await axios.get('http://localhost:80/csdn/singleTriplet?username=' + userName)
if (res.code === 200) {
this.currentUserName = null
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
this.loading = false
},
async fixUserLikesStatus() {
this.loading = true
this.resetLikesCommentDialogVisible = false
const { data: res } = await axios.get('http://localhost:80/csdn/user/fixUserLikesStatus')
if (res.code === 200) {
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
this.loading = false
},
async onBlog10(userName) {
this.loading = true
this.blog10DialogVisible = false
const { data: res } = await axios.get('http://localhost:80/csdn/user/add10Blog?username=' + userName)
if (res.code === 200) {
this.currentUserName = null
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
this.loading = false
},
async resetUserDayStatus(userName) {
this.loading = true
this.resetUserDayStatusVisible = false
const { data: res } = await axios.get('http://localhost:80/csdn/user/resetCsdnUserInfo?username=' + userName)
if (res.code === 200) {
this.currentUserName = null
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
this.loading = false
},
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://localhost:80/csdn/user/delete', {
params: {
id: id,
},
})
this.dialogVisible = false
this.userPage()
this.loading = false
},
refreshPage() {
//获取问题类型的枚举
this.userPage()
location.reload()
},
async userPage() {
this.loading = true
const { data: res } = await axios.post('http://localhost:80/csdn/user/page', {
page: this.currentPage,
pageSize: this.pageSize,
userName: this.formInline.userName,
nickName: this.formInline.nickName,
articleType: this.formInline.articleType == '全部' ? '' : this.formInline.articleType,
userWeight: this.formInline.userWeight == -1 ? null : this.formInline.userWeight,
likeStatus: this.formInline.likeStatus == -1 ? null : this.formInline.likeStatus,
collectStatus: this.formInline.collectStatus == -1 ? null : this.formInline.collectStatus,
commentStatus: this.formInline.commentStatus == -1 ? null : this.formInline.commentStatus,
})
if (res.code === 200) {
this.total = res.result.totalElements
const userWeightMap = {} const likeStatusMap = {}
this.allOptions.forEach((option) => { this.likeStatus.forEach((option) => {
userWeightMap[option.type] = option.name likeStatusMap[option.type] = option.name
}) })
res.result.content.forEach((item) => { res.result.content.forEach((item) => {
item.userWeightName = userWeightMap[item.userWeight] item.likeStatusName = likeStatusMap[item.likeStatus]
}) })
const likeStatusMap = {} const collectStatusMap = {}
this.likeStatus.forEach((option) => { this.collectStatus.forEach((option) => {
likeStatusMap[option.type] = option.name collectStatusMap[option.type] = option.name
}) })
res.result.content.forEach((item) => { res.result.content.forEach((item) => {
item.likeStatusName = likeStatusMap[item.likeStatus] item.collectStatusName = collectStatusMap[item.collectStatus]
}) })
const collectStatusMap = {} const commentStatusMap = {}
this.collectStatus.forEach((option) => { this.commentStatus.forEach((option) => {
collectStatusMap[option.type] = option.name commentStatusMap[option.type] = option.name
}) })
res.result.content.forEach((item) => { res.result.content.forEach((item) => {
item.collectStatusName = collectStatusMap[item.collectStatus] item.commentStatusName = commentStatusMap[item.commentStatus]
}) })
const commentStatusMap = {} this.csdnUserList = res.result.content
this.commentStatus.forEach((option) => { }
commentStatusMap[option.type] = option.name this.loading = false
}) },
res.result.content.forEach((item) => { handleCurrentChange(currentPage) {
item.commentStatusName = commentStatusMap[item.commentStatus] this.currentPage = currentPage
}) this.userPage()
},
handleSizeChange(currentSize) {
this.pageSize = currentSize
this.userPage()
},
getTagType(statusName) {
if (statusName == '未处理') {
return 'info'
} else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') {
return 'success'
} else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已到40条') {
return 'danger'
} else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') {
return 'success'
} else if (statusName == '点赞已满' || statusName == '参数缺失' || statusName == '其他错误' || statusName == '取消点赞' || statusName == '评论太快') {
return 'warning'
}
},
getArticleType(articleType) {
if (articleType == 'blog') {
return 'success'
} else if (articleType == 'blink') {
return 'danger'
} else if (articleType == 'topic') {
return 'warning'
} else if (articleType == 'download') {
return 'primary'
} else if (articleType == 'ask') {
return 'info'
}
},
this.csdnUserList = res.result.content errorMsg(msg) {
} this.$message({
this.loading = false showClose: true,
}, message: msg,
handleCurrentChange(currentPage) { type: 'error',
this.currentPage = currentPage })
this.userPage() },
}, },
handleSizeChange(currentSize) {
this.pageSize = currentSize
this.userPage()
},
getTagType(statusName) {
if (statusName == '未处理') {
return 'info'
} else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') {
return 'success'
} else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已经到了40条') {
return 'danger'
} else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') {
return 'success'
} else if (statusName == '点赞已满' || statusName == '参数缺失' || statusName == '其他错误' || statusName == '取消点赞' || statusName == '评论太快') {
return 'warning'
}
},
async autoReply() {
this.loading = true
this.autoReplyDialogVisible = false
const { data: res } = await axios.get('http://localhost:80/csdn/autoReply')
if (res.code === 200) {
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
this.loading = false
},
},
} }
</script> </script>
......
<template> <template>
<div> <div>
<el-container> <el-container>
<el-main> <el-main>
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item> <el-form-item>
<el-input size="small" clearable v-model="formInline.userName" placeholder="请输入用户名" @keydown.enter.native="messagePage"></el-input> <el-input size="small" clearable v-model="formInline.userName" placeholder="请输入用户名"
</el-form-item> @keydown.enter.native="messagePage"></el-input>
<el-form-item> </el-form-item>
<el-input size="small" clearable v-model="formInline.nickName" placeholder="请输入用户昵称" @keydown.enter.native="messagePage"></el-input> <el-form-item>
</el-form-item> <el-input size="small" clearable v-model="formInline.nickName" placeholder="请输入用户昵称"
<el-form-item> @keydown.enter.native="messagePage"></el-input>
<el-select size="small" v-model="formInline.hasRepliedInfo" placeholder="请选择收藏状态" @change="messagePage"> </el-form-item>
<el-option v-for="item in hasRepliedInfo" :key="item.type" :label="item.name" :value="item.type"></el-option> <el-form-item>
</el-select> <el-select size="small" v-model="formInline.hasRepliedInfo" placeholder="请选择收藏状态" @change="messagePage">
</el-form-item> <el-option v-for="item in hasRepliedInfo" :key="item.type" :label="item.name"
<el-form-item> :value="item.type"></el-option>
<el-button size="small" type="primary" @click="messagePage">查询</el-button> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="messagePage">查询</el-button>
</el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="prepareRefreshMessage">刷新私信列表</el-button> <el-button size="small" type="primary" @click="prepareRefreshMessage">刷新私信列表</el-button>
<el-dialog title="提示" :visible.sync="refreshMessageDialogVisible" width="30%" :before-close="handleClose"> <el-dialog title="提示" :visible.sync="refreshMessageDialogVisible" width="30%" :before-close="handleClose">
<span>确认刷新私信列表吗?</span> <span>确认刷新私信列表吗?</span>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="refreshMessageDialogVisible = false">取 消</el-button> <el-button @click="refreshMessageDialogVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="refreshMessage()">确 定</el-button> <el-button type="primary" @click.prevent="acquireMessage()">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="prepareMeaasge">私信点赞收藏</el-button> <el-button size="small" type="primary" @click="messageDeal">私信点赞收藏</el-button>
<el-dialog title="提示" :visible.sync="messageDialogVisible" width="30%" :before-close="handleClose"> </el-form-item>
<span>确认处理私信点赞收藏吗?</span> </el-form>
<span slot="footer" class="dialog-footer"> <el-table border ref="multipleTable" v-loading="loading" :data="csdnMessageList" tooltip-effect="dark"
<el-button @click="messageDialogVisible = false">取 消</el-button> style="width: 100%">
<el-button type="primary" @click.prevent="messageDeal()">确 定</el-button> <el-table-column prop="id" label="序号" width="100" sortable></el-table-column>
</span> <el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column>
</el-dialog> <el-table-column prop="nickName" label="用户昵称" show-overflow-tooltip>
</el-form-item> <template slot-scope="scope">
</el-form> <a :href="scope.row.messageUrl" target="_blank">{{ scope.row.nickName }}</a>
<el-table ref="multipleTable" v-loading="loading" :data="csdnMessageList" tooltip-effect="dark" style="width: 100%"> </template>
<el-table-column prop="id" label="序号" width="100" sortable></el-table-column> </el-table-column>
<el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="nickName" label="用户昵称" show-overflow-tooltip>
<template slot-scope="scope">
<a :href="scope.row.messageUrl" target="_blank">{{ scope.row.nickName }}</a>
</template>
</el-table-column>
<el-table-column prop="hasRepliedName" label="是否回复" show-overflow-tooltip> <el-table-column prop="hasRepliedName" label="是否回复" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getTagType(scope.row.hasRepliedName)">{{ scope.row.hasRepliedName }}</el-tag> <el-tag :type="getTagType(scope.row.hasRepliedName)">{{ scope.row.hasRepliedName }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="content" label="回复内容" show-overflow-tooltip></el-table-column> <el-table-column prop="content" label="回复内容" show-overflow-tooltip></el-table-column>
<el-table-column label="更新时间"> <el-table-column label="更新时间">
<template slot-scope="props"> <template slot-scope="props">
{{ props.row.updateTime | dateFormat }} {{ props.row.updateTime | dateFormat }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="操作" label="操作" width="380px"> <el-table-column prop="操作" label="操作" width="380px">
<template slot-scope="props"> <template slot-scope="props">
<el-button type="primary" @click="prepareDealMessageOne(props.row.userName)" size="small">私信</el-button> <el-button type="primary" @click="dealMessageOne(props.row.userName)" size="small">私信</el-button>
<el-dialog title="提示" :visible.sync="dealMessageOneVisible" width="30%" :before-close="handleClose"> </template>
<span>确认私信吗?</span> </el-table-column>
<span slot="footer" class="dialog-footer"> </el-table>
<el-button @click="dealMessageOneVisible = false">取 消</el-button> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
<el-button type="primary" @click.prevent="dealMessageOne(currentUserName)">确 定</el-button> :page-sizes="[8, 50, 100, 200, 400]" :page-size="pageSize"
</span> layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
</el-dialog> </el-main>
<el-button type="danger" @click="prepareDelete(props.row.id)" size="small">删除</el-button> <el-backtop class="backtop"></el-backtop>
<el-dialog title="提示" :visible.sync="deleteDialogVisible" width="30%" :before-close="handleClose"> </el-container>
<span>确认删除?</span> </div>
<span slot="footer" class="dialog-footer">
<el-button @click="deleteDialogVisible = false">取 消</el-button>
<el-button type="primary" @click.prevent="onDelete(currentRowId)">确 定</el-button>
</span>
</el-dialog>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[8, 50, 100, 200, 400]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
</el-main>
<el-backtop class="backtop"></el-backtop>
</el-container>
</div>
</template> </template>
<script> <script>
import axios from 'axios' import axios from 'axios'
import ApiService from '../../api/ApiService'
export default { export default {
name: 'MyMessage', name: 'MyMessage',
data() { data() {
return { return {
formInline: { formInline: {
userName: '', userName: '',
nickName: '', nickName: '',
hasRepliedInfo: null, hasRepliedInfo: null,
}, },
hasRepliedInfo: [ hasRepliedInfo: [
{ {
type: -1, type: -1,
name: '全部', name: '全部',
}, },
{ {
type: 0, type: 0,
name: '未回复', name: '未回复',
}, },
{ type: 1, name: '已回复' }, {type: 1, name: '已回复'},
], ],
deleteDialogVisible: false, refreshMessageDialogVisible: false,
dealMessageOneVisible: false, // 用户列表数据
messageDialogVisible: false, csdnMessageList: [],
refreshMessageDialogVisible: false, loading: false,
// 用户列表数据 elementui_page_component_key: 0,
csdnMessageList: [], currentPage: Number(localStorage.getItem('csdnUserPage')) || 1,
loading: false, pageSize: 8,
elementui_page_component_key: 0, total: 0,
currentPage: Number(localStorage.getItem('csdnUserPage')) || 1, currentRowId: null,
pageSize: 8, currentUserName: null,
total: 0, }
currentRowId: null, },
currentUserName: null, watch: {
} 'formInline.userName'(newVal, oldVal) {
}, if (newVal !== oldVal) {
watch: { this.currentPage = 1
'formInline.userName'(newVal, oldVal) { localStorage.setItem('csdnUserPage', this.currentPage)
if (newVal !== oldVal) { this.messagePage()
this.currentPage = 1 }
localStorage.setItem('csdnUserPage', this.currentPage) },
this.messagePage() 'formInline.nickName'(newVal, oldVal) {
} if (newVal !== oldVal) {
}, this.currentPage = 1
'formInline.nickName'(newVal, oldVal) { localStorage.setItem('csdnUserPage', this.currentPage)
if (newVal !== oldVal) { this.messagePage()
this.currentPage = 1 }
localStorage.setItem('csdnUserPage', this.currentPage) },
this.messagePage() // 监听currentPage的变化,将新值保存到localStorage中
} currentPage(newPage) {
}, localStorage.setItem('csdnUserPage', newPage.toString())
// 监听currentPage的变化,将新值保存到localStorage中 },
currentPage(newPage) { },
localStorage.setItem('csdnUserPage', newPage.toString()) created() {
}, //获取问题类型的枚举
}, this.messagePage()
created() { },
//获取问题类型的枚举 mounted() {
this.messagePage() this.currentPage = 1
}, },
mounted() { methods: {
this.currentPage = 1 prepareRefreshMessage() {
}, this.refreshMessageDialogVisible = true
methods: { },
prepareMeaasge() {
this.messageDialogVisible = true
},
prepareRefreshMessage() {
this.refreshMessageDialogVisible = true
},
prepareDelete(id) {
this.currentRowId = id
this.deleteDialogVisible = true
},
prepareDealMessageOne(userName) {
this.currentUserName = userName
this.dealMessageOneVisible = true
},
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
.then((_) => { .then((_) => {
done() done()
}) })
.catch((_) => {}) .catch((_) => {
}, })
handleConfirm(addType) { },
this.dialogFormVisible = false // 关闭对话框 handleConfirm(addType) {
this.dialogMutiFormVisible = false this.dialogFormVisible = false // 关闭对话框
this.addUser(addType) // 发送请求 this.dialogMutiFormVisible = false
}, this.addUser(addType) // 发送请求
async messagePage() { },
this.loading = true async messagePage() {
const { data: res } = await axios.post('http://localhost:80/csdn/message/page', { this.loading = true
page: this.currentPage, const {data: res} = await ApiService.messagePage(this.currentPage, this.pageSize, this.formInline)
pageSize: this.pageSize, if (res.code === 200) {
userName: this.formInline.userName, this.total = res.result.totalElements
nickName: this.formInline.nickName, const userWeightMap = {}
hasReplied: this.formInline.hasRepliedInfo == -1 ? null : this.formInline.hasRepliedInfo, this.hasRepliedInfo.forEach((option) => {
}) userWeightMap[option.type] = option.name
if (res.code === 200) { })
this.total = res.result.totalElements res.result.content.forEach((item) => {
const userWeightMap = {} item.hasRepliedName = userWeightMap[item.hasReplied]
this.hasRepliedInfo.forEach((option) => { })
userWeightMap[option.type] = option.name this.csdnMessageList = res.result.content
}) }
res.result.content.forEach((item) => { this.loading = false
item.hasRepliedName = userWeightMap[item.hasReplied] },
})
this.csdnMessageList = res.result.content
}
this.loading = false
},
async dealMessageOne(userName) { async dealMessageOne(userName) {
this.loading = true this.loading = true
this.dealMessageOneVisible = false const {data: res} = await ApiService.dealMessageOne(userName)
const { data: res } = await axios.get('http://localhost:80/csdn/message/dealMessageOne?userName=' + userName) if (res.code === 200) {
if (res.code === 200) { this.currentUserName = null
this.currentUserName = null await this.messagePage()
this.messagePage() } else {
} else { console.error('Received non-200 status code', res)
console.error('Received non-200 status code', res) }
} this.loading = false
this.loading = false },
},
async messageDeal() { async messageDeal() {
this.loading = true this.loading = true
this.messageDialogVisible = false const {data: res1} = await ApiService.dealMessage()
const { data: res1 } = await axios.get('http://localhost:80/csdn/message/dealMessage') if (res1.code === 200) {
if (res1.code === 200) { await this.messagePage()
this.messagePage() } else {
} else { console.error('Received non-200 status code', res1)
console.error('Received non-200 status code', res1) }
} const {data: res2} = await ApiService.dealLikeCollect()
const { data: res2 } = await axios.get('http://localhost:80/csdn/likeCollect/dealLikeCollect') if (res2.code === 200) {
if (res2.code === 200) { await this.messagePage()
this.messagePage() } else {
} else { console.error('Received non-200 status code', res2)
console.error('Received non-200 status code', res2) }
} this.loading = false
this.loading = false },
}, async acquireMessage() {
async refreshMessage() { this.loading = true
this.loading = true this.refreshMessageDialogVisible = false
this.refreshMessageDialogVisible = false const {data: res} = await ApiService.acquireMessage()
const { data: res } = await axios.get('http://localhost:80/csdn/message/acquireMessage') if (res.code === 200) {
if (res.code === 200) { await this.messagePage()
this.messagePage() } else {
} else { console.error('Received non-200 status code', res)
console.error('Received non-200 status code', res) }
} this.loading = false
this.loading = false },
}, refreshPage() {
async onDelete(id) { //获取问题类型的枚举
this.loading = true this.messagePage()
const { data: res } = await axios.get('http://localhost:80/csdn/user/delete', { location.reload()
params: { },
id: id, handleCurrentChange(currentPage) {
}, this.currentPage = currentPage
}) this.messagePage()
this.deleteDialogVisible = false },
this.messagePage() handleSizeChange(currentSize) {
this.loading = false this.pageSize = currentSize
}, this.messagePage()
refreshPage() { },
//获取问题类型的枚举 getTagType(hasRepliedName) {
this.messagePage() if (hasRepliedName == '未回复') {
location.reload() return 'warning'
}, } else {
handleCurrentChange(currentPage) { return 'success'
this.currentPage = currentPage }
this.messagePage() },
}, },
handleSizeChange(currentSize) {
this.pageSize = currentSize
this.messagePage()
},
getTagType(hasRepliedName) {
if (hasRepliedName == '未回复') {
return 'warning'
} else {
return 'success'
}
},
},
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.el-header { .el-header {
background-color: #b3c0d1; background-color: #b3c0d1;
color: #333; color: #333;
line-height: 60px; line-height: 60px;
} }
.el-aside { .el-aside {
color: #333; color: #333;
} }
.pagination { .pagination {
margin-top: 16px; margin-top: 16px;
text-align: right; text-align: right;
} }
.header-button-item { .header-button-item {
margin-right: 15px; margin-right: 15px;
font-size: 20px; font-size: 20px;
} }
.red-title { .red-title {
line-height: 24px; line-height: 24px;
font-size: 18px; font-size: 18px;
color: red; color: red;
} }
.backtop { .backtop {
position: fixed; position: fixed;
bottom: 50px; bottom: 50px;
right: 50px; right: 50px;
height: 40px; height: 40px;
width: 40px; width: 40px;
line-height: 40px; line-height: 40px;
text-align: center; text-align: center;
border-radius: 20px; border-radius: 20px;
background-color: #007aff; background-color: #007aff;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
z-index: 999; z-index: 999;
} }
.custom-textarea { .custom-textarea {
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
.backtop:hover { .backtop:hover {
background-color: #0050a0; background-color: #0050a0;
} }
</style> </style>
\ No newline at end of file
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
<el-main> <el-main>
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item> <el-form-item>
<el-select size="small" v-model="picType" placeholder="请选择" @change="queryPic"> <el-input size="small" clearable v-model="formInline.picName" placeholder="请输入图片名称" @keydown.enter.native="queryPic"></el-input>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> </el-form-item>
<el-form-item>
<el-select size="small" clearable v-model="formInline.type" placeholder="请选择" @change="queryPic">
<el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -14,22 +17,44 @@ ...@@ -14,22 +17,44 @@
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="prepareAddPic">新增图片</el-button> <el-button size="small" type="primary" @click="prepareAddPic">新增图片</el-button>
<el-dialog title="新增图片" :visible.sync="addPicVisible" style="width: 100%"> <el-dialog title="新增图片" :visible.sync="addPicVisible" style="width: 100%">
<el-upload ref="upload" :limit="30" accept=".jpg,.gif,.png,.jpeg,.txt,.pdf,.doc,.docx,.xls,.xlsx" name="files" multiple action="http://localhost:80/picInfo/upload" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false" :on-success="handleUploadSuccess"> <el-select size="small" v-model="formInline.type" placeholder="请选择图片类型">
<el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
</el-select>
<el-upload ref="upload" :limit="30" accept=".jpg,.gif,.png,.jpeg,.txt,.pdf,.doc,.docx,.xls,.xlsx" name="files" multiple :action="getUploadAction()" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false" :on-success="handleUploadSuccess">
<el-button slot="trigger" size="small" type="primary">选择图片</el-button> <el-button slot="trigger" size="small" type="primary">选择图片</el-button>
<el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload">上传到服务器</el-button> <el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
</el-upload> </el-upload>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
</el-form>
<el-table border :data="picList" v-loading="loading"> <el-form-item>
<el-button size="small" type="primary" @click="prepareBatchUpdatePic">批量修改</el-button>
<el-dialog title="批量修改" :visible.sync="batchUpdatePicVisible" style="width: 100%">
<el-form :model="form" class="custom-form">
<el-form-item label="图片类型" :label-width="formLabelWidth" class="form-item">
<el-select size="small" v-model="form.type" placeholder="请选择图片类型">
<el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="batchUpdatePicVisible = false">取 消</el-button>
<el-button type="primary" @click="batchUpdatePic()">确 定</el-button>
</div>
</el-dialog>
</el-form-item>
</el-form>
<el-table border ref="multipleTable" v-loading="loading" :data="picList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="序号" align="center" sortable></el-table-column> <el-table-column prop="id" label="序号" align="center" sortable></el-table-column>
<el-table-column prop="picName" label="图片名字" align="center" show-overflow-tooltip></el-table-column> <el-table-column prop="picName" label="图片名字" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="type" label="图片类型" align="center" show-overflow-tooltip></el-table-column>
<el-table-column align="center"> <el-table-column align="center">
<template slot-scope="props"> <template slot-scope="props">
<img :src="props.row.picUrl" alt="图片" height="100px" @click="showImageDialog(props.row.picUrl, props.$index)" style="cursor: pointer" /> <img :src="props.row.picUrl" alt="图片" height="100px" @click="showImageDialog(props.row.picUrl, props.$index)" style="cursor: pointer" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center"> <el-table-column label="创建时间" align="center">
<template slot-scope="props"> <template slot-scope="props">
{{ props.row.createTime | dateFormat }} {{ props.row.createTime | dateFormat }}
...@@ -38,18 +63,20 @@ ...@@ -38,18 +63,20 @@
<el-table-column prop="操作" label="操作" width="100px" align="center"> <el-table-column prop="操作" label="操作" width="100px" align="center">
<template slot-scope="props"> <template slot-scope="props">
<el-button size="small" type="primary" @click.prevent="prePicEdit(props.row.id, props.row.picUrl, props.row.type)">编辑</el-button> <el-button size="small" type="primary" @click.prevent="prePicEdit(props.row.id, props.row.picName, props.row.picUrl, props.row.type)">编辑</el-button>
<el-dialog title="编辑图片信息" :visible.sync="editPicVisible"> <el-dialog title="编辑图片信息" :visible.sync="editPicVisible">
<el-form :model="form" class="custom-form"> <el-form :model="form" class="custom-form">
<el-form-item align="center" class="form-item"> <el-form-item align="center" class="form-item">
<img :src="form.picUrl" alt="图片" height="100px" style="cursor: pointer" /> <img :src="form.picUrl" alt="图片" height="100px" style="cursor: pointer" />
</el-form-item> </el-form-item>
<el-form-item label="" class="form-item" align="middle"> <el-form-item label="" class="form-item" align="middle">
<el-select v-model="form.type" placeholder="请选择"> <el-select v-model="form.type" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<el-input clearable v-model="form.picName" placeholder="请输入图片名称"></el-input>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="editPicVisible = false">取 消</el-button> <el-button @click="editPicVisible = false">取 消</el-button>
...@@ -83,15 +110,19 @@ export default { ...@@ -83,15 +110,19 @@ export default {
name: 'MyPic', name: 'MyPic',
data() { data() {
return { return {
fileUrl: 'http://localhost:80/picInfo/upload',
form: { form: {
picName: '',
picUrl: '', picUrl: '',
type: 0, type: '',
}, },
formInline: { formInline: {
picType: 0, type: '',
picName: '',
}, },
//待上传的图片 //待上传的图片
fileList: [], fileList: [],
multipleSelection: [],
// 用户列表数据 // 用户列表数据
picList: [], picList: [],
loading: false, loading: false,
...@@ -99,54 +130,43 @@ export default { ...@@ -99,54 +130,43 @@ export default {
currentPage: 1, currentPage: 1,
pageSize: 6, pageSize: 6,
total: 0, total: 0,
formLabelWidth: '120px',
imageDialogVisible: false, imageDialogVisible: false,
batchUpdatePicVisible: false,
addPicVisible: false, addPicVisible: false,
editPicVisible: false, editPicVisible: false,
enlargedImageUrl: '', enlargedImageUrl: '',
currentRowId: null, currentRowId: null,
imageIndex: 0, // 当前展示的图片索引 imageIndex: 0, // 当前展示的图片索引
options: [ options: ['全部', '宝宝', '学习', '风景', '美女', '猫咪', '素材', '动漫', '其他'],
{
value: 0,
label: '宝宝',
},
{
value: 1,
label: '学习',
},
{
value: 2,
label: '风景',
},
{
value: 3,
label: '美女',
},
{
value: 4,
label: '猫咪',
},
{
value: 5,
label: '素材',
},
{
value: 6,
label: '动漫',
},
{
value: 99,
label: '其他',
},
],
picType: 0,
} }
}, },
watch: {
formInline: {
handler(newVal, oldVal) {
this.currentPage = 1
localStorage.setItem('picPage', this.currentPage)
this.queryPic()
},
deep: true,
},
// 监听currentPage的变化,将新值保存到localStorage中
currentPage(newPage) {
localStorage.setItem('picPage', newPage.toString())
},
},
created() { created() {
// 调用请求数据的方法 // 调用请求数据的方法
this.queryPic() this.queryPic()
}, },
methods: { methods: {
prepareBatchUpdatePic() {
this.form.type = ''
this.batchUpdatePicVisible = true
},
getUploadAction() {
return this.fileUrl + '?type=' + this.formInline.type
},
async submitUpload() { async submitUpload() {
this.$refs.upload.submit() this.$refs.upload.submit()
this.addPicVisible = false this.addPicVisible = false
...@@ -160,8 +180,9 @@ export default { ...@@ -160,8 +180,9 @@ export default {
prepareAddPic() { prepareAddPic() {
this.addPicVisible = true this.addPicVisible = true
}, },
prePicEdit(id, picUrl, type) { prePicEdit(id, picName, picUrl, type) {
this.currentRowId = id this.currentRowId = id
this.form.picName = picName
this.form.picUrl = picUrl this.form.picUrl = picUrl
this.form.type = type this.form.type = type
this.editPicVisible = true this.editPicVisible = true
...@@ -199,7 +220,7 @@ export default { ...@@ -199,7 +220,7 @@ export default {
}, },
async queryPic() { async queryPic() {
this.loading = true this.loading = true
const { data: res } = await ApiService.queryPic(this.currentPage, this.pageSize, this.picType) const { data: res } = await ApiService.queryPic(this.currentPage, this.pageSize, this.formInline)
if (res.code === 200) { if (res.code === 200) {
this.picList = res.result.records this.picList = res.result.records
this.total = res.result.total this.total = res.result.total
...@@ -210,9 +231,10 @@ export default { ...@@ -210,9 +231,10 @@ export default {
try { try {
this.loading = true this.loading = true
this.editPicVisible = false this.editPicVisible = false
const { data: res } = await ApiService.editPicConfirm(this.currentRowId, this.form.type) const { data: res } = await ApiService.editPicConfirm(this.currentRowId, this.form.type, this.form.picName)
if (res.code === 200) { if (res.code === 200) {
this.form.type = 0 this.form.picName = ''
this.form.type = ''
this.form.picUrl = null this.form.picUrl = null
this.currentRowId = null this.currentRowId = null
this.queryPic() this.queryPic()
...@@ -227,6 +249,26 @@ export default { ...@@ -227,6 +249,26 @@ export default {
} }
}, },
async batchUpdatePic() {
this.loading = true
this.batchUpdatePicVisible = false
if (this.multipleSelection && this.multipleSelection.length === 0) {
this.loading = false
this.errorMsg('请选择需要处理项')
} else {
let ids = this.multipleSelection.map((item) => item.id)
const { data: res } = await ApiService.batchUpdatePic(ids, this.form.type)
if (res.code === 200) {
this.multipleSelection = []
this.form.type = ''
this.queryPic()
} else {
console.error('Received non-200 status code', res)
}
}
this.loading = false
},
handleCurrentChange(currentPage) { handleCurrentChange(currentPage) {
this.currentPage = currentPage this.currentPage = currentPage
this.queryPic() this.queryPic()
...@@ -235,6 +277,16 @@ export default { ...@@ -235,6 +277,16 @@ export default {
this.pageSize = currentSize this.pageSize = currentSize
this.queryPic() this.queryPic()
}, },
handleSelectionChange(val) {
this.multipleSelection = val
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
}, },
} }
</script> </script>
......
...@@ -32,13 +32,11 @@ ...@@ -32,13 +32,11 @@
{{ props.row.tripletDate | dateDayFormat }} {{ props.row.tripletDate | dateDayFormat }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" sortable prop="likeNum" label="点赞数量" show-overflow-tooltip> <el-table-column align="center" sortable prop="likeNum" label="点赞数量" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="isMaxValue(scope.row.likeNum, 'likeNum')">{{ scope.row.likeNum }}</el-tag> <el-tag :type="isMaxValue(scope.row.likeNum, 'likeNum')">{{ scope.row.likeNum }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" sortable prop="collectNum" label="收藏数量" show-overflow-tooltip> <el-table-column align="center" sortable prop="collectNum" label="收藏数量" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="isMaxValue(scope.row.collectNum, 'collectNum')">{{ scope.row.collectNum }}</el-tag> <el-tag :type="isMaxValue(scope.row.collectNum, 'collectNum')">{{ scope.row.collectNum }}</el-tag>
...@@ -79,7 +77,6 @@ ...@@ -79,7 +77,6 @@
</template> </template>
<script> <script>
import axios from 'axios'
import ApiService from '../../api/ApiService' import ApiService from '../../api/ApiService'
export default { export default {
name: 'MyTripletDayInfo', name: 'MyTripletDayInfo',
...@@ -126,6 +123,8 @@ export default { ...@@ -126,6 +123,8 @@ export default {
endDate: null, endDate: null,
weekInfo: null, weekInfo: null,
}, },
form: {
},
tripletDayInfoList: [], tripletDayInfoList: [],
weekInfo: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'], weekInfo: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
likeStatus: [ likeStatus: [
...@@ -174,7 +173,7 @@ export default { ...@@ -174,7 +173,7 @@ export default {
{ type: 2, name: '评论已满' }, { type: 2, name: '评论已满' },
{ type: 3, name: '禁言' }, { type: 3, name: '禁言' },
{ type: 4, name: '评论太快' }, { type: 4, name: '评论太快' },
{ type: 5, name: '评论已经到了40条' }, { type: 5, name: '评论已40条' },
{ type: 8, name: '其他错误' }, { type: 8, name: '其他错误' },
{ type: 9, name: '评论成功' }, { type: 9, name: '评论成功' },
], ],
...@@ -249,7 +248,6 @@ export default { ...@@ -249,7 +248,6 @@ export default {
res.result.from.content.forEach((item) => { res.result.from.content.forEach((item) => {
item.commentStatusName = commentStatusMap[item.commentStatus] item.commentStatusName = commentStatusMap[item.commentStatus]
}) })
this.tripletDayInfoList = res.result.from.content this.tripletDayInfoList = res.result.from.content
} }
this.loading = false this.loading = false
...@@ -271,7 +269,7 @@ export default { ...@@ -271,7 +269,7 @@ export default {
return 'info' return 'info'
} else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') { } else if (statusName == '已经点过赞' || statusName == '已经收藏过' || statusName == '已经评论过') {
return 'success' return 'success'
} else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已经到了40条') { } else if (statusName == '文章状态不能点赞' || statusName == '收藏已满' || statusName == '收藏夹不存在' || statusName == '评论已满' || statusName == '禁言' || statusName == '评论已40条') {
return 'danger' return 'danger'
} else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') { } else if (statusName == '点赞成功' || statusName == '收藏成功' || statusName == '评论成功') {
return 'success' return 'success'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册