From 77b15609b62c9bcd80fcdfd65f134a06252920b9 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 14 四月 2025 17:11:21 +0800 Subject: [PATCH] 48px --- src/layout/component/sidebar/components/UserInformation.vue | 171 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 142 insertions(+), 29 deletions(-) diff --git a/src/layout/component/sidebar/components/UserInformation.vue b/src/layout/component/sidebar/components/UserInformation.vue index 57e1615..cc37527 100644 --- a/src/layout/component/sidebar/components/UserInformation.vue +++ b/src/layout/component/sidebar/components/UserInformation.vue @@ -2,33 +2,70 @@ <div class="flex flex-col"> <el-dialog v-model="isShowInformation" title="鎴戠殑淇℃伅" width="500" :before-close="handleCloseInformation"> <el-form :model="userInformationInfo" ref="autoDialogFormRef" label-width="85"> - <el-row :gutter="20" class="form_Class"> - <el-col :span="12" class="id"> - <el-form-item label="鐢ㄦ埛ID" prop="name"> <el-input v-model="userInformationInfo.id" readonly></el-input> </el-form-item - ></el-col> - <el-col :span="12" class="mb20"> - <el-form-item label="濮撳悕" prop="realName"> - <el-input v-model="userInformationInfo.realName" readonly></el-input> - </el-form-item> - </el-col> - <el-col :span="12" class="mb20"> - <el-form-item label="鎵嬫満鍙�" prop="phoneNumber"> - <el-input v-model="userInformationInfo.phoneNumber" readonly></el-input> - </el-form-item> - </el-col> - <el-col :span="12" class="mb20" - ><el-form-item label="鎬у埆" prop="sex"> <el-input v-model="userInformationInfo.sex" readonly></el-input> </el-form-item - ></el-col> - <el-col :span="24" class="mb20"> - <el-form-item label="閮ㄩ棬" prop="department"> <el-input v-model="userInformationInfo.department" readonly></el-input> </el-form-item - ></el-col> + <el-form-item label="鐢ㄦ埛ID" prop="name"> + <el-input v-model="userInformationInfo.userName" readonly></el-input> + </el-form-item> - <el-col :span="24" class="mb20"> - <el-form-item label="閭" prop="email"> - <el-input v-model="userInformationInfo.email" readonly /> - </el-form-item> - </el-col> - </el-row> + <el-form-item label="濮撳悕" prop="realName"> + <el-input v-model="userInformationInfo.realName" readonly></el-input> + </el-form-item> + <el-form-item label="鎬у埆" prop="sex"> + <el-input v-model="userInformationInfo.sex" readonly></el-input> + </el-form-item> + <el-form-item label="閮ㄩ棬" prop="department"> + <el-input v-model="userInformationInfo.department" readonly></el-input> + </el-form-item> + <!-- <el-form-item label="鐢ㄦ埛鐘舵��" prop="phoneNumber"> + <el-input v-model="userInformationInfo.a" readonly></el-input> + </el-form-item> --> + <el-form-item label="鐢佃瘽" prop="phoneNumber"> + <el-input v-model="userInformationInfo.phoneNumber" readonly></el-input> + </el-form-item> + <!-- <el-form-item label="寰俊鍙�" prop="phoneNumber"> + <el-input v-model="userInformationInfo.phoneNumber" readonly></el-input> + </el-form-item> --> + <el-form-item label="閭" prop="email"> + <el-input v-model="userInformationInfo.email" readonly></el-input> + </el-form-item> + <el-form-item v-if="userInformationInfo.wechatNickname" label="寰俊鏄电О" prop="wechatNickname"> + <el-input v-model="userInformationInfo.wechatNickname" readonly></el-input> + + </el-form-item> + + <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.isBindWechat" 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-form-item label="瑙掕壊" prop="role"> + <el-select v-model="userInformationInfo.role" placeholder="璇烽�夋嫨瑙掕壊" disabled> + <el-option label="瑙掕壊A" value="roleA"></el-option> + <el-option label="瑙掕壊B" value="roleB"></el-option> + </el-select> + </el-form-item> --> + <!-- <el-form-item label="璇存槑" prop="description"> + <el-input v-model="userInformationInfo.description" type="textarea" readonly></el-input> + </el-form-item> --> </el-form> </el-dialog> </div> @@ -36,11 +73,12 @@ <script setup lang="ts"> //#region ====================== 鎴戠殑淇℃伅 ====================== -import { onMounted, ref } from 'vue'; +import { nextTick, onMounted, ref, watch } from 'vue'; import { useUserInfo } from '/@/stores/userInfo'; import { accessSessionKey, handleNoAuth, userInfoKey } from '/@/utils/request'; import { Local } from '/@/utils/storage'; import { userInfo } from '/@/stores/chatRoom'; +import { SERVE_URL } from '/@/constants'; const isShowInformation = defineModel({ type: Boolean, }); @@ -50,12 +88,87 @@ isShowInformation.value = false; }; //#endregion + +const wechatQrRef = ref<HTMLIFrameElement>(); + +const handleBindWechat = () => {}; + +const getWechartQrCode = () => { + const state = (new Date().getTime() / 1000).toString(); + // JJJHHH 琛ㄧず锛冨彿 + const url = `${SERVE_URL}JJJHHH/home?isWxLogin=N`; + const obj = new window.WxLogin({ + id: 'wechat-bind', + appid: 'wx4ea2dca37170074c', + scope: 'snsapi_login', + redirect_uri: encodeURIComponent(`http://apiv3.xpump.net/User/wxUserLoginCB.html?from=wi&url=${url}`), + state: state, + }); +}; + +const bindingCodeShow = ref(false); + +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; +}; + onMounted(async () => { - if(!Local.get(accessSessionKey)){ - handleNoAuth() + if (!Local.get(accessSessionKey)) { + handleNoAuth(); return; } + + // getWechartQrCode(); userInformationInfo.value = Local.get(userInfoKey); }); + +watch( + () => isShowInformation.value, + (val) => { + if (val) { + // nextTick(() => { + // openWechatLogin(); + // }); + } + } +); </script> <style scoped lang="scss"></style> -- Gitblit v1.9.3