You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oaweb/components/appcard.vue

107 lines
2.1 KiB
Vue

4 weeks ago
<!--
* appcard.vue
* Copyright (C) 2024 veypi <i@veypi.com>
* 2024-06-07 16:48
* Distributed under terms of the MIT license.
-->
<template>
<div class="core rounded-2xl" @click="Go">
<img class="logo rounded-full" :src="core.icon">
<div class="txt">
<div class="title truncate italic font-bold">{{ core.name }}</div>
<div class="des"></div>
</div>
</div>
</template>
<script setup lang="ts">
4 weeks ago
import type { models } from "#imports";
import msg from "@veypi/msg";
4 weeks ago
import oaer from "@veypi/oaer";
const router = useRouter()
let props = withDefaults(defineProps<{
4 weeks ago
core: models.App,
is_part: boolean
}>(),
{}
)
function Go() {
if (props.is_part) {
router.push('/app/' + props.core.id)
return
}
// $q.dialog({
// title: '确认',
// message: '是否确定申请加入应用 ' + props.core.name,
// cancel: true,
// }).onOk(() => {
4 weeks ago
api.app.AppUserPost(props.core.id, { user_id: oaer.local().id, status: 'ok' }).then(e => {
msg.Info('申请成功')
switch (e.status) {
case AUStatus.OK:
msg.Info('加入成功')
router.push({ name: "app.home", params: { id: props.core.id } });
return;
case AUStatus.Applying:
msg.Info("请等待管理员审批进入");
return;
case AUStatus.Deny:
msg.Warn("进入申请未通过");
return;
case AUStatus.Disabled:
msg.Warn("已被禁止使用");
return;
}
}).catch(e => {
msg.Warn("加入失败" + e)
})
}
</script>
<style scoped lang="scss">
.core {
user-select: none;
cursor: pointer;
width: 256px;
height: 96px;
padding: 12px;
background: var(--base-bg-1);
filter: brightness(1.05);
.logo {
vertical-align: top;
display: inline-block;
width: 72px;
height: 72px;
}
.txt {
vertical-align: top;
display: inline-block;
width: 160px;
height: 72px;
.title {
padding-left: 12px;
text-align: left;
width: 160px;
height: 48px;
line-height: 48px;
font-size: 24px;
}
.des {
height: 24px;
padding-left: 12px;
}
}
}
</style>