index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <view class="container Index-container">
  3. <view class="index-fixed">
  4. <view class="index-header">
  5. <input type="text"
  6. placeholder="搜索您想要的纪要"
  7. placeholder-class="sea_ipt_placeholder"
  8. class="sea_ipt"
  9. v-model="searchTxt"
  10. disabled
  11. @click="goSearch"/>
  12. <icon type="search" size="15" class="search_ico"/>
  13. </view>
  14. <!-- 导航条 -->
  15. <view class="tab-cont">
  16. <scroll-view
  17. scroll-x="true"
  18. scroll-with-animation
  19. class="scroll-tab"
  20. :scroll-into-view="'_'+tabIndex">
  21. <block v-for="(item, index) in tabBars" :key="item.ChartPermissionId">
  22. <view :id="'_'+index" class="scroll-tab-item" :class="{ active: tabAct_id == item.ChartPermissionId }" @click.stop="toggleTab(item,index)">
  23. {{item.PermissionName}}
  24. <image src="@/static/img/border_act.png" mode="" class="border_act" v-if="tabAct_id == item.ChartPermissionId"></image>
  25. </view>
  26. </block>
  27. <view class="limit-box" v-if="limitIsShow">
  28. <image class="limit-img" src="../../static/img/limit_icon.png" mode=""></image>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <block v-if="haveData">
  34. <view class="data-cont">
  35. <view class="report-ul">
  36. <view class="report-item" v-for="(report,index) in dataList" :key="index" v-if="index%2 === 0" @click="goDetail(report)">
  37. <!-- <view class="item-content"><u-parse :html="report.Body"></u-parse></view> -->
  38. <view class="item-content">{{report.Body}}</view>
  39. <view class="line"></view>
  40. <text class="item-title">{{report.Title}}</text>
  41. <view class="item-abstract text_twoLine" v-if="report.ExpertBackground">
  42. <image src="@/static/img/report_ico.png" class="report_ico"></image>
  43. {{report.ExpertBackground}}
  44. </view>
  45. <view class="item-createtime">
  46. <text>{{report.PublishDate}}</text>
  47. <view class="item-examine">
  48. <image src="../../static/img/examine_icon.png" v-if="report.IsResearch"></image>
  49. <text v-if="report.IsResearch">{{report.Pv}}</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="report-ul">
  55. <view class="report-item" v-for="(report,index) in dataList" :key="index" v-if="index%2 !== 0" @click="goDetail(report)">
  56. <!-- <view class="item-content"><u-parse :html="report.Body"></u-parse></view> -->
  57. <view class="item-content">{{report.Body}}</view>
  58. <view class="line"></view>
  59. <text class="item-title">{{report.Title}}</text>
  60. <view class="item-abstract text_twoLine" v-if="report.ExpertBackground">
  61. <image src="@/static/img/report_ico.png" class="report_ico"></image>
  62. {{report.ExpertBackground}}
  63. </view>
  64. <view class="item-createtime">
  65. <text>{{report.PublishDate}}</text>
  66. <view class="item-examine">
  67. <image src="../../static/img/examine_icon.png" v-if="report.IsResearch"></image>
  68. <text v-if="report.IsResearch">{{report.Pv}}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20"/>
  75. </block>
  76. <view class="nodata" v-else-if="haveData===false" style="padding-top: 400rpx;">
  77. <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
  78. <text>暂时没有行业数据</text>
  79. </view>
  80. <image class="advice_ico" src="@/static/img/advice_ico.png" @click="adviceHandle"></image>
  81. </view>
  82. </template>
  83. <script>
  84. import {Home} from '@/config/api.js';
  85. import { Throttle } from '@/config/util.js'
  86. let app = getApp()
  87. export default {
  88. data() {
  89. return {
  90. refresh:false,
  91. pageSize:10,//条数
  92. pageNum:1,//页码
  93. haveMore:true,//是否有更多数据
  94. haveData:null,//是否有数据
  95. tabAct_id:0,
  96. //数据列表
  97. dataList:[],
  98. // tab
  99. tabBars:[],
  100. status:'loadmore',
  101. loadText: {
  102. loadmore: '上拉加载更多',
  103. loading: '加载中',
  104. nomore: '已经到底了'
  105. },
  106. totalPage:'',
  107. limitIsShow:false,//限免的隐现
  108. }
  109. },
  110. watch: {
  111. tabAct_id: {
  112. handler() {
  113. this.getReportList();
  114. },
  115. immediate:true
  116. }
  117. },
  118. onLoad(optios) {
  119. this.$store.dispatch("checkHandle",{type:'load',val:optios}).then((res) => {})
  120. if(optios.tabid){
  121. this.tabAct_id = optios.tabid
  122. this.getReportList();
  123. }
  124. this.getTabs();
  125. },
  126. onShow() {
  127. this.$store.dispatch("statistics",{PageType:'Summary',ChartPermissionId:this.tabAct_id})
  128. // #ifdef MP-WEIXIN
  129. uni.hideHomeButton()
  130. // #endif
  131. },
  132. methods: {
  133. /* 切换分类 */
  134. toggleTab (item,index) {
  135. if(this.tabAct_id !== item.ChartPermissionId) {
  136. this.tabAct_id = item.ChartPermissionId;
  137. this.pageNum = 1;
  138. uni.pageScrollTo({
  139. scrollTop: 0,
  140. duration: 0,
  141. });
  142. this.$store.dispatch("statistics",{PageType:'Summary',ChartPermissionId:this.tabAct_id})
  143. }
  144. },
  145. /* 获取列表 */
  146. getReportList() {
  147. Home.getList({
  148. PageSize: this.pageSize,
  149. CurrentIndex: this.pageNum,
  150. ChartPermissionId:Number(this.tabAct_id) || 0
  151. }).then(res => {
  152. if(res.Ret === 200) {
  153. this.status = this.pageNum < res.Data.Paging.Pages ? 'loadmore' : 'nomore'
  154. // this.totalPage = res.Data.Paging.Pages;//总页数
  155. if(this.pageNum === 1) {
  156. this.dataList = res.Data.List || []
  157. this.haveData = this.dataList.length ? true : false;
  158. }else {
  159. this.dataList = this.dataList.concat(res.Data.List)
  160. }
  161. if(this.refresh) {
  162. uni.stopPullDownRefresh();
  163. this.refresh = false;
  164. }
  165. }
  166. })
  167. },
  168. /* 获取tab分类 */
  169. getTabs() {
  170. Home.Tab().then(res => {
  171. if(res.Ret === 200) {
  172. let arr = res.Data.List;
  173. arr.unshift({
  174. ChartPermissionId: 0,
  175. PermissionName: "最新"
  176. })
  177. this.tabBars = arr;
  178. this.limitIsShow=this.tabBars.some(item=>item.IsShowSustainable)
  179. }
  180. })
  181. },
  182. /* 进入详情 校验是否有该品种权限 */
  183. goDetail(item) {
  184. /* 无需授权且已绑定 检验是或否有权限 */
  185. this.$store.dispatch('checkHandle').then(res => {
  186. app.globalData.isAuth = res.IsAuth;
  187. app.globalData.isBind = res.IsBind;
  188. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  189. uni.navigateTo({
  190. url:'/pages/reportDetail/reportDetail?id=' + item.ArticleId,
  191. });
  192. }else if(res.IsAuth) { //未授权
  193. uni.navigateTo({
  194. url:'/pages/authGuide/authGuide'
  195. })
  196. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  197. uni.navigateTo({
  198. url:'/pages/login/login'
  199. })
  200. }
  201. })
  202. },
  203. /* 搜索 */
  204. goSearch() {
  205. /* */
  206. this.$store.dispatch('checkHandle').then(res => {
  207. app.globalData.isAuth = res.IsAuth;
  208. app.globalData.isBind = res.IsBind;
  209. if((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
  210. uni.navigateTo({
  211. url:'/pages/search/search',
  212. });
  213. }else if(res.IsAuth) { //未授权
  214. uni.navigateTo({
  215. url:'/pages/authGuide/authGuide'
  216. })
  217. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  218. uni.navigateTo({
  219. url:'/pages/login/login'
  220. })
  221. }
  222. })
  223. },
  224. adviceHandle() {
  225. this.$store.dispatch('checkHandle').then(res => {
  226. app.globalData.isAuth = res.IsAuth;
  227. app.globalData.isBind = res.IsBind;
  228. if((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
  229. uni.navigateTo({url:'/pages/advice/advice'});
  230. }else if(res.IsAuth) { //未授权
  231. uni.navigateTo({
  232. url:'/pages/authGuide/authGuide'
  233. })
  234. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  235. uni.navigateTo({
  236. url:'/pages/login/login'
  237. })
  238. }
  239. })
  240. }
  241. },
  242. /* 下拉刷新 */
  243. onPullDownRefresh: Throttle(function() {
  244. this.pageNum = 1;
  245. this.refresh = true;
  246. this.getReportList()
  247. }),
  248. // 上拉加载
  249. onReachBottom: Throttle(function() {
  250. if(this.status === 'nomore') return ;
  251. this.status = 'loading';
  252. this.pageNum++;
  253. this.getReportList()
  254. }),
  255. /**
  256. * 用户点击分享
  257. */
  258. onShareAppMessage: function (res) {
  259. return {
  260. title: '您手边的弘则研究素材检索库',
  261. path: '/pages/index/index?tabid='+this.tabAct_id,
  262. imageUrl: this.tabAct_id==0 ?'/static/img/home_share.png' : '' ,
  263. success: (res)=> {
  264. },
  265. fail: (err)=> {
  266. }
  267. }
  268. },
  269. // onShareTimeline: function(res) {
  270. // return {
  271. // title:'111',
  272. // // query:'',
  273. // // imageUrl:''
  274. // }
  275. // }
  276. }
  277. </script>
  278. <style lang="scss">
  279. .Index-container {
  280. background-color: #F7F7F7;
  281. font-size: 30rpx;
  282. .index-fixed {
  283. width: 750rpx;
  284. position: fixed;
  285. left: 0;
  286. top: 0;
  287. z-index: 999;
  288. .index-header {
  289. background-color: #fff;
  290. padding: 32rpx 34rpx;
  291. position: relative;
  292. .sea_ipt_placeholder {
  293. color: #8D8D8D;
  294. opacity: 0.7;
  295. }
  296. .sea_ipt {
  297. width: 100%;
  298. height: 70rpx;
  299. font-size: 30rpx;
  300. color: #707070;
  301. background-color: #F6F6F6;
  302. padding: 0 34rpx 0 70rpx;
  303. border-radius: 70rpx;
  304. border: 1rpx solid #E5E5E5;
  305. }
  306. .search_ico {
  307. display: block;
  308. position: absolute;
  309. color: #8D8D8D;
  310. left: 60rpx;
  311. top: 50%;
  312. z-index: 100;
  313. transform: translateY(-50%);
  314. }
  315. }
  316. .tab-cont {
  317. padding: 0 26rpx;
  318. background-color: #fff;
  319. font-size: 32rpx;
  320. box-shadow: 0 3rpx 6rpx rgba(187,216,255,0.2);
  321. .scroll-tab {
  322. position: relative;
  323. width: 100%;
  324. white-space: nowrap;
  325. }
  326. .limit-box {
  327. position: absolute;
  328. text-align: center;
  329. display: inline-block;
  330. padding-right: 50rpx;
  331. top: -8rpx;
  332. margin-left: -50rpx;
  333. image {
  334. width: 46rpx;
  335. height: 26rpx;
  336. }
  337. }
  338. .scroll-tab-item {
  339. // flex-grow: 1;
  340. text-align: center;
  341. display: inline-block;
  342. padding: 10rpx 8rpx 20rpx 8rpx;
  343. margin-right: 51rpx;
  344. border-bottom: 8rpx solid transparent;
  345. position: relative;
  346. &:last-child {
  347. margin-right: 0;
  348. }
  349. &.active {
  350. border-bottom: none;
  351. color: #2C83FF;
  352. font-weight: 700;
  353. }
  354. .border_act {
  355. width: 100%;
  356. height: 8rpx;
  357. position: absolute;
  358. bottom: 0;
  359. left: 0;
  360. }
  361. }
  362. }
  363. }
  364. .data-cont {
  365. padding: 228rpx 20rpx 10rpx;
  366. display: flex;
  367. .report-ul {
  368. width: 50%;
  369. &:first-child {
  370. margin-right: 10rpx;
  371. }
  372. .report-item {
  373. padding: 20rpx 20rpx 24rpx 20rpx;
  374. margin-bottom: 20rpx;
  375. border-radius: 8rpx;
  376. box-shadow: 0 3rpx 6rpx rgba($color: #000000, $alpha: 0.16);
  377. background: #fff;
  378. .item-content {
  379. height: 273rpx;
  380. font-size: 24rpx;
  381. line-height: 40rpx;
  382. color: #7F7F7F;
  383. overflow: hidden;
  384. text-overflow: ellipsis;
  385. display: -webkit-box;
  386. -webkit-line-clamp: 7;
  387. -webkit-box-orient: vertical;
  388. }
  389. .line {
  390. margin: 18rpx 0;
  391. content: '';
  392. width: 100%;
  393. height: 1px;
  394. padding: 0 32rpx;
  395. box-sizing: border-box;
  396. background-color: #E5E5E5;
  397. -webkit-transform: scale(1, 0.5);
  398. transform: scale(1, 0.5);
  399. -webkit-transform-origin: center bottom;
  400. transform-origin: center bottom;
  401. }
  402. .item-title {
  403. font-size: 28rpx;
  404. color: #4A4A4A;
  405. margin-bottom: 10rpx;
  406. }
  407. .item-abstract {
  408. font-size: 26rpx;
  409. color: #6A6A6A;
  410. margin-bottom: 10rpx;
  411. .report_ico {
  412. width: 32rpx;
  413. height: 26rpx;
  414. margin-right: 20rpx;
  415. display: inline-block;
  416. }
  417. }
  418. .item-createtime {
  419. display: flex;
  420. align-items: center;
  421. justify-content: space-between;
  422. color: #ACACAC;
  423. font-size: 24rpx;
  424. .item-examine {
  425. display: flex;
  426. align-items: center;
  427. image {
  428. width: 30rpx;
  429. height: 24rpx;
  430. margin: 0 10rpx 0 15rpx;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. .advice_ico {
  438. width: 81rpx;
  439. height: 81rpx;
  440. position: fixed;
  441. right: 30rpx;
  442. bottom: 214rpx;
  443. }
  444. }
  445. </style>