pcNav.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view>
  3. <view class="nav">
  4. <view class="navCont">
  5. <view class="logo">
  6. <image src="../../static/pcimg/nav_logo@2x.png" mode="" class="logoImg"></image>
  7. </view>
  8. <view class="navTitle">门店学院</view>
  9. <view class="indexNav" :class="{'indexActive':data=='index'}" @click="goIndex">首页</view>
  10. <view class="allCategory">
  11. <view class="allCategoryLine" :class="{'indexActive':itemName==item.name}" v-for="(item,index) in allCategory" v-if="index<4" @click="goItem(item)">{{item.name}}</view>
  12. <view class="allCategoryMore" v-if="allCategory.length>1">
  13. <span @click="moreBtn">更多</span>
  14. <image @click="moreBtn" src="../../static/pcimg/icon_arrow_xia@2x.png" mode="widthFix" class="navmoreImg"></image>
  15. <view class="navMoret" v-show="navMoret">
  16. <view class="navMoreTline" v-for="(item,index) in allCategory" v-if="index>3" @click="goItem(item)">{{item.name}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="navSs" @click="gosearchlist">
  21. <image src="../../static/pcimg/icon_search@2x.png" mode="widthFix" class="navSsimg"></image>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. name: "searchBox",
  30. props: ['data','itemName'],
  31. data() {
  32. return {
  33. allCategory:[],
  34. navMoret:false,
  35. };
  36. },
  37. onLoad() {
  38. },
  39. created(){
  40. this.getallCategory();
  41. },
  42. methods:{
  43. gosearchlist(){
  44. uni.navigateTo({
  45. url:'../../pages/pc/searchlist'
  46. })
  47. },
  48. goItem(item){
  49. console.log(item)
  50. uni.navigateTo({
  51. url:'list?code='+item.code+'&topName='+item.name+'&comment='+item.comment
  52. })
  53. },
  54. goIndex(){
  55. uni.navigateTo({
  56. url:'../../pages/pc/index'
  57. })
  58. },
  59. getallCategory(){
  60. this.$http('/trainingOpenApi/allCategory', {}, 'GET').then(res => {
  61. this.allCategory = res.data
  62. })
  63. },
  64. moreBtn(){
  65. this.navMoret=!this.navMoret
  66. },
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. .nav{
  72. width: 100%;
  73. height: 72px;
  74. background: #FFFFFF;
  75. box-shadow: 0px 4px 10px 0px rgba(153, 153, 153, 0.12);
  76. display: flex;
  77. justify-content: center;
  78. position: fixed;
  79. left: 0;
  80. top: 0;
  81. z-index: 11;
  82. }
  83. .navCont{
  84. width: 1200px;
  85. display: flex;
  86. position: relative;
  87. }
  88. .logoImg{
  89. width: 86px;
  90. height: 36px;
  91. margin-top: 19px;
  92. }
  93. .navTitle{
  94. line-height: 72px;
  95. font-weight: 500;
  96. color: #3C3C3C;
  97. font-size: 24px;
  98. padding-left: 24px;
  99. }
  100. .indexNav{
  101. line-height: 72px;
  102. font-weight: 500;
  103. color: #3C3C3C;
  104. font-size: 20px;
  105. padding-left: 54px;
  106. cursor: pointer;
  107. }
  108. .indexActive{
  109. color: #FF4F00 !important;
  110. }
  111. .allCategory{
  112. display: flex;
  113. line-height: 72px;
  114. }
  115. .allCategoryLine{
  116. padding-left: 44px;
  117. color: #3C3C3C;
  118. font-size: 20px;
  119. cursor: pointer;
  120. }
  121. .allCategoryMore{
  122. padding-left: 44px;
  123. color: #3C3C3C;
  124. font-size: 20px;
  125. display: flex;
  126. cursor: pointer;
  127. position: relative;
  128. }
  129. .navMoret{
  130. position: absolute;
  131. width: 160px;
  132. background: #FFFFFF;
  133. box-shadow: 0px 4px 10px 0px rgba(153, 153, 153, 0.12);
  134. border-radius: 6px;
  135. top: 72px;
  136. left:0 ;
  137. }
  138. .navMoreTline{
  139. width: 160px;
  140. text-align: center;
  141. font-size: 20px;
  142. }
  143. .navmoreImg{
  144. width: 12px;
  145. height: 8px;
  146. margin-top: 32px;
  147. margin-left: 10px;
  148. }
  149. .navSsimg{
  150. width: 24px;
  151. height: 24px;
  152. }
  153. .navSs{
  154. position: absolute;
  155. cursor: pointer;
  156. top:24px;
  157. right: 0;
  158. }
  159. </style>