No need to login with Stable-Diffusion page and Invite page

This commit is contained in:
RockYang
2024-03-23 15:45:37 +08:00
parent 4a9028747b
commit 82e06fad33
5 changed files with 504 additions and 475 deletions

View File

@@ -471,16 +471,7 @@
<script setup>
import {nextTick, onMounted, onUnmounted, ref} from "vue"
import {
ChromeFilled,
Delete,
DeleteFilled,
DocumentCopy,
InfoFilled,
Picture,
Plus,
Refresh
} from "@element-plus/icons-vue";
import {ChromeFilled, Delete, DocumentCopy, InfoFilled, Picture, Plus, Refresh} from "@element-plus/icons-vue";
import Compressor from "compressorjs";
import {httpGet, httpPost} from "@/utils/http";
import {ElMessage, ElMessageBox, ElNotification} from "element-plus";
@@ -489,7 +480,7 @@ import Clipboard from "clipboard";
import {checkSession} from "@/action/session";
import {useRouter} from "vue-router";
import {getSessionId} from "@/store/session";
import {isMobile, removeArrayItem} from "@/utils/libs";
import {removeArrayItem} from "@/utils/libs";
import LoginDialog from "@/components/LoginDialog.vue";
const listBoxHeight = ref(window.innerHeight - 40)
@@ -673,7 +664,6 @@ onMounted(() => {
})
// 初始化数据
const initData = () => {
checkSession().then(user => {
power.value = user['power']
@@ -683,7 +673,6 @@ const initData = () => {
fetchRunningJobs()
fetchFinishJobs(1)
connect()
}).catch(() => {
});

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,8 @@
</div>
</div>
</div>
<login-dialog :show="showLoginDialog" @hide="showLoginDialog = false" @success="initData"/>
</div>
</template>
@@ -95,7 +97,7 @@ import {ElMessage} from "element-plus";
import Clipboard from "clipboard";
import InviteList from "@/components/InviteList.vue";
import {checkSession} from "@/action/session";
import {useRouter} from "vue-router";
import LoginDialog from "@/components/LoginDialog.vue";
const inviteURL = ref("")
const qrImg = ref("")
@@ -104,10 +106,24 @@ const inviteImgCalls = ref(0)
const hits = ref(0)
const regNum = ref(0)
const rate = ref(0)
const router = useRouter()
const isLogin = ref(false)
const showLoginDialog = ref(true)
onMounted(() => {
initData()
// 复制链接
const clipboard = new Clipboard('.copy-link');
clipboard.on('success', () => {
ElMessage.success('复制成功!');
})
clipboard.on('error', () => {
ElMessage.error('复制失败!');
})
})
const initData = () => {
checkSession().then(() => {
isLogin.value = true
httpGet("/api/invite/code").then(res => {
@@ -136,19 +152,8 @@ onMounted(() => {
ElMessage.error("获取系统配置失败:" + e.message)
})
}).catch(() => {
router.push('/login')
});
// 复制链接
const clipboard = new Clipboard('.copy-link');
clipboard.on('success', () => {
ElMessage.success('复制成功!');
})
clipboard.on('error', () => {
ElMessage.error('复制失败!');
})
})
}
</script>
<style lang="stylus" scoped>