home.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <view class="mybody bgclF8 df fdc">
  3. <TopMenu ref="TopMenu" v-on:onTopSYClick="onTopSYClick" v-on:onTopQXZBClick="onTopQXZBClick" v-on:onLoginClick="onLoginClick"
  4. v-on:onTopXXYSYClick="onTopXXYSYClick" v-on:onTopMenuIconClick="onTopMenuIconClick" v-on:onClick_return="onClick_return"
  5. v-on:onClick_avatar="onClick_avatar" v-on:onClick_topMenu_sy="onClick_topMenu_sy" v-on:onClick_exit="onClick_userExit"></TopMenu>
  6. <view class="content homeContent">
  7. <Login ref="Login" v-show="bShow[0]" v-on:onLogin="onLogin"></Login>
  8. <SYJJ ref="SYJJ" v-show="bShow[1]" v-on:onClick_Btn1="onClick_SYJJ_btn1"></SYJJ>
  9. <!-- <XXLC ref="XXLC" v-show="bShow[2]" v-on:onClick_ksxx="onClick_ksxx"></XXLC> -->
  10. <XQDL ref="XQDL" v-show="bShow[2]" v-on:onClick_Btn1="onClick_XQDL_btn1"></XQDL>
  11. <KSXX ref="KSXX" v-show="bShow[3]" v-on:on2thTitleClick="on2thKSXXClick"></KSXX>
  12. <!-- <image v-show="bShow[4]" class="homeBG" mode="aspectFill" src="../assets/home/homeBG.png"></image> -->
  13. <SY ref="SY" v-show="bShow[4]" v-on:onClick_menu_btn="onClick_sy_btn"></SY>
  14. <QXZB ref="QXZB" v-show="bShow[5]"></QXZB>
  15. <XXYSY ref="XXYSY" v-show="bShow[6]" v-on:onClick_KSRZ="onClick_KSRZ" v-on:onClick_KSKC="onClick_KSKC" v-on:onShowWebview720="onShowWebview720"></XXYSY>
  16. <YLRZ ref="YLRZ" v-show="bShow[7]"></YLRZ>
  17. <SYJJ2 ref="SYJJ2" v-show="bShow[8]"></SYJJ2>
  18. <simulation ref="simulation" v-show="bShow[9]"></simulation>
  19. <simulationLibrary ref="simulationLibrary" v-show="bShow[10]"></simulationLibrary>
  20. <simulationcore ref="simulationcore" v-show="bShow[11]" v-on:goToTeachCreation="goToTeachCreation" v-on:goToStudentPlatform="goToStudentPlatform"></simulationcore>
  21. <simulationBase ref="simulationBase" v-show="bShow[12]"></simulationBase>
  22. <teacherCreation ref="teacherCreation" v-show="bShow[13]"></teacherCreation>
  23. <User ref="User" v-show="bShow[14]" v-on:onClick_proManage="onClick_proManage"></User>
  24. <XXGY ref="XXGY" v-show="bShow[15]"></XXGY>
  25. <SYBZ ref="SYBZ" v-show="bShow[16]" v-on:onClick_ksxx="onClick_ksxx"></SYBZ>
  26. <SYYDSP ref="SYYDSP" v-show="bShow[17]"></SYYDSP>
  27. <student ref="student" v-show="bShow[18]"></student>
  28. <vstudentPlatform ref="vstudentPlatform" v-show="bShow[19]"></vstudentPlatform>
  29. <survey ref="survey" v-show="bShow[20]"></survey>
  30. <SJKC ref="SJKC" v-show="bShow[21]"></SJKC>
  31. <XXZLXZ ref="XXZLXZ" v-show="bShow[22]"></XXZLXZ>
  32. </view>
  33. <!-- 左侧导航栏永远保持在最上层 -->
  34. <LeftMenu ref="LeftMenu" v-on:onLeftMenuClick="onLeftMenuClick"></LeftMenu>
  35. <webview720 ref="webview720"></webview720>
  36. <shutDownWebview ref="shutDownWebview" v-on:onHideWebview="onHideWebview"></shutDownWebview>
  37. </view>
  38. </template>
  39. <script>
  40. import SY from '../components/home/sy.vue'
  41. import LeftMenu from '../components/leftMenu.vue'
  42. import TopMenu from '../components/topMenu.vue'
  43. import Login from '../components/login/login.vue'
  44. import simulation from "../components/home/simulation.vue"
  45. import simulationLibrary from "../components/home/simulationLibrary.vue"
  46. import simulationcore from "../components/home/simulationCore.vue"
  47. import simulationBase from "../components/home/simulationBase.vue"
  48. import teacherCreation from "../components/home/teacherCreation.vue"
  49. import vstudentPlatform from "../components/student/Index.vue"
  50. import student from "../components/student/commoand.vue"
  51. import survey from "../components/student/survey.vue"
  52. //一级页面
  53. import KSXX from '../components/startLearning/startLearning.vue' //开始学习
  54. import SYJJ from '../components/introductionToTheExperiment/introductionToTheExperiment.vue' //实验简介
  55. // import XXLC from '../components/learningProcess/learningProcess.vue' //学习流程
  56. //二级页面
  57. //开始学习
  58. import QXZB from '../components/startLearning/preludePreparation/preludePreparation.vue' //前序准备
  59. import XXYSY from '../components/startLearning/learningAndExperiment/learningAndExperiment.vue' //学习与实验
  60. import YLRZ from '../components/startLearning/learningAndExperiment/ksxx_xxysy_ylrz/ksxx_xxysy_ylrz.vue' //原理认知
  61. //实验简介的详情页
  62. import SYJJ2 from '../components/introductionToTheExperiment/syjj_second.vue' //实验简介的详情页
  63. import User from '../components/user/user.vue' //用户信息等
  64. import XQDL from '../components/learningProcess/xqdl.vue' //学前导览
  65. import XXGY from '../components/learningProcess/xxgy.vue' //学习概要
  66. import SYBZ from '../components/learningProcess/learningProcess.vue' //实验步骤
  67. import SYYDSP from '../components/learningProcess/syydsp.vue' //实验引导视频
  68. import XXZLXZ from '../components/learningProcess/xxzlxz.vue' //学习资料下载
  69. import SJKC from '../components/startLearning/learningAndExperiment/ksxx_xxysy_sjkc/ksxx_xxysy_sjkc.vue' //实景勘察
  70. import shutDownWebview from '../components/home/shutDownWebview.vue' //实景勘察720
  71. import webview720 from '../components/home/webview720.vue' //实景勘察720
  72. export default {
  73. components: {
  74. LeftMenu,
  75. TopMenu,
  76. Login,
  77. SYJJ,
  78. XQDL,
  79. KSXX,
  80. QXZB,
  81. XXYSY,
  82. YLRZ,
  83. SYJJ2,
  84. simulation,
  85. simulationLibrary,
  86. simulationcore,
  87. simulationBase,
  88. teacherCreation,
  89. User,
  90. XXGY,
  91. SYBZ,
  92. SYYDSP,
  93. SY,
  94. student,
  95. vstudentPlatform,
  96. survey,
  97. SJKC,
  98. XXZLXZ,
  99. shutDownWebview,
  100. webview720
  101. },
  102. data() {
  103. return {
  104. curShowPage: 4,
  105. //这里记录当前需要显示哪个页面。每新添加一个页面,都需要在这里注册。
  106. bShow: [
  107. false, //0登录
  108. false, //1实验简介一级页面
  109. false, //2学习流程一级页面----改为学前导览
  110. false, //3开始学习一级页面
  111. true, //4首页
  112. false, //5开始学习-前序准备
  113. false, //6开始学习-学习与实验
  114. false, //7开始学习-学习与实验-原理认知
  115. false, //8实验简介的详情页
  116. false, //9虚拟仿真1号摄影棚
  117. false, //10虚拟仿真资产库
  118. false, //11虚拟影视项目开发管理中心
  119. false, //12虚拟仿真真题拍摄基地
  120. false, //13老师创作管理平台
  121. false, //14用户(个人信息等)
  122. false, //15学习概要
  123. false, //16实验步骤
  124. false, //17实验引导视频
  125. false, //18 学生信息
  126. false, //19 学生创作项目管理平台
  127. false, //20开始勘测
  128. false, //21实景勘察
  129. false, //22学习资料下载
  130. ],
  131. checkedIndex_SYJJ: 0, //实验简介选中标题索引值
  132. }
  133. },
  134. onLoad(){
  135. let account = localStorage.getItem("account");
  136. let password = localStorage.getItem("password");
  137. if(account!=null && password!=null)
  138. {
  139. let url = this.$Api + "/user/loginin";
  140. uni.request({
  141. header: {
  142. 'Content-Type': 'application/json;charset=UTF-8'
  143. },
  144. url: url,
  145. method: 'POST',
  146. data: {
  147. "IlabAccount": account,
  148. "Password": password
  149. },
  150. dataType: 'json',
  151. success: (res) => {
  152. let data = res.data;
  153. //登录成功
  154. if (data.Code == 100) {
  155. // console.log("登陆成功");
  156. if (data.Image != '') {
  157. mydata_userInfo.avatarSrc = data.Image;
  158. }
  159. console.log("登陆成功data=",data);
  160. mydata_userInfo.Name = data.Name;
  161. mydata_userInfo.UserID = data.UserID;
  162. mydata_userInfo.Position = data.Position;
  163. mydata_userInfo.role = data.Type;
  164. if (mydata_userInfo.role == '老师') {
  165. userController.updateStudentList(null,null);
  166. } else {
  167. userController.updateScore();
  168. }
  169. userController.updateUserInfo();
  170. MyRequest.SetUserType(mydata_userInfo.role,null,null);
  171. getApp().globalData.bLogin = true;
  172. this.onLogin();
  173. }
  174. },
  175. fail: (res) => {
  176. console.log("fail+**+*", res)
  177. }
  178. });
  179. }
  180. },
  181. methods: {
  182. onTopSYClick(index) {
  183. if(!getApp().globalData.bLogin) {
  184. alert('请先登录')
  185. return
  186. };
  187. // console.log("点击了首页标题", index, myData_QXZB_SYQY.length);
  188. let pageIndex = -1;
  189. switch (index) {
  190. case 0: //实验简介
  191. pageIndex = 1;
  192. // this.$refs.SYJJ.initData();
  193. break;
  194. case 1: //学习流程
  195. pageIndex = 2;
  196. // this.$refs.XXLC.initData();
  197. break;
  198. case 2: //开始学习
  199. pageIndex = 3;
  200. this.$refs.KSXX.initData();
  201. break;
  202. default:
  203. console.log("选中状态为home:", state);
  204. }
  205. this.showPage(pageIndex);
  206. },
  207. onLogin: function() {
  208. // console.log("登陆成功home");
  209. this.$refs.TopMenu.switchLoginState(true);
  210. this.showPage(4);
  211. },
  212. showPage(index) {
  213. this.curShowPage = index;
  214. for (let i = 0; i < this.bShow.length; i++) {
  215. if (i == index) {
  216. this.bShow[i] = true;
  217. } else {
  218. this.bShow[i] = false;
  219. }
  220. }
  221. // console.log("显示页面", index, this.bShow, this.bShow.length);
  222. this.$forceUpdate();
  223. },
  224. //2级开始学习标题点击事件
  225. on2thKSXXClick(data) {
  226. // console.log("2级点击", data);
  227. let lineIndex = data.indexOf("-");
  228. let type = data.substr(0, lineIndex)
  229. let index = data.substr(lineIndex + 1, data.length - 1)
  230. // console.log("2级点击home---", type, index);
  231. //前序准备
  232. if (type == "QXZB") {
  233. this.showPage(5)
  234. this.$refs.TopMenu.switchMiddleState(topMenuS.QXZB, index);
  235. this.$refs.QXZB.onTopQXZBClick(index);
  236. }
  237. //学习与实验
  238. else if (type == "XXYSY") {
  239. this.showPage(6)
  240. this.$refs.TopMenu.switchMiddleState(topMenuS.XXYSY, index);
  241. this.$refs.XXYSY.onTopXXYSYClick(index);
  242. } else {
  243. console.log("2级点击---", lineIndex, type, index);
  244. }
  245. },
  246. //顶部前序准备小标题点击事件
  247. onTopQXZBClick(index) {
  248. // console.log("顶部点击home",index);
  249. this.$refs.QXZB.onTopQXZBClick(index);
  250. },
  251. //顶部学习与实验小标题点击事件
  252. onTopXXYSYClick(index) {
  253. // console.log("顶部点击home",index);
  254. this.$refs.XXYSY.onTopXXYSYClick(index);
  255. },
  256. //左侧导航点击事件
  257. onLeftMenuClick(indexArr) {
  258. let targetPage = -1;
  259. let topMiddleState = '';
  260. switch (indexArr[0]) {
  261. case 0: //首页
  262. if (indexArr[1] == 0) {
  263. targetPage = 9;
  264. topMiddleState = topMenuS.home1;
  265. } else if (indexArr[1] == 1) {
  266. targetPage = 10;
  267. topMiddleState = topMenuS.home2;
  268. } else if (indexArr[1] == 2) {
  269. targetPage = 11;
  270. topMiddleState = topMenuS.home3;
  271. } else if (indexArr[1] == 3) {
  272. targetPage = 12;
  273. topMiddleState = topMenuS.home4;
  274. } else if (indexArr[1] == 4) {
  275. targetPage = 13;
  276. topMiddleState = topMenuS.home5;
  277. } else {
  278. targetPage = 4;
  279. topMiddleState = topMenuS.SY;
  280. }
  281. break;
  282. case 1: //实验简介
  283. targetPage = 8;
  284. topMiddleState = topMenuS.SYJJ;
  285. this.$refs.SYJJ2.showPage(indexArr[1]);
  286. this.$refs.TopMenu.switchState_syjj(indexArr[1]);
  287. break;
  288. case 2: //学习流程
  289. switch (indexArr[1]) {
  290. case 0: //学习概要
  291. targetPage = indexArr[1] + 15;
  292. topMiddleState = topMenuS.XXGY;
  293. break;
  294. case 1: //实验步骤
  295. targetPage = indexArr[1] + 15;
  296. topMiddleState = topMenuS.SYBZ;
  297. break;
  298. case 2: //实验引导视频
  299. targetPage = indexArr[1] + 15;
  300. topMiddleState = topMenuS.SYYDSP;
  301. break;
  302. case 3: //学习资料下载
  303. targetPage = 22;
  304. topMiddleState = topMenuS.XXZLXZ;
  305. break;
  306. default:
  307. }
  308. break;
  309. case 3: //开始学习
  310. targetPage = 6;
  311. topMiddleState = topMenuS.XXYSY;
  312. this.$refs.XXYSY.checkedIndex_topTitle = indexArr[1];
  313. break;
  314. case 4:
  315. targetPage = 18;
  316. topMiddleState = topMenuS.info;
  317. break;
  318. case 5:
  319. targetPage = 19;
  320. topMiddleState = topMenuS.info;
  321. break;
  322. case 6:
  323. targetPage = 20;
  324. topMiddleState = '开始勘测'
  325. break;
  326. default:
  327. console.log("展示页面home:", this.curShowPage);
  328. }
  329. this.showPage(targetPage);
  330. this.$refs.TopMenu.switchMiddleState(topMiddleState, indexArr[1]);
  331. // console.log("左侧导航点击home", indexArr);
  332. this.$forceUpdate();
  333. },
  334. goToTeachCreation(){
  335. this.showPage(13);
  336. },
  337. goToStudentPlatform(){
  338. this.showPage(19);
  339. this.$refs.vstudentPlatform.updateInfo();
  340. },
  341. //顶部导航左上角icon点击事件
  342. onTopMenuIconClick() {
  343. if(!getApp().globalData.bLogin) {
  344. alert('请先登录')
  345. return
  346. };
  347. let indexArr = [];
  348. switch (this.curShowPage) {
  349. case 0: //登录
  350. indexArr = [-1, -1];
  351. break;
  352. case 1: //实验简介1级
  353. indexArr = [1, -1];
  354. break;
  355. case 2: //学习流程1级
  356. indexArr = [2, -1];
  357. break;
  358. case 3: //开始学习1级
  359. indexArr = [3, -1];
  360. break;
  361. case 4: //首页
  362. indexArr = [0, -1];
  363. break;
  364. case 5: //开始学习-前序准备
  365. indexArr = [3, 0];
  366. break;
  367. case 6: //开始学习-学习与实验
  368. indexArr = [3, 1];
  369. break;
  370. case 7: //开始学习-学习与实验-原理认知
  371. indexArr = [3, 1];
  372. break;
  373. case 8: //实验简介2级
  374. indexArr = [1, this.checkedIndex_SYJJ];
  375. break;
  376. default:
  377. console.log("展示页面home:", this.curShowPage);
  378. }
  379. this.$refs.LeftMenu.show(indexArr);
  380. },
  381. //开始学习-学习与实验-开始认知按钮
  382. onClick_KSRZ() {
  383. this.showPage(7);
  384. this.$refs.TopMenu.switchMiddleState(topMenuS.YLRZ, -1);
  385. },
  386. //开始学习-实景勘察-开始勘察按钮
  387. onClick_KSKC() {
  388. this.showPage(21);
  389. this.$refs.TopMenu.switchMiddleState(topMenuS.SJKC, -1);
  390. },
  391. onClick_return(type) {
  392. //从首页建筑页返回到首页
  393. if (type == 9 || type == 10 || type == 11 || type == 12) {
  394. this.showPage(4);
  395. this.$refs.SY.initData();
  396. }
  397. //学前导览三级级返回到学前导览
  398. else if (type == 5 || type == 6 || type == 7 || type == 8) {
  399. this.showPage(2);
  400. }
  401. else {
  402. switch (type) {
  403. case 1: //前序准备-返回上一层:返回到开始学习-前序准备的展开页 type-1
  404. this.showPage(3);
  405. this.$refs.KSXX.switchSecondTitle(0);
  406. break;
  407. case 2: //学习与实验-返回上一层:返回到开始学习-学习与实验的展开页 type-2
  408. this.showPage(3);
  409. this.$refs.KSXX.switchSecondTitle(1);
  410. break;
  411. case 3: //原理认知-返回上一层:返回到开始学习-学习与实验-原理认知页 type-3
  412. this.showPage(6);
  413. this.$refs.XXYSY.checkedIndex_topTitle = 0;
  414. break;
  415. case 4: //实验简介-返回上一层:返回到实验简介的展开页 type-4
  416. this.showPage(1);
  417. break;
  418. case 14: //开始勘察-返回上一层:返回到开始学习-实景勘察页
  419. this.showPage(6);
  420. this.$refs.XXYSY.checkedIndex_topTitle = 1;
  421. break;
  422. default:
  423. console.log("返回上一层", type);
  424. }
  425. }
  426. },
  427. //实验简介按钮点击
  428. onClick_SYJJ_btn1(index) {
  429. if (index == 1) { //点击快速进入实验后跳转到原理认知页
  430. this.showPage(6)
  431. this.$refs.TopMenu.switchMiddleState(topMenuS.XXYSY, 0);
  432. this.$refs.XXYSY.onTopXXYSYClick(0);
  433. } else {
  434. this.showPage(8);
  435. this.checkedIndex_SYJJ = index;
  436. this.$refs.SYJJ2.showPage(index);
  437. this.$refs.TopMenu.switchMiddleState(topMenuS.SYJJ, -1);
  438. this.$refs.TopMenu.switchState_syjj(index);
  439. this.$forceUpdate();
  440. }
  441. },
  442. onClick_ksxx() {
  443. this.showPage(3);
  444. this.$refs.KSXX.initData();
  445. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, 2);
  446. },
  447. //顶部导航栏-头像点击事件
  448. onClick_avatar() {
  449. this.showPage(14);
  450. this.$refs.User.initData();
  451. },
  452. //学前导览
  453. onClick_XQDL_btn1(index) {
  454. let targetPage = 0;
  455. switch (index) {
  456. case 0: //学习概要
  457. this.$refs.TopMenu.switchMiddleState(topMenuS.XXGY, -1);
  458. targetPage = index + 15;
  459. break;
  460. case 1: //实验步骤
  461. this.$refs.TopMenu.switchMiddleState(topMenuS.SYBZ, -1);
  462. targetPage = index + 15;
  463. break;
  464. case 2: //实验引导视频
  465. this.$refs.TopMenu.switchMiddleState(topMenuS.SYYDSP, -1);
  466. targetPage = index + 15;
  467. break;
  468. case 3: //学习资料下载
  469. this.$refs.TopMenu.switchMiddleState(topMenuS.XXZLXZ, -1);
  470. targetPage = 22;
  471. break;
  472. default:
  473. console.log("onClick_XQDL_btn1", type);
  474. }
  475. this.showPage(targetPage);
  476. },
  477. //顶部导航点击"影视现场实时特效虚拟仿真实验"
  478. onClick_topMenu_sy() {
  479. this.showPage(4);
  480. this.$refs.SY.initData();
  481. },
  482. //首页建筑按钮点击事件
  483. onClick_sy_btn(index) {
  484. let targetPage = -1;
  485. let topMiddleState = '';
  486. switch (index) {
  487. case 0: //资产库
  488. targetPage = 10;
  489. topMiddleState = topMenuS.home2;
  490. this.$refs.simulationLibrary.init();
  491. break;
  492. case 1: //摄影棚
  493. targetPage = 9;
  494. topMiddleState = topMenuS.home1;
  495. break;
  496. case 2: //管理中心
  497. targetPage = 11;
  498. topMiddleState = topMenuS.home3;
  499. this.$refs.simulationcore.init();
  500. break;
  501. case 3: //拍摄基地
  502. targetPage = 12;
  503. topMiddleState = topMenuS.home4;
  504. break;
  505. default:
  506. console.log("展示页面home:", this.curShowPage);
  507. }
  508. this.showPage(targetPage);
  509. this.$refs.TopMenu.switchMiddleState(topMiddleState, index);
  510. this.$forceUpdate();
  511. },
  512. //项目管理平台
  513. onClick_proManage() {
  514. let targetPage = -1;
  515. let topMiddleState = '';
  516. if (mydata_userInfo.role == '老师') {
  517. targetPage = 13;
  518. } else {
  519. targetPage = 19;
  520. this.$refs.vstudentPlatform.updateInfo();
  521. }
  522. topMiddleState = topMenuS.SY;
  523. this.showPage(targetPage);
  524. this.$refs.TopMenu.switchMiddleState(topMiddleState, -1);
  525. this.$forceUpdate();
  526. },
  527. //用户退出
  528. onClick_userExit() {
  529. this.showPage(4);
  530. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, -1);
  531. },
  532. onLoginClick() {
  533. this.showPage(0);
  534. this.$refs.Login.initData();
  535. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, -1);
  536. },
  537. onHideWebview()
  538. {
  539. this.$refs.TopMenu.hideTopMenu(true);
  540. this.$refs.webview720.onClickShutWebview();
  541. },
  542. onShowWebview720(){
  543. this.$refs.TopMenu.hideTopMenu(false);
  544. this.$refs.shutDownWebview.onClickShow();
  545. this.$refs.webview720.onClickShow();
  546. }
  547. }
  548. }
  549. </script>
  550. <style lang="scss">
  551. .homeBG {
  552. width: 100%;
  553. height: 100%;
  554. }
  555. .homeContent {
  556. margin-top: px2vw(120);
  557. }
  558. </style>