<template>
  <view class="navbox">
    <view class="bg"></view>
    <view class="namebox">
        <view class="back" @click="goBack">
          <u-icon name="arrow-left" color="#000" size="24"></u-icon>
        </view>
       <view class="logo" @click="goHome">
       <up--image
          :src="logoImg"
          width="62rpx"
          height="62rpx"
          radius="50%"

        ></up--image>
      </view>
      <view class="name" @click="goHome">
			{{ navName }}
			<view class="navbg">
						  <up--image
						     :src="navbg"
						     width="100rpx"
						     height="31rpx"		 
						   ></up--image>
			</view>
	  </view>
	  <view class="user" @click="goMy">
		  <up--image
		     :src="useImg?useImg:headImg"
		     width="62rpx"
		     height="62rpx"
		     radius="50%"
		  
		   ></up--image>
	  </view>
    </view>
   
  </view>
</template>

<script setup>
import navTo  from "@/utils/navTo.js";
import logoImg from "@/static/logo.png";
import headImg from "@/static/headImg.png";
import navbg from  "@/static/navbg.png"
import { onMounted,ref} from 'vue';
const props = defineProps({
  navName: {
    type: String,
    default: "我的",
  }

});
const useImg=ref('')
const goBack = () => {
  uni.navigateBack({
    delta: 1,
	fail(){
		uni.redirectTo({
			url:'/pages/index/index'
		})
	}
  });
};

const goHome=()=>{
	console.log(props.navName);
	if(props.navName=="肝胆相照病例交流园地"){
		uni.reLaunch({
			url:'/pages/caseTalk/caseTalk'
		  })
		}else{
		uni.reLaunch({
			url:'/pages/index/index'
		  })
		};	
	
	}	
const goMy=()=>{
	navTo({
		url:'/pages/my/my'
	})
};
onMounted(()=>{
	let userInfo=uni.getStorageSync('userInfo');
	if(userInfo && userInfo.avatar){
		useImg.value=userInfo.avatar;
	}
})
</script>

<style lang="scss" scoped>
.navbox {
  padding-bottom: 20rpx;
  background-color: #fff;
  position: relative;
  /* #ifdef H5 */
  height:120rpx;
  /* #endif */
  /* #ifdef MP-WEIXIN */
   height:200rpx;
  /* #endif */
  
  background: radial-gradient(
    60% 90% at 4% 2%,
    #43c9c3 0%,
   #fff 100%
  );
}
.bg {
  z-index: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  position: absolute;
  // background: radial-gradient(
  //   43% 90% at 84% 6%,
  //   #ffd6c9 0%,
  //   rgba(255, 255, 255, 0) 100%
  // );
}
.namebox {
   /* #ifdef H5 */
    padding-top: 51rpx;
   /* #endif */
   /* #ifdef MP-WEIXIN */
    padding-top: 102rpx;
   /* #endif */
    
    margin: 0rpx 30rpx 0rpx;
    display: flex;
    align-items: center;
  display: flex;
  align-items: center;
  .logo{
    margin-left: 35rpx;
  }
  .back{
    position: absolute;
    left: 0;
  }
  .user{
	  margin-left:55rpx;
  }
  .name {
    margin-left: 16rpx;
    font-size: 30rpx;
    color: #111827;
	position: relative;
	.navbg{
		position: absolute;
		 z-index:-1;
		 top:10rpx;
		 left:18rpx;
		 
		   
	}
  }
}
.search {
  margin: 40rpx 30rpx 0rpx;
  display: flex;

  align-items: center;
  justify-content: space-between;
  .searchwrap {
    display: flex;
    align-items: center;
    flex: 1;
    padding-left: 28rpx;
    margin-right: 23rpx;
    height: 80rpx;
    background: #fbfbfb;
    box-shadow: 0px 4rpx 10rpx 0px rgba(153, 153, 153, 0.5);
    border-radius: 40rpx;

    .ipt {
      margin-left: 15rpx;
      font-size: 28rpx;
    }
  }
}
</style>