leftMenu.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="leftMenuRoot df fdr" v-show="isShow">
  3. <!-- 左边导航栏 -->
  4. <view class="leftBox df fdc">
  5. <view class="leftMenu-topIcon df aic" @click="hide">
  6. <img src="../assets/leftMenu/icon_leftUp.png"></img>
  7. </view>
  8. <!-- <scroll-view class="leftMenu-scroll df showboder" scroll-y="true"> -->
  9. <view class="df fdc" v-for="(menu1,i) in btnList" :key="i">
  10. <view class="leftMenu-btn1 df fdr aic" @click="onLeftBtn1Click(i)">
  11. <view class="leftMenu-btn1-icon df ">
  12. <img :src="checkedIndex1==i?menu1.icon_btn1_checked:menu1.icon_btn1_unchecked"></img>
  13. </view>
  14. <view class="leftMenu-btn1-text" :style="{color:checkedIndex1==i?color_checked:color_unchecked}">{{menu1.text}}</view>
  15. </view>
  16. <view class="leftMenu-line"></view>
  17. <view class="leftMenu-btn2-box1 df fdc" v-show="checkedIndex1==i" v-for="(menu2,m) in menu1.list" :key="m" @click="onLeftBtn2Click(m)">
  18. <view class="leftMenu-btn2-box2 df fdr aic">
  19. <view class="leftMenu-btn2-icon df">
  20. <img :src="checkedIndex2==m?icon_btn2_checked:icon_btn2_unchecked"></img>
  21. </view>
  22. <view class="leftMenu-btn2-text" :style="{color:checkedIndex2==m?color_checked:color_unchecked}">{{menu2}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- </scroll-view> -->
  27. </view>
  28. <!-- 右边半透明 -->
  29. <view class="rightBox" @click="hide"></view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. isShow: false,
  37. checkedIndex1: 3,
  38. checkedIndex2: 0,
  39. // ------以下为静态
  40. btnList: [{
  41. "text": '首页',
  42. "icon_btn1_checked": require('../assets/leftMenu/icon_sy_02.png'),
  43. "icon_btn1_unchecked": require('../assets/leftMenu/icon_sy_01.png'),
  44. //"list": ["虚拟仿真1号摄影棚", '虚拟仿真库', '影视项目开发管理中心', '虚拟仿真主题拍摄基地', "学生创作项目管理平台老师"]
  45. "list": []
  46. },
  47. {
  48. "text": '实验简介',
  49. "icon_btn1_checked": require('../assets/leftMenu/icon_syjj_02.png'),
  50. "icon_btn1_unchecked": require('../assets/leftMenu/icon_syjj_01.png'),
  51. "list": ['评审账号', '快速进入实验', '项目概述', '实验使用环境与技术架构', '项目简介视频']
  52. },
  53. {
  54. "text": '学前导览',
  55. "icon_btn1_checked": require('../assets/leftMenu/icon_xxlc_02.png'),
  56. "icon_btn1_unchecked": require('../assets/leftMenu/icon_xxlc_01.png'),
  57. "list": ['学习概要', '实验步骤', '实验引导视频', '学习资料下载']
  58. },
  59. {
  60. "text": '开始学习',
  61. "icon_btn1_checked": require('../assets/leftMenu/icon_ksxx_02.png'),
  62. "icon_btn1_unchecked": require('../assets/leftMenu/icon_ksxx_01.png'),
  63. "list": ["原理认知", "实景勘察", "虚拟技术搭建", "虚拟艺术创作", "虚拟资源库"]
  64. },
  65. // {
  66. // "text": '学生登录',
  67. // "icon_btn1_checked": require('../assets/leftMenu/icon_ksxx_02.png'),
  68. // "icon_btn1_unchecked": require('../assets/leftMenu/icon_ksxx_01.png'),
  69. // "list": []
  70. // },
  71. // {
  72. // "text": '学生创作项目管理平台',
  73. // "icon_btn1_checked": require('../assets/leftMenu/icon_ksxx_02.png'),
  74. // "icon_btn1_unchecked": require('../assets/leftMenu/icon_ksxx_01.png'),
  75. // "list": []
  76. // },
  77. // {
  78. // "text": '开始勘测',
  79. // "icon_btn1_checked": require('../assets/leftMenu/icon_ksxx_02.png'),
  80. // "icon_btn1_unchecked": require('../assets/leftMenu/icon_ksxx_01.png'),
  81. // "list": []
  82. // }
  83. ],
  84. icon_btn2_checked: require('../assets/leftMenu/icon_btn2_02.png'),
  85. icon_btn2_unchecked: require('../assets/leftMenu/icon_btn2_01.png'),
  86. color_checked: '#EA252C',
  87. color_unchecked: '#020202'
  88. }
  89. },
  90. methods: {
  91. initData() {
  92. this.checkedIndex1 = -1;
  93. this.checkedIndex2 = -1;
  94. },
  95. hide() {
  96. this.isShow = false;
  97. },
  98. show(indexArr) {
  99. this.isShow = true;
  100. // console.log("左侧导航展示",indexArr);
  101. this.checkedIndex1 = indexArr[0];
  102. this.checkedIndex2 = indexArr[1];
  103. },
  104. onLeftBtn1Click(index) {
  105. this.checkedIndex2 = -1;
  106. if (this.btnList[index].list.length > 0) {
  107. //收起
  108. if (index == this.checkedIndex1) {
  109. this.checkedIndex1 = -1;
  110. // this.$emit("onLeftMenuClick", [index, -1])
  111. }
  112. // 展开
  113. else {
  114. this.checkedIndex1 = index;
  115. // this.$emit("onLeftMenuClick", [index, -1])
  116. }
  117. } else {
  118. // this.hide();
  119. this.checkedIndex1 = index;
  120. this.$emit("onLeftMenuClick", [index, -1])
  121. }
  122. // this.$forceUpdate();
  123. // console.log("点击1级目录",this.checkedIndex1,this.checkedIndex2);
  124. },
  125. onLeftBtn2Click(index) {
  126. this.checkedIndex2 = index;
  127. // this.hide();
  128. this.$emit("onLeftMenuClick", [this.checkedIndex1, index])
  129. // console.log("点击2级目录",this.checkedIndex1,this.checkedIndex2);
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. .leftMenuRoot {
  136. position: fixed;
  137. width: 100%;
  138. height: 100%;
  139. z-index: 2;
  140. }
  141. .leftBox {
  142. // width: px2vw(226);
  143. width: px2vw(300);
  144. height: 100%;
  145. background: #FFFFFF;
  146. }
  147. .rightBox {
  148. flex: 1;
  149. background: #000000;
  150. opacity: 0.24;
  151. }
  152. .leftMenu-topIcon {
  153. background: #EA252C;
  154. height: 6.2vw;
  155. }
  156. .leftMenu-topIcon img {
  157. margin-left: px2vw(41);
  158. }
  159. .leftMenu-btn1-icon {
  160. margin-left: px2vw(21);
  161. margin-top: px2vw(32);
  162. margin-bottom: px2vw(32);
  163. }
  164. .leftMenu-btn1-text {
  165. margin-left: px2vw(14);
  166. font-size: px2vw(22);
  167. }
  168. .leftMenu-line {
  169. height: 2px;
  170. background: #F2F2F2;
  171. }
  172. .leftMenu-btn2-box1 {
  173. background: #F2F2F2;
  174. }
  175. .leftMenu-btn2-box2 {
  176. margin-left: px2vw(48);
  177. margin-right: px2vw(45);
  178. // margin-top: px2vw(25);
  179. // margin-bottom: px2vw(25);
  180. margin-top: px2vw(20);
  181. margin-bottom: px2vw(20);
  182. }
  183. .leftMenu-btn2-text {
  184. margin-left: px2vw(14);
  185. font-size: px2vw(20);
  186. }
  187. </style>