Prechádzať zdrojové kódy

试题倒计时添加,扫码签到功能迁移

lidie 1 rok pred
rodič
commit
0847c30d13

+ 6 - 12
src/router/routes.js

@@ -306,23 +306,17 @@ const frameCustom = [
         meta: { title: '我的考试' },
         component: _import('/platform/bpmn/my-test/index')
       },
+      {
+        path: 'siginin/index',
+        name: 'siginin',
+        meta: { title: '签到' },
+        component: _import('/platform/bpmn/siginin/index')
+      },
       {
         path: 'communication/communicationList',
         name: 'communicationList',
         meta: { title: '信息沟通' },
         component: _import('/platform/bpmn/communication/communicationList')
-      },
-      {
-        path: 'complaint/complaintList',
-        name: 'complaintList',
-        meta: { title: '投诉列表' },
-        component: _import('/platform/bpmn/complaint/complaintList')
-      },
-      {
-        path: 'satisfaction/satisfaction',
-        name: 'satisfaction',
-        meta: { title: '满意度评价' },
-        component: _import('/platform/bpmn/satisfaction/satisfaction')
       }
     ]
   },

+ 3 - 1
src/views/platform/bpmn/my-test/examPop.vue

@@ -7,7 +7,9 @@
     <van-row>
       <van-col span="2" @click="handInAnExaminationPaperBtn()"> <van-icon name="arrow-left" size="18px"
           color="	#1E90FF" /></van-col>
-      <van-col span="20">剩余时间:不限</van-col>
+      <van-col span="20"><span style="font-weight: 600;">剩余时间:&nbsp;&nbsp;&nbsp;&nbsp;</span><span
+          v-if="listData.duration=='不限'">不限</span><van-count-down v-if="listData.duration!=='不限'"
+          :time="listData.duration" style="display: inline-block;" @finish="countDown" /></van-col>
       <van-col span="2" @click="answerSheet=true"><van-icon name="notes-o" size="18px" color="	#1E90FF" /></van-col>
     </van-row>
     <!-- 进度条 -->

+ 183 - 0
src/views/platform/bpmn/siginin/index.vue

@@ -0,0 +1,183 @@
+<template>
+  <div>
+    <div class="headTitle">
+      <van-row>
+        <van-col span="1.5" style="text-align: center;" @click="backHome"><van-icon name="wap-home-o"
+            size="16px" /></van-col>
+        <van-col span="2.5" style="font-size: 16px;" @click="backHome">首页</van-col>
+        <van-col span="13" offset="7" style="font-size: 18px;">签到</van-col>
+      </van-row>
+    </div>
+    <!-- 签到信息 -->
+    <div class="content">
+      <div class="contentNo" v-if="this.statusCode!==2">
+        {{statusCode==0?"已签到,请勿重复操作":statusCode==1?"未获取到相关签到信息":statusCode==3?"二维码已失效":statusCode==4?"错误二维码":""}}</div>
+      <div class="contentTitle" v-if="this.statusCode==2">签到信息</div>
+      <div class="contentShow" v-if="this.statusCode==2">
+        <van-row style="padding: 4% 5%;" v-for="(item,index) in  qdInfo" :key="index">
+          <van-col span="10" class="contentLeft">{{item.label}}</van-col>
+          <van-col span="14" class="contentRight">{{item.value}}</van-col>
+        </van-row>
+      </div>
+    </div>
+    <div class="footBtn"><van-button type="info" @click="interpositionQD()" :disabled="statusCode!==2">点击签到</van-button>
+    </div>
+  </div>
+</template>
+<script>
+  import { mapState } from 'vuex'
+  import Vue from 'vue';
+  import { Toast } from 'vant'
+  Vue.use(Toast)
+  export default {
+    data() {
+      return {
+        qdInfo: [],
+        scanList: [],
+        statusCode: 1,
+        guanlianID: '',
+      }
+    },
+    created() {
+      this.getQdInfo()
+    },
+    computed: {
+      ...mapState('ibps/user', [
+        'info'
+      ]),
+    },
+    methods: {
+      getQdInfo() {
+        // 扫描二维码传递过来的codeId
+        // this.$route.query.codeId = '1244662627406184448'
+        let sql = `select * from t_qrcodeb where id_='${this.$route.query.codeId}'`
+        if (this.$route.query.codeId) {
+          this.$common.request('sql', sql).then(res => {
+            console.log("根据id查询得到的数据", res);
+            let data = res.variables.data || []
+            if (data.length > 0) {
+              this.qdInfo = data[0].xiang_xi_xin_xi_ != '' ? JSON.parse(data[0].xiang_xi_xin_xi_) : 0
+              this.scanList = data[0]
+              if (data[0].zhuang_tai_ == '失效') {
+                // 二维码失效
+                this.statusCode = 3
+              } else {
+                this.getAlreadyQD()
+                this.guanlianID = data[0].guan_lian_id_
+              }
+            }
+
+          })
+        } else {
+          // 错误二维码
+          this.statusCode = 4
+        }
+      },
+      getAlreadyQD() {
+        // t_qdxxb签到信息表
+        let sql = `select * from t_qdxxb where er_wei_ma_id_='${this.$route.query.codeId}' and ren_yuan_id_ = '${this.info.employee.id}'`
+        this.$common.request('sql', sql).then(res => {
+          // console.log("根据this.$route.query.codeId和用户id查询数据库", res);
+          let data = res.variables.data || []
+          if (data.length > 0) {
+            this.statusCode = 0
+          } else {
+            // 1.未获取到相关签到信息2.正常
+            this.statusCode = this.qdInfo.length > 0 ? 2 : 1
+          }
+        })
+      },
+      // 点击签到相当于往数据库添加一条数据
+      interpositionQD() {
+        let ids = []
+        let duixian = {}
+        duixian["parent_id_"] = this.$route.query.codeId
+        duixian["er_wei_ma_id_"] = this.$route.query.codeId
+        duixian["qian_dao_shi_jian"] = this.getNow()
+        duixian["ren_yuan_id_"] = this.info.employee.id
+        duixian["guan_lian_id_"] = this.guanlianID
+        ids.push(duixian)
+        console.log("duixian", duixian);
+        console.log("ids", ids);
+        this.$common.request('add', '{"tableName":"t_qdxxb","paramWhere":' + JSON.stringify(ids) + '}').then(res => {
+          // console.log("res点击签到往数据库添加一条数据", res);
+          if (res.state == 200) {
+            Toast.success('签到成功');
+            setTimeout(() => {
+              this.statusCode = 0
+            }, 1500)
+          }
+
+        })
+      },
+      // 获取当前时间
+      getNow() {
+        const now = new Date();
+        const year = now.getFullYear();
+        const month = ('0' + (now.getMonth() + 1)).slice(-2);
+        const day = ('0' + now.getDate()).slice(-2);
+        const hours = ('0' + now.getHours()).slice(-2);
+        const minutes = ('0' + now.getMinutes()).slice(-2);
+        const seconds = ('0' + now.getSeconds()).slice(-2);
+        const formattedTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
+        return formattedTime
+      },
+      // 返回首页
+      backHome() {
+        this.$router.push({ name: 'dashboard' });
+      }
+    }
+  }
+</script>
+<style scoped lang="scss">
+  .headTitle {
+    width: 100%;
+    background-color: #1E90FF;
+    padding: 5% 5%;
+    color: #fff;
+    font-size: 16px;
+  }
+
+  .content {
+    width: 94%;
+    margin: 5% auto;
+    /* border: 1px solid #ccc; */
+    box-shadow: 0px 0px 2px 1px rgb(226, 226, 226);
+
+    .contentTitle {
+      width: 100%;
+      text-align: center;
+      padding: 5% 0;
+      background-color: #f3f0f0;
+
+    }
+
+    .contentNo {
+      width: 100%;
+      height: 160px;
+      text-align: center;
+      line-height: 160px;
+      font-size: 20px;
+      font-weight: 600;
+    }
+
+    .contentLeft {
+      color: #444;
+    }
+
+    .contentRight {
+      color: #777;
+    }
+  }
+
+  .footBtn {
+    width: 94%;
+    margin: auto;
+
+    .van-button {
+      width: 100%;
+      border-radius: 2%;
+      font-size: 16px;
+    }
+  }
+</style>

+ 188 - 201
src/views/system/login/index.vue

@@ -1,222 +1,209 @@
 <template>
-  <div class="ibps-login">
-    <div class="login-bg">
-      <div class="login-top">
-        <van-icon  name="comment-circle-o" class="logo-icon"/>
-        <div class="logo-text">{{ $t('common.platform') }}</div>
-        <br>
-        <div class="logo-text">(移动端)</div>
-      </div>
-    </div>
-    <div class="ibps-p">
-      <van-form ref="form" @submit="handleLogin" @failed="onFailed">
-        <van-field
-          v-model="loginForm.username"
-          :placeholder="$t('system.login.usernamePlaceholder')"
-          :rules="usernameRules"
-          name="username"
-          icon-prefix="ibps-icon"
-          left-icon="user-circle-o"
-          clearable
-        />
-        <van-field
-          v-model="loginForm.password"
-          :type="passwordType"
-          :placeholder="$t('system.login.passwordPlaceholder')"
-          :rules="[{ required: true, message: ' ' }]"
-          :right-icon="passwordType==='password'?'eye-slash':'eye'"
-          name="password"
-          icon-prefix="ibps-icon"
-          left-icon="lock"
-          clearable
-          @click-right-icon="showPassword"
-        />
-        <van-field
-          v-if="enabledValidCode"
-          v-model="loginForm.captcha"
-          :placeholder="$t('system.login.codePlaceholder')"
-          :rules="[{ required: true, message: ' ' }]"
-          name="captcha"
-          icon-prefix="ibps-icon"
-          left-icon="qrcode"
-          clearable
-        >
-          <template #button>
-            <img :src="code.src" class="login-code-img" @click="refreshCode">
-          </template>
-        </van-field>
-        <div class="ibps-mt">
-          <van-button round block type="info" native-type="submit">
-            {{ $t('system.login.logIn') }}
-          </van-button>
+  <div>
+    <div class="ibps-login">
+      <div class="login-bg">
+        <div class="login-top">
+          <van-icon name="comment-circle-o" class="logo-icon" />
+          <div class="logo-text">{{ $t('common.platform') }}</div>
+          <br>
+          <div class="logo-text">(移动端)</div>
         </div>
-      </van-form>
-
-      <switch-environment v-if="$nodeEnv === 'development'" class="ibps-mt ibps-text-center" type="link" />
-    </div>
-    <div class="copyright">
-     {{ $t('common.company') }}©{{ $t('common.copyright') }}
+      </div>
+      <div class="ibps-p">
+        <van-form ref="form" @submit="handleLogin" @failed="onFailed">
+          <van-field v-model="loginForm.username" :placeholder="$t('system.login.usernamePlaceholder')"
+            :rules="usernameRules" name="username" icon-prefix="ibps-icon" left-icon="user-circle-o" clearable />
+          <van-field v-model="loginForm.password" :type="passwordType"
+            :placeholder="$t('system.login.passwordPlaceholder')" :rules="[{ required: true, message: ' ' }]"
+            :right-icon="passwordType==='password'?'eye-slash':'eye'" name="password" icon-prefix="ibps-icon"
+            left-icon="lock" clearable @click-right-icon="showPassword" />
+          <van-field v-if="enabledValidCode" v-model="loginForm.captcha"
+            :placeholder="$t('system.login.codePlaceholder')" :rules="[{ required: true, message: ' ' }]" name="captcha"
+            icon-prefix="ibps-icon" left-icon="qrcode" clearable>
+            <template #button>
+              <img :src="code.src" class="login-code-img" @click="refreshCode">
+            </template>
+          </van-field>
+          <div class="ibps-mt">
+            <van-button round block type="info" native-type="submit">
+              {{ $t('system.login.logIn') }}
+            </van-button>
+          </div>
+        </van-form>
+        <switch-environment v-if="$nodeEnv === 'development'" class="ibps-mt ibps-text-center" type="link" />
+      </div>
+      <div class="copyright">
+        {{ $t('common.company') }}©{{ $t('common.copyright') }}
+      </div>
     </div>
   </div>
 </template>
 
 <script>
-import { mapActions } from 'vuex'
-import Utils from '@/utils/util'
-import '@/assets/styles/pages/login.scss'
-import SwitchEnvironment from '@/views/system/switch-environment'
+  import { mapActions } from 'vuex'
+  import Utils from '@/utils/util'
+  import '@/assets/styles/pages/login.scss'
+  import SwitchEnvironment from '@/views/system/switch-environment'
 
-const loginForm = process.env.NODE_ENV === 'development'
-  ? {
-    username: 'admin',
-    password: '1'
-  } : {
-    username: '',
-    password: ''
-  }
-export default {
-  components: {
-    SwitchEnvironment
-  },
-  data() {
-    return {
-      passwordType: 'password',
-      loginForm: {
-        username: loginForm.username,
-        password: loginForm.password,
-        requestId: '',
-        captcha: ''
-      },
-      redirect: undefined,
-      isRegOpen: false,
-      enabledValidCode: false,
-      code: {
-        src: '',
-        value: '',
-        len: 5,
-        type: 'src'
-      },
-      usernameRules: [{ required: true, message: ' ' }]
-    }
-  },
-  watch: {
-    $route: {
-      handler: function(route) {
-        this.redirect = route.query && route.query.redirect
-      },
-      immediate: true
+  const loginForm = process.env.NODE_ENV === 'development'
+    ? {
+      username: 'admin',
+      password: '1'
+    } : {
+      username: '',
+      password: ''
     }
-  },
-  created() {
-    this.isRegisterOpen()
-    this.loadValidCode(true)
-  },
-  mounted() {
-    // 注销退出清空验证码
-    this.loginForm.captcha = ''
-    // 注销退出清空请求ID
-    this.loginForm.requestId = ''
-  },
-  methods: {
-    ...mapActions('ibps/account', [
-      'login',
-      'getCaptcha',
-      'getRegisterOpen'
-    ]),
-    isRegisterOpen() {
-      this.getRegisterOpen().then((data) => {
-        this.isRegOpen = data.data
-        if (this.isRegOpen) {
-          this.usernameRules = [
-            { required: true, message: ' ' },
-            { validator: this.validateMobile, message: ' ' }
-          ]
-        } else {
-          this.usernameRules = [{ required: true, message: ' ' }]
-        }
-      }).catch((e) => {})
+  export default {
+    components: {
+      SwitchEnvironment
+    },
+    data() {
+      return {
+        passwordType: 'password',
+        loginForm: {
+          username: loginForm.username,
+          password: loginForm.password,
+          requestId: '',
+          captcha: ''
+        },
+        // redirect: undefined,
+        redirect: null,
+        isRegOpen: false,
+        enabledValidCode: false,
+        code: {
+          src: '',
+          value: '',
+          len: 5,
+          type: 'src'
+        },
+        usernameRules: [{ required: true, message: ' ' }]
+      }
+    },
+    watch: {
+      $route: {
+        handler: function (route) {
+          // if (route.query.codeId) {
+          // this.redirect = '/dashboard'
+          // this.redirect = `${route.path}?codeId=${route.query.codeId}`;
+          // } else {
+          this.redirect = route.query && route.query.redirect
+          // }
+        },
+        immediate: true
+      }
     },
-    validateMobile(value) {
-      if (Utils.isEmpty(value)) {
-        return false
-      } else {
-        const isPhone = /^1(3|4|5|6|7|8|9)\d{9}$/
-        if (value.length === 11) {
-          if (!isPhone.test(value)) {
-            return false
+
+    created() {
+      this.isRegisterOpen()
+      this.loadValidCode(true)
+    },
+    mounted() {
+      // 注销退出清空验证码
+      this.loginForm.captcha = ''
+      // 注销退出清空请求ID
+      this.loginForm.requestId = ''
+    },
+    methods: {
+      ...mapActions('ibps/account', [
+        'login',
+        'getCaptcha',
+        'getRegisterOpen'
+      ]),
+      isRegisterOpen() {
+        this.getRegisterOpen().then((data) => {
+          this.isRegOpen = data.data
+          if (this.isRegOpen) {
+            this.usernameRules = [
+              { required: true, message: ' ' },
+              { validator: this.validateMobile, message: ' ' }
+            ]
           } else {
-            return true
+            this.usernameRules = [{ required: true, message: ' ' }]
           }
+        }).catch((e) => { })
+      },
+      validateMobile(value) {
+        if (Utils.isEmpty(value)) {
+          return false
         } else {
-          if (!isPhone.test(value)) {
-            return false
+          const isPhone = /^1(3|4|5|6|7|8|9)\d{9}$/
+          if (value.length === 11) {
+            if (!isPhone.test(value)) {
+              return false
+            } else {
+              return true
+            }
           } else {
-            return false
+            if (!isPhone.test(value)) {
+              return false
+            } else {
+              return false
+            }
           }
         }
-      }
-    },
-    // 获取验证码
-    loadValidCode(isBackfill) {
-      this.getCaptcha({ params: { requestId: this.loginForm.requestId }}).then((data) => {
-        // 返回状态501,说明系统没有开启验证码
-        if (data.state === 501) {
-          this.enabledValidCode = false
-        } else {
-          this.enabledValidCode = true
-          this.code.src = data.data
-          this.loginForm.requestId = data.variables.requestId
-        }
-        this.initValidCode()
-        if (isBackfill) {
-          this.loginForm.code = this.code.value
-        }
-      }).catch((e) => {
-
-      })
-    },
-    refreshCode() {
-      this.loadValidCode()
-    },
-    showPassword() {
-      this.passwordType === 'text'
-        ? (this.passwordType = 'password')
-        : (this.passwordType = 'text')
-    },
-    onFailed({ values }) {
-      if (this.enabledValidCode && this.$utils.isEmpty(values.captcha)) {
-        this.$toast(this.$t('system.login.codeCorrect'))
-        return
-      }
+      },
+      // 获取验证码
+      loadValidCode(isBackfill) {
+        this.getCaptcha({ params: { requestId: this.loginForm.requestId } }).then((data) => {
+          // 返回状态501,说明系统没有开启验证码
+          if (data.state === 501) {
+            this.enabledValidCode = false
+          } else {
+            this.enabledValidCode = true
+            this.code.src = data.data
+            this.loginForm.requestId = data.variables.requestId
+          }
+          this.initValidCode()
+          if (isBackfill) {
+            this.loginForm.code = this.code.value
+          }
+        }).catch((e) => {
 
-      if (this.$utils.isNotEmpty(values.username) && this.isRegOpen) {
-        this.$toast(this.$t('system.login.mobileCorrect'))
-      } else {
-        this.$toast(this.$t('system.login.usernamePasswordCorrect'))
-      }
-    },
-    handleLogin() {
-      this.login({
-        form: this.loginForm
-      }).then(() => {
-        let path = '/'
-        if (this.redirect) {
-          path = '/dashboard'
-        }
-        this.$router.push({ path: path })
-      }).catch((err) => {
-        // 验证码错误自动清空&密码输入错误3次后触发验证码填写模块
-        if (err && err.state === 6020104) {
-          this.loginForm.captcha = ''
-          this.enabledValidCode = true
-          this.refreshCode()
+        })
+      },
+      refreshCode() {
+        this.loadValidCode()
+      },
+      showPassword() {
+        this.passwordType === 'text'
+          ? (this.passwordType = 'password')
+          : (this.passwordType = 'text')
+      },
+      onFailed({ values }) {
+        if (this.enabledValidCode && this.$utils.isEmpty(values.captcha)) {
+          this.$toast(this.$t('system.login.codeCorrect'))
+          return
         }
-        if (err && err.state && this.enabledValidCode) {
-          this.loginForm.captcha = ''
-          this.refreshCode()
+
+        if (this.$utils.isNotEmpty(values.username) && this.isRegOpen) {
+          this.$toast(this.$t('system.login.mobileCorrect'))
+        } else {
+          this.$toast(this.$t('system.login.usernamePasswordCorrect'))
         }
-      })
+      },
+      handleLogin() {
+        this.login({
+          form: this.loginForm
+        }).then(() => {
+          // let path = '/'
+          // if (this.redirect) {
+          //   path = '/dashboard'
+          // }
+          let redirectPath = this.redirect || '/';
+          this.$router.push({ path: redirectPath })
+        }).catch((err) => {
+          // 验证码错误自动清空&密码输入错误3次后触发验证码填写模块
+          if (err && err.state === 6020104) {
+            this.loginForm.captcha = ''
+            this.enabledValidCode = true
+            this.refreshCode()
+          }
+          if (err && err.state && this.enabledValidCode) {
+            this.loginForm.captcha = ''
+            this.refreshCode()
+          }
+        })
+      }
     }
   }
-}
-</script>
+</script>