¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="sys-userCenter-container h100"> |
| | | <el-row :gutter="8" style="width: 100%" class="h100"> |
| | | <el-col :span="8" :xs="24" class="h100"> |
| | | <el-card shadow="hover" class="h100"> |
| | | <div class="account-center-avatarHolder"> |
| | | <el-avatar |
| | | :size="100" |
| | | :src="userInfos.photo" |
| | | @click="openCropperDialog" |
| | | v-loading="state.avatarLoading" |
| | | element-loading-spinner="el-icon-Upload" |
| | | element-loading-background="rgba(0, 0, 0, 0.2)" |
| | | @mouseenter="mouseEnterAvatar" |
| | | @mouseleave="mouseLeaveAvatar" |
| | | /> |
| | | <div class="username">{{ userInfos.realName }}</div> |
| | | </div> |
| | | <div class="account-center-org" style="display: flex; flex-direction: column; align-items: center"> |
| | | <div> |
| | | <p class="user-simple-info"> |
| | | <!-- ç¨æ·å --> |
| | | <el-icon size="17" class="mr10"><ele-User /></el-icon> <span>{{ userInfos?.name ?? '---' }}</span> |
| | | </p> |
| | | <!-- å
¬å¸å --> |
| | | <!-- <p class="user-simple-info"> |
| | | <el-icon size="17"><ele-Briefcase /></el-icon> <span>{{ userInfos.SoftWare?.Project?.Corpration?.Name ?? '---' }}</span> |
| | | </p> --> |
| | | <p class="user-simple-info" v-if="userInfos?.weixin_nikename"> |
| | | <!-- è´¦æ·ç±»åå --> |
| | | <span class="ywifont ywicon-weixin mr10"></span> |
| | | <span>{{ userInfos?.weixin_nikename ?? '---' }}</span> |
| | | </p> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | |
| | | <el-col :span="16" :xs="24" class="h100" v-loading="state.loading"> |
| | | <el-card shadow="hover" class="h100"> |
| | | <el-tabs> |
| | | <el-tab-pane label="åºç¡ä¿¡æ¯"> |
| | | <el-form :model="state.ruleFormBase" ref="ruleFormBaseRef" label-width="80px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="ç¨æ·ID"> |
| | | <el-input :model-value="userInfos?.name" placeholder="ç¨æ·ID" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="å§å"> |
| | | <el-input :model-value="userInfos?.real_name" placeholder="å§å" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="æ§å«"> |
| | | <el-input :model-value="userInfos?.sex" placeholder="æ§å«" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="é¨é¨"> |
| | | <el-input :model-value="userInfos?.part" placeholder="é¨é¨" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="çµè¯"> |
| | | <el-input :model-value="userInfos?.phone" placeholder="çµè¯" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="é®ç®±"> |
| | | <el-input :model-value="userInfos?.email" placeholder="é®ç®±" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="微信æµç§°"> |
| | | <el-input :model-value="userInfos?.weixin_nikename" placeholder="微信æµç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="微信ç»å®" prop="wechat"> |
| | | <div id="wechat-bind"> |
| | | <div v-if="bindingCodeShow" class="flex flex-col items-center justify-center"> |
| | | <iframe |
| | | ref="wechatQrRef" |
| | | sandbox="allow-top-navigation allow-scripts" |
| | | style="width: 200px; height: 170px; overflow: hidden" |
| | | frameborder="0" |
| | | ></iframe> |
| | | <span>使ç¨å¾®ä¿¡æ«ä¸æ«ç»å®</span> |
| | | </div> |
| | | <template v-else> |
| | | <div v-if="userInformationInfo.weixin_openid" class="flex items-center"> |
| | | <span>å·²ç»å®</span> |
| | | <el-button link type="primary" @click="openWechatLogin">éæ°ç»å®</el-button> |
| | | </div> |
| | | <div v-else class="flex items-center"> |
| | | <span>æªç»å®</span> |
| | | <el-button link type="primary" @click="openWechatLogin">ç¹å»ç»å®</el-button> |
| | | </div> |
| | | </template> |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </el-tab-pane> |
| | | |
| | | <el-tab-pane label="ä¿®æ¹å¯ç "> |
| | | <el-form ref="ruleFormPasswordRef" :model="state.ruleFormPassword" label-width="80px"> |
| | | <el-form-item |
| | | label="æ°å¯ç " |
| | | prop="passwordNew" |
| | | :rules="[{ required: true, message: 'æ°å¯ç ä¸è½ä¸ºç©º', trigger: 'blur' }]" |
| | | > |
| | | <el-input |
| | | v-model="state.ruleFormPassword.passwordNew" |
| | | :type="state.showPasswdNew ? 'text' : 'password'" |
| | | autocomplete="off" |
| | | > |
| | | <template #suffix> |
| | | <i |
| | | class="iconfont el-input__icon login-content-password" |
| | | :class="state.showPasswdNew ? 'icon-yincangmima' : 'icon-xianshimima'" |
| | | @click="state.showPasswdNew = !state.showPasswdNew" |
| | | > |
| | | </i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="确认å¯ç " |
| | | prop="passwordNew2" |
| | | :rules="[{ validator: validatePassword, required: true, trigger: 'blur' }]" |
| | | > |
| | | <el-input :type="state.showPassWdNew2 ? 'text' : 'password'" v-model="state.passwordNew2" autocomplete="off"> |
| | | <template #suffix> |
| | | <i |
| | | class="iconfont el-input__icon login-content-password" |
| | | :class="state.showPassWdNew2 ? 'icon-yincangmima' : 'icon-xianshimima'" |
| | | @click="state.showPassWdNew2 = !state.showPassWdNew2" |
| | | > |
| | | </i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button icon="ele-Refresh" @click="resetPassword">é ç½®</el-button> |
| | | <el-button icon="ele-SuccessFilled" type="primary" @click="submitPassword">ç¡® å®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" setup name="sysUserCenter"> |
| | | import { onMounted, watch, reactive, ref, nextTick } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { ElForm, ElMessage, ElMessageBox, genFileId } from 'element-plus'; |
| | | import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'; |
| | | import { useUserInfo } from '/@/stores/userInfo'; |
| | | // import { base64ToFile } from '/@/utils/base64Conver'; |
| | | // import CropperDialog from '/@/components/cropper/index.vue'; |
| | | import { ADMIN_TYPE_MAP } from '/@/views/types'; |
| | | import { clearAccessTokens, userInfoKey } from '/@/utils/request'; |
| | | import { ResetSystemLoginPwd, UpdateSystemLoginPwd } from '/@/api/auth/userManage'; |
| | | import { SERVE_URL } from '/@/constants'; |
| | | import { Local } from '/@/utils/storage'; |
| | | |
| | | const stores = useUserInfo(); |
| | | const { userInfos } = storeToRefs(stores); |
| | | const uploadSignRef = ref<UploadInstance>(); |
| | | //const uploadAvatarRef = ref<UploadInstance>(); |
| | | const ruleFormBaseRef = ref<InstanceType<typeof ElForm>>(); |
| | | const ruleFormPasswordRef = ref<InstanceType<typeof ElForm>>(); |
| | | const state = reactive({ |
| | | loading: false, |
| | | avatarLoading: false, |
| | | signDialogVisible: false, |
| | | ruleFormBase: {}, |
| | | ruleFormPassword: {} as any, |
| | | showPasswdNew: false, |
| | | showPassWdNew2: false, |
| | | |
| | | signFileList: [] as any, |
| | | passwordNew2: '', |
| | | cropperTitle: '', |
| | | }); |
| | | const userInformationInfo = ref({}) as any; |
| | | |
| | | onMounted(async () => { |
| | | state.loading = true; |
| | | userInformationInfo.value = Local.get(userInfoKey); |
| | | |
| | | // var res = await getAPI(SysUserApi).apiSysUserBaseInfoGet(); |
| | | // state.ruleFormBase = res.data.result ?? { account: '' }; |
| | | state.loading = false; |
| | | }); |
| | | |
| | | // ä¸ä¼ 头åå¾ç |
| | | const uploadCropperImg = async (e: any) => { |
| | | // var res = await getAPI(SysFileApi).apiSysFileUploadAvatarPostForm(e.img); |
| | | // userInfos.value.avatar = res.data.result?.filePath + '/' + res.data.result?.name; |
| | | }; |
| | | |
| | | // è·å¾çµåç¾åæä»¶å表 |
| | | const handleChangeSignFile = (_file: any, fileList: []) => { |
| | | state.signFileList = fileList; |
| | | }; |
| | | |
| | | // å¯ç éªè¯ |
| | | const validatePassword = (_rule: any, value: any, callback: any) => { |
| | | if (!state.ruleFormPassword.passwordNew) { |
| | | callback('请å
è¾å
¥æ°å¯ç ï¼'); |
| | | } else if (state.passwordNew2 != state.ruleFormPassword.passwordNew) { |
| | | callback(new Error('两次å¯ç ä¸ä¸è´ï¼')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | |
| | | // å¯ç éç½® |
| | | const resetPassword = () => { |
| | | ElMessageBox.confirm('ç¡®å®éç½®å½åç¨æ·å¯ç ï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }) |
| | | .then(async () => { |
| | | resetSystemLoginPwd(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const confirmReLogin = () => { |
| | | // éåºç³»ç» |
| | | ElMessageBox.confirm('å¯ç 已修æ¹ï¼æ¯å¦éæ°ç»å½ç³»ç»ï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }) |
| | | .then(async () => { |
| | | clearAccessTokens(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const resetSystemLoginPwd = async () => { |
| | | const res = await ResetSystemLoginPwd({ |
| | | ID: userInfos.value?.User?.LoginAccount?.ID, |
| | | }); |
| | | |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | confirmReLogin(); |
| | | } else { |
| | | ElMessage.error('éç½®å¯ç 失败'); |
| | | } |
| | | } else { |
| | | ElMessage.error('éç½®å¯ç 失败' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }; |
| | | |
| | | // å¯ç æäº¤ |
| | | const submitPassword = () => { |
| | | ruleFormPasswordRef.value?.validate(async (valid: boolean) => { |
| | | if (!valid) return; |
| | | ElMessageBox.confirm('ç¡®å®ä¿®æ¹å½åè´¦æ·å¯ç ï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }) |
| | | .then(async () => { |
| | | const res = await UpdateSystemLoginPwd({ |
| | | ID: userInfos.value?.User?.LoginAccount?.ID, |
| | | LoginPwd: state.passwordNew2, |
| | | }); |
| | | |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | confirmReLogin(); |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å¯ç 失败'); |
| | | } |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å¯ç 失败' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const bindingCodeShow = ref(false); |
| | | const wechatQrRef = ref<HTMLIFrameElement>(); |
| | | |
| | | const openWechatLogin = async () => { |
| | | bindingCodeShow.value = true; |
| | | await nextTick(); |
| | | if (!wechatQrRef.value) return; |
| | | const url = `${SERVE_URL}JJJHHH/home?isWxLogin=N`; |
| | | const appid = 'wx4ea2dca37170074c'; |
| | | const state = (new Date().getTime() / 1000).toString(); |
| | | const base64 = btoa(` |
| | | .impowerBox .title {display:none;} |
| | | |
| | | .impowerBox .status.status_browser p:nth-of-type(2){ |
| | | display: none; |
| | | } |
| | | |
| | | .impowerBox .qrcode { |
| | | width: 160px; |
| | | margin-top:0; |
| | | |
| | | } |
| | | |
| | | .info{ |
| | | display: none; |
| | | } |
| | | .impowerBox .status{ |
| | | } |
| | | #tpl_for_iframe{ |
| | | height:100%; |
| | | overflow: hidden; |
| | | |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | `); |
| | | const wechatAuthUrl = `https://open.weixin.qq.com/connect/qrconnect?appid=${appid}&redirect_uri=${encodeURIComponent( |
| | | `http://apiv3.xpump.net/User/wxUserLoginCB.html?from=wi&url=${url}` |
| | | )}&response_type=code&scope=snsapi_login&state=${state}&href=data:text/css;base64,${base64}#wechat_redirect`; |
| | | wechatQrRef.value.src = wechatAuthUrl; |
| | | }; |
| | | |
| | | // æå¼è£åªå¼¹çª |
| | | const openCropperDialog = () => { |
| | | // state.cropperTitle = 'æ´æ¢å¤´å'; |
| | | // cropperDialogRef.value?.openDialog(userInfos.value.avatar); |
| | | }; |
| | | |
| | | // é¼ æ è¿å
¥å离å¼å¤´åæ¶ |
| | | const mouseEnterAvatar = () => { |
| | | state.avatarLoading = true; |
| | | }; |
| | | |
| | | const mouseLeaveAvatar = () => { |
| | | state.avatarLoading = false; |
| | | }; |
| | | |
| | | // 导åºå¯¹è±¡ |
| | | defineExpose({ handleChangeSignFile }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .login-content-password { |
| | | display: inline-block; |
| | | width: 20px; |
| | | cursor: pointer; |
| | | |
| | | &:hover { |
| | | color: #909399; |
| | | } |
| | | } |
| | | .user-simple-info { |
| | | display: flex; |
| | | align-items: flex-start; |
| | | } |
| | | .account-center-avatarHolder { |
| | | text-align: center; |
| | | margin-bottom: 24px; |
| | | |
| | | .username { |
| | | font-size: 20px; |
| | | line-height: 28px; |
| | | font-weight: 500; |
| | | margin-bottom: 4px; |
| | | } |
| | | } |
| | | .account-center-org { |
| | | margin-bottom: 8px; |
| | | position: relative; |
| | | p { |
| | | margin-top: 10px; |
| | | } |
| | | span { |
| | | // padding-left: 17px; |
| | | } |
| | | } |
| | | .avatar { |
| | | margin: 0 auto; |
| | | width: 104px; |
| | | height: 104px; |
| | | margin-bottom: 20px; |
| | | border-radius: 50%; |
| | | overflow: hidden; |
| | | img { |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .image-signature { |
| | | margin-top: 20px; |
| | | margin-bottom: 10px; |
| | | width: 100%; |
| | | height: 150px; |
| | | background-color: #fff; |
| | | text-align: center; |
| | | vertical-align: middle; |
| | | border: solid 1px var(--el-border-color); |
| | | } |
| | | </style> |