tab4-4.vue 7.7 KB

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