coys 1 år sedan
förälder
incheckning
e441aa5f65

+ 4 - 0
src/App.vue

@@ -1,10 +1,14 @@
 <template>
   <div id="app">
+    <watercom></watercom>
     <router-view />
   </div>
 </template>
 <script>
+// import watercom from '@/components/waterCom.vue'
+
 export default {
+  
   name: 'App'
 }
 </script>

+ 4 - 0
src/components/TopBar.vue

@@ -55,6 +55,7 @@
 <script>
 import { Icon } from 'vant'
 import { mapGetters } from 'vuex'
+
 import { logout, getTheAreaWeather } from '@/api/public'
 export default {
   components: {
@@ -109,6 +110,9 @@ export default {
       }
     },
     clickOutLogin() {
+      
+      // window.location.reload()
+      
       logout().then(res => {
         sessionStorage.clear()
         this.$router.replace('/login')

+ 72 - 0
src/components/waterCom.vue

@@ -0,0 +1,72 @@
+<template>
+  <div id="water" >
+   
+    <canvas id="canvas"></canvas>
+  </div>
+</template>
+<script>
+import {  newDateDay } from '@/utils/date.js'
+
+export default {
+  name: 'SocAppWaterCom',
+
+  data() {
+    return {
+        name:'',
+        userName:'',
+        date:newDateDay()
+    }
+  },
+  
+  created(){
+    this.name=JSON.parse(window.sessionStorage.getItem('SET_USER_ORGNAME'))
+    this.userName=JSON.parse(window.sessionStorage.getItem('SET_USER_NAME'))
+  },
+  mounted() {
+    this.getWater()
+  },
+  watch:{
+    'sessionStorage.SET_USER_NAME'(val){
+        
+        if(val){
+            console.log(val);
+            this.getWater()
+        }
+    }
+  },
+
+  methods: {
+    getWater() {
+      let orgName=JSON.parse(sessionStorage.getItem('SET_USER_ORGNAME'))
+      let userName=JSON.parse(sessionStorage.getItem('SET_USER_NAME'))
+      console.log(this.$store.getters,'this.$store.getters');
+      const canvas = document.getElementById('canvas') //获取canvas
+      // canvas.width = 800 //设置画布宽度
+      canvas.height = 200 //设置画布高度
+      canvas.style.display = 'none' //隐藏画布本身
+       //加层级权重
+     
+      const ctx = canvas.getContext('2d') //获取画笔
+      ctx.font = '18px -apple-system'
+    //   设置文字大小
+      ctx.fillStyle = 'rgba(0,0,0,.1)' //设置文字颜色及透明度
+      ctx.rotate(-0.3) //设置文字旋转角度
+      ctx.fillText(`${userName||''}${orgName||''}${this.date}`, -10, 120) //设置显示文字内容
+      const img = canvas.toDataURL('image/png') //参数默认为 image/png,可以是其他image/jpeg等,该方法返回值是一个url,是base64组成的图片的源数据、可以直接赋值给图片的src属性
+      const style = `background-image:url(${img});width:300px;z-index:111;display:none;` //定义样式
+      water.setAttribute('style', style) //给要添加水印的元素设置样式
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+#water {
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  left: 0;
+  top: 0;
+//   z-index: -1;
+  pointer-events: none;
+}
+</style>

+ 37 - 16
src/main.js

@@ -2,25 +2,25 @@
 // https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
 //import 'core-js/stable'
 //import 'regenerator-runtime/runtime'
-require("@/assets/css/index.scss")
+require('@/assets/css/index.scss')
 import Vue from 'vue'
 import App from './App.vue'
-import Vant from 'vant';
-import 'vant/lib/index.css';
+import Vant from 'vant'
+import 'vant/lib/index.css'
 import router from './router'
 import store from './store'
 // 引入样式
-import "vue-easytable/libs/theme-default/index.css";
+import 'vue-easytable/libs/theme-default/index.css'
 // 引入组件库
-import VueEasytable from "vue-easytable";
-import dayjs from "dayjs";
-import {imgUrl} from "@/utils";
+import VueEasytable from 'vue-easytable'
+import dayjs from 'dayjs'
+import { imgUrl } from '@/utils'
 // 设置 js中可以访问 $cdn
 import config, { $cdn } from '@/config'
 import EmptyBox from '@/components/EmptyBox'
 Vue.prototype.$cdn = $cdn
 Vue.prototype.dayjs = dayjs
-Vue.prototype.imgUrl = imgUrl;
+Vue.prototype.imgUrl = imgUrl
 
 // 移动端适配
 import 'amfe-flexible'
@@ -28,16 +28,37 @@ import 'amfe-flexible'
 // filters
 import './filters'
 Vue.config.productionTip = false
-import VCalendar from 'v-calendar';
-import globals from "@/utils/global.js"//全局混入
+import VCalendar from 'v-calendar'
+import globals from '@/utils/global.js' //全局混入
 import '@vant/touch-emulator'
 import './components/index.js'
-Vue.use(Vant);
-Vue.use(VueEasytable);
-Vue.use(globals);
-Vue.use(VCalendar,{
-  componentPrefix: 'vc',  // Use <vc-calendar /> instead of <v-calendar />
-});
+import watercom from '@/components/waterCom.vue'
+Vue.component('watercom', watercom)
+/*实时获取 sessionStorage 的值*/
+Vue.prototype.resetSetItem = function (key, newVal) {
+  //注意categoryNum为要监听的属性,实际开发中请自行修改
+  if (key === 'userName') {
+    // 创建一个StorageEvent事件
+    var newStorageEvent = document.createEvent('StorageEvent')
+    const storage = {
+      setItem: function (k, val) {
+        sessionStorage.setItem(k, val)
+        // 初始化创建的事件
+        newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null)
+        // 派发对象
+        window.dispatchEvent(newStorageEvent)
+      }
+    }
+    return storage.setItem(key, newVal)
+  }
+}
+Vue.use(Vant)
+// Vue.use(watercom);
+Vue.use(VueEasytable)
+Vue.use(globals)
+Vue.use(VCalendar, {
+  componentPrefix: 'vc' // Use <vc-calendar /> instead of <v-calendar />
+})
 new Vue({
   el: '#app',
   router,

+ 19 - 9
src/router/index.js

@@ -24,33 +24,43 @@ Router.prototype.replace = function push(location, onResolve, onReject) {
 }
 // 路由守卫
 router.beforeEach((to, from, next) => {
+  //路由守卫控制登陆页面取消水印非登录页显示水印
+  if (to.path === '/login') {
+    if (document.querySelector('#water')) {
+      document.querySelector('#water').style.display = 'none'
+    }
+  } else {
+    if (document.querySelector('#water')) {
+      document.querySelector('#water').style.display = 'block'
+    }
+  }
   console.log('从' + from.path + '跳向' + to.path)
   //如果当前是工作台页面返回的时候判断当前是否是A标签跳转是进行重定向到works
   switch (to.path) {
     case '/lz':
-      next('/works') 
+      next('/works')
       break
     case '/dy':
-      next('/works') 
+      next('/works')
       break
     case '/jc':
-      next('/works') 
+      next('/works')
       break
     case '/yl':
-      next('/works') 
+      next('/works')
       break
     case '/px':
-      next('/works') 
+      next('/works')
       break
     case '/qt':
-      next('/works') 
+      next('/works')
       break
     case '/py':
-      next('/works') 
+      next('/works')
     case '/wbpj':
-      next('/works') 
+      next('/works')
     case '/wtzg':
-      next('/works') 
+      next('/works')
       break
   }
   if (to.path === '/login' || to.path === '/tokenlogin') return next()

+ 4 - 0
src/store/modules/user.js

@@ -39,6 +39,10 @@ const mutations = {
     state.orgName = val;
     sessionStorage.setItem("SET_USER_ORGNAME", JSON.stringify(val))
   },
+  DELETE_USER_ORGNAME(state, val) {
+    state.orgName = '';
+    sessionStorage.setItem("SET_USER_ORGNAME", JSON.stringify(''))
+  },
 }
 const actions = {
   // 设置name

+ 1 - 0
src/views/home/works.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="index-container">
+    
     <nav-bar :leftArrow="false"></nav-bar>
 
     <!-- 步骤条 -->

+ 31 - 30
src/views/login.vue

@@ -27,15 +27,15 @@
           <template #title>
             <p class="check-box">
               <van-checkbox class="custom-title" icon-size="15" v-model="checked" shape="square">记住密码</van-checkbox>
-              <router-link style="color:#1989fa" to="#"> 忘记密码 </router-link>
+              <router-link style="color: #1989fa" to="#"> 忘记密码 </router-link>
             </p>
           </template>
         </van-cell>
-<!--        <div>-->
-<!--          <van-checkbox v-model="checked" shape="square">记住密码</van-checkbox>-->
-<!--          <a href=""> 忘记密码 </a>-->
-<!--        </div>-->
-        <div style="margin: 16px;">
+        <!--        <div>-->
+        <!--          <van-checkbox v-model="checked" shape="square">记住密码</van-checkbox>-->
+        <!--          <a href=""> 忘记密码 </a>-->
+        <!--        </div>-->
+        <div style="margin: 16px">
           <van-button block type="info" native-type="submit">登录</van-button>
         </div>
       </van-form>
@@ -43,45 +43,46 @@
   </div>
 </template>
 
-<script>2
+<script>
+2
 // 请求接口
-import {login} from '@/api/public.js'
+import { login } from '@/api/public.js'
 import { mapGetters } from 'vuex'
 export default {
   data() {
     return {
       wechat: `${this.$cdn}/wx/640.gif`,
-      formData:{
-        username:'',
-        password:'',
+      formData: {
+        username: '',
+        password: ''
       },
       pattern: /\d{6}/,
-      checked:false
+      checked: false
     }
   },
   mounted() {
-    let checked = localStorage.getItem('checked');
-    if(checked){
-      this.checked = checked;
-      this.formData.username = localStorage.getItem('username');
-      this.formData.password = localStorage.getItem('password');
+    let checked = localStorage.getItem('checked')
+    if (checked) {
+      this.checked = checked
+      this.formData.username = localStorage.getItem('username')
+      this.formData.password = localStorage.getItem('password')
     }
   },
   methods: {
-    onSubmit(){
+    onSubmit() {
       login(this.formData).then(res => {
-        if(this.checked){
-           localStorage.setItem('username',this.formData.username);
-           localStorage.setItem('password',this.formData.password);
-           localStorage.setItem('checked',this.checked);
-        }else {
-          localStorage.clear();
+        if (this.checked) {
+          localStorage.setItem('username', this.formData.username)
+          localStorage.setItem('password', this.formData.password)
+          localStorage.setItem('checked', this.checked)
+        } else {
+          localStorage.clear()
         }
-        console.log(res,'res')
-        sessionStorage.setItem('access_token',res.data.access_token);
-        this.$router.replace('/home');
+        console.log(res, 'res')
+        sessionStorage.setItem('access_token', res.data.access_token)
+        this.$router.replace('/home')
       })
-    },
+    }
   }
 }
 </script>
@@ -97,7 +98,7 @@ export default {
 <style scoped lang="scss">
 .login {
   height: 100vh;
-  background: url("../assets/img/login-background.png") top left no-repeat #edfcff;
+  background: url('../assets/img/login-background.png') top left no-repeat #edfcff;
   background-size: 100%;
   display: flex;
   justify-content: center;
@@ -124,7 +125,7 @@ export default {
     letter-spacing: 10px;
     text-align: center;
   }
-  .check-box{
+  .check-box {
     display: flex;
     justify-content: space-between;
     align-items: center;

+ 7 - 7
src/views/menu/cockpit/components/overviewCom.vue

@@ -194,15 +194,15 @@ export default {
     },
     //自动补0
     remedyZero(val) {
-      let newVal=val||0
+      let newVal=val||''
       // let newVal = val + ''
-      // let num = 6 - newVal.length
+      let num = newVal.length
 
-      // for (let index = 0; index < num; index++) {
-      //   newVal = '0' + newVal
-      // }
-      // return ('' + newVal).split('')
-      return newVal
+      for (let index = 0; index < num; index++) {
+        newVal = newVal[index]
+      }
+      return ('' + newVal).split('')
+      
     }
   }
 }

+ 16 - 7
src/views/menu/cockpit/index.vue

@@ -264,11 +264,20 @@ export default {
         offlineATM2015,
         banking2015
       } = this.baseData
-      this.dataopntion = securityPrecautions([
-        { value: securityFacilities.ga382021, name: 'GA38-2021' },
-        { value: securityFacilities.ga382015, name: 'GA38-2015' },
-        { value: securityFacilities.ga38Unreached, name: '未达标' }
-      ])
+      let dataopntionList=[]
+      if(securityFacilities.ga382021){
+        
+        dataopntionList.push({ value: securityFacilities.ga382021, name: 'GA38-2021' })
+      }
+      if(securityFacilities.ga382015){
+        dataopntionList.push({ value: securityFacilities.ga382015, name: 'GA38-2015' })
+        
+      }
+      if(securityFacilities.ga38Unreached){
+        dataopntionList.push({ value: securityFacilities.ga38Unreached, name: '未达标' })
+
+      }
+      this.dataopntion = securityPrecautions(dataopntionList)
       // banking2015.total
       this.dataGA = pieGaData('营业网点', [
         { value: parseInt(banking2015.rate * 100), name: banking2015.total },
@@ -333,9 +342,9 @@ export default {
       ])
       let list = []
       Object.keys(businessStoreInfo).map(item => {
-        if (businessStoreInfo[item]) {
+        // if (businessStoreInfo[item]) {
           list.push({ value: businessStoreInfo[item], name: item })
-        }
+        // }
       })
       this.dotPieData = dotData('网点业务库总览', list)
     },

+ 2 - 1
vue.config.js

@@ -118,7 +118,8 @@ module.exports = defineConfig({
         }
       },
       '/dev': {
-        target: "http://10.87.21.107:8080",
+        // target: "http://10.87.21.107:8080",
+        target: "http://47.92.229.224:8080",
         // ws:true,
         changOrigin:true,
         pathRewrite:{