From b2ff79644a1ac74fc1f3ef3867e9e77f392eb7fa Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 09 十一月 2023 10:28:18 +0800
Subject: [PATCH] 修改视频专网

---
 src/views/login.vue |  100 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/src/views/login.vue b/src/views/login.vue
index 60b7940..3a3128f 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,24 +1,24 @@
 <template>
   <div class="login">
     <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
-      <h3 class="title">RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h3>
-      <el-form-item prop="tenantId" v-if="tenantEnabled">
-        <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">
-          <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
-          <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
-        </el-select>
-      </el-form-item>
-      <el-form-item prop="username">
+      <h3 class="title">璺ㄧ綉鏂囦欢鍚屾绯荤粺</h3>
+<!--      <el-form-item prop="tenantId" v-if="tenantEnabled">-->
+<!--        <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">-->
+<!--          <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>-->
+<!--          <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+      <el-form-item style="display: none" prop="username">
         <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="璐﹀彿">
           <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
         </el-input>
       </el-form-item>
-      <el-form-item prop="password">
+      <el-form-item style="display: none" prop="password">
         <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="瀵嗙爜" @keyup.enter="handleLogin">
           <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
         </el-input>
       </el-form-item>
-      <el-form-item prop="code" v-if="captchaEnabled">
+      <el-form-item style="display: none" prop="code" v-if="captchaEnabled">
         <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" @keyup.enter="handleLogin">
           <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
         </el-input>
@@ -26,22 +26,22 @@
           <img :src="codeUrl" @click="getCode" class="login-code-img" />
         </div>
       </el-form-item>
-      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox>
-      <el-form-item style="float: right;">
-        <el-button circle title="寰俊鐧诲綍" @click="doSocialLogin('wechat')">
-          <svg-icon icon-class="wechat" />
-        </el-button>
-        <el-button circle title="MaxKey鐧诲綍" @click="doSocialLogin('maxkey')">
-          <svg-icon icon-class="maxkey" />
-        </el-button>
-        <el-button circle title="Gitee鐧诲綍" @click="doSocialLogin('gitee')">
-          <svg-icon icon-class="gitee" />
-        </el-button>
-        <el-button circle title="Github鐧诲綍" @click="doSocialLogin('github')">
-          <svg-icon icon-class="github" />
-        </el-button>
-      </el-form-item>
-      <el-form-item style="width:100%;">
+      <el-checkbox style="display: none;margin:0px 0px 25px 0px;" v-model="loginForm.rememberMe" >璁颁綇瀵嗙爜</el-checkbox>
+      <!--      <el-form-item style="float: right;">-->
+      <!--        <el-button circle title="寰俊鐧诲綍" @click="doSocialLogin('wechat')">-->
+<!--          <svg-icon icon-class="wechat" />-->
+<!--        </el-button>-->
+<!--        <el-button circle title="MaxKey鐧诲綍" @click="doSocialLogin('maxkey')">-->
+<!--          <svg-icon icon-class="maxkey" />-->
+<!--        </el-button>-->
+<!--        <el-button circle title="Gitee鐧诲綍" @click="doSocialLogin('gitee')">-->
+<!--          <svg-icon icon-class="gitee" />-->
+<!--        </el-button>-->
+<!--        <el-button circle title="Github鐧诲綍" @click="doSocialLogin('github')">-->
+<!--          <svg-icon icon-class="github" />-->
+<!--        </el-button>-->
+<!--      </el-form-item>-->
+      <el-form-item style="display: none;width:100%;" >
         <el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
           <span v-if="!loading">鐧� 褰�</span>
           <span v-else>鐧� 褰� 涓�...</span>
@@ -53,7 +53,7 @@
     </el-form>
     <!--  搴曢儴  -->
     <div class="el-login-footer">
-      <span>Copyright 漏 2018-2023 鐤媯鐨勭嫯瀛怢i All Rights Reserved.</span>
+      <span>Copyright 漏 浼樺垱鍔�.</span>
     </div>
   </div>
 </template>
@@ -63,8 +63,10 @@
 import { authBinding } from '@/api/system/social/auth';
 import { useUserStore } from '@/store/modules/user';
 import { LoginData, TenantVO } from '@/api/types';
-import { to } from 'await-to-js';
+import { to as tos, to } from "await-to-js";
 import { HttpStatus } from "@/enums/RespEnum";
+import { createUser } from "@/api/system/oss";
+import { setToken } from "@/utils/auth";
 
 const userStore = useUserStore();
 const router = useRouter();
@@ -82,7 +84,7 @@
   tenantId: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勭鎴风紪鍙�" }],
   username: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勮处鍙�' }],
   password: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勫瘑鐮�' }],
-  code: [{ required: false, trigger: 'change', message: '璇疯緭鍏ラ獙璇佺爜' }]
+  code: [{ required: true, trigger: 'change', message: '璇疯緭鍏ラ獙璇佺爜' }]
 };
 
 const codeUrl = ref('');
@@ -90,7 +92,7 @@
 // 楠岃瘉鐮佸紑鍏�
 const captchaEnabled = ref(true);
 // 绉熸埛寮�鍏�
-const tenantEnabled = ref(true);
+const tenantEnabled = ref(false);
 
 
 // 娉ㄥ唽寮�鍏�
@@ -125,7 +127,9 @@
       console.log(loginForm.value);
       const [err] = await to(userStore.login(loginForm.value));
       if (!err) {
-        await router.push({ path: redirect.value || '/' });
+        console.log(redirect.value);
+        // await router.push({ path: redirect.value || '/' });
+        await router.push({ path: '/oss' || '/' });
         loading.value = false;
       } else {
         loading.value = false;
@@ -201,12 +205,38 @@
   });
 };
 
+const setAddUser = async (val: any | number | (string | number)[]) => {
+  console.log(val);
+  const res = await createUser(val)
+  console.log(res);
+  if (res.code == 200) {
+    const data = res.data;
+    setToken(data.access_token);
 
+  }
+}
 
-onMounted(() => {
-  getCode();
-  initTenantList();
-  getLoginData();
+onMounted(async () => {
+  try {
+    // 浣跨敤fetch API鑾峰彇褰撳墠IP鍦板潃
+    await fetch('https://api.ipify.org/?format=json')
+      .then(response => response.json())
+      .then(async data => {
+        let obj = {
+          username: data.ip
+        }
+        await setAddUser(obj)
+      })
+      .catch(error => {
+        console.error('鑾峰彇IP鍦板潃澶辫触锛�', error);
+      });
+  } catch (error) {
+    console.log(error);
+  }
+  router.push('index')
+  // getCode();
+  // initTenantList();
+  // getLoginData();
 });
 </script>
 

--
Gitblit v1.8.0