leftMenu.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. if(!getApp().globalData.bLogin) {
  100. alert('请先登录')
  101. return
  102. };
  103. this.isShow = true;
  104. // console.log("左侧导航展示",indexArr);
  105. this.checkedIndex1 = indexArr[0];
  106. this.checkedIndex2 = indexArr[1];
  107. },
  108. onLeftBtn1Click(index) {
  109. this.checkedIndex2 = -1;
  110. if (this.btnList[index].list.length > 0) {
  111. //收起
  112. if (index == this.checkedIndex1) {
  113. this.checkedIndex1 = -1;
  114. // this.$emit("onLeftMenuClick", [index, -1])
  115. }
  116. // 展开
  117. else {
  118. this.checkedIndex1 = index;
  119. // this.$emit("onLeftMenuClick", [index, -1])
  120. }
  121. } else {
  122. // this.hide();
  123. this.checkedIndex1 = index;
  124. this.$emit("onLeftMenuClick", [index, -1])
  125. }
  126. // this.$forceUpdate();
  127. // console.log("点击1级目录",this.checkedIndex1,this.checkedIndex2);
  128. },
  129. onLeftBtn2Click(index) {
  130. this.checkedIndex2 = index;
  131. // this.hide();
  132. this.$emit("onLeftMenuClick", [this.checkedIndex1, index])
  133. // console.log("点击2级目录",this.checkedIndex1,this.checkedIndex2);
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. .leftMenuRoot {
  140. position: fixed;
  141. width: 100%;
  142. height: 100%;
  143. z-index: 2;
  144. }
  145. .leftBox {
  146. // width: px2vw(226);
  147. width: px2vw(300);
  148. height: 100%;
  149. background: #FFFFFF;
  150. }
  151. .rightBox {
  152. flex: 1;
  153. background: #000000;
  154. opacity: 0.24;
  155. }
  156. .leftMenu-topIcon {
  157. background: #EA252C;
  158. height: 6.2vw;
  159. }
  160. .leftMenu-topIcon img {
  161. margin-left: px2vw(41);
  162. }
  163. .leftMenu-btn1-icon {
  164. margin-left: px2vw(21);
  165. margin-top: px2vw(32);
  166. margin-bottom: px2vw(32);
  167. }
  168. .leftMenu-btn1-text {
  169. margin-left: px2vw(14);
  170. font-size: px2vw(22);
  171. }
  172. .leftMenu-line {
  173. height: 2px;
  174. background: #F2F2F2;
  175. }
  176. .leftMenu-btn2-box1 {
  177. background: #F2F2F2;
  178. }
  179. .leftMenu-btn2-box2 {
  180. margin-left: px2vw(48);
  181. margin-right: px2vw(45);
  182. // margin-top: px2vw(25);
  183. // margin-bottom: px2vw(25);
  184. margin-top: px2vw(20);
  185. margin-bottom: px2vw(20);
  186. }
  187. .leftMenu-btn2-text {
  188. margin-left: px2vw(14);
  189. font-size: px2vw(20);
  190. }
  191. </style>