整理

上级 d05ab7e8
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -281,7 +281,7 @@ export default {
async addQuestion(addType) {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/algorithmicProblem/add', {
const { data: res } = await axios.post('http://localhost:8888/algorithmicProblem/add', {
addType: addType,
questionName: this.form.questionName,
questionType: this.form.questionType,
......@@ -322,7 +322,7 @@ export default {
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/algorithmicProblem/update', {
const { data: res } = await axios.post('http://localhost:8888/algorithmicProblem/update', {
id: this.currentRowId,
questionName: this.form.questionName,
questionType: this.form.questionType,
......@@ -352,7 +352,7 @@ export default {
async onDelete(id) {
this.dialogVisible = false
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/algorithmicProblem/delete', {
const { data: res } = await axios.get('http://localhost:8888/algorithmicProblem/delete', {
params: {
id: id,
},
......@@ -367,7 +367,7 @@ export default {
},
async getQuestionType() {
const { data: res } = await axios.get('http://120.79.36.53:8888/algorithmicProblem/questionType', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/algorithmicProblem/questionType', { params: {} })
if (res.code === 200) {
this.options = res.result
console.log(this.options)
......@@ -377,7 +377,7 @@ export default {
},
async getAllQuestionType() {
const { data: res } = await axios.get('http://120.79.36.53:8888/algorithmicProblem/allQuestionType', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/algorithmicProblem/allQuestionType', { params: {} })
if (res.code === 200) {
this.allOptions = res.result
}
......@@ -385,7 +385,7 @@ export default {
async interviewPage() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/algorithmicProblem/page', {
const { data: res } = await axios.get('http://localhost:8888/algorithmicProblem/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
......@@ -410,7 +410,7 @@ export default {
},
async interviewRandom() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/algorithmicProblem/random', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/algorithmicProblem/random', { params: {} })
if (res.code === 200) {
this.randomAlgorithmic.questionName = res.result.questionName
this.randomAlgorithmic.leetcodeNumber = res.result.leetcodeNumber
......
......@@ -192,7 +192,7 @@ export default {
async addQuestion(addType) {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/aphorismPoetry/add', {
const { data: res } = await axios.post('http://localhost:8888/aphorismPoetry/add', {
addType: addType,
poetryText: this.form.poetryText,
......@@ -227,7 +227,7 @@ export default {
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/aphorismPoetry/update', {
const { data: res } = await axios.post('http://localhost:8888/aphorismPoetry/update', {
id: this.currentRowId,
poetryText: this.form.poetryText,
})
......@@ -250,7 +250,7 @@ export default {
async onDelete(id) {
this.dialogVisible = false
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/aphorismPoetry/delete', {
const { data: res } = await axios.get('http://localhost:8888/aphorismPoetry/delete', {
params: {
id: id,
},
......@@ -265,7 +265,7 @@ export default {
},
async interviewPage() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/aphorismPoetry/page', {
const { data: res } = await axios.get('http://localhost:8888/aphorismPoetry/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
......@@ -280,7 +280,7 @@ export default {
},
async interviewRandom() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/aphorismPoetry/random', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/aphorismPoetry/random', { params: {} })
if (res.code === 200) {
this.randomAlgorithmic.poetryText = res.result.poetryText
}
......
......@@ -89,7 +89,7 @@ export default {
methods: {
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
const { data: res } = await axios.get('http://localhost:8888/chatbot/delete', {
params: {
id: id,
},
......@@ -109,7 +109,7 @@ export default {
async initCartList() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', {
const { data: res } = await axios.get('http://localhost:8888/chatbot/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
......
......@@ -49,6 +49,9 @@
<el-form-item>
<el-button type="primary" @click="prepareMutiAdd">批量新增</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="allTriplet">三连</el-button>
</el-form-item>
</el-form>
<el-table border :data="csdnUserList" v-loading="loading">
<el-table-column prop="userName" label="用户名称" show-overflow-tooltip></el-table-column>
......@@ -59,20 +62,22 @@
<el-table-column prop="commentStatusName" 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 :width="100"></el-table-column>
<el-table-column label="创建时间" width="170">
<template slot-scope="props">
{{ props.row.createTime | dateFormat }}
</template>
</el-table-column>
<el-table-column label="更新时间" width="170">
<el-table-column prop="articleType" label="文章类型" show-overflow-tooltip></el-table-column>
<el-table-column label="更新时间">
<template slot-scope="props">
{{ props.row.updateTime | dateFormat }}
</template>
</el-table-column>
<el-table-column prop="操作" label="操作" width="180">
<el-table-column prop="操作" label="操作" width="250px">
<template slot-scope="props">
<el-button type="primary" @click="prepareTriplet(props.row.userName)">三连</el-button>
<el-dialog title="提示" :visible.sync="tripletVisible" width="30%" :before-close="handleClose">
<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="success" @click.prevent="preEdit(props.row.id, props.row.userName, props.row.nickName, props.row.userWeight)" width="200">编辑</el-button>
<el-dialog title="编辑用户信息" :visible.sync="editVisible">
<el-form :model="form">
......@@ -112,268 +117,291 @@
<script>
import axios from 'axios'
export default {
name: 'MyCsdnUser',
data() {
return {
form: {
userName: '',
nickName: '',
userWeight: 0,
},
formInline: {
userName: '',
nickName: '',
},
allOptions: [
{
type: 9,
name: '铁子',
},
{ type: 8, name: '闺蜜' },
{ type: 7, name: '基友' },
{ type: 0, name: '默认' },
],
likeStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经点过赞' },
{ type: 2, name: '点赞已满' },
{ type: 3, name: '取消点赞' },
{ type: 9, name: '点赞成功' },
],
collectStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经收藏过' },
{ type: 2, name: '收藏已满' },
{ type: 3, name: '参数缺失' },
{ type: 9, name: '收藏成功' },
],
commentStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经评论过' },
{ type: 2, name: '评论已满' },
{ type: 3, name: '禁言' },
{ type: 4, name: '评论太快' },
{ type: 5, name: '评论已经到了49条' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '收藏成功' },
],
dialogFormVisible: false,
dialogMutiFormVisible: false,
dialogVisible: false,
editVisible: false,
// 用户列表数据
csdnUserList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('csdnUserPage')) || 1,
pageSize: 9,
total: 0,
// 新增的内容
formLabelWidth: '120px',
currentRowId: null,
}
},
watch: {
'formInline.userName'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
}
},
'formInline.nickName'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
}
},
// 监听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
},
prepareMutiAdd() {
this.form.userName = ''
this.dialogMutiFormVisible = true
},
prepareDelete(id) {
this.currentRowId = id
this.dialogVisible = true
},
preEdit(id, userName, nickName, userWeight) {
this.form.userName = userName
this.form.nickName = nickName
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) // 发送请求
},
name: 'MyCsdnUser',
async addUser(addType) {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/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 = 0
this.userPage()
} 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
}
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/csdn/user/update', {
id: this.currentRowId,
userName: this.form.userName,
nickName: this.form.nickName,
userWeight: this.form.userWeight,
})
if (res.code === 200) {
this.form.userName = ''
this.form.nickName = ''
this.form.userWeight = 0
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
}
},
data() {
return {
form: {
userName: '',
nickName: '',
userWeight: 0,
},
formInline: {
userName: '',
nickName: '',
},
allOptions: [
{
type: 9,
name: '铁子',
},
{ type: 8, name: '闺蜜' },
{ type: 7, name: '基友' },
{ type: 0, name: '默认' },
],
likeStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经点过赞' },
{ type: 2, name: '点赞已满' },
{ type: 3, name: '取消点赞' },
{ type: 9, name: '点赞成功' },
],
collectStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经收藏过' },
{ type: 2, name: '收藏已满' },
{ type: 3, name: '参数缺失' },
{ type: 9, name: '收藏成功' },
],
commentStatus: [
{
type: 0,
name: '未处理',
},
{ type: 1, name: '已经评论过' },
{ type: 2, name: '评论已满' },
{ type: 3, name: '禁言' },
{ type: 4, name: '评论太快' },
{ type: 5, name: '评论已经到了49条' },
{ type: 8, name: '其他错误' },
{ type: 9, name: '收藏成功' },
],
dialogFormVisible: false,
dialogMutiFormVisible: false,
dialogVisible: false,
editVisible: false,
tripletVisible: false,
// 用户列表数据
csdnUserList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('csdnUserPage')) || 1,
pageSize: 9,
total: 0,
// 新增的内容
formLabelWidth: '120px',
currentRowId: null,
currentUserName: null,
}
},
watch: {
'formInline.userName'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
}
},
'formInline.nickName'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('csdnUserPage', this.currentPage)
this.userPage()
}
},
// 监听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
},
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, userWeight) {
this.form.userName = userName
this.form.nickName = nickName
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) // 发送请求
},
async onDelete(id) {
this.dialogVisible = false
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/csdn/user/delete', {
params: {
id: id,
},
})
this.userPage()
this.loading = false
},
refreshPage() {
//获取问题类型的枚举
this.userPage()
location.reload()
},
async userPage() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/csdn/user/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
userName: this.formInline.userName,
nickName: this.formInline.nickName,
},
})
if (res.code === 200) {
this.total = res.result.totalElements
async addUser(addType) {
try {
this.loading = true
const { data: res } = await axios.post('http://localhost:8888/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 = 0
this.userPage()
} 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
}
},
errorMsg(msg) {
this.$message({
showClose: true,
message: msg,
type: 'error',
})
},
async editConfirm() {
try {
this.loading = true
const { data: res } = await axios.post('http://localhost:8888/csdn/user/update', {
id: this.currentRowId,
userName: this.form.userName,
nickName: this.form.nickName,
userWeight: this.form.userWeight,
})
if (res.code === 200) {
this.form.userName = ''
this.form.nickName = ''
this.form.userWeight = 0
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 allTriplet() {
const { data: res } = await axios.get('http://localhost:8888/csdn/multiTriplet')
if (res.code === 200) {
this.userPage()
} else {
console.error('Received non-200 status code', res)
}
},
async triplet(userName) {
const { data: res } = await axios.get('http://localhost:8888/csdn/singleTriplet?' + userName)
if (res.code === 200) {
this.userPage()
this.currentUserName = null
this.tripletVisible = false
} else {
console.error('Received non-200 status code', res)
}
},
async onDelete(id) {
this.dialogVisible = false
this.loading = true
const { data: res } = await axios.get('http://localhost:8888/csdn/user/delete', {
params: {
id: id,
},
})
this.userPage()
this.loading = false
},
refreshPage() {
//获取问题类型的枚举
this.userPage()
location.reload()
},
async userPage() {
this.loading = true
const { data: res } = await axios.get('http://localhost:8888/csdn/user/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
userName: this.formInline.userName,
nickName: this.formInline.nickName,
},
})
if (res.code === 200) {
this.total = res.result.totalElements
const userWeightMap = {}
this.allOptions.forEach((option) => {
userWeightMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.userWeightName = userWeightMap[item.userWeight]
})
const userWeightMap = {}
this.allOptions.forEach((option) => {
userWeightMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.userWeightName = userWeightMap[item.userWeight]
})
const likeStatusMap = {}
this.likeStatus.forEach((option) => {
likeStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.likeStatusName = likeStatusMap[item.likeStatus]
})
const likeStatusMap = {}
this.likeStatus.forEach((option) => {
likeStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.likeStatusName = likeStatusMap[item.likeStatus]
})
const collectStatusMap = {}
this.collectStatus.forEach((option) => {
collectStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.collectStatusName = collectStatusMap[item.collectStatus]
})
const collectStatusMap = {}
this.collectStatus.forEach((option) => {
collectStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.collectStatusName = collectStatusMap[item.collectStatus]
})
const commentStatusMap = {}
this.commentStatus.forEach((option) => {
commentStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.commentStatusName = commentStatusMap[item.commentStatus]
})
const commentStatusMap = {}
this.commentStatus.forEach((option) => {
commentStatusMap[option.type] = option.name
})
res.result.content.forEach((item) => {
item.commentStatusName = commentStatusMap[item.commentStatus]
})
this.csdnUserList = res.result.content
}
this.loading = false
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.userPage()
},
},
this.csdnUserList = res.result.content
}
this.loading = false
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.userPage()
},
},
}
</script>
......
......@@ -205,7 +205,7 @@ export default {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/interviewQuestion/add', {
const { data: res } = await axios.post('http://localhost:8888/interviewQuestion/add', {
addType: addType,
question: this.form.question,
questionType: this.form.questionType,
......@@ -237,7 +237,7 @@ export default {
try {
this.loading = true
const { data: res } = await axios.post('http://120.79.36.53:8888/interviewQuestion/update', {
const { data: res } = await axios.post('http://localhost:8888/interviewQuestion/update', {
id: this.currentRowId,
question: this.form.question,
questionType: this.form.questionType,
......@@ -262,7 +262,7 @@ export default {
async onDelete(id) {
this.dialogVisible = false
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/interviewQuestion/delete', {
const { data: res } = await axios.get('http://localhost:8888/interviewQuestion/delete', {
params: {
id: id,
},
......@@ -278,7 +278,7 @@ export default {
},
async getQuestionType() {
const { data: res } = await axios.get('http://120.79.36.53:8888/interviewQuestion/questionType', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/interviewQuestion/questionType', { params: {} })
if (res.code === 200) {
this.options = res.result
this.interviewPage()
......@@ -287,7 +287,7 @@ export default {
async interviewPage() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/interviewQuestion/page', {
const { data: res } = await axios.get('http://localhost:8888/interviewQuestion/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
......
......@@ -106,7 +106,7 @@ export default {
},
async queryPic() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/picInfo/page', {
const { data: res } = await axios.get('http://localhost:8888/picInfo/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
......
......@@ -164,7 +164,7 @@ export default {
},
async interviewRandom() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/aphorismPoetry/random', { params: {} })
const { data: res } = await axios.get('http://localhost:8888/aphorismPoetry/random', { params: {} })
if (res.code === 200) {
this.randomAlgorithmic.poetryText = res.result.poetryText
}
......
......@@ -42,7 +42,7 @@ export default {
response: this.form.response,
}
axios
.post('http://120.79.36.53:8888/chatbot', data)
.post('http://localhost:8888/chatbot', data)
.then((response) => {
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (response.data.code === 200) {
......
......@@ -66,7 +66,7 @@ export default {
// 封装请求列表数据的方法
async initChatList() {
// 调用 axios 的 get 方法,请求列表数据
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/' + this.id)
const { data: res } = await axios.get('http://localhost:8888/chatbot/' + this.id)
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (res.code === 200) {
this.list = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册