resultRecommend.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="rf-category" style="position: relative;">
  3. <!--搜索导航栏-->
  4. <!--<view class="icoStyle">
  5. <view class="leftArrow" @tap="back">
  6. <u-icon name="arrow-left" color="#fff" size="36"></u-icon>
  7. </view>
  8. <rf-search-bar @search="navToSearch" icon="iconkuaijiecaidan" />
  9. </view>-->
  10. <view class="icoStyle">
  11. <view style="width:90%;height:99upx">
  12. <rf-search-bar2 @search="" icon="iconkuaijiecaidan"
  13. style="z-index: 99;" />
  14. </view>
  15. </view>
  16. <u-toast ref="uToast"/>
  17. <view style="width: 100%;">
  18. <view style="width: 100%;">
  19. <view v-for="(item,index) in recommendList" style="width: 100%;height: 340upx;margin-bottom: 20upx;padding: 30upx;background-color: white;" @click="toDetaile(item.entityId)">
  20. <view style="width: 218upx;height: 280upx;float: left;border: 1px solid #979797;margin-right: 20upx">
  21. <image v-if="item.researchResultCover!='null'&&item.researchResultCover!=null&&item.researchResultCover!=''&&item.researchResultCover!=undefined"
  22. :src="'https://www.geidcp.com//api/file/pub/'+item.researchResultCover" mode="" style="width: 100%;height: 100%;"></image>
  23. <image v-else src="@/static/img/resourceSharing/backImage.png" mode="" style="width: 100%;height: 100%;"></image>
  24. </view>
  25. <view style="width: 452upx;height: 100%;float: left;position: relative;">
  26. <view>
  27. <text style="font-size: 30upx; color: #0B0B11;" class="twoLine">
  28. {{item.name}}
  29. </text>
  30. </view>
  31. <view style="margin-top: 13upx;">
  32. <text style="font-size: 26upx; padding: 0 13upx; border: 2px solid #1777FE;
  33. display: inline-block;border-radius: 32upx;color: #1777FE;">
  34. {{item.researchResultType}}
  35. </text>
  36. </view>
  37. <view v-show="item.informationVisibleStatus=='Y'" style="margin-top: 13upx;">
  38. <text style="font-size: 26upx; padding: 0 13upx; display: inline-block;
  39. border-radius: 12upx;background-color: rgba(61,127,255,0.1);color: #3D7FFF;">
  40. {{i18n('resourcevip')}}
  41. </text>
  42. </view>
  43. <view style="position: absolute;bottom: 0;width: 100%;height: 35upx;color: #666;">
  44. <view style="float: left;height: 100%">
  45. <text style="font-size: 28upx;">{{item.createDate}}</text>
  46. </view>
  47. <view style="float: right;">
  48. <view style="float: left;font-size: 28upx;font-weight: 400;">
  49. <u-icon name="heart" color="#848485" size="28" style="margin-right: 6upx"></u-icon>
  50. <text style="color: #666;">
  51. {{item.num=='null'?'0':item.num}}
  52. </text>
  53. </view>
  54. <!--<view style="float: left;font-size: 28upx;font-weight: 400;margin-left: 70upx;">
  55. <u-icon name="arrow-right" color="#848485" size="28" style="margin-right: 6upx"></u-icon>
  56. <text style="color: #666;">
  57. 888
  58. </text>
  59. </view>-->
  60. </view>
  61. <view style="clear: both;"></view>
  62. </view>
  63. </view>
  64. <view style="clear: both;"></view>
  65. </view>
  66. <view style="margin-top: 20rpx;">
  67. <u-loadmore :status="status" :load-text="loadText" />
  68. </view>
  69. </view>
  70. </view>
  71. <rf-back-top :scrollTop="scrollTop"></rf-back-top>
  72. </view>
  73. </template>
  74. <script>
  75. import rfSearchBar from '@/components/rf-search-bar';
  76. import rfSearchBar2 from '@/components/rf-search-bar-xiangmu';
  77. export default {
  78. data() {
  79. return {
  80. recommendList:[],
  81. pageNo:0,
  82. totalPage:1,
  83. status: 'loading',
  84. isLoading: true,
  85. loadText: {
  86. loading: this.$i18n.locale == 'zh'? '加载中': 'Loading',
  87. nomore: this.$i18n.locale == 'zh'? '没有更多数据了': 'No more'
  88. },
  89. // 字典
  90. classify1:'',
  91. classify2:'',
  92. // 返回顶部
  93. scrollTop: 0,
  94. }
  95. },
  96. components: { rfSearchBar,rfSearchBar2 },
  97. async onShow() {
  98. await this.initData();
  99. await this.getDict();
  100. await this.getRecommend();
  101. },
  102. onPageScroll(e) {
  103. this.scrollTop = e.scrollTop;
  104. },
  105. onReachBottom() { //页面拉到底部加载
  106. if(this.isLoading) {
  107. this.getRecommend();
  108. }
  109. },
  110. watch:{
  111. /* recommendList(val){
  112. this.$refs.uToast.show({
  113. title: `${this.i18n('resourceRecommended')}${this.recommendList.length}${this.i18n('resourceRecommended1')}`,
  114. position: "top",
  115. icon: false,
  116. })
  117. }, */
  118. },
  119. methods: {
  120. async initData(){
  121. this.recommendList = [];
  122. this.pageNo = 0;
  123. this.totalPage = 1;
  124. this.status = 'loading';
  125. this.isLoading = true;
  126. this.loadText = {
  127. loading: this.$i18n.locale == 'zh'? '加载中' : 'Loading',
  128. nomore: this.$i18n.locale == 'zh'? '没有更多数据了' : 'No more'
  129. };
  130. // 字典
  131. this.classify1 = '';
  132. this.classify2 = '';
  133. // 返回顶部
  134. this.scrollTop = 0;
  135. },
  136. navToSearch(){},
  137. toDetaile(entityId){
  138. this.$mRouter.push({
  139. route: `/pages/resourceSharing/resourceInfoDetail/resourceInfoDetail?entityId=${entityId}`,
  140. });
  141. },
  142. async getDict(){
  143. const res = await this.$myRequest({
  144. url: '/sys/sysDicts',
  145. data: {
  146. type:this.$i18n.locale=="zh"?'RESEARCH_RESULT_TYPE_DICT,RESEARCH_RESOURCE_TYPE_DICT':'RESEARCH_RESULT_TYPE_DICT_EN,RESEARCH_RESOURCE_TYPE_DICT_EN',
  147. }
  148. });
  149. if (res.data) {
  150. let both={
  151. label:this.$t('common.All'),
  152. value:null
  153. };
  154. this.classify1=res.data[0];
  155. this.classify2=res.data[1];
  156. this.classify1.unshift(both);
  157. this.classify2.unshift(both);
  158. }
  159. },
  160. async getRecommend(){
  161. const that = this;
  162. let params = {
  163. pageNo: '',
  164. pageSize: 50,
  165. language: this.$i18n.locale.toUpperCase(),
  166. status: 0,
  167. descStatus: 0,
  168. reserveTwo: 'Y',
  169. }
  170. if( this.pageNo >= this.totalPage){
  171. this.isLoading = false;
  172. this.status = 'nomore';
  173. }else{
  174. this.isLoading = true;
  175. this.pageNo++;
  176. params.pageNo = this.pageNo;
  177. const res = await this.$myRequest({
  178. url: '/resourceshare/baseResearchResultViews/',
  179. data: {
  180. ...params
  181. }
  182. })
  183. if (res.data) {
  184. let data = res.data.baseResearchResultViews;
  185. data.forEach((i) => {
  186. i.createDate = i.createDate ? this.formatDate(i.createDate, "YYYY-MM-DD") : "";
  187. })
  188. for (let i=0;i<data.length;i++){
  189. for (let o=0;o<that.classify1.length;o++){
  190. if (data[i].researchResultType == that.classify1[o].value){
  191. data[i].researchResultType = that.classify1[o].label;
  192. }
  193. }
  194. }
  195. that.recommendList = [...that.recommendList,...data]
  196. this.totalPage = res.data.page.totalPage;
  197. if(that.totalPage == 1){
  198. this.isLoading = false;
  199. this.status = 'nomore';
  200. }
  201. }
  202. }
  203. },
  204. back() {
  205. uni.navigateBack();
  206. },
  207. //中英文切换
  208. i18n (data) {
  209. return this.$t('common.'+data);
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. .rf-category {
  216. background-color: #F3F4F5;
  217. /* #ifdef APP-PLUS */
  218. margin-top: calc(20upx + var(--status-bar-height));
  219. /* #endif */
  220. /*.icoStyle {
  221. display: flex;
  222. align-items:center;
  223. .leftArrow {
  224. width:36upx;
  225. height:36upx;
  226. position: fixed;
  227. z-index: 99;
  228. !* #ifdef APP-PLUS *!
  229. padding-top: calc(20upx + var(--status-bar-height));
  230. !* #endif *!
  231. }
  232. }*/
  233. .icoStyle {
  234. display: flex;
  235. .leftArrow {
  236. position: absolute;
  237. left: 4upx;
  238. top: calc(30upx + var(--status-bar-height));;
  239. z-index: 9999;
  240. }
  241. }
  242. .oneLine{
  243. /* 隐藏溢出元素 */
  244. overflow: hidden;
  245. /* 单行显示 */
  246. white-space: nowrap;
  247. /* 溢出显示省略号 */
  248. text-overflow: ellipsis;
  249. }
  250. .twoLine{
  251. overflow : hidden;
  252. text-overflow: ellipsis;
  253. display: -webkit-box;
  254. -webkit-line-clamp: 2;
  255. -webkit-box-orient: vertical;
  256. }
  257. .threeLine{
  258. overflow : hidden;
  259. text-overflow: ellipsis;
  260. display: -webkit-box;
  261. -webkit-line-clamp: 3;
  262. -webkit-box-orient: vertical;
  263. }
  264. .wrap {
  265. display: flex;
  266. flex-direction: column;
  267. height: calc(100vh - var(--window-top));
  268. width: 100%;
  269. }
  270. .swiper-box {
  271. flex: 1;
  272. }
  273. .swiper-item {
  274. height: 100%;
  275. }
  276. .item-box {
  277. margin-bottom: 50rpx;
  278. display: flex;
  279. flex-wrap: wrap;
  280. justify-content: space-between;
  281. }
  282. .item-box .item {
  283. border: 1px solid $u-type-primary;
  284. color: $u-type-primary;
  285. padding: 8rpx 40rpx;
  286. border-radius: 100rpx;
  287. margin-top: 30rpx;
  288. }
  289. .recommendScroll{
  290. overflow: hidden;
  291. white-space: nowrap; // 滚动必须加的属性
  292. width: 100%;
  293. height: 210upx;
  294. margin: 0 auto;
  295. }
  296. .recommendScroll .item{
  297. width: 400upx;
  298. height: 210upx;
  299. border: 1px solid #979797;
  300. display: inline-block;
  301. vertical-align: top;
  302. }
  303. }
  304. </style>
  305. <style>
  306. /deep/ .u-position-top{
  307. width: 70%;
  308. }
  309. </style>