science.vue 4.5 KB

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