leftMenu.vue 6.1 KB

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