liuguocan
2023-03-14 ef61883a5437d03c5e384ba0b35c3e0885a882ab
登录页面添加滑块校验/报表页面高度问题处理
1 文件已重命名
2个文件已添加
4个文件已修改
155 ■■■■ 已修改文件
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/report/demo/print_1.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tool/report_design/iframe.css 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tool/report_design/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/dragVerify/index.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/user/login.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -55,6 +55,7 @@
    "vue": "2.6.12",
    "vue-count-to": "1.0.13",
    "vue-cropper": "0.5.5",
    "vue-drag-verify": "^1.0.6",
    "vue-meta": "2.4.0",
    "vue-router": "3.4.9",
    "vuedraggable": "2.24.3",
src/router/index.js
@@ -43,7 +43,7 @@
  },
  {
    path: '/login',
    component: () => import('@/views/login'),
    component: () => import('@/views/user/login'),
    hidden: true
  },
  {
src/views/report/demo/print_1.vue
@@ -1,5 +1,7 @@
<template>
  <iframe ref="iframe" :src="url" scrolling="auto" :style="{height:'calc(100% - 5px)',width:'100%',border:'none'}" />
  <div class="report-box">
    <iframe id="iframe-box" @load="loadFrame" ref="iframe" :src="url" scrolling="auto" :style="{height:'100%',width:'100%',border:'none'}" />
  </div>
</template>
<script>
@@ -20,10 +22,24 @@
      let token = getToken();
      this.url = globalConf.baseUrl + `/jmreport/view/ff9bd143582a6dfed897ba8b6f93b175?token=${token}`
      this.height = window.screen.availHeight
    },
    methods:{
      loadFrame() {
        const iframeBox = document.getElementById('iframe-box')
        const doc = iframeBox.contentWindow.document
        const head = doc.getElementsByTagName('head')
        const linkTag = document.createElement('link')
        linkTag.id = 'newstyle'
        linkTag.href = `./iframe.css`
        linkTag.setAttribute('rel', 'stylesheet')
        linkTag.setAttribute('type', 'text/css')
        head[0].append(linkTag)
      }
    }
  }
</script>
<style scoped>
<style lang="scss">
.report-box{
  height: calc( 100vh - 150px );
}
</style>
src/views/tool/report_design/iframe.css
New file
@@ -0,0 +1,3 @@
.jm-sheet-sheet{
  padding-left: 20px!important;
}
src/views/tool/report_design/index.vue
@@ -1,5 +1,7 @@
<template>
  <iframe ref="iframe" :src="url" scrolling="auto" :style="{height:'calc(100% - 5px)',width:'100%',border:'none'}" />
  <div class="report-box">
    <iframe ref="iframe" :src="url" scrolling="auto" :style="{height:'100%',width:'100%',border:'none'}" />
  </div>
</template>
<script>
@@ -24,6 +26,8 @@
  }
</script>
<style scoped>
<style lang="scss">
.report-box{
  height: calc( 100vh - 150px );
}
</style>
src/views/user/dragVerify/index.vue
New file
@@ -0,0 +1,58 @@
<template>
  <drag-verify
    :width="width"
    :height="height"
    :text="text"
    :success-text="successText"
    :background="background"
    :progress-bar-bg="progressBarBg"
    :completed-bg="completedBg"
    :handler-bg="handlerBg"
    :handler-icon="handlerIcon"
    :text-size="textSize"
    :success-icon="successIcon"
    @passcallback="passcallback2"
    ref="Verify"
  >
  </drag-verify>
</template>
<script>
import dragVerify from 'vue-drag-verify'
import 'font-awesome/css/font-awesome.min.css'
export default {
  name: 'DragVerify',
  components: {
    dragVerify
  },
  data () {
    return {
      handlerIcon: 'fa fa-angle-double-right',
      successIcon: 'fa fa-check',
      background: '#f5f5f5',
      progressBarBg: 'rgba(71,141,251,0.5)',
      completedBg: '#1890ff',
      handlerBg: '#fff',
      text: '请将滑块拖动到右侧',
      successText: '验证成功',
      width: 350,
      height: 45,
      textSize: '14px',
      isCircle: 'true'
    }
  },
  methods: {
    passcallback2 () {
      if (this.$refs.Verify.isPassing) {
        this.$emit('success')
      }
    }
  }
}
</script>
<style>
.drag_verify .dv_handler_bg{
  width: 45px!important;
  height: 45px!important;
}
</style>
src/views/user/login.vue
File was renamed from src/views/login.vue
@@ -23,19 +23,20 @@
          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
        </el-input>
      </el-form-item>
      <el-form-item prop="code" v-if="captchaEnabled">
        <el-input
          v-model="loginForm.code"
          auto-complete="off"
          placeholder="验证码"
          style="width: 63%"
          @keyup.enter.native="handleLogin"
        >
          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
        </el-input>
        <div class="login-code">
          <img :src="codeUrl" @click="getCode" class="login-code-img"/>
        </div>
      <el-form-item>
<!--        <el-input-->
<!--          v-model="loginForm.code"-->
<!--          auto-complete="off"-->
<!--          placeholder="验证码"-->
<!--          style="width: 63%"-->
<!--          @keyup.enter.native="handleLogin"-->
<!--        >-->
<!--          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />-->
<!--        </el-input>-->
<!--        <div class="login-code">-->
<!--          <img :src="codeUrl" @click="getCode" class="login-code-img"/>-->
<!--        </div>-->
        <drag-verify @success="verifyTrue" ref="verify"/>
      </el-form-item>
      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
      <el-form-item style="width:100%;">
@@ -62,20 +63,22 @@
</template>
<script>
import { getCodeImg } from "@/api/login";
import dragVerify from './dragVerify/index.vue'// 滑动验证组件
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
  name: "Login",
  components: {
    'drag-verify': dragVerify
  },
  data() {
    return {
      verify:false,
      codeUrl: "",
      loginForm: {
        username: "",
        password: "",
        username: "supervisor",
        password: "123456",
        rememberMe: false,
        code: "",
        uuid: ""
      },
      loginRules: {
@@ -104,10 +107,13 @@
    }
  },
  created() {
    this.getCode();
    // this.getCode();
    this.getCookie();
  },
  methods: {
    verifyTrue () {
      this.verify = true
    },
    getCode() {
      getCodeImg().then(res => {
        // console.log(res);
@@ -137,6 +143,11 @@
    handleLogin() {
      this.$refs.loginForm.validate(valid => {
        if (valid) {
          if (!this.verify) {
            this.$message.error('请先完成验证')
            this.loading = false
            return
          }
          this.loading = true;
          if (this.loginForm.rememberMe) {
            Cookies.set("username", this.loginForm.username, { expires: 30 });
@@ -151,9 +162,9 @@
            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
          }).catch(() => {
            this.loading = false;
            if (this.captchaEnabled) {
              this.getCode();
            }
            // if (this.captchaEnabled) {
            //   this.getCode();
            // }
          });
        }
      });
@@ -168,7 +179,7 @@
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-image: url("../../assets/images/login-background.jpg");
  background-size: cover;
}
.title {