fix
This commit is contained in:
@@ -16,11 +16,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<setting />
|
||||
<flow-canvas />
|
||||
<flow-canvas ref="flowCanvasRef" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import LeftNav from './left-nav.vue'
|
||||
import TopNav from './top-nav.vue'
|
||||
import setting from './setting/index.vue'
|
||||
@@ -28,6 +28,16 @@
|
||||
const globalStore = useGlobalStore()
|
||||
const loading = computed(() => globalStore.state.loading)
|
||||
import FlowCanvas from '@/components/Canvas/FlowCanvas/index.vue'
|
||||
import myEvent from '@/utils/myEvent'
|
||||
|
||||
const flowCanvasRef = ref(null)
|
||||
const openFlowCanvas = () => {
|
||||
flowCanvasRef.value.open()
|
||||
}
|
||||
myEvent.add('openFlowCanvas', openFlowCanvas)
|
||||
onUnmounted(() => {
|
||||
myEvent.remove('openFlowCanvas', openFlowCanvas)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
<span class="icon"><svg-icon name="home" size="24" /></span>
|
||||
<span class="title" v-show="!isCollapse">{{ $t('Home.home') }}</span>
|
||||
</div> -->
|
||||
<div class="menu-item" @click="onCanvas">
|
||||
<!-- <span class="icon"><svg-icon name="home" size="24" /></span> -->
|
||||
<span class="title">画布</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="onHistory" :class="{ active: showHistory }">
|
||||
<span class="icon"><svg-icon name="history" size="24" /></span>
|
||||
<span class="title" v-show="!isCollapse">{{ $t('Home.history') }}</span>
|
||||
@@ -108,9 +104,6 @@
|
||||
router.push({ name: 'mainInput' })
|
||||
}
|
||||
const onHome = () => {}
|
||||
const onCanvas = () => {
|
||||
router.push({ name: 'canvas' })
|
||||
}
|
||||
const onHistory = () => {
|
||||
if (isCollapse.value) {
|
||||
globalStore.setHomeLeftNavCollapse(false)
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
<template>
|
||||
<div class="test">
|
||||
<p>Conversation Item - {{ id }}</p>
|
||||
<button @click="openCanvas">打开画布</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import myEvent from '@/utils/myEvent'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
const route = useRoute()
|
||||
const id = computed(() => route.params.id)
|
||||
const openCanvas = () => {
|
||||
myEvent.emit('openFlowCanvas')
|
||||
}
|
||||
onMounted(() => {
|
||||
openCanvas();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -19,6 +27,9 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 10rem;
|
||||
flex-direction: column;
|
||||
> p {
|
||||
font-size: 10rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
</template>
|
||||
<visible-code
|
||||
v-show="isVisible"
|
||||
type="LOGIN"
|
||||
:password="formData.password"
|
||||
ref="visibleCodeRef"
|
||||
:email="formData.email"
|
||||
@submit="onVerifyCode"
|
||||
@@ -61,6 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import md5 from 'md5'
|
||||
import { Login } from '@/api/login'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -106,7 +109,7 @@
|
||||
// console.log(code)
|
||||
Login({
|
||||
email: formData.email,
|
||||
password: formData.password,
|
||||
password: md5(formData.password),
|
||||
verificationCode: code
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
</template>
|
||||
<visible-code
|
||||
v-show="isVisible"
|
||||
type="REGISTER"
|
||||
ref="visibleCodeRef"
|
||||
:email="formData.email"
|
||||
@submit="onVerifyCode"
|
||||
@@ -65,6 +66,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import md5 from 'md5'
|
||||
import { Register } from '@/api/login'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -113,7 +115,7 @@
|
||||
Register({
|
||||
username: formData.name,
|
||||
email: formData.email,
|
||||
password: formData.password,
|
||||
password: md5(formData.password),
|
||||
verificationCode: code
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="visible-code">
|
||||
<div class="title">{{ $t('Login.verifyEmail') }}</div>
|
||||
<div class="tip" v-html="$t('Login.verifyCodeHasSent', { email: props.email })"></div>
|
||||
<input-code @submit="onVerify" v-model="code" />
|
||||
<input-code @submit="onVerify" v-model="code" ref="inputCodeRef" />
|
||||
<el-button class="verify" @click="onVerify">{{ $t('Login.verify') }}</el-button>
|
||||
<p class="time" v-if="time > 0">{{ $t('Login.resendCodeIn', { time: timeStr }) }}</p>
|
||||
<p class="time" v-if="time === 0">
|
||||
@@ -12,15 +12,21 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import md5 from 'md5'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { SendVerificationCode } from '@/api/login'
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { CountDown } from '@/utils/tools'
|
||||
import InputCode from '@/components/input-code.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const emit = defineEmits(['submit'])
|
||||
const props = defineProps({
|
||||
email: ''
|
||||
email: { type: String, required: true },
|
||||
type: { default: 'LOGIN', type: String as () => 'LOGIN' | 'REGISTER' },
|
||||
password: { type: String, default: '' }
|
||||
})
|
||||
const code = ref('')
|
||||
const time = ref(60)
|
||||
@@ -47,15 +53,31 @@
|
||||
onMounted(() => {
|
||||
// onSendCode()
|
||||
})
|
||||
const inputCodeRef = ref(null)
|
||||
const resetCode = () => {
|
||||
inputCodeRef.value?.resetCode?.()
|
||||
}
|
||||
const onSendCode = async () => {
|
||||
resetCode()
|
||||
const email = props.email
|
||||
if (!email) {
|
||||
console.warn('请输入邮箱')
|
||||
return Promise.reject('请输入邮箱')
|
||||
}
|
||||
await SendVerificationCode({ email })
|
||||
const data = {
|
||||
email,
|
||||
type: props.type
|
||||
}
|
||||
if (props.type === 'LOGIN') {
|
||||
data['password'] = md5(props.password)
|
||||
}
|
||||
const res = await SendVerificationCode(data)
|
||||
if (!res) {
|
||||
ElMessage.error(t('Login.sendCodeError'))
|
||||
return Promise.reject('发送验证码失败')
|
||||
}
|
||||
setTime()
|
||||
return Promise.resolve()
|
||||
return Promise.resolve(res)
|
||||
}
|
||||
const onResend = () => {
|
||||
if (time.value > 0) return
|
||||
|
||||
Reference in New Issue
Block a user