吉安感知网项目-前端
罗广辉
2026-02-09 94ad7022d69f6234f5f283c78708bcff6ceba4ac
feat: 免密登陆-工单
10 files modified
1 files added
153 ■■■■ changed files
applications/drone-command/env/.env 4 ●●●● patch | view | raw | blame | history
applications/drone-command/src/page/index/top/index.vue 6 ●●●● patch | view | raw | blame | history
applications/drone-command/src/page/login/loginByUser.vue 2 ●●● patch | view | raw | blame | history
applications/drone-command/src/page/login/userlogin.vue 1 ●●●● patch | view | raw | blame | history
applications/drone-command/src/store/modules/user.js 1 ●●●● patch | view | raw | blame | history
applications/task-work-order/env/.env 3 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/App.vue 18 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/page/index/top/index.vue 9 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/page/login/loginByUser.vue 33 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/page/login/userlogin.vue 66 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/router/page/index.js 10 ●●●●● patch | view | raw | blame | history
applications/drone-command/env/.env
@@ -14,3 +14,7 @@
VITE_BUILD_COMPRESS=gzip
VITE_APP_TERRAIN_URL=https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_c_uas/
#父系统
VITE_APP_PARENT_SYSTEM=http://219.146.74.42:8015/drone-web
applications/drone-command/src/page/index/top/index.vue
@@ -93,7 +93,11 @@
        cancelButtonClass: 'command-message-box-cancel',
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
                    this.$router.push({ path: '/login' })
                    const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
                    const isDev = VITE_APP_ENV === 'development'
                    isDev
                        ? this.$router.push({ path: '/login' })
                        : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
        })
      })
    },
applications/drone-command/src/page/login/loginByUser.vue
@@ -15,7 +15,7 @@
store
    .dispatch('LoginByUsername', {
        username: userName,
        password: 'jadk@2026',
        password: userName === 'admin' ? 'admin' :'jadk@2026',
        tenantId: '000000',
        type: 'account',
    })
applications/drone-command/src/page/login/userlogin.vue
@@ -50,7 +50,6 @@
<script>
import { mapGetters } from 'vuex';
import { info } from '@/api/system/tenant';
import { getCaptcha } from '@/api/user';
import { getTopUrl } from '@/utils/util';
export default {
applications/drone-command/src/store/modules/user.js
@@ -240,6 +240,7 @@
            removeToken()
            removeRefreshToken()
            resolve()
                        localStorage.clear()
          })
          .catch(error => {
            reject(error)
applications/task-work-order/env/.env
@@ -27,3 +27,6 @@
#地形服务地址
VITE_APP_TERRAIN_URL=https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_c_uas/
#父系统
VITE_APP_PARENT_SYSTEM=http://219.146.74.42:8015/drone-web/#/
applications/task-work-order/src/App.vue
@@ -7,14 +7,20 @@
import { useStore } from 'vuex'
const store = useStore()
const authToken = window.localStorage?.authToken
function getXTToken() {
    loginWithMiniProgramApi({ username: 'admin' }).then(res => {
        store.commit('setXtToken', res.data.data.access_token)
    })
store.commit('setXtToken', authToken)
const { VITE_APP_ENV } = import.meta.env
if (VITE_APP_ENV === 'development') {
    function getXTToken() {
        loginWithMiniProgramApi({ username: 'admin' }).then(res => {
            store.commit('setXtToken', res.data.data.access_token)
        })
    }
    getXTToken()
    setInterval(getXTToken, 600000)
}
getXTToken()
setInterval(getXTToken, 600000)
</script>
<style>
applications/task-work-order/src/page/index/top/index.vue
@@ -87,10 +87,11 @@
        type: 'warning',
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
        const env = import.meta.env.VITE_APP_ENV
          const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
                    this.$router.push({ path: '/login' })
           // env === 'development' ? this.$router.push({ path: '/login' }):window.location.replace(`${adminUrl}#/login`)
                    const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
            const isDev = VITE_APP_ENV === 'development'
                    isDev
                        ? this.$router.push({ path: '/login' })
                        : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
        })
      })
    },
applications/task-work-order/src/page/login/loginByUser.vue
New file
@@ -0,0 +1,33 @@
<template>
    <div style="width: 100%; height: 100%; background: #FFFFFF"></div>
</template>
<script setup>
import { useStore } from 'vuex'
import { ElLoading } from 'element-plus'
const store = useStore()
const router = useRouter()
const userName = window.localStorage?.userName
const route = useRoute()
let loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.3)', text: '加载中...' })
const tagWel = computed(() => store.state.tags.tagWel)
const redirect = route.query.redirect
store
    .dispatch('LoginByUsername', {
        username: userName,
        password: userName === 'admin' ? 'admin' :'jadk@2026',
        tenantId: '000000',
        type: 'account',
    })
    .then(() => {
        loading.close()
        router.push(redirect || tagWel.value)
    })
    .catch(err => {
        loading.close()
        // 返回上一个路由
        window.history.go(-1)
    })
</script>
<style scoped lang="scss"></style>
applications/task-work-order/src/page/login/userlogin.vue
@@ -7,24 +7,12 @@
    :model="loginForm"
    label-width="0"
  >
    <!-- <el-form-item v-if="tenantMode" prop="tenantId">
      <el-input
        @keyup.enter="handleLogin"
        v-model="loginForm.tenantId"
        auto-complete="off"
        :placeholder="$t('login.tenantId')"
      >
        <template #prefix>
          <i class="icon-quanxian" />
        </template>
      </el-input>
    </el-form-item> -->
    <el-form-item prop="username">
      <el-input
        @keyup.enter="handleLogin"
        v-model="loginForm.username"
        auto-complete="off"
        :placeholder="$t('login.username')"
        placeholder="请输入账号"
      >
        <template #prefix>
          <i class="icon-yonghu" />
@@ -37,7 +25,7 @@
        :type="passwordType"
        v-model="loginForm.password"
        auto-complete="off"
        :placeholder="$t('login.password')"
        placeholder="请输入密码"
      >
        <template #suffix>
          <i class="el-icon-view el-input__icon" @click="showPassword" />
@@ -47,49 +35,15 @@
        </template>
      </el-input>
    </el-form-item>
    <!-- <el-form-item v-if="this.website.captchaMode" prop="code">
      <el-row :span="24">
        <el-col :span="16">
          <el-input
            @keyup.enter="handleLogin"
            v-model="loginForm.code"
            auto-complete="off"
            :placeholder="$t('login.code')"
          >
            <template #prefix>
              <i class="icon-yanzhengma" />
            </template>
          </el-input>
        </el-col>
        <el-col :span="8">
          <div class="login-code">
            <img :src="loginForm.image" class="login-code-img" @click="refreshCode" />
          </div>
        </el-col>
      </el-row>
    </el-form-item> -->
    <el-form-item>
      <el-button
        style="width: 100%;"
        type="primary"
        @click.prevent="handleLogin"
        :class="this.registerMode ? 'login-submit' : 'btn-submit'"
        >{{ $t('login.submit') }}
        >登 录
      </el-button>
      <!-- <el-button
        v-if="this.registerMode"
        type="danger"
        @click.prevent="handleRegister"
        class="register-submit"
        >{{ $t('login.register') }}
      </el-button> -->
    </el-form-item>
    <!-- <el-dialog title="用户信息选择" append-to-body v-model="userBox" width="350px">
      <avue-form :option="userOption" v-model="userForm" @submit="submitLogin" />
    </el-dialog>
    <el-dialog title="用户信息注册" append-to-body v-model="registerBox" width="350px">
      <avue-form :option="registerOption" v-model="registerForm" @submit="submitRegister" />
    </el-dialog> -->
  </el-form>
</template>
@@ -346,19 +300,6 @@
          this.$store
            .dispatch('LoginByUsername', this.loginForm)
            .then(() => {
              if (this.website.switchMode) {
                const deptId = this.userInfo.dept_id;
                const roleId = this.userInfo.role_id;
                if (deptId.includes(',') || roleId.includes(',')) {
                  this.loginForm.deptId = deptId;
                  this.loginForm.roleId = roleId;
                  this.userBox = true;
                  this.$store.dispatch('LogOut').then(() => {
                    loading.close();
                  });
                  return false;
                }
              }
              loading.close();
              //加载工作流路由集
              this.loadFlowRoutes();
@@ -367,7 +308,6 @@
            .catch(err => {
              console.log(err);
              loading.close();
              this.refreshCode();
            });
        }
      });
applications/task-work-order/src/router/page/index.js
@@ -12,6 +12,16 @@
        },
    },
    {
        path: '/logInByUser',
        name: '按用户登录',
        component: () => import('@/page/login/loginByUser.vue'),
        meta: {
            keepAlive: false,
            isTab: false,
            isAuth: false,
        },
    },
    {
        path: '/oauth/redirect/:source',
        name: '第三方登录',
        component: () => (Store.getters.isMacOs ? import('@/mac/login.vue') : import('@/page/login/index.vue')),