tab4-5.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. display: flex;
  132. font-size: 30px;
  133. align-items: center;
  134. justify-content: center;
  135. color: #b9412e !important;
  136. }
  137. .tab4-5 {
  138. /*修改提示文字的颜色*/
  139. /deep/input::-webkit-input-placeholder {
  140. /* WebKit browsers */
  141. color: #b9412e;
  142. }
  143. /deep/input:-moz-placeholder {
  144. /* Mozilla Firefox 4 to 18 */
  145. color: #b9412e;
  146. }
  147. /deep/input::-moz-placeholder {
  148. /* Mozilla Firefox 19+ */
  149. color: #b9412e;
  150. }
  151. /deep/input:-ms-input-placeholder {
  152. /* Internet Explorer 10+ */
  153. color: #b9412e;
  154. }
  155. // position: relative;
  156. width: 100%;
  157. height: 750px;
  158. min-width: 1500px;
  159. color: black;
  160. .top {
  161. height: 100px;
  162. position: relative;
  163. width: 100%;
  164. text-align: center;
  165. color: #b9412e;
  166. font-size: 26px;
  167. font-weight: 700;
  168. .search {
  169. /deep/.el-input__inner {
  170. border-radius: 40px;
  171. border: 1px solid #b9412e;
  172. }
  173. width: 500px;
  174. left: 50%;
  175. transform: translateX(-50%);
  176. bottom: 0px;
  177. position: absolute;
  178. .btn {
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. color: #fff;
  183. z-index: 999;
  184. background-color: #b9412e;
  185. border-radius: 40px;
  186. cursor: pointer;
  187. position: absolute;
  188. right: -20px;
  189. top: 3px;
  190. height: 40px;
  191. width: 80px;
  192. /deep/.el-icon-search {
  193. color: #fff;
  194. font-weight: 400;
  195. font-size: 16px;
  196. }
  197. }
  198. }
  199. }
  200. .conten {
  201. margin-top: 50px;
  202. min-width: 1556px;
  203. height: 600px;
  204. display: flex;
  205. flex-wrap: wrap;
  206. justify-content: center;
  207. overflow-y: auto;
  208. .row {
  209. cursor: pointer;
  210. margin: 20px 64px 10px 0;
  211. width: 260px;
  212. height: 316px;
  213. & > img {
  214. object-fit: cover;
  215. border: 2px solid #b9412e;
  216. width: 260px;
  217. height: 280px;
  218. }
  219. & > p {
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. white-space: nowrap;
  223. font-size: 18px;
  224. color: #b9412e;
  225. margin-top: 12px;
  226. text-align: center;
  227. }
  228. }
  229. // .row:nth-of-type(5n) {
  230. // margin-right: 0;
  231. // }
  232. }
  233. .paging {
  234. position: absolute;
  235. left: 50%;
  236. bottom: 20px;
  237. transform: translateX(-50%);
  238. }
  239. .details {
  240. background-color: #fff;
  241. z-index: 9999;
  242. position: absolute;
  243. right: 0;
  244. top: 0;
  245. display: flex;
  246. // width: calc(100% - 160px);
  247. width: 100%;
  248. height: 100%;
  249. padding: 0px 0 0 80px;
  250. color: #707070;
  251. .left {
  252. margin-right: 100px;
  253. padding-top: 50px;
  254. width: 200px;
  255. height: auto;
  256. & > div {
  257. margin-left: -12px;
  258. cursor: pointer;
  259. font-size: 50px;
  260. margin-bottom: 30px;
  261. }
  262. & > img {
  263. width: 200px;
  264. height: 230px;
  265. object-fit: cover;
  266. }
  267. & > P {
  268. margin-top: 8px;
  269. text-align: center;
  270. }
  271. }
  272. .right {
  273. flex: 1;
  274. padding-top: 100px;
  275. & > div {
  276. margin-top: 30px;
  277. width: 1000px;
  278. border-bottom: 1px solid #afafaf;
  279. & > span {
  280. transform: translateY(2px);
  281. width: 105px;
  282. border-bottom: 4px solid #b9412e;
  283. display: block;
  284. height: 50px;
  285. font-size: 26px;
  286. font-weight: 700;
  287. color: #b9412e;
  288. }
  289. }
  290. & > p {
  291. margin: 15px 0;
  292. font-size: 16px;
  293. }
  294. .intro {
  295. padding-top: 15px;
  296. margin-top: 0px;
  297. height: 450px;
  298. overflow-y: auto;
  299. border-bottom: none;
  300. font-size: 16px;
  301. /deep/p {
  302. margin: 10px 0;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. </style>