From 5f00696dfb25bc90034448ceb634ed1ef256681a Mon Sep 17 00:00:00 2001 From: qiyunfeng-create <1940665526@qq.com> Date: 星期四, 21 八月 2025 21:13:35 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/xiehe_website --- src/views/classManage/components/headerPage.vue | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 288 insertions(+), 0 deletions(-) diff --git a/src/views/classManage/components/headerPage.vue b/src/views/classManage/components/headerPage.vue new file mode 100644 index 0000000..3ac739e --- /dev/null +++ b/src/views/classManage/components/headerPage.vue @@ -0,0 +1,288 @@ +<template> + <div class="pageHeader"> + <div class="headerBox"> + <div class="logoBox"> + <el-image :src="logo" class="logo" @click="goHome" style="cursor: pointer" /> + <div class="titleName"><img :src="titleName" /></div> + </div> + <div class="inputBox f1"> + <div class="signIn"> + <p v-if="!userStore.userInfo?.name" class="signInBox"> + <span @click="loginBtn">娉ㄥ唽</span> + <span>|</span> + <span @click="signupBtn">鐧诲綍</span> + </p> + <!-- 鐢ㄦ埛鍚� --> + <el-dropdown trigger="click" v-else> + <p class="el-dropdown-link signInBox"> + <span>{{ userStore.userInfo?.name }}</span> + <el-icon class="el-icon--right"> + <CaretBottom /> + </el-icon> + </p> + <template #dropdown> + <el-dropdown-menu> + <el-dropdown-item @click="router.push('/personalCenter')" + >涓汉涓績</el-dropdown-item + > + <el-dropdown-item @click="logOut">閫�鍑虹櫥褰�</el-dropdown-item> + </el-dropdown-menu> + </template> + </el-dropdown> + </div> + </div> + </div> + </div> + <login ref="loginRef"></login> + <!-- 瀵艰埅鏍� --> + + <!-- 娓╅Θ鎻愮ず寮圭獥 --> + <el-dialog v-model="tipsDialogState" width="420" align-center class="tipsDialog"> + <template #title>娓╅Θ鎻愮ず</template> + <el-icon color="#e6a23c" size="24"> + <WarningFilled /> + </el-icon> + <p> + 濡傛灉鎮ㄥ凡浣跨敤銆愪含甯堟櫤鏁欐壂涓�鎵�戞垨銆愪簯涓婁功鎴裤�� + 寰俊娉ㄥ唽杩囷紝璇蜂娇鐢ㄥ井淇℃壂鐮佺櫥褰曪紱濡傛灉鎮ㄥ凡鍦ㄣ�� + 浜笀鏅烘暀銆慞C绔敞鍐岃繃锛岃浣跨敤鎵嬫満鍙风櫥褰曪紒缁х画娉ㄥ唽灏嗗垱寤哄叏鏂拌处鎴凤紒 + </p> + <template #footer> + <el-button @click="goPhoneSignup">鎵嬫満鍙风櫥褰�</el-button> + <el-button @click="goWechatSignUp">寰俊鐧诲綍</el-button> + <el-button type="primary" @click="goLogin">缁х画娉ㄥ唽</el-button> + </template> + </el-dialog> +</template> + +<script setup lang="ts"> +// import login from '@/layout/components/login.vue' +import { onMounted, ref, watchEffect, inject, watch } from 'vue' +import { ElMessage, ElMessageBox, type FormInstance } from 'element-plus' +// import logo from '@/assets/images/header/logo.png' +// import titleName from '@/assets/images/header/titleName.png' +import { useRouter } from 'vue-router' +import { useUserStore, applyBookStore } from '@/store' +const loginRef = ref() +const router = useRouter() +const userStore = useUserStore() +const applyBook = applyBookStore() +const MG = inject('MG') +const config:any = inject('config') +const tipsDialogState = ref<boolean>(false) // 娓╅Θ鎻愮ず寮圭獥鐘舵�� +const wechatTipsState = ref<boolean>(false) +const localData = ref(localStorage.getItem(config.tokenKey)) +onMounted(() => { + // 鍒ゆ柇鏄惁寰俊鎵爜鐧诲綍 + var url = window.location.href + if (url.indexOf('WeChatScanningCodeLogin') > -1) { + var querys = url.substring(url.indexOf('?') + 1).split('&') + var result = {} + for (var i = 0; i < querys.length; i++) { + var temp = querys[i].split('=') + if (temp.length < 2) { + result[temp[0]] = '' + } else { + result[temp[0]] = temp[1] + } + } + if (result && result.code) { + MG.identity + .loginByWeChatOpenCode({ + code: result.code, + appRefCode: config.appRefCode, + platform: 'PCWeb' + }) + .then((res) => { + if (res && res.status == 'Ok') { + userStore.setToken(res.token) + loginRef.value.getUserInfo() + MG.app.creatUserBehavior({ + refCode:"sign" + }).then(res => { + if(res){ + console.log("浠婃棩宸茬Н鍒�") + } + }); + } + }) + } + } +}) +watchEffect(() => { + localData.value = localStorage.getItem(config.tokenKey) || '0' +}) + +// 娉ㄥ唽鎸夐挳 +const loginBtn = () => { + tipsDialogState.value = true +} +// 鐧诲綍鎸夐挳 +const signupBtn = () => { + loginRef.value.logIn() +} + +// 缁х画娉ㄥ唽 +const goLogin = () => { + tipsDialogState.value = false + loginRef.value.signUp() +} +// 鍘诲井淇$櫥褰� +const goWechatSignUp = () => { + tipsDialogState.value = false + // loginRef.value.logIn() + loginRef.value.setWechatTipsState() +} +// 鍘绘墜鏈哄彿鐧诲綍 +const goPhoneSignup = () => { + tipsDialogState.value = false + loginRef.value.logIn() + loginRef.value.changeSignUp('authSignUp') +} +// 閫�鍑虹櫥褰� +const logOut = () => { + router.push('/home') + userStore.delteUserInfo() + applyBook.emptyBookList() + sessionStorage.removeItem('cartNumber') + localStorage.removeItem('alreadyElectronicBook') + localStorage.removeItem('alreadyPaperBook') + ElMessage.success('閫�鍑烘垚鍔�') +} + +// logo棣栭〉瀹氬悜 +const goHome = () => { + router.push('/home') +} +</script> + +<style lang="less"> +.tipsDialog { + .el-dialog__header { + font-size: 18px; + } + + .el-dialog__body { + display: flex; + align-items: center; + + p { + margin-left: 10px; + line-height: 24px; + } + } +} +</style> +<style lang="less" scoped> +.pageHeader { + width: 100%; + background: #fff; + // border-bottom:1px solid #C0C0C0; +} + +.headerBox { + width: 1200px; + margin: 0 auto; + height: 60px; + display: flex; + align-items: center; + justify-content: space-between; + .logoBox { + display: flex; + align-items: center; + .titleName { + font-size: 24px; + padding: 0 10px; + margin-left: 15px; + border-left: 1px solid #c0c0c0; + color: #181818; + font-family: Microsoft YaHei, Microsoft YaHei; + font-weight: 400; + } + /deep/.el-image__inner { + height: 48px; + border: 0; + padding: 0; + } + } +} + +/** 楠岃瘉鐮佸浘鐗� */ +.imgCode { + height: 40px; + margin-top: 5px; +} + +/** 鐪嬩笉娓呮崲涓�寮� */ +.linkHight { + height: 20px; + + /deep/ .el-link__inner { + height: 100%; + } +} + +/** header鐧诲綍娉ㄥ唽鏂囧瓧 */ +.signIn { + height: 40px; + width: 95px; + min-width: 90px; + text-align: right; + margin-left: 80px; + font-weight: 400; + justify-content: space-around; + color: #000; + font-size: 14px; + + span:first-child, + span:last-child { + cursor: pointer; + } + + .signInBox { + height: 100%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + } + + span { + padding: 5px; + } + + .el-dropdown { + width: 100%; + height: 100%; + + span { + height: 40px; + line-height: 40px; + padding: 0; + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } +} + +.selectPhone { + background: #fff; +} + +.el-select { + width: 100px; + height: 40px; + color: red; + + /deep/ .select-trigger { + height: 100%; + + .el-input--suffix { + height: 100%; + background-color: #fff; + } + } +} +</style> -- Gitblit v1.9.1