tab4-5.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <div class="tab4-5">
  3. <div class="top">
  4. <div class="search" @keyup.enter="mySearch">
  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,webVisit } 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. async lookBigImg(val) {
  83. this.details = true;
  84. this.txtObj = val;
  85. // 记录访问量
  86. await webVisit("student", val.id);
  87. },
  88. mySearch() {
  89. // console.log("点击了搜索");
  90. if (this.formData.searchKey.trim() === "") {
  91. this.myArr = [];
  92. this.baseTxt = false;
  93. return;
  94. }
  95. // return this.$message.warning("不能为空!");
  96. this.formData.pageNum = 1;
  97. this.studentList(this.formData);
  98. },
  99. // 封装获取列表函数
  100. async studentList(data) {
  101. const res = await studentList(data);
  102. this.total = res.data.total;
  103. this.myArr = res.data.records;
  104. this.baseTxt = true;
  105. },
  106. },
  107. // 生命周期 - 创建完成(可以访问当前this实例)
  108. created() {
  109. // 获取服务器前缀地址
  110. this.baseURL = axios.defaults.baseURL;
  111. // this.studentList(this.formData);
  112. },
  113. // 生命周期 - 挂载完成(可以访问DOM元素)
  114. mounted() {},
  115. beforeCreate() {}, // 生命周期 - 创建之前
  116. beforeMount() {}, // 生命周期 - 挂载之前
  117. beforeUpdate() {}, // 生命周期 - 更新之前
  118. updated() {}, // 生命周期 - 更新之后
  119. beforeDestroy() {}, // 生命周期 - 销毁之前
  120. destroyed() {}, // 生命周期 - 销毁完成
  121. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  122. };
  123. </script>
  124. <style lang='less' scoped>
  125. /deep/::-webkit-scrollbar-thumb {
  126. background-color: #b9412e !important;
  127. outline: 1px solid #b9412e !important;
  128. outline-offset: 0;
  129. }
  130. .conNull {
  131. padding-bottom: 200px;
  132. display: flex;
  133. font-size: 30px;
  134. align-items: center;
  135. justify-content: center;
  136. color: #b9412e !important;
  137. }
  138. .tab4-5 {
  139. /*修改提示文字的颜色*/
  140. /deep/input::-webkit-input-placeholder {
  141. /* WebKit browsers */
  142. color: #b9412e;
  143. }
  144. /deep/input:-moz-placeholder {
  145. /* Mozilla Firefox 4 to 18 */
  146. color: #b9412e;
  147. }
  148. /deep/input::-moz-placeholder {
  149. /* Mozilla Firefox 19+ */
  150. color: #b9412e;
  151. }
  152. /deep/input:-ms-input-placeholder {
  153. /* Internet Explorer 10+ */
  154. color: #b9412e;
  155. }
  156. // position: relative;
  157. width: 100%;
  158. height: 750px;
  159. min-width: 1500px;
  160. color: black;
  161. .top {
  162. height: 100px;
  163. position: relative;
  164. width: 100%;
  165. text-align: center;
  166. color: #b9412e;
  167. font-size: 26px;
  168. font-weight: 700;
  169. .search {
  170. /deep/.el-input__inner {
  171. border-radius: 40px;
  172. border: 1px solid #b9412e;
  173. }
  174. width: 500px;
  175. left: 50%;
  176. transform: translateX(-50%);
  177. bottom: 0px;
  178. position: absolute;
  179. .btn {
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. color: #fff;
  184. z-index: 999;
  185. background-color: #b9412e;
  186. border-radius: 40px;
  187. cursor: pointer;
  188. position: absolute;
  189. right: -20px;
  190. top: 3px;
  191. height: 40px;
  192. width: 80px;
  193. /deep/.el-icon-search {
  194. color: #fff;
  195. font-weight: 400;
  196. font-size: 16px;
  197. }
  198. }
  199. }
  200. }
  201. .conten {
  202. margin-top: 50px;
  203. min-width: 1556px;
  204. height: 600px;
  205. display: flex;
  206. flex-wrap: wrap;
  207. justify-content: center;
  208. overflow-y: auto;
  209. .row {
  210. cursor: pointer;
  211. margin: 20px 64px 10px 0;
  212. width: 260px;
  213. height: 316px;
  214. & > img {
  215. object-fit: cover;
  216. border: 2px solid #b9412e;
  217. width: 260px;
  218. height: 280px;
  219. }
  220. & > p {
  221. overflow: hidden;
  222. text-overflow: ellipsis;
  223. white-space: nowrap;
  224. font-size: 18px;
  225. color: #b9412e;
  226. margin-top: 12px;
  227. text-align: center;
  228. }
  229. }
  230. // .row:nth-of-type(5n) {
  231. // margin-right: 0;
  232. // }
  233. }
  234. .paging {
  235. position: absolute;
  236. left: 50%;
  237. bottom: 20px;
  238. transform: translateX(-50%);
  239. }
  240. .details {
  241. background-color: #fff;
  242. z-index: 9999;
  243. position: absolute;
  244. right: 0;
  245. top: 0;
  246. display: flex;
  247. // width: calc(100% - 160px);
  248. width: 100%;
  249. height: 100%;
  250. padding: 0px 0 0 80px;
  251. color: #707070;
  252. .left {
  253. margin-right: 100px;
  254. padding-top: 50px;
  255. width: 200px;
  256. height: auto;
  257. & > div {
  258. margin-left: -12px;
  259. cursor: pointer;
  260. font-size: 50px;
  261. margin-bottom: 30px;
  262. }
  263. & > img {
  264. width: 200px;
  265. height: 230px;
  266. object-fit: cover;
  267. }
  268. & > P {
  269. margin-top: 8px;
  270. text-align: center;
  271. }
  272. }
  273. .right {
  274. flex: 1;
  275. padding-top: 100px;
  276. & > div {
  277. margin-top: 30px;
  278. width: 1000px;
  279. border-bottom: 1px solid #afafaf;
  280. & > span {
  281. transform: translateY(2px);
  282. width: 105px;
  283. border-bottom: 4px solid #b9412e;
  284. display: block;
  285. height: 50px;
  286. font-size: 26px;
  287. font-weight: 700;
  288. color: #b9412e;
  289. }
  290. }
  291. & > p {
  292. margin: 15px 0;
  293. font-size: 16px;
  294. }
  295. .intro {
  296. padding-top: 15px;
  297. margin-top: 0px;
  298. height: 450px;
  299. overflow-y: auto;
  300. border-bottom: none;
  301. font-size: 16px;
  302. /deep/p {
  303. margin: 10px 0;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>