opt: styles and view micro optimization

This commit is contained in:
RockYang 2024-05-01 07:40:56 +08:00
parent cc1a3ce343
commit e589f25a05
6 changed files with 14 additions and 11 deletions

View File

@ -74,6 +74,7 @@
}
color var(--van-text-color)
.pt-6 {
padding 15px 10px
}

View File

@ -80,6 +80,8 @@
}
color var(--van-text-color)
.pt-6 {
padding 15px 10px
}

View File

@ -13,7 +13,7 @@
<span class="name">{{ scope.item.name }}</span>
<div class="opt">
<div v-if="hasRole(scope.item.key)">
<el-button size="small" type="success" @click="useRole(scope.item.id)">使用</el-button>
<el-button size="small" type="success" @click="useRole(scope.item)">使用</el-button>
<el-button size="small" type="danger" @click="updateRole(scope.item,'remove')">移除</el-button>
</div>
<el-button v-else size="small"
@ -110,8 +110,8 @@ const hasRole = (roleKey) => {
}
const router = useRouter()
const useRole = (roleId) => {
router.push({name: "chat", params: {role_id: roleId}})
const useRole = (role) => {
router.push(`/chat?role_id=${role.id}`)
}
</script>

View File

@ -358,8 +358,8 @@ const initData = () => {
//
httpGet(`/api/role/list`).then((res) => {
roles.value = res.data;
if (router.currentRoute.value.params.role_id) {
roleId.value = parseInt(router.currentRoute.value.params["role_id"])
if (router.currentRoute.value.query.role_id) {
roleId.value = parseInt(router.currentRoute.value.query.role_id)
} else {
roleId.value = roles.value[0]['id']
}

View File

@ -5,9 +5,9 @@
<h2>AI 绘画作品墙</h2>
<div class="settings">
<el-radio-group v-model="imgType" @change="changeImgType">
<el-radio label="mj" size="large">MidJourney</el-radio>
<el-radio label="sd" size="large">Stable Diffusion</el-radio>
<el-radio label="dall" size="large">DALL-E</el-radio>
<el-radio value="mj" size="large">MidJourney</el-radio>
<el-radio value="sd" size="large">Stable Diffusion</el-radio>
<el-radio value="dall" size="large">DALL-E</el-radio>
</el-radio-group>
</div>
</div>
@ -338,7 +338,6 @@ const getNext = () => {
loading.value = true
page.value = page.value + 1
let url = ""
console.log(imgType.value)
switch (imgType.value) {
case "mj":
url = "/api/mj/imgWall"

View File

@ -264,9 +264,10 @@ const connect = (userId) => {
_socket.addEventListener('close', () => {
loading.value = false
if (socket.value !== null) {
checkSession().then(() => {
connect(userId)
}
}).catch(() => {
})
});
}