| | |
| | | <el-form-item label="邮箱" prop="email"> |
| | | <el-input v-model="userInformationInfo.email" readonly></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="微信绑定" prop="wechat"> |
| | | <el-button link type="primary" v-if="userInformationInfo.isBindWechat">已绑定</el-button> |
| | | <div v-else id="wechat-bind"></div> |
| | | <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> |
| | |
| | | }; |
| | | //#endregion |
| | | |
| | | const wechatQrRef = ref<HTMLIFrameElement>(); |
| | | |
| | | const handleBindWechat = () => {}; |
| | | |
| | | const getWechartQrCode = () => { |
| | |
| | | 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(); |
| | | return; |
| | | } |
| | | |
| | | // getWechartQrCode(); |
| | | userInformationInfo.value = Local.get(userInfoKey); |
| | | }); |
| | |
| | | () => isShowInformation.value, |
| | | (val) => { |
| | | if (val) { |
| | | nextTick(() => { |
| | | getWechartQrCode(); |
| | | }); |
| | | // nextTick(() => { |
| | | // openWechatLogin(); |
| | | // }); |
| | | } |
| | | } |
| | | ); |