Explorar o código

526mathfunc修改

tangjunhao hai 3 meses
pai
achega
b83e4933e3

BIN=BIN
src/assets/img/register-bg.png


+ 15 - 1
src/router/index.js

@@ -1,6 +1,7 @@
 // //创建一个路由器
 
-import { createRouter, createWebHashHistory, } from "vue-router";
+import { createRouter, createWebHashHistory} from "vue-router";
+import { getToken2} from "../utils/token";
 const router = createRouter({
     history: createWebHashHistory(),
     routes: [ 
@@ -56,6 +57,15 @@ const router = createRouter({
         keepAlive: false,
         title: '登录'
       }
+    },
+    {
+      path: '/register',
+      name: 'register',
+      component: () => import('@/views/login/register.vue'),
+      meta: {
+        keepAlive: false,
+        title: '注册'
+      }
     },
       {
         path: '/vueflow',
@@ -82,6 +92,10 @@ const router = createRouter({
 //修改动态网页标题 beforeEach 导航钩子,路由改变前触发
 router.beforeEach((to,from,next) =>{
     //window.document.title = to.meta.title;
+    let token = getToken2();
+    if(!token && to.name !== 'login'){
+      next({ name: 'login' });
+    }
     window.document.title = to.name;
     next();
   })

+ 5 - 0
src/utils/token.js

@@ -24,6 +24,11 @@ export function getToken() {
   }
   return Cookies.get(TokenKey);
 }
+
+// 获取 token,不生成新的 token
+export function getToken2() {
+  return Cookies.get(TokenKey);  // 仅从 Cookies 获取 token,不生成新的
+}
 // 设置token
 export function setToken(token) {
   return Cookies.set(TokenKey, token)

+ 3 - 3
src/views/login/SlideToUnlock.vue

@@ -110,7 +110,7 @@ onUnmounted(() => {
 .slider-container {
   position: relative;
   width: 100%;
-  height: 30px;
+  height: 42px;
   background-color: #B3B3B3;
   /* border: 1px solid #B3B3B3 ; */
   border-radius: 4px;
@@ -133,8 +133,8 @@ onUnmounted(() => {
   position: absolute;
   top: 50%;
   transform: translateY(-50%);
-  width: 50px;
-  height: 30px;
+  width: 60px;
+  height: 42px;
   background: #FFFFFF;
   border: 1px solid #B3B3B3 ;
   border-radius: 4px;

+ 42 - 8
src/views/login/index.vue

@@ -29,7 +29,7 @@
               />
             </el-form-item>
 
-            <el-form-item prop="password" label="密码:">
+            <el-form-item prop="password" label="密码:" style="margin-bottom: 20px;">
               <el-input
                 v-model="loginForm.password"
                 placeholder="请输入密码"
@@ -39,7 +39,7 @@
               />
             </el-form-item>
           
-            <el-form-item prop="remember">
+            <el-form-item prop="remember" style="margin-bottom: 20px;">
               <div style="width: 100%; display: flex; justify-content: space-between;">
                 <el-checkbox v-model="loginForm.remember">记住密码</el-checkbox>
                 <el-link type="info">忘记密码</el-link>
@@ -65,7 +65,7 @@
         
           <div class="login-footer">
             <div class="register-prompt">没有账号?点击</div>
-            <el-link type="primary">注册</el-link>
+            <el-link type="primary" @click="goToRegister">注册</el-link>
           </div>
         </el-card>
       </div>
@@ -156,6 +156,11 @@ const handleLogin = () => {
     
   })
 }
+
+// 跳转到注册页面
+const goToRegister = () => {
+  router.push({ path: "/register" })
+}
 </script>
 
 <style lang="scss" scoped>
@@ -174,7 +179,7 @@ const handleLogin = () => {
   left: 0;
   width: 100%;
   height: 100%;
-  object-fit: cover;
+  object-fit: fill;
   object-position: center;
   z-index: 0;
 }
@@ -196,7 +201,7 @@ const handleLogin = () => {
 
 .login-card {
   border: none !important;
-  width: 60%;
+  width: 70%;
   background-color: transparent;
   :deep(.el-card__header) {
     border-bottom: none;
@@ -204,22 +209,51 @@ const handleLogin = () => {
   }
 }
 
+.login-card {
+  // 设置label文字大小
+  :deep(.el-form-item__label) {
+    font-size: 18px;
+    line-height: 42px; /* 保持垂直居中 */
+    color: #333; /* 可选:设置label颜色 */
+  }
+  
+  // 设置输入框文字大小
+  :deep(.el-input__inner) {
+    font-size: 18px;
+    height: 42px; /* 可选:调整输入框高度 */
+    line-height: 42px; /* 保持垂直居中 */
+  }
+
+  :deep(.el-input__wrapper) {
+    background-color: transparent;
+    border: 1px solid #B3B3B3;
+  }
+  
+  // 设置placeholder文字大小
+  :deep(.el-input__inner::placeholder) {
+    font-size: 14px;
+  }
+}
+
 .login-header {
   text-align: start;
   width: 75%;
 
   h2 {
     margin: 0;
-    font-size: 24px;
-    font-weight: 500;
+    font-size: 28px;
+    font-weight: bold;
     color: #2D2D2D;
     margin: 10px 0;
+    font-style: normal;
+    text-transform: none;
+    letter-spacing: 1px;
   }
 }
 
 .login-logo {
   width: 70px;
-  margin-bottom: 10px;
+  margin-bottom: 18px;
 }
 
 .login-btn {

+ 228 - 0
src/views/login/register.vue

@@ -0,0 +1,228 @@
+<template>
+  <div class="register-container">
+    <!-- 背景图 -->
+    <img class="background-image" :src="registerbg" alt="背景图">
+    
+    <!-- 登录框 -->
+    <div class="register-form-container">
+      <div class="register-box">
+        <el-card class="register-card" shadow="never">
+          <template #header>
+            <div class="register-header">
+              <img :src="loginLogo" alt="logo" class="login-logo"/>
+              <h2>注册账号</h2>
+            </div>
+          </template>
+
+          <el-form
+            :model="registerForm"
+            :rules="registerRules"
+            ref="registerFormRef"
+            @keyup.enter="handleRegister"
+          >
+            <el-form-item prop="company" label="单位名称:" style="margin-bottom: 20px;">
+              <el-input
+                v-model="registerForm.company"
+                placeholder="请输入单位名称"
+                clearable
+              />
+            </el-form-item>
+            <el-form-item prop="username" label="邮箱:" style="margin-bottom: 20px;">
+              <el-input
+                v-model="registerForm.username"
+                placeholder="请输入用户名"
+                clearable
+              />
+            </el-form-item>
+
+            <el-form-item prop="password" label="密码:">
+              <el-input
+                v-model="registerForm.password"
+                placeholder="请输入密码"
+                show-password
+                clearable
+              />
+            </el-form-item>
+
+            <el-form-item>
+              <el-button
+                type="primary"
+                class="register-btn"
+                :loading="loading"
+                @click="handleRegister"
+                :disabled="!isverify"
+              >
+                立 即 注 册
+              </el-button>
+            </el-form-item>
+          </el-form>
+
+          <div class="register-footer">
+            <div class="register-prompt">已有账号?点击</div>
+            <el-link type="primary" @click="goToLogin">登录</el-link>
+          </div>
+
+        </el-card>
+      </div>
+      
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage } from 'element-plus'
+import router from "@/router"
+import { request,enPassword } from "@/utils/request"
+
+import { getToken, setToken, setUserId} from "@/utils/token"
+
+import registerbg from '@/assets/img/register-bg.png'
+import loginLogo from '@/assets/img/login-logo.png'
+// 表单引用
+const registerFormRef = ref(null)
+
+// 注册表单数据
+const registerForm = reactive({
+  company: '',
+  username: '',
+  password: ''
+})
+
+// 加载状态
+const loading = ref(false)
+
+const isverify = ref(false)
+
+// 表单验证规则
+const registerRules = reactive({
+  username: [
+    { required: true, message: '请输入用户名', trigger: 'blur' },
+    { min: 3, max: 18, message: '长度在 3 到 18 个字符', trigger: 'blur' }
+  ],
+  password: [
+    { required: true, message: '请输入密码', trigger: 'blur' },
+    { min: 6, max: 18, message: '长度在 6 到 18 个字符', trigger: 'blur' }
+  ]
+})
+
+// 滑动验证成功
+const verifySuccess = () => {
+  isverify.value = true
+}
+
+// 注册方法
+const handleRegister = () => {
+  registerFormRef.value.validate(valid => {
+    if (!valid) return
+    
+    loading.value = true
+    
+    const params = {
+      transCode: "A00002",
+      loginName: loginForm.username,
+      password: enPassword(loginForm.password),
+      type: "",
+    }
+    console.log(params)
+    request(params)
+    .then((res) => {
+      setToken(res.clientToken)
+      setUserId(res.userId)
+      router.push({ path: "/" })
+    })
+    .catch((err) => {
+      console.error('错误信息:',err);
+      ElMessage.error(err.returnMsg);
+      loading.value = false;
+    })
+    .finally(() => {
+      loading.value = false
+    });
+    
+  })
+}
+</script>
+
+<style lang="scss" scoped>
+.register-container {
+  position: relative;
+  width: 100%;
+  height: 100vh;
+  min-width: 1200px;
+  min-height: 600px;
+  overflow: auto;
+}
+
+.background-image {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  object-fit: fill;
+  object-position: center;
+  z-index: 0;
+}
+
+.register-form-container {
+  position: absolute;
+  right: 60%;
+  width: 40%;
+  height: 100%;
+}
+
+.register-box {
+  height: 100%;
+  background-color: rgba(255, 255, 255, 0.6);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.register-card {
+  border: none !important;
+  width: 70%;
+  background-color: transparent;
+  :deep(.el-card__header) {
+    border-bottom: none;
+    padding-bottom: 0;
+  }
+}
+
+.register-header {
+  text-align: start;
+  width: 75%;
+
+  h2 {
+    margin: 0;
+    font-size: 24px;
+    font-weight: 500;
+    color: #2D2D2D;
+    margin: 10px 0;
+  }
+}
+
+.login-logo {
+  width: 70px;
+  margin-bottom: 10px;
+}
+
+.register-btn {
+  width: 100%;
+  height: 42px;
+  margin-top: 10px;
+  font-size: 16px;
+  background-color: #2267B1;
+}
+
+.register-footer {
+  display: flex;
+  justify-content: center;
+  margin-top: 10px;
+}
+
+.register-prompt {
+  margin-right: 5px;
+  font-size: 13px;
+}
+</style>

+ 20 - 16
src/views/titlecomponent/MathFunc.vue

@@ -161,22 +161,22 @@ let code = ref('')
 let name = ref('')
 
 // 监听 outParams 的变化
-watch(
-  outParams,
-  (newParams) => {
-    // 生成新的 equation 内容
-    let newEquation = ``;
-
-    // 遍历 outParams,添加 name = {name} 到 equation
-    newParams.forEach(param => {
-      newEquation += `${param.name}= \n`;
-    });
-
-    // 更新 equation 的值
-    equation.value = newEquation;
-  },
-  { deep: true }  // 深度监听,确保数组内部变化也能触发
-);
+// watch(
+//   outParams,
+//   (newParams) => {
+//     // 生成新的 equation 内容
+//     let newEquation = ``;
+
+//     // 遍历 outParams,添加 name = {name} 到 equation
+//     newParams.forEach(param => {
+//       newEquation += `${param.name}= \n`;
+//     });
+
+//     // 更新 equation 的值
+//     equation.value = newEquation;
+//   },
+//   { deep: true }  // 深度监听,确保数组内部变化也能触发
+// );
 
 const mathfuncnew = () => {
   // console.log('新建')
@@ -190,6 +190,10 @@ let xinjiantablecolumn = () => {
       inParams.value.push({ code: code.value, name: name.value, value: 0, flag: 1 });
     }else if(currentTab1.value === 2){
       outParams.value.push({ code: code.value, name: name.value, value: 0, flag: 1 });
+      equation.value = '';
+      outParams.value.forEach(param => {
+        equation.value += `${param.name}= \n`;
+      });
     }else {
       return;
     }

+ 27 - 1
src/views/vuetree/index.vue

@@ -164,6 +164,14 @@
           :is-indeterminate="isIndeterminate"
           @check-flag-change="handlecheckFlagchange"
         />
+        <linetablecard v-if="datacontent === '10'"
+          v-model:check-all="checkAll"
+          v-model:table-data="youhuaMathFunctable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
       </div>
       <template #footer>
         <div class="dialog-footer">
@@ -621,6 +629,8 @@ let Xfoilyouhuatable = ref([
 
 let Tacsyouhuatable = ref([])
 
+let youhuaMathFunctable = ref([])
+
 let checkAll = ref(false);
 let isIndeterminate = ref(false);
 
@@ -634,6 +644,7 @@ const dataTables = {
   '7': youhuaTACStable,
   '8': MathFuncyouhuatable,
   '9': Tacsyouhuatable,
+  '10': youhuaMathFunctable,
 };
 
 const handlecheckFlagchange = () => {
@@ -667,6 +678,8 @@ const confirmselection=()=>{
     dataFlowsave1(cstid.value,'0');
   }else if(datacontent.value === '7'){
     dataFlowsave1(tacsid.value,'5');
+  }else if(datacontent.value === '10'){
+    dataFlowsave1(mfcid.value,'4');
   }else if(datacontent.value === '5'){
     dataFlowsave2(adid.value,'3',mfcid.value,'4');
   }else if(datacontent.value === '6'){
@@ -854,6 +867,15 @@ function onEdgeDoubleClick(e) {
     }else{
       ElMessage.error('TACS未初始化!')
     }
+  }else if( youhualist.includes(qidian) && zhongdian ==='MathFunc') {
+    datacontent.value = '10';
+    mfcid.value = e.edge.sourceNode.data.mfcid || mfcid.value;
+    if(mfcid.value) {
+      querydataFlow(mfcid,4);
+      dataflowshow.value = true;
+    }else{
+      ElMessage.error('MathFunc未初始化!')
+    }
   }
   console.log('leixing:',datacontent.value);
 
@@ -894,7 +916,11 @@ const querydataFlow = (comid,type) => {
       Tacsyouhuatable.value = res.params;
       handlecheckFlagchange();
     }
-    
+    if(datacontent.value === '10'){
+      youhuaMathFunctable.value = res.params;
+      handlecheckFlagchange();
+    }
+
   })
   .catch((err) => {
       ElMessage.error(err.returnMsg)