topMenu.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <!-- 顶部导航栏 -->
  3. <view class="topMenuBox df jcsb">
  4. <view class="df fdr">
  5. <!-- 左侧导航icon -->
  6. <view class="df aic jcc topMenu-lefticon" @click="onTopMenuIconClick">
  7. <img src="../assets/topMenu/leftUpIcon.png" />
  8. </view>
  9. <!-- 左上角标题 -->
  10. <view class="df aic topMenu-lefttitle-box">
  11. <view v-show="middleShowIndex==0">影视现场实时特效虚拟仿真实验</view>
  12. <view v-show="middleShowIndex==1" class="df fdr aic">
  13. <img src="../assets/learning/icon_ksxx_qxzb.png"></img>
  14. <view>前序准备</view>
  15. <view class="topMenu-lefttitle-line"></view>
  16. </view>
  17. <view v-show="middleShowIndex==2" class="df fdr aic">
  18. <img src="../assets/learning/icon_ksxx_xxysy.png"></img>
  19. <view>学习与实验</view>
  20. <view class="topMenu-lefttitle-line"></view>
  21. </view>
  22. <view v-show="middleShowIndex==3" class="df fdr aic">
  23. <img src="../assets/learning/icon_ksxx_qxzb.png"></img>
  24. <view>原理认知</view>
  25. <view class="topMenu-lefttitle-line"></view>
  26. </view>
  27. <view v-show="middleShowIndex==4" class="df fdr aic">
  28. <img src="../assets/learning/icon_ksxx_qxzb.png"></img>
  29. <view v-for="(syjjTitle,syjjTitleI) in titleSYJJ" :key="syjjTitleI" v-show="syjjTitleI==checkedIndexSYJJ">
  30. {{syjjTitle}}
  31. </view>
  32. <view class="topMenu-lefttitle-line"></view>
  33. </view>
  34. <view v-show="middleShowIndex==9">虚拟仿真实验后台</view>
  35. </view>
  36. </view>
  37. <!-- 中间几个导航标题 -->
  38. <!-- 首页开始学习那几个 -->
  39. <view class="df aic topMenu-middleMenu" v-show="middleShowIndex==0">
  40. <view v-for="(item,i) in titleText" :key="i" @click="onTitleClick_SY(i)" class="df fdr aic jcc topMenu-middleMenu-item">
  41. <view>
  42. <img :src="curTitleSrc[i]"></img>
  43. </view>
  44. <view class="topMenu-middleMenu-item-text" :style="{color:curTitleColor[i]}">{{item}}</view>
  45. </view>
  46. </view>
  47. <!-- 前序准备 -->
  48. <view class="df aic topMenu-middleMenu" v-show="middleShowIndex==1">
  49. <view v-for="(item,i) in titleQXZB" :key="i" @click="onTitleClick_QXZB(i)" class="df fdc aic jcc top2thTitle-item">
  50. <view class="top2thTitle-item-text df aic" :style="{color:checkedIndexQXZB==i?titleColorChecked:titleColorUnchecked}">{{item}}</view>
  51. <view class="top2thTitle-item-line" :style="{opacity: checkedIndexQXZB==i?1:0}"></view>
  52. </view>
  53. </view>
  54. <!-- 学习与实验 -->
  55. <view class="df aic topMenu-middleMenu" v-show="middleShowIndex==2">
  56. <view v-for="(item,i) in titleXXYSY" :key="i" @click="onTitleClick_XXYSY(i)" class="df fdc aic jcc top2thTitle-item">
  57. <view class="top2thTitle-item-text df aic" :style="{color:checkedIndexXXYSY==i?titleColorChecked:titleColorUnchecked}">{{item}}</view>
  58. <view class="top2thTitle-item-line" :style="{opacity: checkedIndexXXYSY==i?1:0}"></view>
  59. </view>
  60. </view>
  61. <!-- 右侧登录或个人头像名字等 -->
  62. <view class="df jcc aic topMenu-rightbox">
  63. <!-- 原理认知页面-返回上一层 -->
  64. <view class="ylrz-return df aic fdr" v-show="returnShowIndex==1" @click="onClick_return">
  65. <view class="df">
  66. <img src="../assets/topMenu/icon_return.png" />
  67. </view>
  68. <view class="ylrz-return-text">返回上一层</view>
  69. </view>
  70. <!-- 登录按钮 -->
  71. <view v-show="loginShowIndex==0" class="df jcc aic btnLogin" id="btnLogin" @click="onLoginClick">登录</view>
  72. <!-- 头像名字 -->
  73. <view v-show="loginShowIndex==1" class="df aic">
  74. <view>
  75. <img src="../assets/topMenu/introductionToTheExperimentChecked.png" />
  76. </view>
  77. <view class="topMenu-rightbox-text">学生</view>
  78. <view>
  79. <img src="../assets/topMenu/arrowDown.png" />
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. export default {
  87. data() {
  88. return {
  89. //中间导航状态 0首页1前序准备2学习与实验3原理认知
  90. middleShowIndex: 0,
  91. // //右侧显示信息0登录按钮1个人头像信息2返回上一层
  92. // rightShowIndex: 0,
  93. //0登录按钮1个人头像信息
  94. loginShowIndex: 0,
  95. //返回上一层 0不显示1显示
  96. returnShowIndex: 0,
  97. // visibleLogin: true,
  98. // visibleInfo: false,
  99. visibleMiddle: true,
  100. curTitleSrc: [
  101. require("../assets/topMenu/introductionToTheExperimentUnchecked.png"),
  102. require("../assets/topMenu/learningProcessUnchecked.png"),
  103. require("../assets/topMenu/startLearningUnchecked.png")
  104. ],
  105. curTitleColor: [
  106. "#020202",
  107. "#020202",
  108. "#020202"
  109. ],
  110. checkedIndexQXZB: 0, //选中的前序准备的菜单
  111. checkedIndexXXYSY: 0, //选中的学习与实验的菜单
  112. checkedIndexSYJJ: 0, //选中的实验简介的菜单
  113. //////////////////////以下皆为静态
  114. titleText: ["实验简介", "学习流程", "开始学习"],
  115. //首页-中间标题选中时icon
  116. titleSrcChecked: [
  117. require("../assets/topMenu/introductionToTheExperimentChecked.png"),
  118. require("../assets/topMenu/learningProcessChecked.png"),
  119. require("../assets/topMenu/startLearningChecked.png")
  120. ],
  121. //首页-中间标题未选中时icon
  122. titleSrcUnchecked: [
  123. require("../assets/topMenu/introductionToTheExperimentUnchecked.png"),
  124. require("../assets/topMenu/learningProcessUnchecked.png"),
  125. require("../assets/topMenu/startLearningUnchecked.png")
  126. ],
  127. //首页-中间标题选中时颜色
  128. titleColorChecked: "#EA252C",
  129. //首页-中间标题未选中时颜色
  130. titleColorUnchecked: "#020202",
  131. //前序准备
  132. titleQXZB: ["实验前言", "实验流程步骤", "教学引导视频", "基础知识"],
  133. //学习与实验
  134. titleXXYSY: ["原理认知", "实景勘察", "虚拟技术搭建", "虚拟艺术创作", "虚拟资源库建设"],
  135. //实验简介
  136. titleSYJJ: ['评审账号', '快速进入实验', '实验概述', '使用环境与技术构架', '项目简介视频'],
  137. titleManager: ["虚拟仿真实验后台"]
  138. }
  139. },
  140. methods: {
  141. //初始化数据
  142. initData() {
  143. this.curTitleSrc = this.titleSrcUnchecked;
  144. this.curTitleColor = this.titleColorUnchecked;
  145. },
  146. onLoginClick() {
  147. this.$emit("onLoginClick");
  148. },
  149. //首页标题点击
  150. onTitleClick_SY(index) {
  151. // console.log("点击了", index);
  152. this.$emit("onTopSYClick", index);
  153. this.$forceUpdate();
  154. //改变颜色
  155. for (let i = 0; i < 3; i++) {
  156. if (i == index) {
  157. this.curTitleSrc[i] = this.titleSrcChecked[i];
  158. this.curTitleColor[i] = this.titleColorChecked;
  159. } else {
  160. this.curTitleSrc[i] = this.titleSrcUnchecked[i];
  161. this.curTitleColor[i] = this.titleColorUnchecked;
  162. }
  163. }
  164. },
  165. //切换右侧状态
  166. // switchRightState(index) {
  167. // this.rightShowIndex = index;
  168. // },
  169. //切换登录状态
  170. switchLoginState(isLogged) {
  171. if (isLogged) {
  172. // this.visibleLogin = false;
  173. // this.visibleInfo = true;
  174. // this.switchRightState(1);
  175. this.loginShowIndex = 1;
  176. } else {
  177. // this.visibleLogin = true;
  178. // this.visibleInfo = false;
  179. // this.switchRightState(0);
  180. this.loginShowIndex = 0;
  181. }
  182. },
  183. //切换中间导航状态
  184. switchMiddleState(state) {
  185. switch (state) {
  186. case topMenuS.SY:
  187. this.middleShowIndex = 0;
  188. // this.switchRightState(0);
  189. this.returnShowIndex = 0;
  190. this.loginShowIndex = 0;
  191. break;
  192. case topMenuS.QXZB:
  193. this.middleShowIndex = 1
  194. // this.switchRightState(0);
  195. this.returnShowIndex = 0;
  196. this.loginShowIndex = 0;
  197. break;
  198. case topMenuS.XXYSY:
  199. this.middleShowIndex = 2
  200. // this.switchRightState(0);
  201. this.returnShowIndex = 0;
  202. this.loginShowIndex = 0;
  203. break;
  204. case topMenuS.YLRZ:
  205. this.middleShowIndex = 3
  206. // this.switchRightState(2);
  207. this.returnShowIndex = 1;
  208. this.loginShowIndex = -1;
  209. break;
  210. case topMenuS.SYJJ:
  211. this.middleShowIndex = 4
  212. // this.switchRightState(2);
  213. this.returnShowIndex = 1;
  214. this.loginShowIndex = 0;
  215. break;
  216. case topMenuS.manager:
  217. this.middleShowIndex = 9;
  218. this.returnShowIndex = 2;
  219. this.loginShowIndex = -1;
  220. break;
  221. default:
  222. console.log("切换中间导航状态", state);
  223. }
  224. },
  225. //前序准备标题点击
  226. onTitleClick_QXZB(index) {
  227. // console.log("前序准备标题点击",index);
  228. this.checkedIndexQXZB = index;
  229. this.$emit("onTopQXZBClick", index);
  230. // this.$forceUpdate();
  231. },
  232. onTitleClick_XXYSY(index) {
  233. this.checkedIndexXXYSY = index;
  234. this.$emit("onTopXXYSYClick", index);
  235. // console.log("学习与实验topmenu",index);
  236. },
  237. onTopMenuIconClick() {
  238. this.$emit("onTopMenuIconClick");
  239. console.log("顶部icon点击");
  240. },
  241. //原理认知-返回上一层:返回到开始学习-学习与实验的展开页 type-3
  242. //实验简介-返回上一层:返回到实验简介的展开页 type-4
  243. onClick_return() {
  244. let type = this.middleShowIndex;
  245. this.$emit("onClick_return", type);
  246. this.switchMiddleState(topMenuS.SY);
  247. },
  248. switchState_syjj(index) {
  249. this.checkedIndexSYJJ = index;
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss">
  255. .topMenuBox {
  256. width: 100%;
  257. // height: px2vw(119);
  258. // height: 11%;
  259. background: #FFFFFF;
  260. box-shadow: 3px 0px 6px 0px rgba(0, 0, 0, 0.1);
  261. position: fixed;
  262. }
  263. .topMenu-lefticon {
  264. width: 6.2vw;
  265. height: 6.2vw;
  266. background: #EA252C;
  267. }
  268. .topMenu-lefttitle-box {
  269. margin-left: 2.4vw;
  270. font-size: 1.5vw;
  271. font-family: MicrosoftYaHei;
  272. color: #323232;
  273. margin-right: 2.4vw;
  274. }
  275. .topMenu-lefttitle-box img {
  276. width: px2vw(50);
  277. margin-right: px2vw(18);
  278. }
  279. .topMenu-lefttitle-line {
  280. width: px2vw(2);
  281. // width: 1px;
  282. height: px2vw(53);
  283. background: #D5D5D5;
  284. margin-left: px2vw(32);
  285. }
  286. .topMenu-middleMenu {
  287. /* display: none; */
  288. flex-grow: 1;
  289. /* justify-content: center; */
  290. justify-content: space-evenly;
  291. }
  292. /* .topMenu-middleMenu-item {
  293. margin-left: 71px;
  294. } */
  295. .topMenu-middleMenu-item-text {
  296. margin-left: px2vw(20);
  297. }
  298. .topMenu-rightbox {
  299. margin-right: px2vw(58);
  300. margin-left: px2vw(58);
  301. }
  302. .btnLogin {
  303. width: 6.2vw;
  304. height: 3vw;
  305. background: #EA252C;
  306. border-radius: 8px;
  307. font-size: 1.14vw;
  308. font-family: MicrosoftYaHei;
  309. color: #FFFFFF;
  310. line-height: 1.5vw;
  311. letter-spacing: 1px;
  312. }
  313. .topMenu-rightbox-text {
  314. margin-left: px2vw(18);
  315. margin-right: px2vw(23);
  316. }
  317. .top2thTitle-item {
  318. height: 100%;
  319. }
  320. // 二级目录标题字
  321. .top2thTitle-item-text {
  322. flex: 1;
  323. font-size: px2vw(24);
  324. color: #323232;
  325. }
  326. // 二级目录标题红线
  327. .top2thTitle-item-line {
  328. width: px2vw(110);
  329. height: px2vw(6);
  330. background: #EA252C;
  331. border-radius: px2vw(5);
  332. }
  333. //返回上一层
  334. .ylrz-return {
  335. margin-right: px2vw(43);
  336. }
  337. .ylrz-return img {
  338. width: px2vw(23);
  339. }
  340. .ylrz-return-text {
  341. font-size: px2vw(24);
  342. color: #EA252C;
  343. margin-left: px2vw(14);
  344. }
  345. </style>