projectPresentation.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="rf-category" style="position: relative;">
  3. <!--搜索导航栏-->
  4. <rf-search-bar2 @search="inputValue" icon="iconkuaijiecaidan" @tab="tabClick" :title=" i18n('return') "
  5. style="z-index: 99;" />
  6. <u-dropdown class="u-dropdown" style="background-color: #fff;margin-top: 140upx;width: 100%;">
  7. <u-dropdown-item v-model="value1" :title="i18n('Comprehensive')" @change="dropdownChange(value1)"
  8. :options="options1"></u-dropdown-item>
  9. <u-dropdown-item v-model="value2" :title="i18n('Region')" @change="dropdownChange" :options="Dict1">
  10. </u-dropdown-item>
  11. <u-dropdown-item v-model="value3" :title="i18n('Category')" @change="dropdownChange" :options="Dict2">
  12. </u-dropdown-item>
  13. </u-dropdown>
  14. <view>
  15. <view style="background-color: #F5F5F5;">
  16. <!-- 项目 -->
  17. <view v-if="ProjectList.length>0" style="padding-top: 10upx;">
  18. <view
  19. @click="navToList('/pages/country/projectPresentation/projectPresentationDetails',item.projectId)"
  20. style="margin: 20upx 20upx;height: 200upx;border-radius: 30upx;overflow: hidden;
  21. background-color: #fff;pointer-events: auto;" v-for="(item,index) in ProjectList" :key="index">
  22. <img :src="websiteUrl+ item.bannerList[0]" alt="" v-if="item.bannerList[0]"
  23. style="width: 200upx;height: 200upx;">
  24. <img :src="websiteUrl+'/def/projectdefault.png'" alt="" v-else
  25. style="width: 200upx;height: 200upx;">
  26. <view class="recommend-bottom">
  27. <view class="recommend-bottom-name">{{item.projectName}}</view>
  28. <!-- <view>发布日期:{{handlePublishTimeDesc(toDate,item.createDate,$i18n.locale)}} {{$t('common.release')}}</view> -->
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view v-if="ProjectList.length==0" style="background-color: #f1f2f3;">
  34. <view style="width: 500upx;height: 350upx;margin:100upx auto;" :style="{'backgroundImage':'url( /static/notFound.png )',
  35. 'background-repeat':'no-repeat', backgroundSize:'500upx 350upx'}">
  36. </view>
  37. </view>
  38. <u-toast ref="uToast" />
  39. </view>
  40. <rf-back-top :scrollTop="scrollTop"></rf-back-top>
  41. </view>
  42. </template>
  43. <script>
  44. import rfSearchBar2 from '@/components/rf-search-bar-xiangmu';
  45. export default {
  46. components: {
  47. rfSearchBar2,
  48. },
  49. data() {
  50. return {
  51. placeholder: '',
  52. ProjectList: [],
  53. Dict1: [],
  54. Dict2: [],
  55. value1: 0,
  56. value2: null,
  57. value3: null,
  58. status: 'loadmore',
  59. input: '',
  60. page: 1,
  61. total2: 0,
  62. scrollTop: 0,
  63. options1: [{
  64. label: this.$t('common.LatestRelease'),
  65. value: 0,
  66. },
  67. {
  68. label: this.$t('common.MostAttention'),
  69. value: 1,
  70. },
  71. {
  72. label: this.$t('common.IntelligentRecommendation'),
  73. value: 3,
  74. },
  75. ],
  76. }
  77. },
  78. onLoad(options) {
  79. this.value1 = options.type
  80. },
  81. async onShow() {
  82. this.getList();
  83. this.getDict();
  84. },
  85. onPageScroll(e) {
  86. this.scrollTop = e.scrollTop;
  87. },
  88. onReachBottom() {
  89. if (this.page * 10 >= this.total2) return;
  90. this.status = 'loading';
  91. this.page = this.page + 1;
  92. console.log(this.page, 'pagepagepagepage');
  93. if ((this.page - 1) * 10 >= this.total2) {
  94. this.status = 'nomore';
  95. } else {
  96. this.status = 'loading';
  97. this.getList(this.page);
  98. }
  99. },
  100. methods: {
  101. async inputValue(data) {
  102. this.input = data.input;
  103. console.log(data, this.input)
  104. this.getList();
  105. },
  106. async getDict() {
  107. const res = await this.$myRequest({
  108. url: '/sys/sysDicts/',
  109. data: {
  110. type: this.$i18n.locale == "zh" ?
  111. 'CONTINENT_CODE_DICT,PROJECT_CATEGORIES_DICT,TECHNICAL_SCOPE_DICT' :
  112. 'CONTINENT_CODE_DICT_EN,PROJECT_CATEGORIES_DICT_EN,TECHNICAL_SCOPE_DICT_EN',
  113. }
  114. });
  115. let both = {
  116. label: this.$t('common.All'),
  117. value: null
  118. };
  119. this.Dict1 = res.data[0];
  120. this.Dict2 = res.data[1];
  121. this.Dict1.unshift(both);
  122. this.Dict2.unshift(both);
  123. },
  124. async getList(num) {
  125. let page = {
  126. pageNo: this.page,
  127. pageSize: 10,
  128. language: this.$i18n.locale.toUpperCase(),
  129. descStatus: this.value1,
  130. messageOpenType: 'Y',
  131. status: 1,
  132. technicalCategories: this.value3,
  133. continentCountry: this.value2,
  134. projectName: this.input
  135. };
  136. const res = await this.$myRequest({
  137. url: '/project/baseProjectViews/',
  138. data: {
  139. ...page
  140. }
  141. });
  142. this.total2 = res.data.page.totalCount;
  143. if (res.data) {
  144. if (this.page == 1) {
  145. this.ProjectList = res.data.baseProjectViews ? res.data.baseProjectViews : [];
  146. } else {
  147. this.ProjectList = this.ProjectList.concat(res.data.baseProjectViews)
  148. }
  149. }
  150. if (this.ProjectList.length >= this.total2 - 0) {
  151. this.status = 'nomore';
  152. }
  153. },
  154. async getRecommendByPortals(){
  155. let params1 = {
  156. pageNo: this.page,
  157. pageSize: 6,
  158. language: this.$i18n.locale.toUpperCase(),
  159. //0为默认排序,1为关注排序
  160. descStatus:0,
  161. messageOpenType:"Y",
  162. status:1,
  163. fuzzySearch:null,
  164. };
  165. console.log("this.page"+this.page);
  166. const res = await this.$myRequest({
  167. url: '/project/baseProjectViews/getRecommendByPortals/',
  168. data: {
  169. ...params1
  170. }
  171. });
  172. this.total2 = res.data.page.totalCount;
  173. console.log("total2"+this.total2);
  174. if (res.data) {
  175. if (this.page == 1) {
  176. this.ProjectList = res.data.baseProjectViews ? res.data.baseProjectViews : [];
  177. } else {
  178. this.ProjectList = this.ProjectList.concat(res.data.baseProjectViews)
  179. }
  180. }
  181. if (this.ProjectList.length >= this.total2 - 0) {
  182. this.status = 'nomore';
  183. }
  184. },
  185. dropdownChange(data) {
  186. if(data ==3){
  187. let user = uni.getStorageSync('user');
  188. let token = uni.getStorageSync('Auth-Token');
  189. if (user && token) {
  190. this.getRecommendByPortals();
  191. } else {
  192. uni.showToast({
  193. title: '请先登录',
  194. icon: 'none'
  195. })
  196. setTimeout(() => {
  197. uni.navigateTo({
  198. url: "/pages/public/login?back=1&language=zh"
  199. })
  200. }, 1000)
  201. }
  202. }else {
  203. this.getList();
  204. }
  205. },
  206. navToList(src, data) {
  207. this.$mRouter.push({
  208. route: src + '?id=' + data + '&language=' + this.$i18n.locale
  209. });
  210. },
  211. i18n(data) {
  212. return this.$t('common.' + data);
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .rf-category {
  219. background-color: $color-white;
  220. /* #ifdef APP-PLUS */
  221. margin-top: calc(20upx + var(--status-bar-height));
  222. /* #endif */
  223. .recommend-bottom {
  224. float: right;
  225. height: 200upx;
  226. width: 488upx;
  227. }
  228. .uni-scroll-view {
  229. height: 500upx !important;
  230. overflow: scroll;
  231. }
  232. .recommend-bottom-name {
  233. font-size: 35upx;
  234. font-family: PingFangSC-Medium, PingFang SC;
  235. font-weight: 500;
  236. color: #0B0B11;
  237. line-height: 65upx;
  238. margin-top: 30upx;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. white-space: nowrap;
  242. }
  243. .wrapper {
  244. display: flex;
  245. align-items: center;
  246. position: absolute;
  247. top: 50%;
  248. left: 50%;
  249. font-size: $font-sm + 2upx;
  250. color: $font-color-light;
  251. transform: translate(-50%, -50%);
  252. flex-direction: row;
  253. .iconsousuo2 {
  254. font-size: 34upx;
  255. margin-right: $spacing-base;
  256. }
  257. input {
  258. width: 100%;
  259. padding-left: 28upx;
  260. height: 28upx;
  261. color: #888;
  262. font-size: 28upx;
  263. }
  264. }
  265. }
  266. </style>