123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <div class="detail bg-gray-900 w-full overflow-hidden relative">
- <img :src="baseApi + info.picture" @error="$AIPohotoError" class="bgImg absolute" />
- <div class="topTool">
- <div class="tm_button rounded-full text-white" @click="goBack">
- <i class="el-icon-arrow-left"></i>
- </div>
- <div class="tm_button rounded-full text-white">
- <i class="el-icon-more"></i>
- </div>
- </div>
- <div class="content">
- <div class="info w-full px-4 text-white" style="height: 30%; margin-top: 60px;">
- <div class="flex pt-4">
- <img class="w-16 h-16 rounded-full object-cover border-2 border-white mr-2" :src="baseApi + info.picture"
- @error="$AIPohotoError">
- <div class="flex flex-col text-white justify-center">
- <div class=" text-lg font-semibold">{{ info.characterName }}</div>
- <div class=" text-xs">Xchat No.{{ info.id }}</div>
- </div>
- </div>
- <div class="mt-2 mb-4 text-sm prologue">
- {{ info.prologue }}
- </div>
- <div class="text-sm mb-2">创作人 <span class="ml-4">{{ info.author }}</span></div>
- <div class="text-sm">创建时间 <span class="ml-4">{{ info.createTime }}</span></div>
- </div>
- <div class="bg-white mx-auto absolute infoBottom pt-4 px-4 w-full" style="height: calc(100vh - 60px);">
- <div class="scenarioList h-full">
- <div class=" text-base" style="height: 25px;">场景</div>
- <div v-if="info.sceneList && info.sceneList.length > 0" class="grid grid-cols-2 gap-2 mb-4 cursor-pointer">
- <template v-for="(item, index) in info.sceneList">
- <div v-if="item.isDelete == 0" class="flex flex-col justify-center" :key="index"
- @click="toChat(item.sceneId)">
- <img class=" rounded w-full h-24 object-cover" :src="baseApi + item.background" alt="">
- <div>{{ item.sceneName }}</div>
- <div class=" text-gray-400">{{ item.sceneDescription }}</div>
- </div>
- </template>
- </div>
- <el-empty v-else description="暂无场景"></el-empty>
- </div>
- </div>
- <div class="bottomButtons flex justify-around px-8">
- <div class="button b1" @click="toCreateScene">创建场景</div>
- <div class="button b2 bgColor1" @click="toChat()">开始对话</div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { detailApi } from "@/api/detail.js"
- // 引入需要的图标
- import 'vue-awesome/icons/heart'
- // import 'vue-awesome/icons/comment'
- import 'vue-awesome/icons/star'
- import 'vue-awesome/icons/brands/twitter'
- import 'vue-awesome/icons/brands/reddit'
- export default {
- components: {
- },
- data() {
- return {
- info: {}
- }
- },
- mounted() {
- console.log(this.$route.query.id);
- if (this.$route.query.id) {
- this.getDetail(this.$route.query.id)
- }
- },
- methods: {
- goBack() {
- this.$router.back()
- },
- toChat(sceneId) {
- let query = {
- characterId: this.info.id
- }
- if (sceneId) {
- query.sceneId = sceneId
- }
- console.log(query, 'query');
- this.$router.push({
- path: '/chatH5',
- query: query
- })
- },
- toCreateScene() {
- let query = {
- characterId: this.info.id
- }
- this.$router.push({
- path: '/createScene',
- query: query
- })
- },
- getDetail(id) {
- detailApi(id).then(res => {
- console.log(res, '角色详情');
- this.info = res.data
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .detail {
- height: 100vh;
- }
- .labels {
- width: 100%;
- overflow-x: auto;
- }
- .photo {}
- .bgImg {
- object-fit: cover;
- object-position: top;
- height: 70%;
- width: 100%;
- }
- .infoBottom {
- overflow: hidden;
- border-radius: 10px;
- // top: 60%;
- }
- .content {
- width: 100%;
- height: 100vh;
- position: absolute;
- padding-top: 60px;
- background: rgba(58, 58, 58, 0.3);
- overflow-y: auto;
- .info {
- .prologue {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- }
- }
- .content::-webkit-scrollbar {
- display: none;
- /* Chrome Safari */
- }
- .content {
- scrollbar-width: none;
- /* firefox */
- -ms-overflow-style: none;
- /* IE 10+ */
- overflow-x: hidden;
- overflow-y: auto;
- }
- .topTool {
- position: absolute;
- width: 100%;
- height: 60px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 20px;
- top: 0;
- z-index: 5;
- .tm_button {
- font-size: 16px;
- width: 30px;
- height: 30px;
- background: rgba(23, 23, 23, 0.4);
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- }
- }
- .scenarioList {
- .list {
- display: grid;
- grid-template-columns: 1fr 1fr;
- grid-gap: 10px;
- }
- }
- .bottomButtons {
- position: fixed;
- bottom: 20px;
- width: 100%;
- .button {
- height: 30px;
- width: 100px;
- border-radius: 100px;
- text-align: center;
- line-height: 30px;
- font-size: 15px;
- box-shadow: 0px 0px 2px 1px rgba(117, 117, 117, 0.3);
- }
- .b1 {
- border: solid 1px #000;
- }
- .b2 {
- color: #fff;
- }
- }
- </style>
|