home.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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. }
  167. userController.updateScore();
  168. userController.updateUserInfo();
  169. // MyRequest.SetUserType(mydata_userInfo.role,null,null);
  170. getApp().globalData.bLogin = true;
  171. this.onLogin();
  172. }
  173. },
  174. fail: (res) => {
  175. console.log("fail+**+*", res)
  176. }
  177. });
  178. }
  179. },
  180. methods: {
  181. onTopSYClick(index) {
  182. if(!getApp().globalData.bLogin) {
  183. alert('请先登录')
  184. return
  185. };
  186. // console.log("点击了首页标题", index, myData_QXZB_SYQY.length);
  187. let pageIndex = -1;
  188. switch (index) {
  189. case 0: //实验简介
  190. pageIndex = 1;
  191. // this.$refs.SYJJ.initData();
  192. break;
  193. case 1: //学习流程
  194. pageIndex = 2;
  195. // this.$refs.XXLC.initData();
  196. break;
  197. case 2: //开始学习
  198. pageIndex = 3;
  199. this.$refs.KSXX.initData();
  200. break;
  201. default:
  202. console.log("选中状态为home:", state);
  203. }
  204. this.showPage(pageIndex);
  205. },
  206. onLogin: function() {
  207. // console.log("登陆成功home");
  208. this.$refs.TopMenu.switchLoginState(true);
  209. this.showPage(4);
  210. },
  211. showPage(index) {
  212. this.curShowPage = index;
  213. for (let i = 0; i < this.bShow.length; i++) {
  214. if (i == index) {
  215. this.bShow[i] = true;
  216. } else {
  217. this.bShow[i] = false;
  218. }
  219. }
  220. // console.log("显示页面", index, this.bShow, this.bShow.length);
  221. this.$forceUpdate();
  222. },
  223. //2级开始学习标题点击事件
  224. on2thKSXXClick(data) {
  225. // console.log("2级点击", data);
  226. let lineIndex = data.indexOf("-");
  227. let type = data.substr(0, lineIndex)
  228. let index = data.substr(lineIndex + 1, data.length - 1)
  229. // console.log("2级点击home---", type, index);
  230. //前序准备
  231. if (type == "QXZB") {
  232. this.showPage(5)
  233. this.$refs.TopMenu.switchMiddleState(topMenuS.QXZB, index);
  234. this.$refs.QXZB.onTopQXZBClick(index);
  235. }
  236. //学习与实验
  237. else if (type == "XXYSY") {
  238. this.showPage(6)
  239. this.$refs.TopMenu.switchMiddleState(topMenuS.XXYSY, index);
  240. this.$refs.XXYSY.onTopXXYSYClick(index);
  241. } else {
  242. console.log("2级点击---", lineIndex, type, index);
  243. }
  244. },
  245. //顶部前序准备小标题点击事件
  246. onTopQXZBClick(index) {
  247. // console.log("顶部点击home",index);
  248. this.$refs.QXZB.onTopQXZBClick(index);
  249. },
  250. //顶部学习与实验小标题点击事件
  251. onTopXXYSYClick(index) {
  252. // console.log("顶部点击home",index);
  253. this.$refs.XXYSY.onTopXXYSYClick(index);
  254. },
  255. //左侧导航点击事件
  256. onLeftMenuClick(indexArr) {
  257. let targetPage = -1;
  258. let topMiddleState = '';
  259. switch (indexArr[0]) {
  260. case 0: //首页
  261. if (indexArr[1] == 0) {
  262. targetPage = 9;
  263. topMiddleState = topMenuS.home1;
  264. } else if (indexArr[1] == 1) {
  265. targetPage = 10;
  266. topMiddleState = topMenuS.home2;
  267. } else if (indexArr[1] == 2) {
  268. targetPage = 11;
  269. topMiddleState = topMenuS.home3;
  270. } else if (indexArr[1] == 3) {
  271. targetPage = 12;
  272. topMiddleState = topMenuS.home4;
  273. } else if (indexArr[1] == 4) {
  274. targetPage = 13;
  275. topMiddleState = topMenuS.home5;
  276. } else {
  277. targetPage = 4;
  278. topMiddleState = topMenuS.SY;
  279. }
  280. break;
  281. case 1: //实验简介
  282. targetPage = 8;
  283. topMiddleState = topMenuS.SYJJ;
  284. this.$refs.SYJJ2.showPage(indexArr[1]);
  285. this.$refs.TopMenu.switchState_syjj(indexArr[1]);
  286. break;
  287. case 2: //学习流程
  288. switch (indexArr[1]) {
  289. case 0: //学习概要
  290. targetPage = indexArr[1] + 15;
  291. topMiddleState = topMenuS.XXGY;
  292. break;
  293. case 1: //实验步骤
  294. targetPage = indexArr[1] + 15;
  295. topMiddleState = topMenuS.SYBZ;
  296. break;
  297. case 2: //实验引导视频
  298. targetPage = indexArr[1] + 15;
  299. topMiddleState = topMenuS.SYYDSP;
  300. break;
  301. case 3: //学习资料下载
  302. targetPage = 22;
  303. topMiddleState = topMenuS.XXZLXZ;
  304. break;
  305. default:
  306. }
  307. break;
  308. case 3: //开始学习
  309. targetPage = 6;
  310. topMiddleState = topMenuS.XXYSY;
  311. this.$refs.XXYSY.checkedIndex_topTitle = indexArr[1];
  312. break;
  313. case 4:
  314. targetPage = 18;
  315. topMiddleState = topMenuS.info;
  316. break;
  317. case 5:
  318. targetPage = 19;
  319. topMiddleState = topMenuS.info;
  320. break;
  321. case 6:
  322. targetPage = 20;
  323. topMiddleState = '开始勘测'
  324. break;
  325. default:
  326. console.log("展示页面home:", this.curShowPage);
  327. }
  328. this.showPage(targetPage);
  329. this.$refs.TopMenu.switchMiddleState(topMiddleState, indexArr[1]);
  330. // console.log("左侧导航点击home", indexArr);
  331. this.$forceUpdate();
  332. },
  333. goToTeachCreation(){
  334. this.showPage(13);
  335. },
  336. goToStudentPlatform(){
  337. this.showPage(19);
  338. this.$refs.vstudentPlatform.updateInfo();
  339. },
  340. //顶部导航左上角icon点击事件
  341. onTopMenuIconClick() {
  342. if(!getApp().globalData.bLogin) {
  343. alert('请先登录')
  344. return
  345. };
  346. let indexArr = [];
  347. switch (this.curShowPage) {
  348. case 0: //登录
  349. indexArr = [-1, -1];
  350. break;
  351. case 1: //实验简介1级
  352. indexArr = [1, -1];
  353. break;
  354. case 2: //学习流程1级
  355. indexArr = [2, -1];
  356. break;
  357. case 3: //开始学习1级
  358. indexArr = [3, -1];
  359. break;
  360. case 4: //首页
  361. indexArr = [0, -1];
  362. break;
  363. case 5: //开始学习-前序准备
  364. indexArr = [3, 0];
  365. break;
  366. case 6: //开始学习-学习与实验
  367. indexArr = [3, 1];
  368. break;
  369. case 7: //开始学习-学习与实验-原理认知
  370. indexArr = [3, 1];
  371. break;
  372. case 8: //实验简介2级
  373. indexArr = [1, this.checkedIndex_SYJJ];
  374. break;
  375. default:
  376. console.log("展示页面home:", this.curShowPage);
  377. }
  378. this.$refs.LeftMenu.show(indexArr);
  379. },
  380. //开始学习-学习与实验-开始认知按钮
  381. onClick_KSRZ() {
  382. this.showPage(7);
  383. this.$refs.TopMenu.switchMiddleState(topMenuS.YLRZ, -1);
  384. },
  385. //开始学习-实景勘察-开始勘察按钮
  386. onClick_KSKC() {
  387. this.showPage(21);
  388. this.$refs.TopMenu.switchMiddleState(topMenuS.SJKC, -1);
  389. },
  390. onClick_return(type) {
  391. //从首页建筑页返回到首页
  392. if (type == 9 || type == 10 || type == 11 || type == 12) {
  393. this.showPage(4);
  394. this.$refs.SY.initData();
  395. }
  396. //学前导览三级级返回到学前导览
  397. else if (type == 5 || type == 6 || type == 7 || type == 8) {
  398. this.showPage(2);
  399. }
  400. else {
  401. switch (type) {
  402. case 1: //前序准备-返回上一层:返回到开始学习-前序准备的展开页 type-1
  403. this.showPage(3);
  404. this.$refs.KSXX.switchSecondTitle(0);
  405. break;
  406. case 2: //学习与实验-返回上一层:返回到开始学习-学习与实验的展开页 type-2
  407. this.showPage(3);
  408. this.$refs.KSXX.switchSecondTitle(1);
  409. break;
  410. case 3: //原理认知-返回上一层:返回到开始学习-学习与实验-原理认知页 type-3
  411. this.showPage(6);
  412. this.$refs.XXYSY.checkedIndex_topTitle = 0;
  413. break;
  414. case 4: //实验简介-返回上一层:返回到实验简介的展开页 type-4
  415. this.showPage(1);
  416. break;
  417. case 14: //开始勘察-返回上一层:返回到开始学习-实景勘察页
  418. this.showPage(6);
  419. this.$refs.XXYSY.checkedIndex_topTitle = 1;
  420. break;
  421. default:
  422. console.log("返回上一层", type);
  423. }
  424. }
  425. },
  426. //实验简介按钮点击
  427. onClick_SYJJ_btn1(index) {
  428. if (index == 1) { //点击快速进入实验后跳转到原理认知页
  429. this.showPage(6)
  430. this.$refs.TopMenu.switchMiddleState(topMenuS.XXYSY, 0);
  431. this.$refs.XXYSY.onTopXXYSYClick(0);
  432. } else {
  433. this.showPage(8);
  434. this.checkedIndex_SYJJ = index;
  435. this.$refs.SYJJ2.showPage(index);
  436. this.$refs.TopMenu.switchMiddleState(topMenuS.SYJJ, -1);
  437. this.$refs.TopMenu.switchState_syjj(index);
  438. this.$forceUpdate();
  439. }
  440. },
  441. onClick_ksxx() {
  442. this.showPage(3);
  443. this.$refs.KSXX.initData();
  444. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, 2);
  445. },
  446. //顶部导航栏-头像点击事件
  447. onClick_avatar() {
  448. this.showPage(14);
  449. this.$refs.User.initData();
  450. },
  451. //学前导览
  452. onClick_XQDL_btn1(index) {
  453. let targetPage = 0;
  454. switch (index) {
  455. case 0: //学习概要
  456. this.$refs.TopMenu.switchMiddleState(topMenuS.XXGY, -1);
  457. targetPage = index + 15;
  458. break;
  459. case 1: //实验步骤
  460. this.$refs.TopMenu.switchMiddleState(topMenuS.SYBZ, -1);
  461. targetPage = index + 15;
  462. break;
  463. case 2: //实验引导视频
  464. this.$refs.TopMenu.switchMiddleState(topMenuS.SYYDSP, -1);
  465. targetPage = index + 15;
  466. break;
  467. case 3: //学习资料下载
  468. this.$refs.TopMenu.switchMiddleState(topMenuS.XXZLXZ, -1);
  469. targetPage = 22;
  470. break;
  471. default:
  472. console.log("onClick_XQDL_btn1", type);
  473. }
  474. this.showPage(targetPage);
  475. },
  476. //顶部导航点击"影视现场实时特效虚拟仿真实验"
  477. onClick_topMenu_sy() {
  478. this.showPage(4);
  479. this.$refs.SY.initData();
  480. },
  481. //首页建筑按钮点击事件
  482. onClick_sy_btn(index) {
  483. let targetPage = -1;
  484. let topMiddleState = '';
  485. switch (index) {
  486. case 0: //资产库
  487. targetPage = 10;
  488. topMiddleState = topMenuS.home2;
  489. this.$refs.simulationLibrary.init();
  490. break;
  491. case 1: //摄影棚
  492. targetPage = 9;
  493. topMiddleState = topMenuS.home1;
  494. break;
  495. case 2: //管理中心
  496. targetPage = 11;
  497. topMiddleState = topMenuS.home3;
  498. this.$refs.simulationcore.init();
  499. break;
  500. case 3: //拍摄基地
  501. targetPage = 12;
  502. topMiddleState = topMenuS.home4;
  503. break;
  504. default:
  505. console.log("展示页面home:", this.curShowPage);
  506. }
  507. this.showPage(targetPage);
  508. this.$refs.TopMenu.switchMiddleState(topMiddleState, index);
  509. this.$forceUpdate();
  510. },
  511. //项目管理平台
  512. onClick_proManage() {
  513. let targetPage = -1;
  514. let topMiddleState = '';
  515. if (mydata_userInfo.role == '老师') {
  516. targetPage = 13;
  517. } else {
  518. targetPage = 19;
  519. this.$refs.vstudentPlatform.updateInfo();
  520. }
  521. topMiddleState = topMenuS.SY;
  522. this.showPage(targetPage);
  523. this.$refs.TopMenu.switchMiddleState(topMiddleState, -1);
  524. this.$forceUpdate();
  525. },
  526. //用户退出
  527. onClick_userExit() {
  528. this.showPage(4);
  529. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, -1);
  530. },
  531. onLoginClick() {
  532. this.showPage(0);
  533. this.$refs.Login.initData();
  534. this.$refs.TopMenu.switchMiddleState(topMenuS.SY, -1);
  535. },
  536. onHideWebview()
  537. {
  538. this.$refs.TopMenu.hideTopMenu(true);
  539. this.$refs.webview720.onClickShutWebview();
  540. },
  541. onShowWebview720(){
  542. this.$refs.TopMenu.hideTopMenu(false);
  543. this.$refs.shutDownWebview.onClickShow();
  544. this.$refs.webview720.onClickShow();
  545. }
  546. }
  547. }
  548. </script>
  549. <style lang="scss">
  550. .homeBG {
  551. width: 100%;
  552. height: 100%;
  553. }
  554. .homeContent {
  555. margin-top: px2vw(120);
  556. }
  557. </style>