| | |
| | | <template> |
| | | <div class="IndexHeader"> |
| | | <div class="header" :class="{ showBox: isShow, disOpacity: !opacity }"> |
| | | <!-- 右侧 --> |
| | | <!-- 左侧 --> |
| | | <div class="left"> |
| | | <router-link to="/"> |
| | | <img class="logo" src="/images/index/LOGO.png" alt="" /> |
| | |
| | | <div class="label" @click="$router.push('/product')">应用商城</div> |
| | | </div> |
| | | |
| | | <!-- 左侧 --> |
| | | <!-- 右侧 --> |
| | | <div class="right"> |
| | | <el-input |
| | | placeholder="请输入关键词" |
| | |
| | | > |
| | | <div class="iconList" slot="suffix"> |
| | | <i class="search iconfont" v-if="!isShow"></i> |
| | | <i class="search iconfont" v-if="isShow"></i> |
| | | <i class="del iconfont" v-if="isShow" @click="showInputBox(false)" |
| | | ></i |
| | | > |
| | | <i class="search iconfont" @click="search" v-if="isShow"></i> |
| | | <i class="del iconfont" v-if="isShow" @click="showInputBox(false)"></i> |
| | | </div> |
| | | </el-input> |
| | | |
| | | <!-- 未登录情况 --> |
| | | <div |
| | | class="headerLogin" |
| | | v-if="!userInfo" |
| | | @click="$router.push('/login')" |
| | | > |
| | | <div class="headerLogin" v-if="!userInfo" @click="$router.push('/login')"> |
| | | 登录 |
| | | </div> |
| | | <div |
| | | class="register" |
| | | v-if="!userInfo" |
| | | @click="$router.push('/register')" |
| | | > |
| | | <div class="register" v-if="!userInfo" @click="$router.push('/register')"> |
| | | 免费注册 |
| | | </div> |
| | | |
| | | <!-- 已登录情况 --> |
| | | <img |
| | | class="userImg" |
| | | src="/images/index/default.png" |
| | | src="/images/index/8.jpg" |
| | | alt="" |
| | | v-if="userInfo" |
| | | @mouseenter="showUserBox" |
| | | @mouseleave="hiddenUserBox" |
| | | style="border-radius: 50%" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 用户下拉框 --> |
| | | <div |
| | | class="userBox" |
| | | v-if="userInfo && isShowUserBox" |
| | | @mouseenter="showUserBox" |
| | | @mouseleave="hiddenUserBox" |
| | | > |
| | | <div class="userBox" v-if="userInfo && isShowUserBox" @mouseenter="showUserBox" @mouseleave="hiddenUserBox"> |
| | | <div class="userName">{{ userInfo.username }}</div> |
| | | <ul> |
| | | <li class="money"> |
| | | <!-- <li class="money"> |
| | | <div class="label">余额</div> |
| | | <div class="content"> |
| | | <span class="button">充值</span> |
| | | <span class="number">¥0</span> |
| | | </div> |
| | | </li> |
| | | |
| | | --> |
| | | <li class="personal"> |
| | | <div class="label"> |
| | | <router-link to="/personalCenter">个人中心</router-link> |
| | | </div> |
| | | |
| | | <div class="content"> |
| | | <span class="iconfont"></span> 已实名认证 |
| | | </div> |
| | | <div class="content"><span class="iconfont"></span> 已实名认证</div> |
| | | </li> |
| | | |
| | | <li> |
| | | <div class="label" @click="jump(1)">订单管理</div> |
| | | <div class="label" @click="jump(0)">订单管理</div> |
| | | </li> |
| | | |
| | | <li> |
| | | <!-- <li> |
| | | <div class="label">产品续费</div> |
| | | </li> |
| | | </li> --> |
| | | |
| | | <li> |
| | | <!-- <li> |
| | | <div class="label">未读消息</div> |
| | | </li> |
| | | </li> --> |
| | | |
| | | <li> |
| | | <div class="label">未支付订单</div> |
| | | <div class="label" @click="jump(0, 1)">未支付订单</div> |
| | | </li> |
| | | |
| | | <li> |
| | |
| | | <div class="hotKey"> |
| | | <div class="title">热门搜索</div> |
| | | <ul class="keyCard"> |
| | | <li class="keyItem" v-for="(item, index) in hotKeyArr" :key="index"> |
| | | <li class="keyItem" @click="jumpToSearch(item)" v-for="(item, index) in hotKeyArr" :key="index"> |
| | | {{ item }} |
| | | </li> |
| | | x |
| | | </ul> |
| | | </div> |
| | | |
| | | <div class="historyKey"> |
| | | <!-- <div class="historyKey"> |
| | | <div class="title colorLight">历史搜索</div> |
| | | |
| | | <ul class="keyCard"> |
| | |
| | | {{ item }} |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | |
| | | <!-- 遮罩层 --> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { logout } from "@/api/login"; |
| | | import { logout } from "@/api/login" |
| | | |
| | | export default { |
| | | props: { |
| | | opacity: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | default: true |
| | | } |
| | | }, |
| | | name: "Header", |
| | | created() { |
| | | //尝试从session中拿用户信息 |
| | | this.userInfo = JSON.parse(sessionStorage.getItem("userInfo")); |
| | | this.userInfo = JSON.parse(sessionStorage.getItem("userInfo")) |
| | | /* document.addEventListener("click", () => { |
| | | this.showUserBox = false; |
| | | }); */ |
| | |
| | | return { |
| | | keyWord: "", //输入框内容 |
| | | isShow: false, //显示下拉框 |
| | | hotKeyArr: ["算法", "智能AI", "云服务", "管理中心", "实时音视频", "短信"], //热门关键词 |
| | | hotKeyArr: ["打电话", "离岗", "睡岗", "入侵", "离岗", "安全帽"], //热门关键词 |
| | | historyKeyArr: ["云服务", "算法", "管理服务", "应用"], //历史关键词 |
| | | isShowBox: false, //输入下拉框 |
| | | userInfo: null, //用户信息 |
| | | isShowUserBox: false, //用户信息弹层 |
| | | UserTimer: null, // 控制弹层的定时器 |
| | | }; |
| | | UserTimer: null // 控制弹层的定时器 |
| | | } |
| | | }, |
| | | methods: { |
| | | // 控制输入框box |
| | | showInputBox(toggle) { |
| | | this.isShow = toggle; |
| | | this.isShowBox = toggle; |
| | | this.$emit("showInputBox", toggle); |
| | | this.isShow = toggle |
| | | this.isShowBox = toggle |
| | | this.keyWord = "" |
| | | this.$emit("showInputBox", toggle) |
| | | }, |
| | | |
| | | //控制用户信息box |
| | | showUserBox() { |
| | | if (this.UserTimer) { |
| | | clearTimeout(this.UserTimer); |
| | | this.UserTimer = null; |
| | | clearTimeout(this.UserTimer) |
| | | this.UserTimer = null |
| | | } |
| | | this.isShowUserBox = true; |
| | | this.isShowUserBox = true |
| | | }, |
| | | hiddenUserBox() { |
| | | const _this = this; |
| | | const _this = this |
| | | this.UserTimer = setTimeout(() => { |
| | | _this.isShowUserBox = false; |
| | | }, 200); |
| | | _this.isShowUserBox = false |
| | | }, 200) |
| | | }, |
| | | |
| | | logOut() { |
| | | logout().then(() => { |
| | | sessionStorage.removeItem("loginedInfo"); |
| | | sessionStorage.removeItem("expires_in"); |
| | | sessionStorage.removeItem("userInfo"); |
| | | sessionStorage.removeItem("loginedInfo") |
| | | sessionStorage.removeItem("expires_in") |
| | | sessionStorage.removeItem("userInfo") |
| | | this.$router.push({ |
| | | path: "/login", |
| | | }); |
| | | path: "/login" |
| | | }) |
| | | this.$notify({ |
| | | title: "提示", |
| | | type: "success", |
| | | message: "退出成功!", |
| | | duration: 2500, |
| | | offset: 57, |
| | | }); |
| | | }); |
| | | offset: 57 |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | jump(id) { |
| | | jump(id, type) { |
| | | if (type) { |
| | | sessionStorage.setItem("type", type) |
| | | } |
| | | this.$router.push({ |
| | | path: "/personalCenter", |
| | | query: { |
| | | id: id, |
| | | }, |
| | | }); |
| | | id: id |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | }; |
| | | |
| | | search() { |
| | | this.$router.push({ |
| | | path: "/product", |
| | | query: { |
| | | keyWord: this.keyWord |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | jumpToSearch(keyWord) { |
| | | this.$router.push({ |
| | | path: "/product", |
| | | query: { |
| | | keyWord |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | height: 62px; |
| | | height: 50px; |
| | | width: 100%; |
| | | min-width: 1280px; |
| | | background-color: rgba(255, 255, 255, 0.25); |
| | | background-color: #1f2a3e; |
| | | color: #fff; |
| | | font-size: 14px; |
| | | |
| | |
| | | } |
| | | |
| | | .title { |
| | | margin-right: 10px; |
| | | margin-right: 30px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .label { |
| | | margin: 0 20px; |
| | | margin-right: 20px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | |
| | | .right { |
| | | position: relative; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | |
| | | .el-input ::v-deep { |
| | | input { |
| | | height: 62px; |
| | | height: 50px; |
| | | width: 180px; |
| | | background-color: rgba(255, 255, 255, 0.5); |
| | | background-color: rgba(255, 255, 255, 0.05) !important; |
| | | border: none; |
| | | border-radius: 0; |
| | | color: #fff; |
| | |
| | | } |
| | | |
| | | .el-input__suffix { |
| | | padding-top: 23px; |
| | | padding-right: 23px; |
| | | padding-top: 17px; |
| | | padding-right: 19px; |
| | | } |
| | | |
| | | .search { |
| | | color: #fff; |
| | | cursor: pointer; |
| | | .iconList { |
| | | .search { |
| | | color: #fff !important; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .userImg { |
| | | height: 48px; |
| | | width: 48px; |
| | | height: 28px; |
| | | width: 28px; |
| | | margin: 0 20px; |
| | | } |
| | | } |
| | |
| | | &:hover, |
| | | &.showBox, |
| | | &.disOpacity { |
| | | background-color: #fff; |
| | | background-color: #1f2a3e; |
| | | |
| | | .left { |
| | | font-family: PingFang SC Regular; |
| | | font-size: 14px; |
| | | font-weight: normal; |
| | | line-height: 20px; |
| | | letter-spacing: 0px; |
| | | color: #ffffff; |
| | | .title { |
| | | color: #3d3d3d; |
| | | // color: #3d3d3d; |
| | | font-weight: 700; |
| | | } |
| | | |
| | | .label { |
| | | color: #3d3d3d; |
| | | // color: #3d3d3d; |
| | | &:hover { |
| | | color: #0065ff; |
| | | } |
| | | } |
| | | } |
| | | .right { |
| | |
| | | top: 64px; |
| | | padding: 0 20px; |
| | | width: 240px; |
| | | height: 427px; |
| | | height: 327px; |
| | | background-color: #fff; |
| | | box-shadow: 0px 4px 12px rgba(96, 100, 106, 0.12); |
| | | border-radius: 4px; |
| | |
| | | } |
| | | |
| | | ul { |
| | | height: 300px; |
| | | height: 200px; |
| | | border-top: 1px solid #e9ebee; |
| | | border-bottom: 1px solid #e9ebee; |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | | </style> |