topMenu.vue 12 KB

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