Admin
2022-10-28 55c9d726f32f068ef2cf91a0d1a1fe9b9370b639
新增有效期限
已修改3个文件
228 ■■■■■ 文件已修改
src/api/user.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/enterprise/userinfo.vue 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/user.js
@@ -155,3 +155,14 @@
    params: params || {}
  })
}
export function updateDeadline(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/jiangWai/deadline/set ',
        method: 'post',
        data
    })
}
src/views/enterprise/userinfo.vue
@@ -117,10 +117,15 @@
            <span>{{ scope.row.lastmodifieddate | parseTime('{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
      <el-table-column label="账户有效期" prop="deadline" align="center" sortable="custom">
          <template slot-scope="scope">
              <span>{{ scope.row.deadline }}</span>
          </template>
      </el-table-column>
        <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button type="text" @click="showEditHandle(scope.row)">编辑</el-button>
<!--            <el-button :disabled="disableRole(scope.row)" type="text" align="center" @click="showAssignRole(scope.row)">分配角色</el-button>-->
            <el-button v-if="scope.row.companyid !=null" type="text" @click="showEditDeadline(scope.row)">修改有效期</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -238,16 +243,35 @@
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogUserRoleFormVisible = false">取消</el-button>
        <el-button type="primary" @click="assignUserRoleHandle">确认</el-button>
        <el-button type="primary" @click="assignUserRoleHandle()">确认</el-button>
      </div>
    </el-dialog>
    <el-dialog title="修改有效期" :visible.sync="dialogDeadlineVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="700px">
        <el-form ref="deadlineForm" :rules="deadlineFormRules" :model="deadlineForm" label-position="right" label-width="100px" style="margin-left:50px;width:500px;" element-loading-text="保存中...">
            <el-form-item label="有效期:" prop="deadline">
                <el-date-picker
                    v-model.trim="deadlineForm.deadline"
                    type="date"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd"
                    placeholder="选择有效期">
                </el-date-picker>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogDeadlineVisible = false">取消</el-button>
            <el-button type="primary" @click="editDeadline()">确认</el-button>
        </div>
    </el-dialog>
    <div style="clear: both;"/>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { enterpriseUserList, createUser, deleteUser, updateUser, importDistrict,getDistrict,getDistrictByName,updateUserRole} from '@/api/user'
import { enterpriseUserList, createUser, deleteUser, updateUser, importDistrict,getDistrict,getDistrictByName,updateUserRole,updateDeadline} from '@/api/user'
import { checkBtnPermission } from '@/utils/permission'
import { roleList } from '@/api/role'
import { parseTime, computePageCount, parseUserType } from '@/utils'
@@ -365,11 +389,16 @@
        town: '',
        community: '',
        type:'',
        job:'',
        job:''
      },
        deadlineForm:{
          uid: '',
          deadline: ''
      },
      importDialogFormVisible: false,
      importDisabled: false,
      dialogFormVisible: false,
      dialogDeadlineVisible: false,
      dialogStatus: '',
      dataFormRules: {
        name: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
@@ -377,6 +406,9 @@
        password: [{ required: true, message: '密码不能为空', trigger: 'blur' }],
        confirmPassword: [{ required: true, message: '确认密码不能为空', trigger: 'blur' }],
        type: [{ required: true, message: '用户类型不能为空', trigger: 'blur' }]
      },
        deadlineFormRules: {
            deadline: [{ required: true, message: '有效期不能为空', trigger: 'blur' }]
      },
      provinceList:[],
      cityList:[],
@@ -551,6 +583,12 @@
      this.townList = []
      this.communityList = []
    },
      resetDeadlineForm(){
        this.deadlineForm = {
            uid: '',
            deadline: ''
        }
      },
    showCreateHandle() {
      this.resetDataForm()
      this.dialogStatus = 'create'
@@ -687,6 +725,36 @@
      })
    },
    showEditDeadline(row){
        this.resetDeadlineForm()
        this.deadlineForm.uid = row.id
        this.dialogDeadlineVisible = true
    },
    editDeadline(){
        const t = this
        this.$refs['deadlineForm'].validate((valid) => {
            if (valid) {
                const params = this.deadlineForm
                console.log(params,'params')
                updateDeadline(params).then(response => {
                    const res = response.data
                    if (res.code == 200) {
                        t.dialogDeadlineVisible = false
                        t.$message({
                            message: '有效期修改成功',
                            type: 'success'
                        })
                        t.getUserList()
                    } else {
                        parseError({ error: res.message, vm: t })
                    }
                })
            }
        })
    },
    passwordChangeEvent: function(value) {
      if (this.dataForm.password != value) {
        parseError({ error: '密码输入不一致', vm: this })
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>
@@ -41,7 +79,11 @@
      logincontainer: 'login-container',
      isSafe: process.env.isSafe,
      titleName: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统',
      safeLoginTitle: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统'
      safeLoginTitle: '新疆维吾尔自治区烟花爆竹流向管理信息实名登记系统',
      dialogTip: false,
      dialogPay: false,
      deadline: '',
      isOverTime: true
    }
  },
  watch: {
@@ -74,6 +116,26 @@
        this.logincontainer = 'login-container'
      }
    },
    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
@@ -85,6 +147,54 @@
          if (res.code == 200) {
            _this.loading = false
            const data = res.result
            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是否是一个非空数组
@@ -113,6 +223,7 @@
            // 加载菜单
            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 {