MainLayout.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="main-layout">
  3. <header class="header qm-primary-text">
  4. <!-- <a style="float: left; padding-left: 20px" @click="goBack">
  5. <Icon type="ios-arrow-back" />返回</a> -->
  6. <Poptip
  7. v-if="ifShowQr"
  8. trigger="hover"
  9. width="240"
  10. >
  11. <span class="name-arrow">手机端登录(Android)
  12. </span>
  13. <div slot="content">
  14. <div class="qm-primary-text">
  15. <qrcode
  16. :value="qrValue"
  17. :options="{ width: 200 }"
  18. ></qrcode>
  19. </div>
  20. </div>
  21. </Poptip>
  22. <span
  23. v-if="ifShowQr"
  24. style="margin: auto 20px"
  25. >|</span>
  26. <Poptip
  27. trigger="hover"
  28. width="300"
  29. >
  30. <span class="name-arrow">{{user.displayName}} &nbsp;
  31. <i
  32. class="ivu-icon ivu-icon-md-arrow-dropdown"
  33. style="vertical-align: middle;"
  34. ></i>
  35. </span>
  36. <div slot="content">
  37. <div class="info qm-primary-text">
  38. <div class="hr info-row">
  39. <div>底照</div>
  40. <div><img
  41. class="user-avatar"
  42. :src="user.photoPath"
  43. alt="无底照"
  44. /></div>
  45. </div>
  46. <div class="hr info-row">
  47. <div>学号</div>
  48. <div>{{user.studentCode}}</div>
  49. </div>
  50. <div class="hr info-row">
  51. <div>身份证号</div>
  52. <div>{{user.identityNumber}}</div>
  53. </div>
  54. <div class="hr info-row">
  55. <div>学习中心</div>
  56. <div>{{user.orgName}}</div>
  57. </div>
  58. <div style="grid-column: span 2; place-self: center; width: 100%; padding-top: 10px">
  59. <i-button
  60. class="qm-primary-button"
  61. long
  62. @click="goChangePwd"
  63. >修改密码</i-button>
  64. </div>
  65. </div>
  66. </div>
  67. </Poptip>
  68. <span style="margin: auto 20px">|</span>
  69. <a
  70. @click="logout"
  71. class="qm-primary-text"
  72. style="display: inline-block; margin-right: 20px; text-align: center;"
  73. >退出登录</a>
  74. </header>
  75. <main class="content">
  76. <slot></slot>
  77. </main>
  78. <nav class="nav">
  79. <img
  80. src="./qm-logo.png"
  81. class="qm-logo"
  82. />
  83. <ul>
  84. <li>
  85. <router-link
  86. class="link"
  87. to="/online-exam"
  88. >在线考试&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</router-link>
  89. </li>
  90. <li>
  91. <router-link
  92. class="link"
  93. to="/online-practice"
  94. >在线练习&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</router-link>
  95. </li>
  96. <li>
  97. <router-link
  98. class="link"
  99. to="/offline-exam"
  100. >离线考试&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</router-link>
  101. </li>
  102. <li>
  103. <router-link
  104. class="link"
  105. to="/password"
  106. >修改密码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</router-link>
  107. </li>
  108. </ul>
  109. </nav>
  110. <footer class="footer">©️2018 启明泰和</footer>
  111. </div>
  112. </template>
  113. <script>
  114. import { mapState } from "vuex";
  115. import VueQrcode from "@chenfengyuan/vue-qrcode";
  116. export default {
  117. name: "MainLayout",
  118. data() {
  119. return {};
  120. },
  121. methods: {
  122. goChangePwd() {
  123. this.$router.push("/password");
  124. },
  125. goBack() {
  126. window.history.back();
  127. }
  128. },
  129. computed: {
  130. ...mapState(["user"]),
  131. qrValue() {
  132. const { rootOrgId, studentCode, identityNumber } = this.user;
  133. return JSON.stringify({ rootOrgId, studentCode, identityNumber });
  134. },
  135. ifShowQr() {
  136. return location.href.includes("ecs-dev");
  137. }
  138. },
  139. components: {
  140. qrcode: VueQrcode
  141. }
  142. };
  143. </script>
  144. <style scoped>
  145. .main-layout {
  146. display: grid;
  147. grid-template-areas: "nav header" "nav content" "nav footer";
  148. min-height: 100vh;
  149. grid-template-columns: 180px 1fr;
  150. grid-template-rows: auto 1fr auto;
  151. }
  152. .header {
  153. grid-area: header;
  154. height: 50px;
  155. background-color: #ffffff;
  156. box-shadow: 0px 1px 0px 0px #eeeeee;
  157. text-align: right;
  158. line-height: 50px;
  159. }
  160. .user-avatar {
  161. display: inline-block;
  162. width: 80px;
  163. height: 80px;
  164. object-fit: contain;
  165. }
  166. .info {
  167. width: 260px;
  168. }
  169. .info > div {
  170. min-height: 50px;
  171. }
  172. .hr {
  173. border-bottom: 1px solid #eeeeee;
  174. }
  175. .info-row {
  176. display: grid;
  177. grid-template-columns: 1fr 2fr;
  178. align-items: center;
  179. }
  180. .info-row > div:nth-of-type(odd) {
  181. justify-self: left;
  182. }
  183. .info-row > div:nth-of-type(even) {
  184. justify-self: right;
  185. }
  186. .name-arrow:hover .ivu-icon-md-arrow-dropdown::before {
  187. content: "\F343";
  188. }
  189. .nav {
  190. grid-area: nav;
  191. /* background-image: url(../../features/Login/bg.jpg); */
  192. background-color: rgb(113, 113, 113);
  193. background-repeat: repeat;
  194. width: 180px;
  195. min-height: 100vh;
  196. display: flex;
  197. flex-direction: column;
  198. }
  199. .qm-logo {
  200. width: 80px;
  201. height: 68px;
  202. margin: 30px auto;
  203. }
  204. .link {
  205. background-image: url(./link.png);
  206. background-repeat: no-repeat;
  207. background-position: 30px 50%;
  208. /* margin-left: -40px; */
  209. line-height: 40px;
  210. width: 100%;
  211. display: inline-block;
  212. color: #ffffff;
  213. }
  214. .router-link-active,
  215. .link:hover {
  216. background-image: url(./link-active.png);
  217. background-color: rgba(255, 255, 255, 0.5);
  218. color: #fafafa;
  219. }
  220. .footer {
  221. grid-area: footer;
  222. margin-bottom: 10px;
  223. }
  224. </style>