index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 class="detail">
  11. <el-tooltip :content="info.intro ? info.intro : '暂无简介'" placement="top" effect="dark">
  12. <span>{{info.intro ? info.intro : '暂无简介'}}</span>
  13. </el-tooltip>
  14. </div>
  15. </div>
  16. <div class="i_bottom">
  17. <div class="i_bottom_span">
  18. <span>教研室</span>
  19. <el-tooltip :content="info.classname ? info.classname : '暂无'" placement="top" effect="dark">
  20. <span>{{info.classname ? info.classname : '暂无'}}</span>
  21. </el-tooltip>
  22. </div>
  23. <div v-if="!oidArray.includes(oid)" class="i_bottom_span">
  24. <span>学科</span>
  25. <el-tooltip :content="info.subject ? info.subject : '暂无'" placement="top" effect="dark">
  26. <span>{{info.subject ? info.subject : '暂无'}}</span>
  27. </el-tooltip>
  28. </div>
  29. <div v-if="!oidArray.includes(oid)" class="i_bottom_span">
  30. <span>职务</span>
  31. <el-tooltip :content="info.job ? info.job : '暂无'" placement="top" effect="dark">
  32. <span>{{info.job ? info.job : '暂无'}}</span>
  33. </el-tooltip>
  34. </div>
  35. <div class="i_bottom_btn" @click="openInfo()">
  36. <span class="edit"></span>
  37. <span>编辑个人信息</span>
  38. </div>
  39. </div>
  40. <infoDialog :dialogVisibleInfo.sync="dialogVisibleInfo" :userid="userid" :oid="oid"></infoDialog>
  41. </div>
  42. </template>
  43. <script>
  44. import avator from '../../../../assets/icon/test/teacher.jpg'
  45. import infoDialog from './infoDialog/index.vue'
  46. export default {
  47. components: {
  48. infoDialog,
  49. },
  50. props: {
  51. userid: {
  52. type: String
  53. },
  54. oid: {
  55. type: String
  56. },
  57. },
  58. data() {
  59. return {
  60. avator: avator,
  61. info: {},
  62. dialogVisibleInfo:false,
  63. oidArray: ["d67940a5-510c-40ea-9c9a-2631ab03013a"]
  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 + "selectTestUser", 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. height: calc(55% - 10px);
  99. min-height: 420px;
  100. background: #fff;
  101. border-radius: 5px;
  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_top > .detail{
  143. width: 100%;
  144. text-align: center;
  145. }
  146. .i_top > .detail > span{
  147. /* display: block; */
  148. max-width: 90%;
  149. font-size: 12px;
  150. margin: 0 auto;
  151. display: -webkit-box;
  152. -webkit-line-clamp: 2;
  153. -webkit-box-orient: vertical;
  154. color: #a1a1a1;
  155. line-height: 20px;
  156. overflow: hidden;
  157. word-break: break-all;
  158. }
  159. .i_bottom{
  160. height: 45%;
  161. width: calc(100% - 20px);
  162. margin: 0 auto;
  163. display: flex;
  164. flex-direction: column;
  165. align-items: center;
  166. justify-content: center;
  167. }
  168. .i_bottom > .i_bottom_span{
  169. width: 90%;
  170. margin: 0 auto;
  171. display: flex;
  172. align-items: center;
  173. font-size: 15px;
  174. }
  175. .i_bottom > .i_bottom_span + .i_bottom_span{
  176. margin-top: 10px;
  177. }
  178. .i_bottom > .i_bottom_span > span:nth-child(1){
  179. width: 50px;
  180. min-width: 50px;
  181. text-align: right;
  182. color: #a1a1a1;
  183. }
  184. .i_bottom > .i_bottom_span > span:nth-child(2){
  185. width: calc(100% - 30px);
  186. overflow: hidden;
  187. margin-left: 20px;
  188. white-space: nowrap;
  189. text-overflow: ellipsis;
  190. }
  191. .i_bottom > .i_bottom_btn{
  192. cursor: pointer;
  193. border-radius: 5px;
  194. border: 1px solid #dbdbdb;
  195. box-sizing: border-box;
  196. width: 90%;
  197. background: rgb(252, 252, 252);
  198. margin: 30px auto 0;
  199. height: 35px;
  200. font-weight: 600;
  201. font-size: 12px;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. }
  206. .i_bottom > .i_bottom_btn > .edit{
  207. display: block;
  208. width: 15px;
  209. height: 15px;
  210. background-size:100% 100%;
  211. background-image: url('../../../../assets/icon/test/edit-icon.png');
  212. margin-right: 10px;
  213. }
  214. </style>