tab4-5.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div class="tab4-5">
  3. <div class="top">
  4. <div class="search">
  5. <el-input
  6. placeholder="请输入姓名"
  7. suffix-icon="el-icon-search"
  8. v-model="formData.searchKey"
  9. >
  10. </el-input>
  11. <span class="btn" @click="mySearch">
  12. <i class="el-icon-search"></i>&nbsp; 查 询</span
  13. >
  14. </div>
  15. </div>
  16. <!-- 内容 -->
  17. <div class="conten conNull" v-if="baseTxt && myArr.length === 0">
  18. 没有此学员!请确认后重新输入!
  19. </div>
  20. <div class="conten" v-else>
  21. <div
  22. class="row"
  23. v-for="item in myArr"
  24. :key="item.id"
  25. @click="lookBigImg(item)"
  26. >
  27. <img class="imgLook" :src="baseURL + item.thumb" alt="" />
  28. <p :title="item.name">{{ item.name }}</p>
  29. </div>
  30. </div>
  31. <!-- 点击领导详情 -->
  32. <div class="details" v-show="details">
  33. <div class="left">
  34. <div class="el-icon-arrow-left" @click="details = false"></div>
  35. <img :src="baseURL + txtObj.thumb" alt="" v-if="txtObj.thumb" />
  36. <p>{{ txtObj.name }}</p>
  37. </div>
  38. <div class="right">
  39. <div>
  40. <span>基本信息</span>
  41. </div>
  42. <p>性别:{{ txtObj.sex === "M" ? "男" : "女" }}</p>
  43. <p>政治面貌:{{ txtObj.politics }}</p>
  44. <p>学籍号:{{ txtObj.num }}</p>
  45. <p>专业:{{ txtObj.job }}</p>
  46. <div>
  47. <span>校园动态</span>
  48. </div>
  49. <div class="intro" v-html="txtObj.description"></div>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import axios from "@/utils/request";
  56. import { studentList } from "@/utils/api";
  57. export default {
  58. name: "tab4-5",
  59. components: {},
  60. data() {
  61. // 这里存放数据
  62. return {
  63. baseTxt: false,
  64. details: false,
  65. txtObj: {},
  66. myArr: [],
  67. formData: {
  68. pageNum: 1,
  69. pageSize: 999,
  70. searchKey: "",
  71. },
  72. baseURL: "",
  73. };
  74. },
  75. // 监听属性 类似于data概念
  76. computed: {},
  77. // 监控data中的数据变化
  78. watch: {},
  79. // 方法集合
  80. methods: {
  81. //点击图片,查看详情
  82. lookBigImg(val) {
  83. this.details = true;
  84. this.txtObj = val;
  85. },
  86. mySearch() {
  87. // console.log("点击了搜索");
  88. if (this.formData.searchKey.trim() === "") {
  89. this.myArr = [];
  90. this.baseTxt = false;
  91. return;
  92. }
  93. // return this.$message.warning("不能为空!");
  94. this.formData.pageNum = 1;
  95. this.studentList(this.formData);
  96. },
  97. // 封装获取列表函数
  98. async studentList(data) {
  99. const res = await studentList(data);
  100. this.total = res.data.total;
  101. this.myArr = res.data.records;
  102. this.baseTxt = true;
  103. },
  104. },
  105. // 生命周期 - 创建完成(可以访问当前this实例)
  106. created() {
  107. // 获取服务器前缀地址
  108. this.baseURL = axios.defaults.baseURL;
  109. // this.studentList(this.formData);
  110. },
  111. // 生命周期 - 挂载完成(可以访问DOM元素)
  112. mounted() {},
  113. beforeCreate() {}, // 生命周期 - 创建之前
  114. beforeMount() {}, // 生命周期 - 挂载之前
  115. beforeUpdate() {}, // 生命周期 - 更新之前
  116. updated() {}, // 生命周期 - 更新之后
  117. beforeDestroy() {}, // 生命周期 - 销毁之前
  118. destroyed() {}, // 生命周期 - 销毁完成
  119. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  120. };
  121. </script>
  122. <style lang='less' scoped>
  123. /deep/::-webkit-scrollbar-thumb {
  124. background-color: #b9412e !important;
  125. outline: 1px solid #b9412e !important;
  126. outline-offset: 0;
  127. }
  128. .conNull {
  129. display: flex;
  130. font-size: 30px;
  131. align-items: center;
  132. justify-content: center;
  133. color: #b9412e !important;
  134. }
  135. .tab4-5 {
  136. /*修改提示文字的颜色*/
  137. /deep/input::-webkit-input-placeholder {
  138. /* WebKit browsers */
  139. color: #b9412e;
  140. }
  141. /deep/input:-moz-placeholder {
  142. /* Mozilla Firefox 4 to 18 */
  143. color: #b9412e;
  144. }
  145. /deep/input::-moz-placeholder {
  146. /* Mozilla Firefox 19+ */
  147. color: #b9412e;
  148. }
  149. /deep/input:-ms-input-placeholder {
  150. /* Internet Explorer 10+ */
  151. color: #b9412e;
  152. }
  153. // position: relative;
  154. width: 100%;
  155. height: 750px;
  156. min-width: 1500px;
  157. color: black;
  158. .top {
  159. height: 100px;
  160. position: relative;
  161. width: 100%;
  162. text-align: center;
  163. color: #b9412e;
  164. font-size: 26px;
  165. font-weight: 700;
  166. .search {
  167. /deep/.el-input__inner {
  168. border-radius: 40px;
  169. border: 1px solid #b9412e;
  170. }
  171. width: 500px;
  172. left: 50%;
  173. transform: translateX(-50%);
  174. bottom: 0px;
  175. position: absolute;
  176. .btn {
  177. display: flex;
  178. align-items: center;
  179. justify-content: center;
  180. color: #fff;
  181. z-index: 999;
  182. background-color: #b9412e;
  183. border-radius: 40px;
  184. cursor: pointer;
  185. position: absolute;
  186. right: -20px;
  187. top: 3px;
  188. height: 40px;
  189. width: 80px;
  190. /deep/.el-icon-search {
  191. color: #fff;
  192. font-weight: 400;
  193. font-size: 16px;
  194. }
  195. }
  196. }
  197. }
  198. .conten {
  199. margin-top: 50px;
  200. min-width: 1556px;
  201. height: 600px;
  202. display: flex;
  203. flex-wrap: wrap;
  204. justify-content: center;
  205. overflow-y: auto;
  206. .row {
  207. cursor: pointer;
  208. margin: 20px 64px 10px 0;
  209. width: 260px;
  210. height: 316px;
  211. & > img {
  212. object-fit: cover;
  213. border: 2px solid #b9412e;
  214. width: 260px;
  215. height: 280px;
  216. }
  217. & > p {
  218. overflow: hidden;
  219. text-overflow: ellipsis;
  220. white-space: nowrap;
  221. font-size: 18px;
  222. color: #b9412e;
  223. margin-top: 12px;
  224. text-align: center;
  225. }
  226. }
  227. // .row:nth-of-type(5n) {
  228. // margin-right: 0;
  229. // }
  230. }
  231. .paging {
  232. position: absolute;
  233. left: 50%;
  234. bottom: 20px;
  235. transform: translateX(-50%);
  236. }
  237. .details {
  238. background-color: #fff;
  239. z-index: 9999;
  240. position: absolute;
  241. right: 0;
  242. top: 0;
  243. display: flex;
  244. // width: calc(100% - 160px);
  245. width: 100%;
  246. height: 100%;
  247. padding: 0px 0 0 80px;
  248. color: #707070;
  249. .left {
  250. margin-right: 100px;
  251. padding-top: 50px;
  252. width: 200px;
  253. height: auto;
  254. & > div {
  255. margin-left: -12px;
  256. cursor: pointer;
  257. font-size: 50px;
  258. margin-bottom: 30px;
  259. }
  260. & > img {
  261. width: 200px;
  262. height: 230px;
  263. object-fit: cover;
  264. }
  265. & > P {
  266. margin-top: 8px;
  267. text-align: center;
  268. }
  269. }
  270. .right {
  271. flex: 1;
  272. padding-top: 100px;
  273. & > div {
  274. margin-top: 30px;
  275. width: 1000px;
  276. border-bottom: 1px solid #afafaf;
  277. & > span {
  278. transform: translateY(2px);
  279. width: 105px;
  280. border-bottom: 4px solid #b9412e;
  281. display: block;
  282. height: 50px;
  283. font-size: 26px;
  284. font-weight: 700;
  285. color: #b9412e;
  286. }
  287. }
  288. & > p {
  289. margin: 15px 0;
  290. font-size: 16px;
  291. }
  292. .intro {
  293. padding-top: 15px;
  294. margin-top: 0px;
  295. height: 450px;
  296. overflow-y: auto;
  297. border-bottom: none;
  298. font-size: 16px;
  299. /deep/p {
  300. margin: 10px 0;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. </style>