From 55c9d726f32f068ef2cf91a0d1a1fe9b9370b639 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期五, 28 十月 2022 17:15:52 +0800
Subject: [PATCH] 新增有效期限

---
 src/views/login/index.vue |  199 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 168 insertions(+), 31 deletions(-)

diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index e2a3bf2..94867c3 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -11,6 +11,44 @@
                 />
             </div>
         </div>
+
+      <el-dialog
+          title="账户到期提醒"
+          :visible.sync="dialogTip"
+          :close-on-click-modal="false"
+          width="40%"
+          top="30vh"
+          :show-close="false"
+          center>
+          <div style="text-indent: 28px;line-height: 1.5">
+              <div style="margin-bottom: 10px">尊敬的烟花爆竹生产、经营厂家,您的账户免费使用权限即将过期,为不影响您的正常使用,请于{{ deadline }}之前缴(续)费,逾期未缴费您的账户将不能继续登录使用。</div>
+              <div style="margin-bottom: 10px">系统年度技术服务费人民币1800元,点击下方“去缴费”即可进行缴(续)费操作。</div>
+              <div>感谢您的配合!</div>
+          </div>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="holdOn()">再等等</el-button>
+            <el-button type="primary" @click="toPay()">去缴费</el-button>
+          </span>
+      </el-dialog>
+      <el-dialog
+          title="缴(续)费须知"
+          :visible.sync="dialogPay"
+          :close-on-click-modal="false"
+          width="40%"
+          top="30vh"
+          @closed="isLogin()"
+          center>
+          <div class="payTip">
+              <div>
+                  <h2>付款方式:</h2>
+                  <span>苏州国科鸿宇智能科技有限公司</span>纳税人识别号:91320594MA1YCQQ60E<br/>开户行:中国银行股份有限公司苏州独墅湖支行<br/>账号:517073268476<br/>地址:苏州工业园区若水路398号D0313<br/>联系电话:0512-62872586
+              </div>
+              <div class="payInfo">
+                  <h3>提醒:</h3>
+                  请您在完成付款之后,联系<br/>0512-62872586 田老师<br/>为您的账户进行续期,为您开具发票。
+              </div>
+          </div>
+      </el-dialog>
       <div class="bottom-container">
         <span class="bottom-container_title">中国科学院苏州纳米技术与纳米仿生研究所监制</span>
       </div>
@@ -34,14 +72,18 @@
   data() {
     return {
       websocket:'',
-      url:process.env.BASE_API.replace("http","ws").replace("https","wss"),
+      url: process.env.BASE_API.replace("http","ws").replace("https","wss"),
       action: 'login',
       screenWidth: '',
       screenHeight: '',
       logincontainer: 'login-container',
       isSafe: process.env.isSafe,
       titleName: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统',
-      safeLoginTitle: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统'
+      safeLoginTitle: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统',
+      dialogTip: false,
+      dialogPay: false,
+      deadline: '',
+      isOverTime: true
     }
   },
   watch: {
@@ -74,7 +116,27 @@
         this.logincontainer = 'login-container'
       }
     },
-    handleLogin(loginForm) {
+    holdOn(){
+        const t = this
+        if(!t.isOverTime){
+            // 加载菜单
+            initRouter(t)
+            t.$router.replace('/enterprise/basic')
+        }
+        t.dialogTip = false
+    },
+    toPay(){
+        this.dialogPay = true
+    },
+      isLogin(){
+          const t = this
+          if(!t.isOverTime){
+              // 加载菜单
+              initRouter(t)
+              t.$router.replace('/enterprise/basic')
+          }
+      },
+      handleLogin(loginForm) {
       const _this = this
       _this.$refs.getdata.submitLoading = false
       _this.loading = true
@@ -85,34 +147,83 @@
           if (res.code == 200) {
             _this.loading = false
             const data = res.result
-            if (data.type != 1 && data.type != 2) {
-              if (!data.roles || data.roles.length == 0) {
-                // 验证返回的roles是否是一个非空数组
-                _this.$store.commit('SET_ROLES', [])
-                parseError({
-                  error: '该用户没有权限登录,请联系所配置管理员分配角色',
-                  vm: _this
-                })
-                // reject('用户未分配角色,没有权限登录')
-                return
-              }
+            if(data.deadline && data.deadline != null){
+                const deadline = data.deadline;
+                console.log('判断时间')
+                const date = new Date(deadline);
+                console.log(date.getTime(),Date.now(),'对比')
+                if(date.getTime() < Date.now()){
+                    console.log("过期")
+                    _this.isOverTime = true
+                    _this.dialogTip = true
+                    return
+                }else{
+                    _this.isOverTime = false
+                    if (data.type != 1 && data.type != 2) {
+                        if (!data.roles || data.roles.length == 0) {
+                            // 验证返回的roles是否是一个非空数组
+                            _this.$store.commit('SET_ROLES', [])
+                            parseError({
+                                error: '该用户没有权限登录,请联系所配置管理员分配角色',
+                                vm: _this
+                            })
+                            // reject('用户未分配角色,没有权限登录')
+                            return
+                        }
+                    }
+                    this._initConnect(data.id)
+                    _this.$store.commit('SET_ROLES', data.roles)
+                    Cookies.set('roles', JSON.stringify(data.roles))
+                    setToken(data.token)
+                    Cookies.set('roleType',data.roleType)
+                    Cookies.set('isSupervision',data.companyid)
+                    Cookies.set('company',data.company)
+                    Cookies.set('userName', data.username)
+                    Cookies.set('name', data.username)
+                    Cookies.set('userId', data.id)
+                    Cookies.set('token_expired_at', data.tokenexpired)
+                    _this.$store.commit('SET_NAME', data.username)
+                    _this.$store.commit('SET_USER_TYPE', data.type)
+                    const nTime = date.getTime() - Date.now();
+                    console.log('还剩' + Math.floor(nTime / 86400000))
+                    if(Math.floor(nTime / 86400000)>30){
+                        // 加载菜单
+                        initRouter(_this)
+                        _this.$router.replace('/enterprise/basic')
+                    }else{
+                        this.dialogTip = true
+                    }
+                }
+            }else{
+                if (data.type != 1 && data.type != 2) {
+                    if (!data.roles || data.roles.length == 0) {
+                        // 验证返回的roles是否是一个非空数组
+                        _this.$store.commit('SET_ROLES', [])
+                        parseError({
+                            error: '该用户没有权限登录,请联系所配置管理员分配角色',
+                            vm: _this
+                        })
+                        // reject('用户未分配角色,没有权限登录')
+                        return
+                    }
+                }
+                this._initConnect(data.id)
+                _this.$store.commit('SET_ROLES', data.roles)
+                Cookies.set('roles', JSON.stringify(data.roles))
+                setToken(data.token)
+                Cookies.set('roleType',data.roleType)
+                Cookies.set('isSupervision',data.companyid)
+                Cookies.set('company',data.company)
+                Cookies.set('userName', data.username)
+                Cookies.set('name', data.username)
+                Cookies.set('userId', data.id)
+                Cookies.set('token_expired_at', data.tokenexpired)
+                _this.$store.commit('SET_NAME', data.username)
+                _this.$store.commit('SET_USER_TYPE', data.type)
+                // 加载菜单
+                initRouter(_this)
+                _this.$router.replace('/enterprise/basic')
             }
-            this._initConnect(data.id)
-            _this.$store.commit('SET_ROLES', data.roles)
-            Cookies.set('roles', JSON.stringify(data.roles))
-            setToken(data.token)
-            Cookies.set('roleType',data.roleType)
-            Cookies.set('isSupervision',data.companyid)
-            Cookies.set('company',data.company)
-            Cookies.set('userName', data.username)
-            Cookies.set('name', data.username)
-            Cookies.set('userId', data.id)
-            Cookies.set('token_expired_at', data.tokenexpired)
-            _this.$store.commit('SET_NAME', data.username)
-            _this.$store.commit('SET_USER_TYPE', data.type)
-            // 加载菜单
-            initRouter(_this)
-           _this.$router.replace('/enterprise/basic')
           } else {
             _this.$message({
               showClose: true,
@@ -323,7 +434,33 @@
           line-height: 20px;
       }
   }
-
+    .payTip{
+        div{
+            line-height: 1.5;
+            h2{
+                margin-top: 0;
+                margin-bottom: 6px;
+            }
+            span{
+                font-size: 16px;
+                font-weight: bolder;
+                display: block;
+            }
+        }
+        .payInfo{
+            line-height: 1.8;
+            margin-top: 15px;
+            width: 100%;
+            padding: 2% 4%;
+            box-sizing: border-box;
+            background: #ffebb2;
+            border-radius: 8px;
+            h3{
+                margin-top: 0;
+                margin-bottom: 6px;
+            }
+        }
+    }
 }
 
 .login-container-1 {

--
Gitblit v1.9.2