pcNav.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view>
  3. <view class="nav">
  4. <view class="navCont">
  5. <view class="logo">
  6. <!-- <image src="../../static/pcimg/111.png" mode="" class="logoImg euroreparIMg"></image> -->
  7. <!-- <image :src="info.logo" mode="" class="logoImg euroreparIMg"></image> --><!-- euroreparIMg -->
  8. </view>
  9. <view class="navTitle">{{info.title}}</view>
  10. <view class="indexNav" :class="{'indexActive':data=='index'}" @click="goIndex">首页</view>
  11. <view class="allCategory">
  12. <view class="allCategoryLine" :class="{'indexActive':itemName==item.name}" v-for="(item,index) in allCategory" v-if="index<7" @click="goItem(item)">{{item.name}}</view>
  13. <view class="allCategoryMore" v-if="allCategory.length>7">
  14. <span @click="moreBtn" class="moreBtn">更多</span>
  15. <image @click="moreBtn" src="../../static/pcimg/icon_arrow_xia@2x.png" mode="widthFix" class="navmoreImg"></image>
  16. <image src="../../static/pcimg/mores.png" mode="widthFix" class="navmoreImg2"></image>
  17. <view class="navMoret" >
  18. <view class="navMoreTline" v-for="(item,index) in allCategory" v-if="index>4" @click="goItem(item)">{{item.name}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="navSs" @click="gosearchlist">
  23. <image src="../../static/pcimg/icon_search@2x.png" mode="widthFix" class="navSsimg"></image>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: "searchBox",
  32. props: ['data','itemName'],
  33. data() {
  34. return {
  35. allCategory:[],
  36. navMoret:false,
  37. info:'',
  38. };
  39. },
  40. onLoad() {
  41. },
  42. created(){
  43. this.getallCategory();
  44. this.getInfo()
  45. },
  46. methods:{
  47. gosearchlist(){
  48. /* uni.navigateTo({
  49. url:'../../pages/pc/searchlist'
  50. }) */
  51. this.$emit("gosearchlist",1);
  52. },
  53. goItem(item){
  54. /* var pages = getCurrentPages() ;
  55. var currentRoute = pages[pages.length-1].route;
  56. console.log(currentRoute)
  57. console.log(item) */
  58. /* if(currentRoute=='pages/pc/list'){
  59. this.$emit("getChildList",item);
  60. }else{
  61. uni.navigateTo({
  62. url:'list?code='+item.code+'&topName='+item.name+'&comment='+item.comment
  63. })
  64. } */
  65. this.$emit("getChildList",item);
  66. uni.pageScrollTo({
  67.    scrollTop: 0, duration: 100
  68. });
  69. },
  70. getInfo(){
  71. this.$http('/trainingOpenApi/getInfo', {}, 'GET').then(res => {
  72. this.info = res.data
  73. })
  74. },
  75. goIndex(){
  76. /* uni.navigateTo({
  77. url:'../../pages/pc/index'
  78. }) */
  79. this.$emit("getIndexList",1);
  80. },
  81. getallCategory(){
  82. this.$http('/trainingOpenApiV2/allCategory', {}, 'GET').then(res => {
  83. this.allCategory = res.data
  84. })
  85. },
  86. moreBtn(){
  87. this.navMoret=!this.navMoret
  88. },
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .nav{
  94. width: 100%;
  95. height: 72px;
  96. background: #FFFFFF;
  97. box-shadow: 0px 4px 10px 0px rgba(153, 153, 153, 0.12);
  98. display: flex;
  99. justify-content: center;
  100. position: fixed;
  101. left: 0;
  102. top: 0;
  103. z-index: 11;
  104. }
  105. .navCont{
  106. width: 1200px;
  107. display: flex;
  108. position: relative;
  109. }
  110. .logoImg{
  111. width: 62px;
  112. height: 28px;
  113. margin-top: 19px;
  114. }
  115. .navTitle{
  116. line-height: 72px;
  117. font-weight: 500;
  118. color: #3C3C3C;
  119. font-size: 20px;
  120. padding-left: 10px;
  121. font-family: PingFangSC-Medium, PingFang SC;
  122. }
  123. .indexNav{
  124. line-height: 72px;
  125. color: #3C3C3C;
  126. font-size: 16px;
  127. padding-left: 54px;
  128. cursor: pointer;
  129. }
  130. .indexActive{
  131. color: #FF4F00 !important;
  132. }
  133. .allCategory{
  134. display: flex;
  135. line-height: 72px;
  136. }
  137. .allCategoryLine{
  138. padding-left: 30px;
  139. color: #3C3C3C;
  140. font-size: 16px;
  141. cursor: pointer;
  142. }
  143. .allCategoryMore{
  144. padding-left: 30px;
  145. color: #3C3C3C;
  146. font-size: 16px;
  147. display: flex;
  148. cursor: pointer;
  149. position: relative;
  150. }
  151. .navMoret{
  152. position: absolute;
  153. width: 140px;
  154. background: #FFFFFF;
  155. box-shadow: 0px 4px 10px 0px rgba(153, 153, 153, 0.12);
  156. border-radius: 6px;
  157. top: 72px;
  158. left:0px ;
  159. font-size: 16px;
  160. display: none;
  161. }
  162. .allCategoryMore:hover .navMoret{
  163. display: block;
  164. }
  165. .navMoreTline{
  166. width: 140px;
  167. text-align: center;
  168. font-size: 16px;
  169. line-height: 50px;
  170. }
  171. .allCategoryMore:hover .moreBtn{
  172. color: #FF4F00;
  173. }
  174. .navmoreImg{
  175. width: 12px;
  176. height: 8px;
  177. margin-top: 32px;
  178. margin-left: 10px;
  179. }
  180. .navmoreImg2{
  181. width: 12px;
  182. height: 8px;
  183. margin-top: 32px;
  184. margin-left: 10px;
  185. display: none;
  186. }
  187. .allCategoryMore:hover .navmoreImg{
  188. display: none;
  189. }
  190. .allCategoryMore:hover .navmoreImg2{
  191. display: block;
  192. }
  193. .navSsimg{
  194. width: 20px;
  195. height: 20px;
  196. }
  197. .navSs{
  198. position: absolute;
  199. cursor: pointer;
  200. top:24px;
  201. right: 0;
  202. }
  203. .euroreparIMg{
  204. width: 132px;
  205. height: 29px;
  206. margin-top: 21px;
  207. }
  208. </style>