杨磊
2024-06-06 1a5b2a6443dc24e3e024e2c0bb500d80a2b20d11
src/components/headNav/headNav.vue
@@ -3,7 +3,13 @@
    <view class="NavTop flex" :style="{ backgroundImage: 'url(' + bg + ')' }">
      <view
        class="santiaogang"
        style="width: 0.34rem; height: 0.34rem; margin-right: 3rem;cursor: pointer;"
        style="
          width: 0.34rem;
          height: 0.34rem;
          margin-right: 3rem;
          cursor: pointer;
        "
        title="导航菜单"
        @click="menuNav = !menuNav"
        ><img
          style="width: 100%; height: 100%"
@@ -13,13 +19,7 @@
      <view class="flex" style="letter-spacing: 5rpx">
        <view class="logo"></view>
        <view
          class=""
          style="
            margin-left: 0.19rem;
            font-size: 0.24rem;
            font-family: cursive;
            font-weight: 900;
          "
          style="margin-left: 0.19rem; font-size: 0.24rem; font-weight: 900"
        >
          {{ text }}
        </view>
@@ -35,7 +35,6 @@
            justify-content: flex-end;
          "
        >
          <!-- overflow: hidden;  -->
          <input
            :style="{ display: isExpanded == true ? 'block' : 'none' }"
            type="text"
@@ -46,11 +45,13 @@
              font-size: 0.13rem;
            "
            @blur="InputBlur"
            @confirm="toggleSearch"
            class="search-input"
            v-model="searchInput"
            placeholder="请输入搜索内容"
          />
          <view
            title="搜索"
            class="search-logo"
            @click="toggleSearch"
            :style="{
@@ -66,6 +67,7 @@
        <el-dropdown trigger="click" @command="handleCommand">
          <!-- <view @click="iconClick(2)" class="s2 ss1 "></view> -->
          <img
            title="个人中心"
            class="cursor"
            @click="changePassword(1)"
            src="@/static/image/profile.svg"
@@ -77,6 +79,7 @@
          </el-dropdown-menu>
        </el-dropdown>
        <img
          title="帮助"
          class="cursor"
          @click="changePassword(2)"
          src="@/static/image/quote.svg"
@@ -97,7 +100,7 @@
    >
      <!-- 背景 -->
      <img class="leftListBgImage" src="@/static/image/leftListBg.png" alt="" />
      <view class="" style="position: relative; z-index: 999">
      <view style="position: relative; z-index: 999">
        <view class="flex flex-center LeftLogo">
          <!-- <img src="@/static/image/logo.png" ></img> -->
          <view class="img"></view>
@@ -114,11 +117,11 @@
          <el-menu-item index="1">
            <span slot="title">中医人物数据库</span>
          </el-menu-item>
          <el-menu-item index="2">
          <el-menu-item index="2" class="oActive">
            <span slot="title">世医医家数据库</span>
          </el-menu-item>
          <el-menu-item index="3">
            <span slot="title">中医医学流派</span>
            <span slot="title">中医学术流派</span>
          </el-menu-item>
          <el-menu-item index="4">
            <span slot="title">中医地域图谱</span>
@@ -129,7 +132,7 @@
        </el-menu>
      </view>
    </el-dialog>
    <!-- <view class="" style="position: fixed;right: 0;top: 0;" @click="dialogVisible = !dialogVisible">水水水水</view> -->
    <!-- <view  style="position: fixed;right: 0;top: 0;" @click="dialogVisible = !dialogVisible">水水水水</view> -->
    <!-- <el-card v-if="menuNav"
         style="position: fixed;left: 0;top: 0; z-index: 999999999; width: 240px;height: 100vh;">
         
@@ -186,26 +189,21 @@
    // 修改密码
    changePassword(index) {
      if (index == 1) {
        // console.log('sdfdsf');
        // 检查 localStorage 中是否存在 token
        if (localStorage.getItem("access_token")) {
          // token 存在
          console.log("access_token");
          this.isCommand = true;
        } else {
          // token 不存在
          // console.log('Token does not exist.');
          this.isCommand = false;
          // uni.navigateTo({
          //    url: '/pages/Login/Login'
          // })
          console.log("不存在");
          uni.showModal({
            // 询问用户是否退出登录
            title: "请重新登录",
            content: "您确定要重新登录吗?",
            success: async (res) => {
              console.log(res, "reresresrer");
              if (res.confirm) {
                setTimeout(() => {
                  uni.reLaunch({
@@ -214,10 +212,6 @@
                }, 1500);
              } else if (res.cancel) {
                // console.log('用户点击取消');
                uni.showToast({
                  title: "用户点击取消",
                  icon: "none"
                });
              }
            }
          });
@@ -232,59 +226,42 @@
    // 修改获取退出按钮
    handleCommand(int) {
      if (int == 1) {
        console.log("修改密码");
        uni.navigateTo({
          url: "/pages/changePassword/changePassword"
        });
      } else if (int == 2) {
        // console.log('退出登录');
        uni.showModal({
          // 询问用户是否退出登录
          title: "退出登录",
          content: "您确定要退出登录吗?",
          success: async (res) => {
            console.log(res, "reresresrer");
          success: (res) => {
            if (res.confirm) {
              // 退出接口
              await getlogout().then((res) => {
              getlogout().then((res) => {
                //确定退出拿到token并清除token
                let TOKEN = uni.getStorageSync("access_token");
                uni.clearStorageSync();
                //退出成功!并跳转到其他页面
                uni.showToast({
                  title: "退出成功",
                  icon: "none"
                });
              });
              setTimeout(() => {
                this.$message.success("退出成功");
                uni.reLaunch({
                  url: "/pages/Login/Login"
                });
              }, 1500);
              });
            } else if (res.cancel) {
              // console.log('用户点击取消');
              uni.showToast({
                title: "用户点击取消",
                icon: "none"
              });
            }
          }
        });
      }
    },
    aaa() {
      console.log("ss");
    },
    handleSelect(index) {
      console.log(index);
      if (index === "0") {
        uni.navigateTo({
          url: "/pages/index/index?id=" + 0
        });
      } else if (index === "1") {
        uni.navigateTo({
          url: "/pages/characterRelation/characterRelation?id=" + 1
          url: "/pages/character/index?id=" + 1
        });
      } else if (index === "2") {
        uni.navigateTo({
@@ -292,7 +269,7 @@
        });
      } else if (index === "3") {
        uni.navigateTo({
          url: "/pages/dataDisplay/dataDisplay?id=" + 3
          url: "/pages/academicGenres/index?id=" + 3
        });
      } else if (index === "4") {
        uni.navigateTo({
@@ -311,17 +288,15 @@
    },
    // 切换搜索框的展开和收起状态
    toggleSearch() {
      // console.log('撒旦范德萨发生的',this.searchInput);
      this.isExpanded = !this.isExpanded;
      this.$nextTick(() => {
        if (this.searchInput.trim() !== "") {
          console.log("搜索", this.searchInput);
        } else {
          console.log("不搜索");
          uni.navigateTo({
            url:
              "/pages/knowledgeBase/knowledgeBase?keyword=" + this.searchInput
          });
        }
        this.searchInput = "";
        console.log(this.isExpanded);
      });
    }
  }
@@ -343,23 +318,22 @@
  }
}
@media screen and (min-width: 2560px) and (max-width: 3840px) {
  ::v-deep .el-menu .is-active {
    background-color: #244a7b !important;
    border-radius: 0.5rem;
  }
::v-deep .el-menu .is-active {
  background-color: #244a7b !important;
  border-radius: 0.5rem;
}
::v-deep .el-menu .is-active.oActive {
  background-color: #e27917 !important;
}
@media screen and (min-width: 2560px) and (max-width: 3840px) {
  .LeftLogo .img {
    background-image: url(@/static/image/logo4.png);
  }
}
@media screen and (min-width: 1366px) and (max-width: 1920px) {
  ::v-deep .el-menu .is-active {
    background-color: #244a7b !important;
    border-radius: 0.5rem;
  }
  .LeftLogo .img {
    background-image: url(@/static/image/logo.png);
  }
@@ -373,12 +347,11 @@
  /* 粘性定位 */
  position: sticky;
  top: 0;
  z-index: 9;
  z-index: 99999999;
}
.NavTop {
  /* background: url(@/static/image/topBg.png); */
  /* background-image: url("../../static/image/topBg.png"); */
  background-size: 100% 100%;
  padding: 0.16rem 0.24rem;
  color: #fff !important;