topMenu.vue 11 KB

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