index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. <template>
  2. <header class="header">
  3. <img src="@/assets/images/user-bg.png" alt="" />
  4. <span
  5. v-if="userInfo.user_role_id == '77'"
  6. class="changeStu"
  7. @click="childData.length != '0' ? (toChange = true) : (toChange = false)"
  8. ><img
  9. class="w-12px h-13px inline-block mr-8px"
  10. src="@/assets/images/change.png"
  11. />切换学生
  12. <span v-if="childId == '76'">(当前已绑定小孩{{ childName }})</span
  13. ><span v-else>(当前未绑定小孩,请先绑定)</span>
  14. </span>
  15. <div class="logout" @click="loginOut">
  16. <span></span>
  17. 退出登录
  18. </div>
  19. <div class="user-info">
  20. <div class="user-shot">
  21. <img :src="userInfo.user_avatar.big" alt="" />
  22. </div>
  23. <div class="info">
  24. <h3 class="user-name">
  25. {{ userInfo.user_realname
  26. }}<span class="role-type">{{ userInfo.user_role_name }}</span>
  27. </h3>
  28. <h4 class="user-school">{{ userInfo.sm_info.sm_name }}</h4>
  29. </div>
  30. </div>
  31. </header>
  32. <ul class="nav">
  33. <li @click="toOther(1)">
  34. <span class="nav-icon n-1"></span>
  35. <span class="nav-title">个人信息</span>
  36. </li>
  37. <li @click="toOther(2)">
  38. <span class="nav-icon n-2"></span>
  39. <span class="nav-title">信息中心</span>
  40. </li>
  41. <li @click="toOther(3)">
  42. <span class="nav-icon n-3"></span>
  43. <span class="nav-title">成长积分</span>
  44. </li>
  45. </ul>
  46. <ul class="menu-list">
  47. <li @click="toOther(4)">
  48. <div>
  49. <span class="order-icon o-1"></span>
  50. <h4 class="order-title">修改密码</h4>
  51. </div>
  52. <van-icon name="arrow" size="16" color="#E0E0E0" />
  53. </li>
  54. <!-- 家长 -->
  55. <li @click="toOther(5)" v-if="userInfo.user_role_id == '77'">
  56. <div>
  57. <span class="order-icon o-2"></span>
  58. <h4 class="order-title">关于我们</h4>
  59. </div>
  60. <van-icon name="arrow" size="16" color="#E0E0E0" />
  61. </li>
  62. <li @click="toOther(6)" v-if="userInfo.user_role_id == '77'">
  63. <div>
  64. <span class="order-icon o-3"></span>
  65. <h4 class="order-title">我的孩子</h4>
  66. </div>
  67. <van-icon name="arrow" size="16" color="#E0E0E0" />
  68. </li>
  69. <li @click="toOther(11)" v-if="userInfo.user_role_id == '77'">
  70. <div>
  71. <span class="order-icon o-5"></span>
  72. <h4 class="order-title">社团课程</h4>
  73. </div>
  74. <van-icon name="arrow" size="16" color="#E0E0E0" />
  75. </li>
  76. <li @click="toOther(11)" v-if="userInfo.user_role_id == '77'">
  77. <div>
  78. <span class="order-icon o-6"></span>
  79. <h4 class="order-title">学习圈子</h4>
  80. </div>
  81. <van-icon name="arrow" size="16" color="#E0E0E0" />
  82. </li>
  83. <li @click="toOther(11)" v-if="userInfo.user_role_id == '77'">
  84. <div>
  85. <span class="order-icon o-7"></span>
  86. <h4 class="order-title">课程收藏</h4>
  87. </div>
  88. <van-icon name="arrow" size="16" color="#E0E0E0" />
  89. </li>
  90. <!-- 班主任 -->
  91. <li v-if="isManage" @click="toOther(11)">
  92. <div>
  93. <span class="order-icon o-10"></span>
  94. <h4 class="order-title">专业成长</h4>
  95. </div>
  96. <van-icon name="arrow" size="16" color="#E0E0E0" />
  97. </li>
  98. <li v-if="isManage" @click="toOther(11)">
  99. <div>
  100. <span class="order-icon o-9"></span>
  101. <h4 class="order-title">团队带领</h4>
  102. </div>
  103. <van-icon name="arrow" size="16" color="#E0E0E0" />
  104. </li>
  105. <li v-if="isManage" @click="toOther(11)">
  106. <div>
  107. <span class="order-icon o-8"></span>
  108. <h4 class="order-title">我的荣誉</h4>
  109. </div>
  110. <van-icon name="arrow" size="16" color="#E0E0E0" />
  111. </li>
  112. <li @click="toOther(8)" v-if="isManage">
  113. <div>
  114. <span class="order-icon o-4"></span>
  115. <h4 class="order-title">班主任工作</h4>
  116. </div>
  117. <van-icon name="arrow" size="16" color="#E0E0E0" />
  118. </li>
  119. <!-- 社团教师 -->
  120. <li @click="toOther(10)" v-if="userInfo.user_role_id == '75' && !isManage">
  121. <div>
  122. <span class="order-icon o-5"></span>
  123. <h4 class="order-title">社团课程</h4>
  124. </div>
  125. <van-icon name="arrow" size="16" color="#E0E0E0" />
  126. </li>
  127. <!-- 管理员 -->
  128. <li @click="toOther(9)" v-if="userInfo.user_role_id == '72' && !isManage">
  129. <div>
  130. <span class="order-icon o-5"></span>
  131. <h4 class="order-title">社团开展情况</h4>
  132. </div>
  133. <van-icon name="arrow" size="16" color="#E0E0E0" />
  134. </li>
  135. </ul>
  136. <van-tabbar route>
  137. <van-tabbar-item replace icon="home-o" to="/home">首页</van-tabbar-item>
  138. <van-tabbar-item replace icon="chat-o" to="/chat">消息</van-tabbar-item>
  139. <van-tabbar-item replace icon="user-o" to="/user">我的</van-tabbar-item>
  140. </van-tabbar>
  141. <div v-show="toChange" class="cover"></div>
  142. <div class="change-stu" v-if="toChange">
  143. <van-icon @click="toChange = false" name="cross" size="24" />
  144. <h3>切换孩子</h3>
  145. <div class="mt-17px">
  146. <div
  147. @click="initChild(item)"
  148. v-for="(item, index) in childData"
  149. :key="item"
  150. >
  151. <div
  152. v-if="childData.length"
  153. class="stu-list flex w-full h-40px mb-7px rounded px-6px"
  154. :class="activeChild == item.user_id ? 'blueList' : ''"
  155. >
  156. <span class="flex w-1/6"
  157. ><img
  158. class="w-28px h-28px"
  159. style="borderradius: 50%"
  160. :src="item.user_avatar.big"
  161. alt=""
  162. /></span>
  163. <span class="w-3/5">{{ item.user_realname }}</span>
  164. <span class="stu-index">孩子{{ index + 1 }}</span>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="submit">
  169. <button @click="submitDM()">提交</button>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import { showToast } from "vant";
  175. import { setChild } from "~/store/child";
  176. export default {
  177. data() {
  178. return {
  179. userInfo: user,
  180. isManage: false,
  181. toChange: false,
  182. absentStu: [],
  183. activeChild: "",
  184. childData: [],
  185. childId: "",
  186. childName: "",
  187. };
  188. },
  189. methods: {
  190. IsManage() {
  191. this.userInfo.cm_info.forEach((item) => {
  192. if (item.is_manage === 1) {
  193. this.isManage = true;
  194. } else {
  195. this.isManage = false;
  196. }
  197. });
  198. },
  199. loginOut() {
  200. localStorage.clear();
  201. window.location.href = "https://nmlm.bozedu.net/login.html";
  202. },
  203. toOther(type) {
  204. switch (type) {
  205. case 1:
  206. window.location.href =
  207. "https://nmlm.bozedu.net/page/my/profileModify.html";
  208. break;
  209. case 2:
  210. window.location.href =
  211. "https://nmlm.bozedu.net/page/my/msg.html?id=31";
  212. break;
  213. case 4:
  214. window.location.href =
  215. "https://nmlm.bozedu.net/page/my/pwdModify.html";
  216. break;
  217. case 5:
  218. window.location.href = "https://nmlm.bozedu.net/page/my/about.html";
  219. break;
  220. case 6:
  221. this.$router.push("/my_children");
  222. // window.location.href =
  223. // "https://nmlm.bozedu.net/page/parent/my-children.html";
  224. break;
  225. case 7:
  226. window.location.href =
  227. "https://nmlm.bozedu.net/page/my/my-class.html";
  228. break;
  229. case 8:
  230. this.$router.push({ name: "bzrgz" });
  231. break;
  232. case 9:
  233. this.$router.push({ name: "stkzqk" });
  234. break;
  235. case 10:
  236. this.$router.push({ name: "stxk_teacher" });
  237. break;
  238. case 11:
  239. showToast("该模块正在开发中~");
  240. break;
  241. }
  242. },
  243. changeStu() {
  244. request({
  245. baseURL: window.GLOBAL_CONFIG.uc,
  246. timeout: 10 * 1000,
  247. url: "/index.php?mod=user&action=main&do=my_child",
  248. data: {},
  249. }).then((res) => {
  250. if (res.code == "1") {
  251. this.childData = res.data.info;
  252. if (
  253. this.childData.length == "0" &&
  254. this.userInfo.user_role_id == "77"
  255. ) {
  256. showToast("请先绑定孩子~");
  257. }
  258. if (this.userInfo.user_role_id == "77") {
  259. if (localStorage.getItem("childInfo_" + this.userInfo.user_id)) {
  260. let userXx = JSON.parse(
  261. localStorage.getItem("childInfo_" + this.userInfo.user_id)
  262. );
  263. this.activeChild = userXx.user_id;
  264. this.childId = userXx.user_role_id;
  265. this.childName = userXx.user_realname;
  266. } else if (this.childData[0].user_id) {
  267. let userXx = this.childData[0];
  268. // localStorage.setItem(
  269. // "childInfo_" + this.userInfo.user_id,
  270. // JSON.stringify(this.childData[0])
  271. // );
  272. this.activeChild = userXx.user_id;
  273. this.childId = userXx.user_role_id;
  274. this.childName = userXx.user_realname;
  275. // console.log(this.childData[0].user_id, 2222);
  276. setChild(this.childData[0])
  277. }
  278. }
  279. }
  280. });
  281. },
  282. initChild(item) {
  283. this.childId = item.user_role_id;
  284. this.childName = item.user_realname;
  285. this.activeChild = item.user_id;
  286. // localStorage.setItem(
  287. // "childInfo_" + this.userInfo.user_id,
  288. // JSON.stringify(item)
  289. // );
  290. setChild(item);
  291. },
  292. submitDM() {
  293. showToast("切换成功~");
  294. this.toChange = false;
  295. location.reload();
  296. },
  297. },
  298. mounted() {
  299. this.IsManage();
  300. },
  301. created() {
  302. this.changeStu();
  303. },
  304. };
  305. </script>
  306. <style lang="scss" scoped>
  307. .header {
  308. position: relative;
  309. width: 100%;
  310. img {
  311. // width: 100%;
  312. }
  313. .changeStu {
  314. position: absolute;
  315. left: 33px;
  316. top: 25px;
  317. font-size: 14px;
  318. color: #fff;
  319. }
  320. .logout {
  321. position: absolute;
  322. right: 18px;
  323. top: 10px;
  324. font-size: 12px;
  325. color: #fff;
  326. span {
  327. display: block;
  328. margin: 0 auto;
  329. width: 30px;
  330. height: 30px;
  331. background: url("@/assets/images/logout.png") center no-repeat;
  332. background-size: 30px 30px;
  333. }
  334. }
  335. .user-info {
  336. position: absolute;
  337. left: 0;
  338. top: 55px;
  339. padding-left: 30px;
  340. display: flex;
  341. .user-shot {
  342. width: 54px;
  343. height: 54px;
  344. border-radius: 50%;
  345. overflow: hidden;
  346. img {
  347. width: 100%;
  348. border-radius: 50%;
  349. }
  350. }
  351. .info {
  352. flex: 1;
  353. padding-left: 10px;
  354. padding-top: 5px;
  355. .user-name {
  356. font-size: 14px;
  357. color: #fff;
  358. .role-type {
  359. padding: 2px 8px;
  360. font-size: 12px;
  361. border: 1px solid #ffffff;
  362. border-radius: 6px;
  363. margin-left: 15px;
  364. }
  365. }
  366. .user-school {
  367. margin-top: 5px;
  368. font-size: 13px;
  369. color: #fff;
  370. }
  371. }
  372. }
  373. }
  374. .nav {
  375. position: relative;
  376. margin: -30px 15px 0 15px;
  377. display: flex;
  378. height: 90px;
  379. background: #fff;
  380. border-radius: 8px 8px 0 0;
  381. align-items: center;
  382. li {
  383. width: 33.33%;
  384. }
  385. .nav-icon {
  386. display: block;
  387. margin: 0 auto;
  388. width: 24px;
  389. height: 24px;
  390. &.n-1 {
  391. background: url("@/assets/images/n-1.png") center no-repeat;
  392. background-size: 24px 24px;
  393. }
  394. &.n-2 {
  395. background: url("@/assets/images/n-2.png") center no-repeat;
  396. background-size: 23px 23px;
  397. }
  398. &.n-3 {
  399. background: url("@/assets/images/n-3.png") center no-repeat;
  400. background-size: 21px 20px;
  401. }
  402. }
  403. .nav-title {
  404. margin-top: 10px;
  405. display: block;
  406. font-size: 14px;
  407. color: #5a5858;
  408. text-align: center;
  409. }
  410. }
  411. .menu-list {
  412. margin: 50px 15px 0 15px;
  413. background: #fff;
  414. border-radius: 8px;
  415. padding: 0 10px;
  416. font-size: 12px;
  417. li {
  418. width: 100%;
  419. display: flex;
  420. align-items: center;
  421. justify-content: space-between;
  422. padding: 10px 0;
  423. & + li {
  424. border-top: 1px solid #e0e0e0;
  425. }
  426. }
  427. .order-icon {
  428. display: inline-block;
  429. vertical-align: middle;
  430. width: 18px;
  431. height: 18px;
  432. &.o-1 {
  433. background: url("@/assets/images/n-4.png") center no-repeat;
  434. background-size: 16px 18px;
  435. }
  436. &.o-2 {
  437. background: url("@/assets/images/n-5.png") center no-repeat;
  438. background-size: 18px 18px;
  439. }
  440. &.o-3 {
  441. background: url("@/assets/images/n-6.png") center no-repeat;
  442. background-size: 18px 16px;
  443. }
  444. &.o-4 {
  445. background: url("@/assets/images/n-7.png") center no-repeat;
  446. background-size: 18px 18px;
  447. }
  448. &.o-5 {
  449. background: url("@/assets/images/n-8.png") center no-repeat;
  450. background-size: 14px 17.5px;
  451. }
  452. &.o-6 {
  453. background: url("@/assets/images/n-9.png") center no-repeat;
  454. background-size: 18px 17.5px;
  455. }
  456. &.o-7 {
  457. background: url("@/assets/images/n-10.png") center no-repeat;
  458. background-size: 18px 18px;
  459. }
  460. &.o-8 {
  461. background: url("@/assets/images/n-11.png") center no-repeat;
  462. background-size: 17px 17px;
  463. }
  464. &.o-9 {
  465. background: url("@/assets/images/n-12.png") center no-repeat;
  466. background-size: 19.5px 17px;
  467. }
  468. &.o-10 {
  469. background: url("@/assets/images/n-13.png") center no-repeat;
  470. background-size: 18px 15px;
  471. }
  472. &.o-11 {
  473. background: url("@/assets/images/n-14.png") center no-repeat;
  474. background-size: 17.5px 17px;
  475. }
  476. }
  477. .order-title {
  478. margin-left: 10px;
  479. display: inline-block;
  480. vertical-align: middle;
  481. font-size: 15px;
  482. color: #363334;
  483. }
  484. }
  485. .cover {
  486. position: fixed;
  487. top: 0;
  488. width: 100vw;
  489. height: 100vh;
  490. background-color: #000000;
  491. opacity: 0.3;
  492. }
  493. .change-stu {
  494. width: 6.8 * 13.3vw;
  495. // height: 8.24 * 13.3vw;
  496. color: #333333;
  497. background-color: #fff;
  498. position: fixed;
  499. top: 1.5 * 13.3vw;
  500. left: 0.32 * 13.3vw;
  501. border-radius: 0.1 * 13.3vw;
  502. z-index: 5;
  503. padding: 0.24 * 13.3vw 0.37 * 13.3vw;
  504. box-sizing: border-box;
  505. i {
  506. position: absolute;
  507. right: 0.2 * 13.3vw;
  508. top: 0.3 * 13.3vw;
  509. }
  510. h3 {
  511. // width: 1.2 * 13.3vw;
  512. height: 0.4 * 13.3vw;
  513. font-size: 0.3 * 13.3vw;
  514. position: relative;
  515. }
  516. h3::before {
  517. position: absolute;
  518. content: "";
  519. width: 20%;
  520. height: 0.2 * 13.3vw;
  521. bottom: 0 * 13.3vw;
  522. border-radius: 0.1 * 13.3vw;
  523. background-color: #c5c5ff;
  524. opacity: 0.5;
  525. }
  526. }
  527. .submit {
  528. text-align: center;
  529. margin-top: 0.4 * 13.3vw;
  530. button {
  531. width: 2 * 13.3vw;
  532. height: 0.68 * 13.3vw;
  533. background: #003eee;
  534. border-radius: 0.34 * 13.3vw;
  535. color: #fff;
  536. font-size: 0.34 * 13.3vw;
  537. margin: 0 0.2 * 13.3vw;
  538. &:disabled {
  539. pointer-events: none;
  540. background: #ccc;
  541. }
  542. }
  543. }
  544. .stu-list {
  545. border: 1px solid #ddd;
  546. line-height: 0.8 * 13.3vw;
  547. align-items: center;
  548. .stu-index {
  549. width: 1 * 13.3vw;
  550. height: 0.35 * 13.3vw;
  551. line-height: 0.32 * 13.3vw;
  552. background: #003eee;
  553. border: 0.01 * 13.3vw solid #003eee;
  554. border-radius: 0.1 * 13.3vw;
  555. font-size: 0.14 * 13.3vw;
  556. text-align: center;
  557. color: #ffffff;
  558. }
  559. }
  560. .blueList {
  561. border: 1px solid #003eee;
  562. box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
  563. }
  564. </style>