test.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="wrapper">
  3. <!-- 输入框 -->
  4. <view class="searchBox">
  5. <input bindconfirm="bindconfirm" bindinput="bindinput" placeholder="搜索您感兴趣内容" type='text'>
  6. </input>
  7. <!-- <image class="searchImg" src="../../assets/search-icon.png"></image> -->
  8. </view>
  9. <!-- <view class="content"> -->
  10. <view class="centerBox" data-id="list[0].dataId" data-format="list[0].format" data-index="list[0].dataTypeId"
  11. bindtap="nextUrl">
  12. <image :src="list[2].titlePicture"></image>
  13. <view class="sectionBox">
  14. <view class="title">
  15. <!-- style="color:{{list[0].fontcolor}};border:{{list[0].bordercolor}}" -->
  16. <text> {{list[0].dataTypeName}}</text>
  17. <text>{{list[0].title}}</text>
  18. </view>
  19. <view>
  20. <text> {{list[0].value}} </text>
  21. </view>
  22. <view class="timer">
  23. <text>{{list[0].issueTime}}</text>
  24. <view>
  25. <!-- <image src="../../assets/ydl.png"></image> -->
  26. <text>{{list[0].watchNumber}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="lastBox">
  32. <view class="last-sec-box">
  33. <view data-id="item.dataId" data-index="item.dataTypeId" data-format="item.format" bindtap="nextUrl"
  34. v-for="(item,index) in list1" :key="index" class="table-col">
  35. <!-- 左 -->
  36. <view class="leftBox">
  37. <image :src="item.titlePicture"></image>
  38. </view>
  39. <!-- 右 -->
  40. <view class="rightBox">
  41. <view class="right-Box-top">
  42. <!-- style="color:{{item.fontcolor}};border:{{item.bordercolor}}" -->
  43. <text>{{item.dataTypeName}}</text>
  44. <view>{{item.title}}</view>
  45. </view>
  46. <view class="right-Box-bom">
  47. <text>{{item.issueTime}} </text>
  48. <view>
  49. <!-- <image src="../../assets/ydl.png"></image> -->
  50. <text>{{item.watchNumber}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- </view> -->
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. title: 'Hello',
  65. list: [],
  66. list1: [],
  67. inputKey: '',
  68. dataTypeId: 3
  69. }
  70. },
  71. onLoad() {
  72. this.getlistData()
  73. },
  74. methods: {
  75. getlistData() {
  76. let that = this;
  77. uni.request({
  78. url: 'https://gjcx.zhoubianjun.com/keji/policynews/getPolicyNewsList',
  79. data: {
  80. key: this.inputKey,
  81. dataTypeId: this.dataTypeId
  82. },
  83. method: 'GET',
  84. success: (res) => {
  85. let resulte = res.data;
  86. resulte.forEach(it => {
  87. if (it.dataTypeName == '新闻') {
  88. it.fontcolor = '#FF3C1C'
  89. it.bordercolor = '1rpx solid #FF3C1C'
  90. } else {
  91. it.fontcolor = '#4DA4FF'
  92. it.bordercolor = '1rpx solid #4DA4FF'
  93. }
  94. if (it.content) {
  95. let text = it.content.split('\n');
  96. it.value = text[1]
  97. }
  98. })
  99. // this.list.push(resulte);
  100. // this.list1.push(resulte.slice(1))
  101. resulte.forEach(it => {
  102. this.list.push(it)
  103. })
  104. let demo = resulte.slice(1);
  105. demo.forEach(it => {
  106. this.list1.push(it)
  107. })
  108. console.log(this.list, 'list');
  109. console.log(this.list1, 'list1');
  110. }
  111. })
  112. },
  113. }
  114. }
  115. </script>
  116. <style>
  117. .wrapper {
  118. background: #F2F2F2;
  119. height: 100vh;
  120. width: 100%;
  121. }
  122. .searchBox {
  123. width: 100%;
  124. height: 100rpx;
  125. /* line-height: 100rpx; */
  126. z-index: 100;
  127. position: relative;
  128. background-color: white;
  129. display: flex;
  130. align-items: center;
  131. position: fixed;
  132. top: 0;
  133. }
  134. .searchImg {
  135. width: 40rpx;
  136. height: 40rpx;
  137. left: 85rpx;
  138. top: 13rpx;
  139. position: absolute;
  140. line-height: 66rpx;
  141. }
  142. .searchBox input {
  143. margin: 0 auto;
  144. width: calc(90% - 68rpx);
  145. height: 66rpx;
  146. /* line-height: 66rpx; */
  147. background: #F7F7F7;
  148. border-radius: 30rpx;
  149. font-size: 24rpx;
  150. box-sizing: border-box;
  151. /* position: relative; */
  152. padding: 0 0 0 68rpx;
  153. }
  154. .content {
  155. display: flex;
  156. flex-direction: column;
  157. align-items: center;
  158. justify-content: center;
  159. }
  160. .centerBox {
  161. background-color: white;
  162. margin-top: 40rpx;
  163. padding: 24rpx;
  164. box-sizing: border-box;
  165. }
  166. .centerBox>image:first-child {
  167. width: 100%;
  168. height: 350rpx;
  169. }
  170. .sectionBox>view:nth-child(2) {
  171. text-indent: 40rpx;
  172. display: flex;
  173. flex-direction: column;
  174. font-size: 26rpx;
  175. font-weight: 500;
  176. color: #424764;
  177. }
  178. .title {
  179. display: flex;
  180. padding: 21rpx 0 25rpx 0;
  181. align-items: center;
  182. }
  183. .title>text:first-child {
  184. font-size: 14rpx;
  185. border-radius: 4rpx;
  186. padding: 3rpx 5rpx;
  187. display: inline-block;
  188. height: 100%;
  189. }
  190. .title>text:last-child {
  191. flex: 1;
  192. font-size: 26rpx;
  193. font-weight: bold;
  194. color: #424764;
  195. padding-left: 10rpx;
  196. }
  197. .timer {
  198. display: flex;
  199. justify-content: space-between;
  200. padding-top: 23rpx;
  201. }
  202. .timer>text:first-child {
  203. font-size: 22rpx;
  204. font-family: PingFang SC;
  205. font-weight: 500;
  206. color: #686E92;
  207. }
  208. .timer>view:last-child {
  209. font-size: 22rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #4DA4FF;
  213. }
  214. .timer image {
  215. width: 25rpx;
  216. height: 17rpx;
  217. padding-right: 5rpx;
  218. }
  219. .lastBox {
  220. background-color: white;
  221. margin-top: 20rpx;
  222. }
  223. .table-col {
  224. display: flex;
  225. padding: 34rpx 40rpx 34rpx 24rpx;
  226. border-bottom: 1rpx solid #E6E6E6;
  227. }
  228. .leftBox image {
  229. width: 240rpx;
  230. height: 164rpx;
  231. }
  232. .rightBox image {
  233. width: 25rpx;
  234. height: 17rpx;
  235. padding-right: 5rpx;
  236. }
  237. .rightBox {
  238. display: flex;
  239. flex-direction: column;
  240. justify-content: space-around;
  241. margin-left: 13rpx;
  242. flex: 1;
  243. }
  244. .right-Box-top {
  245. display: flex;
  246. align-items: baseline;
  247. }
  248. .right-Box-top>text:first-child {
  249. font-size: 14rpx;
  250. border-radius: 4rpx;
  251. padding: 3rpx 5rpx;
  252. display: inline-block;
  253. vertical-align: middle;
  254. height: 25rpx;
  255. }
  256. .right-Box-top>view:last-child {
  257. font-size: 26rpx;
  258. flex: 1;
  259. color: #424764;
  260. font-weight: bold;
  261. padding-left: 10rpx;
  262. display: -webkit-box;
  263. -webkit-box-orient: vertical;
  264. -webkit-line-clamp: 2;
  265. overflow: hidden;
  266. }
  267. .right-Box-bom {
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: flex-end;
  271. }
  272. .right-Box-bom>text:first-child {
  273. font-size: 22rpx;
  274. color: #686E92;
  275. }
  276. .right-Box-bom>view>text {
  277. font-size: 22rpx;
  278. font-weight: 500;
  279. color: #4DA4FF;
  280. }
  281. .wrapper::after {
  282. content: " ";
  283. width: 100%;
  284. height: 100rpx;
  285. background-color: white;
  286. float: left;
  287. }
  288. </style>