fix(components): https://github.com/rymcu/forest/issues/96
fix(components): https://github.com/rymcu/forest/issues/96
This commit is contained in:
commit
12aa4bf27a
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row class="wrapper">
|
||||
<el-col :xs="24" :sm="24" :xl="24" style="margin: 0 auto;">
|
||||
<el-carousel :interval="5000" height="210px" indicator-position="outside" arrow="always">
|
||||
<el-carousel :interval="5000" height="210px" indicator-position="outside">
|
||||
<el-carousel-item v-for="article in announcements.list" :key="article.idArticle">
|
||||
<el-card>
|
||||
<div class="card-body d-flex flex-column">
|
||||
|
@ -31,7 +31,10 @@
|
||||
label="标题"
|
||||
prop="articleTitle">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="openLink(scope.row.articlePermalink)">{{ scope.row.articleTitle }}</el-button>
|
||||
<el-button type="text" @click="openLink(scope.row.articlePermalink)">{{
|
||||
scope.row.articleTitle
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -52,7 +55,9 @@
|
||||
label="作者"
|
||||
width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="openLink('/user/' + scope.row.articleAuthor.userAccount)">{{ scope.row.articleAuthorName }}</el-button>
|
||||
<el-button type="text" @click="openLink('/user/' + scope.row.articleAuthor.userAccount)">
|
||||
{{ scope.row.articleAuthorName }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -62,16 +67,19 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.articlePerfect === '1'" size="mini" @click="cancelPreference(scope.$index, scope.row.idArticle)" plain>取消优选</el-button>
|
||||
<el-button v-else size="mini" @click="setPreference(scope.$index, scope.row.idArticle)" plain>设为优选</el-button>
|
||||
<el-button v-if="scope.row.articlePerfect === '1'" size="mini"
|
||||
@click="cancelPreference(scope.$index, scope.row.idArticle)" plain>取消优选
|
||||
</el-button>
|
||||
<el-button v-else size="mini" @click="setPreference(scope.$index, scope.row.idArticle)" plain>设为优选
|
||||
</el-button>
|
||||
<el-button size="mini" type="primary"
|
||||
@click="updateTags(scope.$index, scope.row)" plain>编辑标签
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.articleStatus === '0'" size="mini" type="danger"
|
||||
@click="toggleStatus(scope.$index, scope.row)" plain>下架
|
||||
@click="toggleStatus(scope.row.idArticle, 1)" plain>下架
|
||||
</el-button>
|
||||
<el-button v-else size="mini" type="success"
|
||||
@click="toggleStatus(scope.$index, scope.row)" plain>上架
|
||||
@click="toggleStatus(scope.row.idArticle, 0)" plain>上架
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -97,6 +105,17 @@
|
||||
@closeDialog="closeTagsDialog">
|
||||
</edit-tags>
|
||||
</el-dialog>
|
||||
<el-dialog title="下架文章" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="article" label-width="80px">
|
||||
<el-form-item label="下架原因">
|
||||
<el-input type="textarea" v-model="article.remarks" autocomplete="off"></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="updateStatus">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -132,7 +151,13 @@ export default {
|
||||
dialogVisible: false,
|
||||
index: Number,
|
||||
idArticle: Number,
|
||||
articleTags: ''
|
||||
articleTags: '',
|
||||
dialogFormVisible: false,
|
||||
article: {
|
||||
idArticle: 0,
|
||||
articleStatus: 0,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -150,7 +175,47 @@ export default {
|
||||
rows: _ts.articles.pageSize
|
||||
})
|
||||
},
|
||||
toggleStatus() {},
|
||||
toggleStatus(idArticle, status) {
|
||||
let _ts = this;
|
||||
_ts.article = {
|
||||
idArticle: idArticle,
|
||||
articleStatus: status,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
// 下架文章填写下架原因
|
||||
if (status === 1) {
|
||||
_ts.dialogFormVisible = true;
|
||||
} else {
|
||||
_ts.$confirm('此操作将发布该文章, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
_ts.updateStatus();
|
||||
}).catch(() => {
|
||||
_ts.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
updateStatus() {
|
||||
let _ts = this;
|
||||
_ts.$axios.$patch("/api/admin/article/update-status", _ts.article).then(function (res) {
|
||||
if (res) {
|
||||
_ts.article = {
|
||||
idArticle: 0,
|
||||
articleStatus: 0,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
_ts.dialogFormVisible = false;
|
||||
_ts.$message.success("操作成功!");
|
||||
} else {
|
||||
_ts.$message.error("操作失败!");
|
||||
}
|
||||
})
|
||||
},
|
||||
setPreference(index, idArticle) {
|
||||
let _ts = this;
|
||||
_ts.$axios.$patch("/api/admin/article/update-perfect", {
|
||||
|
@ -178,6 +178,17 @@
|
||||
<edit-tags :idArticle="idArticle" :tags="articleTags" @closeDialog="closeTagsDialog">
|
||||
</edit-tags>
|
||||
</el-dialog>
|
||||
<el-dialog title="下架文章" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="article" label-width="80px">
|
||||
<el-form-item label="下架原因">
|
||||
<el-input type="textarea" v-model="article.remarks" autocomplete="off"></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="updateStatus">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -224,7 +235,13 @@ export default {
|
||||
tagsDialogVisible: false,
|
||||
index: Number,
|
||||
idArticle: Number,
|
||||
articleTags: ''
|
||||
articleTags: '',
|
||||
dialogFormVisible: false,
|
||||
article: {
|
||||
idArticle: 0,
|
||||
articleStatus: 0,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -482,7 +499,47 @@ export default {
|
||||
_ts.$set(_ts, 'articleTags', article.articleTags);
|
||||
_ts.$set(_ts, 'tagsDialogVisible', true);
|
||||
},
|
||||
toggleStatus() {},
|
||||
toggleStatus(idArticle, status) {
|
||||
let _ts = this;
|
||||
_ts.article = {
|
||||
idArticle: idArticle,
|
||||
articleStatus: status,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
// 下架文章填写下架原因
|
||||
if (status === 1) {
|
||||
_ts.dialogFormVisible = true;
|
||||
} else {
|
||||
_ts.$confirm('此操作将发布该文章, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
_ts.updateStatus();
|
||||
}).catch(() => {
|
||||
_ts.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
updateStatus() {
|
||||
let _ts = this;
|
||||
_ts.$axios.$patch("/api/admin/article/update-status", _ts.article).then(function (res) {
|
||||
if (res) {
|
||||
_ts.article = {
|
||||
idArticle: 0,
|
||||
articleStatus: 0,
|
||||
remarks: '低质量或无意义文章!'
|
||||
}
|
||||
_ts.dialogFormVisible = false;
|
||||
_ts.$message.success("操作成功!");
|
||||
} else {
|
||||
_ts.$message.error("操作失败!");
|
||||
}
|
||||
})
|
||||
},
|
||||
closeTagsDialog() {
|
||||
this.$set(this, 'tagsDialogVisible', false);
|
||||
},
|
||||
|
@ -178,6 +178,7 @@ export default {
|
||||
to: _ts.to.account,
|
||||
from: _ts.user.account,
|
||||
dataType: 1,
|
||||
role: 'user',
|
||||
dataId: new Date().getTime(),
|
||||
content: await _ts.contentEditor.getHTML()
|
||||
}
|
||||
@ -186,14 +187,13 @@ export default {
|
||||
return b.dataId - a.dataId;
|
||||
});
|
||||
_ts.contentEditor.setValue('')
|
||||
_ts.$axios.$post('/api/openai/chat', {
|
||||
message: message.content
|
||||
}).then(async res => {
|
||||
_ts.$axios.$post('/api/openai/new-chat', _ts.messages).then(async res => {
|
||||
const html = await Vue.Vditor.md2html(_ts.message);
|
||||
_ts.messages.push({
|
||||
to: _ts.user.account,
|
||||
from: _ts.to.account,
|
||||
dataType: 1,
|
||||
role: 'assistant',
|
||||
dataId: new Date().getTime(),
|
||||
content: html
|
||||
});
|
||||
@ -237,9 +237,7 @@ export default {
|
||||
},
|
||||
//handleCustomEvents回调
|
||||
handleCustomEvents(res) {
|
||||
console.log('customEvents22:', res)
|
||||
let { data } = res;
|
||||
console.info('customEvents:', data);
|
||||
this.customEvents = data;
|
||||
}
|
||||
},
|
||||
@ -267,6 +265,7 @@ export default {
|
||||
to: _ts.user.account,
|
||||
from: _ts.to.account,
|
||||
dataType: 1,
|
||||
role: 'assistant',
|
||||
dataId: new Date().getTime(),
|
||||
content: '伟大的"坦格利安家族的风暴降生丹妮莉丝 · 铁王座的合法继承人 · 安达尔人和先民的合法女王 · 七国的守护者 · 草海上的卡丽熙 · 不焚者 · 解放者 · 傲之追猎者 · 悠米"为你服务'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user