|
@@ -58,10 +58,35 @@
|
|
<i class="el-icon-question"></i>
|
|
<i class="el-icon-question"></i>
|
|
操作指南
|
|
操作指南
|
|
</div>
|
|
</div>
|
|
- <div class=" text-gray-800 cursor-pointer ml-4">
|
|
|
|
- <i class="el-icon-plus"></i>
|
|
|
|
- 创建
|
|
|
|
- </div>
|
|
|
|
|
|
+ <el-popover
|
|
|
|
+ placement="bottom"
|
|
|
|
+ width="160"
|
|
|
|
+ v-model="popoverVisible"
|
|
|
|
+ >
|
|
|
|
+ <div class="flex flex-col">
|
|
|
|
+ <div class="submenu w-full text-gray-600 text-center py-2 rounded cursor-pointer"
|
|
|
|
+ @click="() => {
|
|
|
|
+ popoverVisible = false
|
|
|
|
+ routeTo('/createScene')
|
|
|
|
+ }"
|
|
|
|
+ >
|
|
|
|
+ 创建场景
|
|
|
|
+ </div>
|
|
|
|
+ <div class="submenu w-full text-gray-600 text-center py-2 rounded cursor-pointer"
|
|
|
|
+ @click="() => {
|
|
|
|
+ popoverVisible = false
|
|
|
|
+ routeTo('/create')
|
|
|
|
+ }"
|
|
|
|
+ >
|
|
|
|
+ 创建角色
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div slot="reference" class=" text-gray-800 cursor-pointer ml-4">
|
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
|
+ 创建
|
|
|
|
+ </div>
|
|
|
|
+ </el-popover>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="list mt-4">
|
|
<div class="list mt-4">
|
|
@@ -102,19 +127,30 @@
|
|
<el-dialog
|
|
<el-dialog
|
|
title="提示"
|
|
title="提示"
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
- width="30%"
|
|
|
|
|
|
+ width="500px"
|
|
>
|
|
>
|
|
- <div class="flex justify-between px-2 py-3 border-b border-gray-200">
|
|
|
|
- <div>角色</div>
|
|
|
|
|
|
+ <div class="flex justify-between px-2 py-3 border-b border-gray-200" v-if="selectObj.scene == 1">
|
|
|
|
+ <div>场景</div>
|
|
<div>{{ selectObj.name }}</div>
|
|
<div>{{ selectObj.name }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-between px-2 py-3 border-b border-gray-200">
|
|
<div class="flex justify-between px-2 py-3 border-b border-gray-200">
|
|
<div>角色</div>
|
|
<div>角色</div>
|
|
- <div>{{ selectObj.name }}</div>
|
|
|
|
|
|
+ <div>{{ selectObj.scene == 1 ? selectObj.characerName : selectObj.name }}</div>
|
|
</div>
|
|
</div>
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="toChat">聊 天</el-button>
|
|
|
|
- <el-button type="primary">编 辑</el-button>
|
|
|
|
|
|
+ <div class="flex justify-between px-2 py-3 border-b border-gray-200">
|
|
|
|
+ <div>可见性</div>
|
|
|
|
+ <el-radio-group v-model="selectObj.type" @input="typeChange">
|
|
|
|
+ <el-radio :label="0">公开</el-radio>
|
|
|
|
+ <el-radio :label="1">私密</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="flex justify-between px-2 py-3 border-b border-gray-200">
|
|
|
|
+ <div></div>
|
|
|
|
+ <el-button round type="danger" @click="deleteData">删 除</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <span slot="footer" class="dialog-footer flex justify-around">
|
|
|
|
+ <el-button class="flex-1" round @click="toChat">聊 天</el-button>
|
|
|
|
+ <el-button class="flex-1" round type="primary" @click="toCreate">编 辑</el-button>
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
@@ -123,11 +159,16 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { queryCharacterAndSceneApi } from "@/api/profile.js"
|
|
import { queryCharacterAndSceneApi } from "@/api/profile.js"
|
|
-import { labelListApi, characterListApi } from "@/api/home.js"
|
|
|
|
|
|
+import { deleteSceneApi,
|
|
|
|
+ deleteCharacterApi,
|
|
|
|
+ setCharacterShowApi,
|
|
|
|
+ editSceneApi
|
|
|
|
+} from "@/api/create.js"
|
|
import 'vue-awesome/icons/fire'
|
|
import 'vue-awesome/icons/fire'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ popoverVisible: false,
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
selectObj: {},
|
|
selectObj: {},
|
|
active: 0,
|
|
active: 0,
|
|
@@ -138,11 +179,38 @@ export default {
|
|
this.getCharacterList()
|
|
this.getCharacterList()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ routeTo(url) {
|
|
|
|
+ this.$router.push(url)
|
|
|
|
+ },
|
|
|
|
+
|
|
toDetail(item) {
|
|
toDetail(item) {
|
|
console.log(item, 'item');
|
|
console.log(item, 'item');
|
|
this.selectObj = item
|
|
this.selectObj = item
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
},
|
|
},
|
|
|
|
+ // 前往编辑页面
|
|
|
|
+ toCreate() {
|
|
|
|
+ if (this.selectObj.scene == 0) {
|
|
|
|
+ // 点击是角色
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/create',
|
|
|
|
+ query: {
|
|
|
|
+ id: this.selectObj.id
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else if (this.selectObj.scene == 1) {
|
|
|
|
+ // 点击是场景
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/createScene',
|
|
|
|
+ query: {
|
|
|
|
+ sceneId: this.selectObj.id,
|
|
|
|
+ characterId: this.selectObj.characterId
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 前往聊天页面
|
|
toChat() {
|
|
toChat() {
|
|
let query = {}
|
|
let query = {}
|
|
if (this.selectObj.scene == 0) {
|
|
if (this.selectObj.scene == 0) {
|
|
@@ -158,6 +226,76 @@ export default {
|
|
query: query
|
|
query: query
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 修改公开私密状态
|
|
|
|
+ typeChange() {
|
|
|
|
+ console.log(this.selectObj, 'this.selectObj');
|
|
|
|
+ if (this.selectObj.scene == 0) {
|
|
|
|
+ // 点击是角色
|
|
|
|
+ let params = {
|
|
|
|
+ id: this.selectObj.id,
|
|
|
|
+ type: this.selectObj.type
|
|
|
|
+ }
|
|
|
|
+ setCharacterShowApi(this.selectObj.id, this.selectObj.type).then(res => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '修改成功!'
|
|
|
|
+ });
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getCharacterList()
|
|
|
|
+ })
|
|
|
|
+ } else if (this.selectObj.scene == 1) {
|
|
|
|
+ // 点击是场景
|
|
|
|
+ let params = {
|
|
|
|
+ sceneId: this.selectObj.id,
|
|
|
|
+ type: this.selectObj.type
|
|
|
|
+ }
|
|
|
|
+ editSceneApi(params).then(res => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '修改成功!'
|
|
|
|
+ });
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getCharacterList()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 删除
|
|
|
|
+ deleteData() {
|
|
|
|
+ if (this.selectObj.scene == 0) {
|
|
|
|
+ // 删除角色
|
|
|
|
+ this.$confirm('此操作将永久删除该角色及其所有聊天记录, 是否继续?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ deleteCharacterApi(this.selectObj.id).then(res => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '删除成功!'
|
|
|
|
+ });
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getCharacterList()
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ } else if (this.selectObj.scene == 1) {
|
|
|
|
+ // 删除场景
|
|
|
|
+ this.$confirm('此操作将永久删除该场景及其所有聊天记录, 是否继续?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ deleteSceneApi(this.selectObj.id).then(res => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '删除成功!'
|
|
|
|
+ });
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getCharacterList()
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
tabChange(index) {
|
|
tabChange(index) {
|
|
this.active = index
|
|
this.active = index
|
|
this.getCharacterList()
|
|
this.getCharacterList()
|