Handy_Cao 2 years ago
parent
commit
cc27d5c081

+ 33 - 5
src/packages/pc/views/auth/login/index.vue

@@ -1,15 +1,19 @@
 <template>
-  <sign-layout class="user-login" :title="islogin ? '登录' : '重置密码'">
+  <sign-layout class="user-login" :title="islogin ? '登录' : '重置密码'"  v-loading="rloading">
     <el-form ref="formRef" :model="formData" :rules="formRules" v-if="islogin">
       <el-form-item prop="userName">
-        <el-input placeholder="用户名/账号/手机号" v-model="formData.userName"></el-input>
+        <el-input placeholder="用户名/账号/手机号" v-model="formData.userName">
+          <template #append>
+            <el-checkbox v-model="remember"></el-checkbox>
+          </template>
+        </el-input>
       </el-form-item>
       <el-form-item prop="password">
         <el-input type="password" placeholder="请输入您的登录密码" v-model="formData.password">
         </el-input>
       </el-form-item>
       <el-form-item>
-        <el-checkbox label="false" v-model="remember">记住账号</el-checkbox>
+        <span class="text-link" @click="click">立即注册</span>
         <span class="text-link" @click="islogin = false">忘记密码?</span>
       </el-form-item>
       <el-form-item>
@@ -20,19 +24,30 @@
       </el-form-item>
     </el-form>
     <Forget @close="islogin = true" v-else></Forget>
+    <el-dialog v-model="isRegister" title="立即注册" width="30%" >
+      <span>手机扫描二维码进行注册</span>
+      <app-qrcode class="app-register-code__qrcode" :text="qrContent" :logo="require('../../../assets/logo.svg')" />
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="isRegister = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
   </sign-layout>
 </template>
 
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
-import { ElMessage } from 'element-plus'
+import { ElMessage, ElDialog } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { ClientType } from '@/constants/client'
 import { useLogin } from '@/business/login'
 import { useMenuStore } from '@/stores'
+import service from '@/services'
 import SignLayout from '../components/layout/index.vue'
-import Forget from "../forget/index.vue";
+import Forget from "../forget/index.vue"
+import AppQrcode from '@/components/base/qrcode/index.vue'
 
 const { formData, remember, userLogin } = useLogin()
 const route = useRoute()
@@ -41,6 +56,9 @@ const menuStore = useMenuStore()
 const formRef = shallowRef<FormInstance>()
 const loading = shallowRef(false)
 const islogin = shallowRef(true)
+const isRegister = shallowRef(false)
+const qrContent = shallowRef('')
+const rloading = shallowRef(false)
 
 const formRules: FormRules = {
   userName: [
@@ -51,6 +69,16 @@ const formRules: FormRules = {
   ]
 }
 
+const click = () => {
+  rloading.value = true
+  service.onReady().then((res) => {
+    qrContent.value = res.mobileOpenUrl
+    isRegister.value = true
+  }).finally(() => {
+    rloading.value = false
+  }) 
+}
+
 const formSubmit = () => {
   formRef.value?.validate(async (valid) => {
     if (valid) {

+ 0 - 0
src/packages/pc/views/auth/register/index.vue