science.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. }
  42. },
  43. onLoad() {
  44. this.loadData();
  45. },
  46. // onReachBottom() {
  47. // this.loadData()
  48. // },
  49. filters: {
  50. time(val) {
  51. let arr = val.split(' ')
  52. return arr[0]
  53. }
  54. },
  55. methods:{
  56. messagesearch() {
  57. let keyword = this.keyword;
  58. console.log(keyword);
  59. let arrlist = [];
  60. for (let i = 0; i < this.science.length; i++) {
  61. if (this.science[i].title.indexOf(keyword) != -1) {
  62. arrlist.push(this.science[i]);
  63. }
  64. }
  65. this.science = arrlist;
  66. if (keyword == '') {
  67. this.loadData();
  68. }
  69. },
  70. loadData(){
  71. let obj = this;
  72. getArticList({ifyid:69}).then(({ data }) => {
  73. console.log(data,123456);
  74. obj.science = obj.science.concat(data.list);
  75. console.log(obj.science,'999999999999999999')
  76. });
  77. },
  78. Jump(id) {
  79. uni.navigateTo({
  80. url:"/pages/applic/info?id="+id
  81. })
  82. },
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. //搜索框
  88. .Search-box {
  89. padding-left: 20rpx;
  90. padding-right: 20rpx;
  91. height: 100rpx;
  92. background: #ffffff;
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. .Search-box-sort {
  97. font-size: 30rpx;
  98. font-weight: 500;
  99. color: rgba(102, 102, 102, 1);
  100. .sort-text {
  101. width: 57rpx;
  102. height: 29rpx;
  103. font-size: 30rpx;
  104. font-weight: 500;
  105. color: rgba(51, 51, 51, 1);
  106. line-height: 58rpx;
  107. margin-right: 19rpx;
  108. }
  109. .sort-img {
  110. width: 21rpx;
  111. height: 11rpx;
  112. margin-bottom: 4rpx;
  113. }
  114. }
  115. .Search-box-size {
  116. width: 630rpx;
  117. height: 65rpx;
  118. border-radius: 32rpx;
  119. background-color: #f1f1f1;
  120. padding-left: 36rpx;
  121. display: flex;
  122. align-items: center;
  123. .box-img {
  124. height: 32rpx;
  125. width: 32rpx;
  126. margin-right: 16rpx;
  127. }
  128. .box-word {
  129. width: 100%;
  130. font-size: 22rpx;
  131. font-weight: 500;
  132. color: rgba(205, 203, 203, 1);
  133. line-height: 55rpx;
  134. }
  135. }
  136. }
  137. .content{
  138. line-height: 1;
  139. .list-box{
  140. width: 725rpx;
  141. height: 200rpx;
  142. margin: 20rpx auto 0;
  143. background: #FFFFFF;
  144. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  145. border-radius: 7rpx;
  146. padding:0 20rpx;
  147. display: flex;
  148. align-items: center;
  149. .box-left{
  150. width: 230rpx;
  151. height: 145rpx;
  152. margin-right: 20rpx;
  153. .left-img{
  154. width: 230rpx;
  155. height: 145rpx;
  156. }
  157. }
  158. .box-right{
  159. width: 430rpx;
  160. height: 145rpx;
  161. position: relative;
  162. .right-top{
  163. font-size: 25rpx;
  164. font-weight: bold;
  165. color: #333333;
  166. margin-bottom: 24rpx;
  167. }
  168. .right-center{
  169. width: 362rpx;
  170. // height: 53rpx;
  171. font-size: 21rpx;
  172. font-weight: bold;
  173. color: #999999;
  174. line-height: 33rpx;
  175. overflow: hidden;
  176. text-overflow: ellipsis;
  177. display: -webkit-box;
  178. -webkit-line-clamp: 2;//在第几行显示...
  179. -webkit-box-orient: vertical;
  180. }
  181. .right-foot{
  182. font-size: 21rpx;
  183. font-weight: bold;
  184. color: #999999;
  185. line-height: 31rpx;
  186. text-align: right;
  187. // margin-top: 13rpx;
  188. position: absolute;
  189. right: 0;
  190. bottom: 0;
  191. }
  192. }
  193. }
  194. }
  195. </style>