index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <div class="i_body">
  3. <div class="i_b_left">
  4. <img :src="info.headportrait ? info.headportrait : avator" alt="" />
  5. <div>
  6. <div>
  7. {{ info.username
  8. }}<span @click="openInfo()"
  9. ><svg
  10. width="20"
  11. height="20"
  12. viewBox="0 0 20 20"
  13. fill="none"
  14. xmlns="http://www.w3.org/2000/svg"
  15. >
  16. <path
  17. fill-rule="evenodd"
  18. clip-rule="evenodd"
  19. d="M2.5 3.125C2.5 2.77982 2.77982 2.5 3.125 2.5H10.625C10.9702 2.5 11.25 2.77982 11.25 3.125C11.25 3.47018 10.9702 3.75 10.625 3.75H3.75V16.25H16.25V10.625C16.25 10.2798 16.5298 10 16.875 10C17.2202 10 17.5 10.2798 17.5 10.625V16.875C17.5 17.2202 17.2202 17.5 16.875 17.5H3.125C2.77982 17.5 2.5 17.2202 2.5 16.875V3.125Z"
  20. fill="black"
  21. fill-opacity="0.9"
  22. />
  23. <path
  24. fill-rule="evenodd"
  25. clip-rule="evenodd"
  26. d="M17.3169 2.68306C17.561 2.92714 17.561 3.32286 17.3169 3.56694L9.81694 11.0669C9.57286 11.311 9.17714 11.311 8.93306 11.0669C8.68898 10.8229 8.68898 10.4271 8.93306 10.1831L16.4331 2.68306C16.6771 2.43898 17.0729 2.43898 17.3169 2.68306Z"
  27. fill="black"
  28. fill-opacity="0.9"
  29. />
  30. </svg>
  31. </span>
  32. </div>
  33. <span>{{ info.intro ? info.intro : "暂无简介" }}</span>
  34. </div>
  35. </div>
  36. <div class="i_b_right">
  37. <!-- <div>
  38. <span>年级</span>
  39. <div>{{ info.grade ? info.grade : "暂无" }}</div>
  40. </div>
  41. <span></span>
  42. <div>
  43. <span>学科</span>
  44. <div>{{info.subject ? info.subject : '暂无'}}</div>
  45. </div>
  46. <span></span>
  47. <div>
  48. <span>职务</span>
  49. <div>{{info.job ? info.job : '暂无'}}</div>
  50. </div>
  51. <span></span>
  52. <div>
  53. <span>教研室</span>
  54. <div>{{ info.classname ? info.classname : "暂无" }}</div>
  55. </div>
  56. <span></span>
  57. <div>
  58. <span>学段</span>
  59. <div>{{ info.stage ? info.stage : "暂无" }}</div>
  60. </div> -->
  61. <div v-for="(item,index) in teaType" :key="item.id">
  62. <div>
  63. <span>{{ item.name }}</span>
  64. <div>
  65. {{ getTypeC(item.child, item.value) }}
  66. </div>
  67. </div>
  68. <span v-if="index!=teaType.length-1"></span>
  69. </div>
  70. </div>
  71. <!-- <div class="i_top">
  72. <div class="img">
  73. <img :src="info.headportrait ? info.headportrait : avator" alt="">
  74. </div>
  75. <div class="name">
  76. <span>{{info.username}}</span>
  77. </div>
  78. <div class="detail">
  79. <el-tooltip :content="info.intro ? info.intro : '暂无简介'" placement="top" effect="dark">
  80. <span>{{info.intro ? info.intro : '暂无简介'}}</span>
  81. </el-tooltip>
  82. </div>
  83. </div> -->
  84. <!-- <div class="i_bottom"> -->
  85. <!-- <div class="i_bottom_span">
  86. <span>教研室</span>
  87. <el-tooltip :content="info.classname ? info.classname : '暂无'" placement="top" effect="dark">
  88. <span>{{info.classname ? info.classname : '暂无'}}</span>
  89. </el-tooltip>
  90. </div> -->
  91. <!-- <div class="i_bottom_box">
  92. <div class="i_bottom_span" v-for="item in teaType" :key="item.id">
  93. <span>
  94. {{ item.name + ":" }}
  95. </span>
  96. <el-tooltip :content="getTypeC(item.child, item.value)" placement="top" effect="dark">
  97. <span>{{ getTypeC(item.child, item.value) }}</span>
  98. </el-tooltip>
  99. </div>
  100. </div> -->
  101. <!-- <div v-if="!oidArray.includes(oid)" class="i_bottom_span">
  102. <span>学科</span>
  103. <el-tooltip :content="info.subject ? info.subject : '暂无'" placement="top" effect="dark">
  104. <span>{{info.subject ? info.subject : '暂无'}}</span>
  105. </el-tooltip>
  106. </div>
  107. <div v-if="!oidArray.includes(oid)" class="i_bottom_span">
  108. <span>职务</span>
  109. <el-tooltip :content="info.job ? info.job : '暂无'" placement="top" effect="dark">
  110. <span>{{info.job ? info.job : '暂无'}}</span>
  111. </el-tooltip>
  112. </div> -->
  113. <!-- <div class="i_bottom_btn" @click="openInfo()">
  114. <span class="edit"></span>
  115. <span>编辑个人信息</span>
  116. </div> -->
  117. <!-- </div> -->
  118. <infoDialog
  119. :dialogVisibleInfo.sync="dialogVisibleInfo"
  120. :userid="userid"
  121. :oid="oid"
  122. ></infoDialog>
  123. </div>
  124. </template>
  125. <script>
  126. import avator from "../../../../assets/icon/test/teacher.jpg";
  127. import infoDialog from "./infoDialognew/index.vue";
  128. export default {
  129. components: {
  130. infoDialog
  131. },
  132. props: {
  133. userid: {
  134. type: String
  135. },
  136. oid: {
  137. type: String
  138. }
  139. },
  140. data() {
  141. return {
  142. avator: avator,
  143. info: {},
  144. dialogVisibleInfo: false,
  145. oidArray: ["d67940a5-510c-40ea-9c9a-2631ab03013a"],
  146. teaType: []
  147. };
  148. },
  149. watch: {
  150. dialogVisibleInfo(newValue, oldValue) {
  151. this.getData();
  152. }
  153. },
  154. computed: {
  155. getTypeC() {
  156. return function(array, value) {
  157. let name = [];
  158. for (var i = 0; i < array.length; i++) {
  159. if (value.indexOf(array[i].id) != -1) {
  160. name.push(array[i].name);
  161. }
  162. }
  163. return name.length ? name.join("/") : "暂无";
  164. };
  165. }
  166. },
  167. methods: {
  168. arrayToArray(arrayo, arrayt) {
  169. let array1 = arrayo;
  170. let array2 = arrayt;
  171. let commonElements = [];
  172. for (let i = 0; i < array1.length; i++) {
  173. for (let j = 0; j < array2.length; j++) {
  174. if (array1[i] === array2[j]) {
  175. commonElements.push(array1[i]);
  176. }
  177. }
  178. }
  179. return commonElements;
  180. },
  181. //获取分类类名
  182. getTypeInfo() {
  183. let params = {
  184. oid: this.oid
  185. };
  186. this.ajax
  187. .get(this.$store.state.api + "selectPerInfoAllTea", params)
  188. .then(res => {
  189. console.log(res.data)
  190. this.teaType = res.data[0];
  191. let typeInfo = res.data[1];
  192. this.teaType.forEach(e => {
  193. e.child = [];
  194. e.value = [];
  195. typeInfo.forEach(i => {
  196. if (e.id == i.parentid) {
  197. e.child.push({ id: i.id, name: i.name });
  198. }
  199. });
  200. });
  201. console.log(this.teaType, "teaType");
  202. // this.options = res.data[2];
  203. this.getData();
  204. })
  205. .catch(err => {
  206. console.error(err);
  207. });
  208. },
  209. getData() {
  210. let params = {
  211. uid: this.userid
  212. };
  213. this.ajax
  214. .get(this.$store.state.api + "selectTestUser", params)
  215. .then(res => {
  216. this.info = res.data[0][0];
  217. // 用于存储归类后的数据的对象
  218. this.teaType.forEach(e => {
  219. let array2 = [];
  220. for (var i = 0; i < e.child.length; i++) {
  221. array2.push(e.child[i].id);
  222. }
  223. e.value = this.arrayToArray(this.info.cclassid.split(","), array2);
  224. });
  225. })
  226. .catch(err => {
  227. console.error(err);
  228. });
  229. },
  230. openInfo() {
  231. this.dialogVisibleInfo = true;
  232. }
  233. },
  234. mounted() {
  235. this.getTypeInfo();
  236. }
  237. };
  238. </script>
  239. <style scoped>
  240. .i_body {
  241. width: 100%;
  242. height: 130px;
  243. min-height: 130px;
  244. background: #fff;
  245. border-bottom: 1px solid #e7e7e7;
  246. box-sizing: border-box;
  247. padding: 10px 30px;
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-between;
  251. /* border-radius: 5px;
  252. margin-bottom: 10px;
  253. overflow: auto; */
  254. }
  255. .i_b_left {
  256. width: auto;
  257. height: 100%;
  258. max-width: 50%;
  259. overflow: auto;
  260. display: flex;
  261. align-items: center;
  262. }
  263. .i_b_left > img {
  264. width: 80px;
  265. height: 80px;
  266. border-radius: 50%;
  267. }
  268. .i_b_left > div {
  269. margin-left: 20px;
  270. height: 80px;
  271. display: flex;
  272. flex-direction: column;
  273. justify-content: space-between;
  274. }
  275. .i_b_left > div > div {
  276. font-size: 34px;
  277. font-weight: bold;
  278. display: flex;
  279. align-items: center;
  280. }
  281. .i_b_left > div > div > span {
  282. width: 25px;
  283. height: 25px;
  284. cursor: pointer;
  285. margin-left: 20px;
  286. }
  287. .i_b_left > div > div > span > svg {
  288. width: 100%;
  289. height: 100%;
  290. }
  291. .i_b_left > div > span {
  292. font-size: 16px;
  293. color: #a1a1a1;
  294. }
  295. .i_b_right {
  296. width: auto;
  297. max-width: 50%;
  298. height: 100%;
  299. overflow: auto;
  300. display: flex;
  301. align-items: center;
  302. }
  303. .i_b_right>div{
  304. display: flex;
  305. }
  306. .i_b_right>div >div {
  307. display: flex;
  308. flex-direction: column;
  309. align-items: center;
  310. width: auto;
  311. height: 60px;
  312. justify-content: space-between;
  313. padding: 0px 20px;
  314. text-wrap: nowrap;
  315. }
  316. .i_b_right>div > div>div {
  317. font-size: 18px;
  318. font-weight: bold;
  319. text-wrap: nowrap;
  320. }
  321. .i_b_right>div >div > span {
  322. font-size: 18px;
  323. color: #00000099;
  324. text-wrap: nowrap;
  325. }
  326. .i_b_right>div > span {
  327. width: 1px;
  328. height: 50px;
  329. margin: 0 20px;
  330. background: #e7e7e7;
  331. }
  332. /* .i_top{
  333. height: 55%;
  334. width: calc(100% - 20px);
  335. margin: 0 auto;
  336. display: flex;
  337. flex-direction: column;
  338. padding: 10px 0px 0px;
  339. justify-content: center;
  340. align-items: center;
  341. box-sizing: border-box;
  342. border-bottom: 1px solid #efefef;
  343. }
  344. .i_top > .img{
  345. width: 80px;
  346. height: 80px;
  347. overflow: hidden;
  348. border-radius: 50%;
  349. }
  350. .i_top > .img > img{
  351. width: 100%;
  352. height: 100%;
  353. object-fit: cover;
  354. }
  355. .i_top > .name{
  356. width: 100%;
  357. margin: 10px;
  358. text-align: center;
  359. }
  360. .i_top > .name > span{
  361. display: block;
  362. max-width: 100%;
  363. font-size: 22px;
  364. font-weight: 700;
  365. overflow: hidden;
  366. text-overflow: ellipsis;
  367. white-space: nowrap;
  368. }
  369. .i_top > .detail{
  370. width: 100%;
  371. text-align: center;
  372. }
  373. .i_top > .detail > span{
  374. max-width: 90%;
  375. font-size: 12px;
  376. margin: 0 auto;
  377. display: -webkit-box;
  378. -webkit-line-clamp: 2;
  379. -webkit-box-orient: vertical;
  380. color: #a1a1a1;
  381. line-height: 20px;
  382. overflow: hidden;
  383. word-break: break-all;
  384. }
  385. .i_bottom{
  386. height: 45%;
  387. width: calc(100% - 20px);
  388. margin: 0 auto;
  389. display: flex;
  390. flex-direction: column;
  391. align-items: center;
  392. justify-content: center;
  393. }
  394. .i_bottom .i_bottom_span{
  395. width: 90%;
  396. margin: 0 auto;
  397. display: flex;
  398. align-items: center;
  399. font-size: 15px;
  400. }
  401. .i_bottom .i_bottom_span + .i_bottom_span{
  402. margin-top: 10px;
  403. }
  404. .i_bottom .i_bottom_span > span:nth-child(1){
  405. width: 50px;
  406. min-width: 50px;
  407. text-align: right;
  408. color: #a1a1a1;
  409. }
  410. .i_bottom .i_bottom_span > span:nth-child(2){
  411. width: calc(100% - 30px);
  412. overflow: hidden;
  413. margin-left: 20px;
  414. white-space: nowrap;
  415. text-overflow: ellipsis;
  416. }
  417. .i_bottom_box {
  418. width: 100%;
  419. height: calc(100% - 55px);
  420. overflow: auto;
  421. padding-top: 10px;
  422. box-sizing: border-box;
  423. }
  424. .i_bottom > .i_bottom_btn{
  425. cursor: pointer;
  426. border-radius: 5px;
  427. border: 1px solid #dbdbdb;
  428. box-sizing: border-box;
  429. width: 90%;
  430. background: rgb(252, 252, 252);
  431. margin: auto auto 10px;
  432. height: 35px;
  433. font-weight: 600;
  434. font-size: 12px;
  435. display: flex;
  436. align-items: center;
  437. justify-content: center;
  438. }
  439. .i_bottom > .i_bottom_btn > .edit{
  440. display: block;
  441. width: 15px;
  442. height: 15px;
  443. background-size:100% 100%;
  444. background-image: url('../../../../assets/icon/test/edit-icon.png');
  445. margin-right: 10px;
  446. } */
  447. </style>