index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="i_body">
  3. <div class="i_top">
  4. <div class="img">
  5. <img :src="info.headportrait ? info.headportrait : avator" alt="" />
  6. </div>
  7. <div class="name">
  8. <span>{{ info.username }}</span>
  9. </div>
  10. </div>
  11. <div class="i_bottom">
  12. <div class="i_bottom_span">
  13. <span>班级</span>
  14. <el-tooltip
  15. :content="info.cname ? info.cname : '暂无'"
  16. placement="top"
  17. effect="dark"
  18. >
  19. <span>{{ info.cname ? info.cname : "暂无" }}</span>
  20. </el-tooltip>
  21. </div>
  22. <div class="i_bottom_span">
  23. <span>备注</span>
  24. <el-tooltip
  25. :content="info.intro ? info.intro : '暂无'"
  26. placement="top"
  27. effect="dark"
  28. >
  29. <span>{{ info.intro ? info.intro : "暂无" }}</span>
  30. </el-tooltip>
  31. </div>
  32. <div class="i_bottom_btn" @click="openInfo()">
  33. <span class="edit"></span>
  34. <span>编辑个人信息</span>
  35. </div>
  36. </div>
  37. <infoDialog
  38. :dialogVisibleInfo.sync="dialogVisibleInfo"
  39. :userid="userid"
  40. :oid="oid"
  41. ></infoDialog>
  42. </div>
  43. </template>
  44. <script>
  45. import avator from "../../../../assets/icon/test/teacher.jpg";
  46. import infoDialog from "./infoDialog/index.vue";
  47. export default {
  48. components: {
  49. infoDialog,
  50. },
  51. props: {
  52. userid: {
  53. type: String,
  54. },
  55. oid: {
  56. type: String,
  57. },
  58. },
  59. data() {
  60. return {
  61. avator: avator,
  62. info: {},
  63. dialogVisibleInfo: false,
  64. };
  65. },
  66. watch: {
  67. dialogVisibleInfo(newValue, oldValue) {
  68. this.getData();
  69. },
  70. },
  71. methods: {
  72. getData() {
  73. let params = {
  74. uid: this.userid,
  75. };
  76. this.ajax
  77. .get(this.$store.state.api + "selectSDetail", params)
  78. .then((res) => {
  79. this.info = res.data[0][0];
  80. // 用于存储归类后的数据的对象
  81. })
  82. .catch((err) => {
  83. console.error(err);
  84. });
  85. },
  86. openInfo() {
  87. this.dialogVisibleInfo = true;
  88. },
  89. },
  90. mounted() {
  91. this.getData();
  92. },
  93. };
  94. </script>
  95. <style scoped>
  96. .i_body {
  97. width: 100%;
  98. min-height: auto;
  99. height: calc(40% - 10px);
  100. background: #fff;
  101. border-radius: 10px;
  102. margin-bottom: 10px;
  103. overflow: hidden;
  104. }
  105. .i_top {
  106. height: 55%;
  107. width: calc(100% - 20px);
  108. margin: 0 auto;
  109. display: flex;
  110. flex-direction: column;
  111. padding: 10px 0px 0px;
  112. justify-content: center;
  113. align-items: center;
  114. box-sizing: border-box;
  115. border-bottom: 1px solid #efefef;
  116. }
  117. .i_top > .img {
  118. width: 80px;
  119. height: 80px;
  120. overflow: hidden;
  121. border-radius: 50%;
  122. }
  123. .i_top > .img > img {
  124. width: 100%;
  125. height: 100%;
  126. object-fit: cover;
  127. }
  128. .i_top > .name {
  129. width: 100%;
  130. margin: 10px;
  131. text-align: center;
  132. }
  133. .i_top > .name > span {
  134. display: block;
  135. max-width: 100%;
  136. font-size: 22px;
  137. font-weight: 700;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. white-space: nowrap;
  141. }
  142. .i_bottom {
  143. height: 45%;
  144. width: calc(100% - 20px);
  145. margin: 0 auto;
  146. display: flex;
  147. flex-direction: column;
  148. align-items: center;
  149. justify-content: center;
  150. }
  151. .i_bottom > .i_bottom_span {
  152. width: 90%;
  153. margin: 0 auto;
  154. display: flex;
  155. align-items: center;
  156. font-size: 15px;
  157. }
  158. .i_bottom > .i_bottom_span + .i_bottom_span {
  159. margin-top: 10px;
  160. }
  161. .i_bottom > .i_bottom_span > span:nth-child(1) {
  162. width: 50px;
  163. min-width: 50px;
  164. text-align: right;
  165. color: #a1a1a1;
  166. }
  167. .i_bottom > .i_bottom_span > span:nth-child(2) {
  168. width: calc(100% - 30px);
  169. overflow: hidden;
  170. margin-left: 20px;
  171. white-space: nowrap;
  172. text-overflow: ellipsis;
  173. }
  174. .i_bottom > .i_bottom_btn {
  175. cursor: pointer;
  176. border-radius: 5px;
  177. border: 1px solid #dbdbdb;
  178. box-sizing: border-box;
  179. width: 90%;
  180. background: rgb(252, 252, 252);
  181. margin: 30px auto 0;
  182. height: 35px;
  183. font-weight: 600;
  184. font-size: 12px;
  185. display: flex;
  186. align-items: center;
  187. justify-content: center;
  188. }
  189. .i_bottom > .i_bottom_btn > .edit {
  190. display: block;
  191. width: 15px;
  192. height: 15px;
  193. background-size: 100% 100%;
  194. background-image: url("../../../../assets/icon/test/edit-icon.png");
  195. margin-right: 10px;
  196. }
  197. </style>