policyList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <template>
  2. <view>
  3. <view :class="['custom-header', { 'is-back': isBack }, bgColor]">
  4. <view class="back-container" @click="handleBack">
  5. <view class="back-text">返回</view>
  6. </view>
  7. <view class="content-container">
  8. <view class="content-text">涉企政策</view>
  9. </view>
  10. </view>
  11. <view :style="[{top:CustomBar + 'px'}]">
  12. <view class="search-box1">
  13. <view class="choose-box">
  14. <jp-picker2 class="choose-boxp" v-model="searchForm.des2" empty="选择政策类型" rangeKey="label" rangeValue="value"
  15. :range="parkList2" >
  16. </jp-picker2>
  17. </view>
  18. <view class="choose-box">
  19. <jp-picker2 class="choose-boxp" v-model="searchForm.des3" empty="选择政策级别" rangeKey="label" rangeValue="value"
  20. :range="parkList" >
  21. </jp-picker2>
  22. </view>
  23. </view>
  24. <view class="choose-box2" style="margin-top: 20rpx;margin-left: 20rpx;margin-right: 20rpx;">
  25. <view style="width: 560rpx;">
  26. <input type="text" placeholder="输入政策标题关键词" v-model="searchForm.des1" confirm-type="search"
  27. ></input>
  28. </view>
  29. <text style="padding-left: 40rpx;flex: 1;" class="cuIcon-search color-white" @click="doSearch"></text>
  30. </view>
  31. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
  32. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  33. v-for="(item, index) in dataList" :key="index" @touchstart="ListTouchStart"
  34. @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
  35. <view class="item-box" @click="gotoBuildInfo(item.id)">
  36. <view class="item-title-L">
  37. <view class="item-title">
  38. {{item.des1}}
  39. </view>
  40. <view class="item-des">
  41. 政策发文日期:{{item.stime}}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </mescroll-body>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import uniFab from '@/components/uni-fab/uni-fab.vue';
  52. import loginService from '@/api/auth/loginService.js'
  53. import DoublePicker from '@/components/DoublePicker/DoublePicker.vue'
  54. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  55. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  56. export default {
  57. mixins: [MescrollMixin, MescrollMoreItemMixin], // 使用mixin (在main.js注册全局组件)
  58. onShow(option) {
  59. //this.$auth.checkLogin()
  60. this.isLogin=this.$auth.checkisLogin();
  61. console.log("是否登录:"+this.isLogin);
  62. },
  63. components: {
  64. uniFab
  65. },
  66. data() {
  67. return {
  68. isBack: true, // 是否显示返回按钮
  69. backText: '返回', // 返回按钮的文本
  70. bgColor: 'bg-blue', // 背景颜色
  71. isLogin:"",
  72. searchForm: {
  73. des1:"",
  74. des2:"",
  75. des3:"",
  76. },
  77. picture:["https://miniapp.huidutech.com.cn/yd_qycpfbH5/bg1.jpg",
  78. "https://miniapp.huidutech.com.cn/yd_qycpfbH5/bg2.jpg",
  79. "https://miniapp.huidutech.com.cn/yd_qycpfbH5/bg3.jpg",
  80. "https://miniapp.huidutech.com.cn/yd_qycpfbH5/bg4.jpg"],
  81. parkList2: [ {label: '全部',value: ''},{label: '工业',value: '1'},{label: '科技',value: '2'}
  82. ,{label: '发改',value: '3'},{label: '商务',value: '4'},{label: '人才政策',value: '5'}
  83. ],
  84. curWord: "", //当前搜索关键词
  85. dataList: [], // 数据列表
  86. modalName: null,
  87. tablePage: {
  88. total: 0,
  89. currentPage: 1,
  90. pageSize: 10,
  91. orders: []
  92. },
  93. loading: false,
  94. parkId: '',
  95. parkList: [{label: '全部',value: ''},{label: '国家',value: '1'},{label: '省级',value: '2'}
  96. ,{label: '市级',value: '3'},{label: '区级',value: '4'}],
  97. }
  98. },
  99. created() {
  100. //this.getParkList()
  101. //this.getParkList2()
  102. },
  103. methods: {
  104. // //选择属地
  105. // getParkList2() {
  106. // loginService.getAreaList({
  107. // }).then(({
  108. // data
  109. // }) => {
  110. // this.parkList2 = data.map((item) => {
  111. // return {
  112. // label: item.des1,
  113. // value: item.des1
  114. // }
  115. // })
  116. // }).catch(e => {
  117. // console.log(e)
  118. // })
  119. // },
  120. //选择行业
  121. // getParkList() {
  122. // loginService.getHyList({
  123. // }).then(({
  124. // data
  125. // }) => {
  126. // this.parkList = data.map((item) => {
  127. // return {
  128. // label: item.industry,
  129. // value: item.industry
  130. // }
  131. // })
  132. // }).catch(e => {
  133. // console.log(e)
  134. // })
  135. // },
  136. // 新增
  137. add() {
  138. uni.navigateTo({
  139. url: '/pages/comEdit/comEdit'
  140. })
  141. },
  142. // 修改
  143. edit(id) {
  144. uni.navigateTo({
  145. url: '/pages/comEdit/comEdit?id=' + id
  146. })
  147. },
  148. gotoBuildInfo(id) {
  149. uni.navigateTo({
  150. url: `/pages/policy/policyInfo?id=${id}&ischeck=1`
  151. })
  152. },
  153. // 删除
  154. del(id) {
  155. uni.showModal({
  156. title: '提示',
  157. content: '您确认要删除数据吗',
  158. showCancel: true,
  159. success: (res) => {
  160. if (res.confirm) {
  161. loginService.deleteCom(id).then(({
  162. data
  163. }) => {
  164. uni.showToast({
  165. title: data,
  166. icon: "success"
  167. })
  168. this.doSearch()
  169. })
  170. }
  171. }
  172. });
  173. },
  174. /*获取数据列表 */
  175. upCallback(page) {
  176. console.log("upCallback")
  177. this.loading = true
  178. loginService.policyList({
  179. current: page.num,
  180. size: page.size,
  181. orders: [{ column: 'a.create_date', asc: false }],
  182. ...this.searchForm
  183. }).then(({
  184. data
  185. }) => {
  186. let curPageData = data.records
  187. this.mescroll.endBySize(curPageData.length, data.total);
  188. //如果是第一页需手动制空列表
  189. if (page.num == 1)
  190. this.dataList = [];
  191. //追加新数据
  192. this.dataList = this.dataList.concat(curPageData);
  193. }).catch(e => {
  194. //联网失败, 结束加载
  195. this.mescroll.endErr();
  196. })
  197. },
  198. remoteMethod (query) {
  199. if (query) {
  200. this.loading = true
  201. setTimeout(() => {
  202. this.loading = false
  203. this.parkList = this.parkList.filter((item) => {
  204. return item.label.toLowerCase().includes(query.toLowerCase())
  205. })
  206. }, 200)
  207. } else {
  208. this.parkList = []
  209. }
  210. },
  211. // 输入监听
  212. inputWord(e) {
  213. },
  214. // 搜索
  215. doSearch() {
  216. this.dataList = []; // 先清空列表,显示加载进度
  217. this.mescroll.resetUpScroll();
  218. },
  219. // ListTouch触摸开始
  220. ListTouchStart(e) {
  221. this.listTouchStart = e.touches[0].pageX
  222. },
  223. // ListTouch计算方向
  224. ListTouchMove(e) {
  225. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > -60 ? 'right' : 'left'
  226. },
  227. // ListTouch计算滚动
  228. ListTouchEnd(e) {
  229. if (this.listTouchDirection == 'left') {
  230. this.modalName = e.currentTarget.dataset.target
  231. } else {
  232. this.modalName = null
  233. }
  234. this.listTouchDirection = null
  235. },
  236. handleBack() {
  237. // 返回逻辑,比如跳转至上一页
  238. this.$router.go(-1);
  239. console.log('返回按钮被点击');
  240. }
  241. }
  242. }
  243. </script>
  244. <style>
  245. .ellipsis-description {
  246. font-size: 12px;
  247. line-height: $line-height-base;
  248. display: -webkit-box;
  249. /*作为弹性伸缩盒子模型显示*/
  250. -webkit-line-clamp: 1;
  251. /*显示的行数;如果要设置2行加...则设置为2*/
  252. overflow: hidden;
  253. /*超出的文本隐藏*/
  254. text-overflow: ellipsis;
  255. /* 溢出用省略号*/
  256. -webkit-box-orient: vertical;
  257. /*伸缩盒子的子元素排列:从上到下*/
  258. }
  259. .cu-bar .search-form {
  260. background-color: white;
  261. }
  262. .item-line{
  263. display: flex;
  264. height: 48rpx;
  265. margin-top: 20rpx;
  266. }
  267. .item-line2{
  268. height: 48rpx;
  269. margin-top: 20rpx;
  270. }
  271. .subtitle{
  272. color: #E5880E;
  273. }
  274. .item-name{
  275. margin-top: 5rpx;
  276. font-size: 30rpx;
  277. color: #333;
  278. }
  279. .item-name2{
  280. font-size: 29rpx;
  281. color: #8387AA;
  282. }
  283. .item-name3{
  284. display: flex;
  285. width: 100%;
  286. padding-right: 30rpx;
  287. flex: 1;
  288. justify-content: flex-end;
  289. font-size: 29rpx;
  290. color: #8387AA;
  291. }
  292. .item-content{
  293. color: #1497EF;
  294. font-size: 30rpx;
  295. }
  296. .btn-box{
  297. display: flex;
  298. }
  299. .line-zs{
  300. width: 2rpx;
  301. height: 30rpx;
  302. background: #36A7F3;
  303. }
  304. .edit-botton{
  305. width: 100rpx;
  306. height: 48rpx;
  307. line-height: 48rpx;
  308. color: #fff;
  309. font-size: 28rpx;
  310. margin-right: 20rpx;
  311. border-radius: 10rpx;
  312. background: #5A9EE9;
  313. text-align: center;
  314. }
  315. .del-botton{
  316. width: 100rpx;
  317. height: 48rpx;
  318. line-height: 48rpx;
  319. color: #fff;
  320. font-size: 28rpx;
  321. margin-right: 20rpx;
  322. border-radius: 10rpx;
  323. background: #F27C85;
  324. text-align: center;
  325. }
  326. .color-white{
  327. color: #fff;
  328. font-size: 40rpx;
  329. line-height: 60rpx;
  330. }
  331. .search-box{
  332. background: #36A7F3;
  333. display: flex;
  334. padding-left: 20rpx;
  335. padding-right: 20rpx;
  336. padding-bottom: 10rpx;
  337. }
  338. .input-box{
  339. background: #fff;
  340. height: 65rpx;
  341. width: 640rpx;
  342. display: flex;
  343. align-items: center;
  344. border-radius: 30rpx;
  345. padding-left: 30rpx;
  346. margin-right: 20rpx;
  347. }
  348. .input-boxinput{
  349. height: 75rpx;
  350. font-size: 15rpx;
  351. }
  352. .choose-box{
  353. background: #fff;
  354. width: 350rpx;
  355. border-radius: 30rpx;
  356. height: 60rpx;
  357. display: flex;
  358. align-items: center;
  359. justify-content: center;
  360. margin-right: 20rpx;
  361. }
  362. .choose-boxp{
  363. font-size: 32rpx;
  364. width: 80%;
  365. }
  366. .swiper {
  367. width: 750rpx;
  368. height: 310rpx;
  369. }
  370. .swiper-item {
  371. width: 750rpx;
  372. height: 310rpx;
  373. background-color: aliceblue;
  374. }
  375. .item-box{
  376. display: flex;
  377. width: 710rpx;
  378. margin-left: 20rpx;
  379. background: #FFFFFF;
  380. box-shadow: 0px 1px 3px 0px rgba(9,2,4,0.1);
  381. border-radius: 10px;
  382. padding-top: 20rpx;
  383. padding-left: 20rpx;
  384. padding-right: 10rpx;
  385. padding-bottom: 20rpx;
  386. margin-top: 20rpx;
  387. }
  388. .item-title-L{
  389. display: flex;
  390. width: 100%;
  391. margin-left: 10rpx;
  392. flex-direction: column;
  393. }
  394. .item-title{
  395. font-size: 29rpx;
  396. color: #333;
  397. font-weight: bold;
  398. align-items: center;
  399. }
  400. .item-des{
  401. margin-top: 10rpx;
  402. color: #565656;
  403. font-size: 24rpx;
  404. overflow: hidden; /* 超出部分隐藏 */
  405. text-overflow: ellipsis; /* 超出部分显示省略号 */
  406. display: -webkit-box; /* 使用Webkit的行盒模型 */
  407. -webkit-line-clamp: 3; /* 限制最多显示2行 */
  408. -webkit-box-orient: vertical; /* 垂直排列 */
  409. }
  410. /* 返回 */
  411. .item-img {
  412. width: 160rpx;
  413. height: 160rpx;
  414. }
  415. .custom-header {
  416. display: flex;
  417. align-items: center;
  418. justify-content: center;
  419. padding: 10px;
  420. width: 100%;
  421. }
  422. .is-back {
  423. position: relative;
  424. }
  425. .back-container {
  426. position: absolute;
  427. left: 10px;
  428. cursor: pointer;
  429. }
  430. .back-text {
  431. color: white; /* 返回按钮文本颜色 */
  432. }
  433. .back-text {
  434. color: white; /* 返回按钮文本颜色 */
  435. }
  436. .content-container {
  437. flex: 1;
  438. text-align: center;
  439. }
  440. .content-text {
  441. color: white; /* 标题文本颜色 */
  442. font-weight: bold;
  443. }
  444. /* 背景颜色 */
  445. .bg-blue {
  446. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  447. }
  448. .choose-box2{
  449. background: #fff;
  450. width: 94%;
  451. border-radius: 23rpx;
  452. height: 70rpx;
  453. display: flex;
  454. padding-left: 29rpx;
  455. align-items: center;
  456. border: 1rpx solid #808080;
  457. }
  458. .choose-box3{
  459. display: flex;
  460. }
  461. .search-box1{
  462. display: flex;
  463. margin-top: 20rpx;
  464. margin-left: 20rpx;
  465. margin-right: 12rpx;
  466. }
  467. .input-box{
  468. background: #fff;
  469. height: 65rpx;
  470. width: 640rpx;
  471. display: flex;
  472. align-items: center;
  473. border-radius: 30rpx;
  474. padding-left: 30rpx;
  475. margin-right: 20rpx;
  476. }
  477. .input-boxinput{
  478. height: 75rpx;
  479. font-size: 15rpx;
  480. }
  481. .color-white{
  482. color: #808080;
  483. font-size: 40rpx;
  484. line-height: 60rpx;
  485. }
  486. </style>