| | |
| | | import request from '@/utils/request' |
| | | |
| | | // 登录方法 |
| | | export function login(username, password, code, uuid) { |
| | | export function login(username, password, code, uuid,identity) { |
| | | const data = { |
| | | username, |
| | | password, |
| | | code, |
| | | uuid |
| | | uuid, |
| | | identity |
| | | } |
| | | return request({ |
| | | url: '/system/account/login', |
| | |
| | | <!-- <router-link to="/user/profile">--> |
| | | <!-- <el-dropdown-item>个人中心</el-dropdown-item>--> |
| | | <!-- </router-link>--> |
| | | <!-- <el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">--> |
| | | <!-- <span>布局设置</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <el-dropdown-item command="info"> |
| | | <span>基本信息</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item command="password"> |
| | | <span>修改密码</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided command="logout"> |
| | | <span>退出登录</span> |
| | | </el-dropdown-item> |
| | |
| | | </el-dropdown> |
| | | </div> |
| | | </div> |
| | | <review-dialog ref="reviewRef" ></review-dialog> |
| | | <supervise-dialog ref="superRef"></supervise-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useUserStore from '@/store/modules/user' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | import {removeToken} from "@/utils/auth"; |
| | | import {getToken, removeToken} from "@/utils/auth"; |
| | | import {onMounted, ref} from "vue"; |
| | | import Cookies from "js-cookie"; |
| | | import reviewDialog from "@/views/safetyReview/institution/components/viewInstitution.vue" |
| | | import superviseDialog from "@/views/safetyReview/userManage/superviseUsers/components/superviseDialog.vue" |
| | | |
| | | const appStore = useAppStore() |
| | | const userStore = useUserStore() |
| | | const settingsStore = useSettingsStore() |
| | | |
| | | const reviewRef = ref(); |
| | | const superRef = ref(); |
| | | const userInfo = ref(); |
| | | onMounted(()=>{ |
| | | if(getToken()){ |
| | | userInfo.value = JSON.parse(Cookies.get('userInfo')) |
| | | console.log("userInfo",userInfo.value ) |
| | | |
| | | } |
| | | }) |
| | | function toggleSideBar() { |
| | | appStore.toggleSideBar() |
| | | } |
| | | |
| | | function handleCommand(command) { |
| | | switch (command) { |
| | | case "setLayout": |
| | | setLayout(); |
| | | case "info": |
| | | getInfo(); |
| | | break; |
| | | case "logout": |
| | | logout(); |
| | | break; |
| | | case "password": |
| | | editPsd(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | function getInfo() { |
| | | console.log("getInfo") |
| | | //机构用户 |
| | | if(userInfo.value.identity === 1){ |
| | | const obj = { |
| | | agencyId: userInfo.value.agentId |
| | | } |
| | | reviewRef.value.openDialog(obj,'view') |
| | | } |
| | | //监管用户 |
| | | else if (userInfo.value.identity === 0) { |
| | | const obj = { |
| | | id: userInfo.value.id |
| | | } |
| | | superRef.value.openDialog('view', obj); |
| | | } |
| | | } |
| | | function editPsd() { |
| | | superRef.value.openDialog('pwd', userInfo.value); |
| | | } |
| | | |
| | | function logout() { |
| | | ElMessageBox.confirm('确定注销并退出系统吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | |
| | | let param = {} |
| | | if(state.title=='新增/注册') { |
| | | param = { |
| | | phone:value |
| | | phone:value, |
| | | identity: 1 |
| | | } |
| | | }else if(state.title=='编辑'){ |
| | | param = { |
| | | phone:value, |
| | | identity: 1, |
| | | id: state.registerForm.id |
| | | } |
| | | } |
| | |
| | | const password = userInfo.password |
| | | const code = userInfo.code |
| | | const uuid = userInfo.uuid |
| | | const identity = userInfo.identity |
| | | return new Promise((resolve, reject) => { |
| | | login(username, password, code, uuid).then(res => { |
| | | login(username, password, code, uuid, identity).then(res => { |
| | | setToken(res.data.token) |
| | | Cookies.set('userInfo',JSON.stringify(res.data)) |
| | | this.token = res.data.token |
| | |
| | | <img :src="codeUrl" @click="getCode" class="login-code-img"/> |
| | | </div> |
| | | </el-form-item> |
| | | <el-radio-group v-model="loginForm.role" class="mb5"> |
| | | <el-radio :label="0" size="large">监管部门</el-radio> |
| | | <el-radio :label="1" size="large">机构管理员</el-radio> |
| | | </el-radio-group> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 25px"> |
| | | <!-- <el-checkbox v-model="loginForm.rememberMe">记住密码</el-checkbox>--> |
| | | <el-button |
| | |
| | | username: "", |
| | | password: "", |
| | | code: "", |
| | | uuid: "" |
| | | uuid: "", |
| | | role: 0 |
| | | }); |
| | | |
| | | const loginRules = { |
| | |
| | | username: loginForm.value.username, |
| | | password: Base64.encode(loginForm.value.password), |
| | | code: loginForm.value.code, |
| | | uuid: loginForm.value.uuid |
| | | uuid: loginForm.value.uuid, |
| | | identity: loginForm.value.role |
| | | } |
| | | userStore.login(param).then(() => { |
| | | // const query = route.query; |
| | |
| | | state.tableData = res.data.map(item => { |
| | | return { |
| | | ...item, |
| | | facePic: item.faceRecord ? [import.meta.env.VITE_APP_BASE_API + '/' + item.faceRecord.facePath ] : [], |
| | | facePic: item.faceRecord.facePath ? [import.meta.env.VITE_APP_BASE_API + '/' + item.faceRecord.facePath ] : [], |
| | | signPic: item.signPath ? [import.meta.env.VITE_APP_BASE_API + '/' + item.signPath] : [], |
| | | commitPic: item.insurancePath ? [import.meta.env.VITE_APP_BASE_API + '/' + item.insurancePath] : [], |
| | | } |
| | |
| | | let param = {} |
| | | if(state.title=='新增') { |
| | | param = { |
| | | phone:value |
| | | phone:value, |
| | | identity: 2 |
| | | } |
| | | }else if(state.title=='编辑'){ |
| | | param = { |
| | | phone:value, |
| | | id: state.form.id |
| | | id: state.form.id, |
| | | identity: 2 |
| | | } |
| | | } |
| | | checkPhone(param).then((res)=>{ |
| | |
| | | > |
| | | <el-form :model="state.form" size="default" ref="superRef" :rules="state.formRules" label-width="110px" > |
| | | <el-form-item label="姓名:" prop="name" v-if="state.title !== '修改密码'"> |
| | | <el-input v-model.trim="state.form.name" ></el-input> |
| | | <el-input v-model.trim="state.form.name" :disabled="disabled" ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="用户名:" prop="username" v-if="state.title !== '修改密码'"> |
| | | <el-input v-model.trim="state.form.username" :disabled="state.title =='编辑'" ></el-input> |
| | | <el-input v-model.trim="state.form.username" :disabled="state.title =='编辑' || state.title =='查看'" ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="密码:" prop="password" v-if="state.title == '新增' || state.title == '修改密码'"> |
| | | <el-input v-model.trim="state.form.password" type="password" show-password placeholder="请输入密码"></el-input> |
| | |
| | | <el-input v-model.trim="state.form.confirmPassword" type="password" show-password placeholder="请输入确认密码"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="手机号:" prop="phone" v-if="state.title !== '修改密码'"> |
| | | <el-input v-model.trim="state.form.phone" :maxlength="11" ></el-input> |
| | | <el-input v-model.trim="state.form.phone" :maxlength="11" :disabled="disabled"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="账号类型:" v-if="state.title !== '修改密码'"> |
| | | <el-radio-group v-model="state.form.userType" > |
| | | <el-radio-group v-model="state.form.userType" :disabled="disabled"> |
| | | <el-radio :label="0">工作人员</el-radio> |
| | | <el-radio :label="1">领导</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="管辖地区:" prop="manageRegion" v-if="state.title !== '修改密码'"> |
| | | <el-select v-model="state.form.manageRegion" class="m-2" placeholder="请选择" style="width:100%"> |
| | | <el-select v-model="state.form.manageRegion" class="m-2" placeholder="请选择" style="width:100%" :disabled="disabled"> |
| | | <el-option |
| | | v-for="item in state.areaList" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer > |
| | | <template #footer v-if="state.title !='查看'"> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="handleClose" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认</el-button> |
| | |
| | | import {verifyPhone, verifyPwd, verifyUsername} from "../../../../../utils/validate"; |
| | | import { checkUserName, checkPhone } from "@/api/login" |
| | | import { getRegionTree } from "@/api/area" |
| | | import { addMonitor, editMonitor } from "@/api/sysUsers" |
| | | import {addMonitor, editMonitor, getUserById} from "@/api/sysUsers" |
| | | import {Base64} from "js-base64" |
| | | import {resetUserPwd} from "../../../../../api/sysUsers"; |
| | | import {getInstitutionDetail} from "@/api/backManage/insitution"; |
| | | |
| | | const emit = defineEmits(["getList"]); |
| | | const dialogVisible = ref(false) |
| | |
| | | let param = {} |
| | | if(state.title=='新增') { |
| | | param = { |
| | | phone:value |
| | | phone:value, |
| | | identity: 0 |
| | | } |
| | | }else if(state.title=='编辑'){ |
| | | param = { |
| | | phone:value, |
| | | id: state.form.id |
| | | id: state.form.id, |
| | | identity: 0 |
| | | } |
| | | } |
| | | checkPhone(param).then((res)=>{ |
| | |
| | | |
| | | }) |
| | | |
| | | const openDialog = (type, value) => { |
| | | const disabled = ref(false); |
| | | const openDialog = async (type, value) => { |
| | | getArea() |
| | | state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : type ==='pwd' ? '修改密码' : '查看' ; |
| | | if(type === 'edit') { |
| | | nextTick(() => { |
| | | for(let i in state.form){ |
| | | if(validKey(i,value)){ |
| | | state.form[i] = value[i] |
| | | if(type === 'edit' || type === 'view') { |
| | | if( type === 'view'){ |
| | | disabled.value = true; |
| | | } |
| | | const param = { |
| | | userId: value.id |
| | | } |
| | | }) |
| | | |
| | | const res = await getUserById(param); |
| | | if(res.code === 200){ |
| | | state.form = res.data |
| | | } |
| | | // nextTick(() => { |
| | | // for(let i in state.form){ |
| | | // if(validKey(i,value)){ |
| | | // state.form[i] = value[i] |
| | | // } |
| | | // } |
| | | // }) |
| | | } |
| | | if(type == 'pwd'){ |
| | | state.form.id = value.id |