science.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <!-- 搜索框 -->
  5. <view class="Search-box">
  6. <view class="Search-box-size">
  7. <image class="box-img" src="../../static/images/img01.png"></image>
  8. <input type="text" class="box-word" placeholder="请输入关键字" v-model="keyword" />
  9. </view>
  10. <view class="Search-box-sort" @click="messagesearch">搜索</view>
  11. </view>
  12. </view>
  13. <view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item.id)">
  14. <view class="box-left">
  15. <image :src="$store.state.baseURL + item.image" mode="" class="left-img"></image>
  16. </view>
  17. <view class="box-right">
  18. <view class="right-top word1_ellipsis">
  19. {{item.title}}
  20. </view>
  21. <view class="right-center">
  22. {{item.synopsis}}
  23. </view>
  24. <view class="right-foot">
  25. 已阅读人数:{{item.visit || 0}}
  26. </view>
  27. </view>
  28. </view>
  29. <!-- <uni-load-more :status="loadingType"></uni-load-more> -->
  30. </view>
  31. </template>
  32. <script>
  33. import { getArticList} from '@/api/index.js';
  34. export default{
  35. data(){
  36. return{
  37. keyword:'',
  38. science:[],
  39. page: 1,
  40. limit: 10,
  41. loadingType:'more'
  42. }
  43. },
  44. onLoad() {
  45. this.loadData();
  46. },
  47. onReachBottom() {
  48. this.loadData()
  49. },
  50. filters: {
  51. time(val) {
  52. let arr = val.split(' ')
  53. return arr[0]
  54. }
  55. },
  56. methods:{
  57. messagesearch() {
  58. let keyword = this.keyword;
  59. console.log(keyword);
  60. let arrlist = [];
  61. for (let i = 0; i < this.science.length; i++) {
  62. if (this.science[i].title.indexOf(keyword) != -1) {
  63. arrlist.push(this.science[i]);
  64. }
  65. }
  66. this.science = arrlist;
  67. if (keyword == '') {
  68. this.loadData();
  69. }
  70. },
  71. loadData(){
  72. let obj = this;
  73. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  74. return
  75. }
  76. obj.loadingType = 'loading'
  77. getArticList({ifyid:65}).then(({ data }) => {
  78. console.log(data,123456);
  79. obj.science = obj.science.concat(data.list);
  80. obj.page++
  81. if(obj.limit == data.list.length) {
  82. obj.loadingType = 'more'
  83. }else {
  84. obj.loadingType = 'noMore'
  85. }
  86. console.log(obj.science,'999999999999999999')
  87. });
  88. },
  89. Jump(id) {
  90. uni.navigateTo({
  91. url:"/pages/applic/info?id="+id
  92. })
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. //搜索框
  99. .Search-box {
  100. padding-left: 20rpx;
  101. padding-right: 20rpx;
  102. height: 100rpx;
  103. background: #ffffff;
  104. display: flex;
  105. justify-content: space-between;
  106. align-items: center;
  107. .Search-box-sort {
  108. font-size: 30rpx;
  109. font-weight: 500;
  110. color: rgba(102, 102, 102, 1);
  111. .sort-text {
  112. width: 57rpx;
  113. height: 29rpx;
  114. font-size: 30rpx;
  115. font-weight: 500;
  116. color: rgba(51, 51, 51, 1);
  117. line-height: 58rpx;
  118. margin-right: 19rpx;
  119. }
  120. .sort-img {
  121. width: 21rpx;
  122. height: 11rpx;
  123. margin-bottom: 4rpx;
  124. }
  125. }
  126. .Search-box-size {
  127. width: 630rpx;
  128. height: 65rpx;
  129. border-radius: 32rpx;
  130. background-color: #f1f1f1;
  131. padding-left: 36rpx;
  132. display: flex;
  133. align-items: center;
  134. .box-img {
  135. height: 32rpx;
  136. width: 32rpx;
  137. margin-right: 16rpx;
  138. }
  139. .box-word {
  140. width: 100%;
  141. font-size: 22rpx;
  142. font-weight: 500;
  143. color: rgba(205, 203, 203, 1);
  144. line-height: 55rpx;
  145. }
  146. }
  147. }
  148. .content{
  149. line-height: 1;
  150. .list-box{
  151. width: 725rpx;
  152. height: 200rpx;
  153. margin: 20rpx auto 0;
  154. background: #FFFFFF;
  155. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  156. border-radius: 7rpx;
  157. padding:0 20rpx;
  158. display: flex;
  159. align-items: center;
  160. .box-left{
  161. width: 230rpx;
  162. height: 145rpx;
  163. margin-right: 20rpx;
  164. .left-img{
  165. width: 230rpx;
  166. height: 145rpx;
  167. }
  168. }
  169. .box-right{
  170. width: 430rpx;
  171. height: 145rpx;
  172. position: relative;
  173. .right-top{
  174. font-size: 25rpx;
  175. font-weight: bold;
  176. color: #333333;
  177. margin-bottom: 24rpx;
  178. }
  179. .right-center{
  180. width: 362rpx;
  181. // height: 53rpx;
  182. font-size: 21rpx;
  183. font-weight: bold;
  184. color: #999999;
  185. line-height: 33rpx;
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. display: -webkit-box;
  189. -webkit-line-clamp: 2;//在第几行显示...
  190. -webkit-box-orient: vertical;
  191. }
  192. .right-foot{
  193. font-size: 21rpx;
  194. font-weight: bold;
  195. color: #999999;
  196. line-height: 31rpx;
  197. text-align: right;
  198. // margin-top: 13rpx;
  199. position: absolute;
  200. right: 0;
  201. bottom: 0;
  202. }
  203. }
  204. }
  205. }
  206. </style>