case.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="center">
  3. <heard></heard>
  4. <view class="test_title">案例展示</view>
  5. <view class="box" v-if="isShow">
  6. <view class="caseBox" v-for="(item, index) in caseList" @click="nav(item.id)">
  7. <view class="caseBox-img"><image :src="imgUrl + item.coverimage" mode=""></image></view>
  8. <view class="caseBox-right">
  9. <view class="title">{{ item.title }}</view>
  10. <view class="date">{{ item.createtime }}</view>
  11. <view class="content">{{ item.synopsis }}</view>
  12. </view>
  13. </view>
  14. <view class="tishi" v-if="isShowtishi">已加载全部数据~~</view>
  15. <view class="pagInation">
  16. <!-- prevText String 上一页 左侧按钮文字
  17. nextText String 下一页 右侧按钮文字
  18. current Number 1 当前页
  19. total Number 0 数据总量
  20. pageSize Number 10 每页数据量
  21. showIcon Boolean false 是否以 icon 形式展示按钮
  22. @change 点击页码按钮时触发 e={type,current} current为当前页,
  23. type值为:next/prev,表示点击的是上一页还是下一个-->
  24. <!-- <uni-pagination title="标题文字" prevText="" nextText="" pageSize="10" total="20" @change="" ></uni-pagination> -->
  25. <!-- <uni-pagination title="标题文字" show-icon="true" total="50" current="2"></uni-pagination> -->
  26. <uni-pagination
  27. class="pagination"
  28. prevText="上一页"
  29. nextText="下一页"
  30. @change="handlePage"
  31. show-icon="false"
  32. :total="total"
  33. :current="pageNum"
  34. :pageSize="pageSize"
  35. ></uni-pagination>
  36. </view>
  37. </view>
  38. <view class="xianqingye" v-html="caseDetail.content" v-else></view>
  39. <aboutUs class="aboutUs"></aboutUs>
  40. </view>
  41. </template>
  42. <script>
  43. import { changeTaber } from '@/utils/tarberChange.js';
  44. import { caseslist, casesDetail } from '@/api/index.js';
  45. import { getTime } from '@/utils/time.js';
  46. import aboutUs from '@/components/public/introduce.vue'
  47. import heard from '@/components/public/heard.vue';
  48. export default {
  49. components: {
  50. aboutUs,heard
  51. },
  52. data() {
  53. return {
  54. isShowtishi: false, //false不展示
  55. isShow: true,
  56. imgUrl: 'http://tianli.liuniu946.com',
  57. caseList: [],
  58. caseCid: 27,
  59. // limit:,
  60. // page:1,
  61. total: '', //数据总量
  62. pageSize: 5, //每页数据量
  63. pageNum: 1, //当前页
  64. caseDetail: {}
  65. };
  66. },
  67. onLoad() {
  68. // this.loadData();
  69. // this.handlePage()
  70. this.getCaseList();
  71. },
  72. onShow() {
  73. this.$nextTick(function() {
  74. changeTaber(2);
  75. });
  76. },
  77. methods: {
  78. async loadData() {
  79. const obj = this;
  80. },
  81. handlePage(params) {
  82. console.log(params);
  83. this.pageNum = params.current;
  84. this.getCaseList();
  85. },
  86. //获取案例
  87. getCaseList() {
  88. let obj = this;
  89. caseslist({
  90. category_id: obj.caseCid,
  91. page: obj.pageNum,
  92. limit: obj.pageSize
  93. }).then(({ data }) => {
  94. data.list.forEach(e => {
  95. e.createtime = getTime(e.createtime);
  96. });
  97. console.log(data, '111111');
  98. obj.caseList = data.list;
  99. obj.total = data.count;
  100. if (data.list.length < 5) {
  101. this.isShowtishi = true;
  102. } else {
  103. this.isShowtishi = false;
  104. }
  105. });
  106. },
  107. //大概,
  108. nav(id) {
  109. this.isShow = false;
  110. casesDetail({}, id).then(res => {
  111. console.log(res, '111111');
  112. this.caseDetail = res.data;
  113. // }).catch(err => {
  114. // this.gsjj = err.data
  115. // console.log("2222222222")
  116. // console.log(err, 'cuoww')
  117. // })
  118. });
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss" scoped>
  124. .tishi {
  125. font-size: 16rpx;
  126. font-family: Adobe Heiti Std;
  127. font-weight: normal;
  128. color: #c7c9d1;
  129. line-height: 101px;
  130. }
  131. .test_title {
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. width: 100%;
  136. height: 60rpx;
  137. font-size: 22rpx;
  138. font-family: Adobe Heiti Std;
  139. font-weight: normal;
  140. color: #ffffff;
  141. background-color: #0165b5;
  142. }
  143. .box {
  144. display: flex;
  145. flex-direction: column;
  146. align-items: center;
  147. padding-bottom: 150rpx;
  148. .pagination {
  149. position: fixed;
  150. bottom: 0;
  151. left: 0;
  152. bottom: 232rpx;
  153. }
  154. .caseBox {
  155. margin-top: 20rpx;
  156. display: flex;
  157. align-items: center;
  158. width: 90%;
  159. height: 100%;
  160. .caseBox-img {
  161. flex-shrink: 1;
  162. width: 240rpx;
  163. height: 160rpx;
  164. image {
  165. width: 100%;
  166. height: 100%;
  167. }
  168. }
  169. .caseBox-right {
  170. margin-left: 30rpx;
  171. width: 440rpx;
  172. display: flex;
  173. flex-direction: column;
  174. .title {
  175. margin-top: -70rpx;
  176. font-size: 18rpx;
  177. font-family: Adobe Heiti Std;
  178. font-weight: normal;
  179. color: #535962;
  180. max-width: 420rpx;
  181. overflow: hidden;
  182. text-overflow: ellipsis;
  183. white-space: nowrap;
  184. }
  185. .date {
  186. margin-top: 10rpx;
  187. font-size: 11rpx;
  188. font-family: Adobe Heiti Std;
  189. font-weight: normal;
  190. color: #a1a1a1;
  191. line-height: 20rpx;
  192. }
  193. .content {
  194. font-size: 15rpx;
  195. font-family: Adobe Heiti Std;
  196. font-weight: normal;
  197. color: #a1a1a1;
  198. line-height: 46rpx;
  199. max-width: 420rpx;
  200. overflow: hidden;
  201. text-overflow: ellipsis;
  202. white-space: nowrap;
  203. }
  204. }
  205. }
  206. }
  207. // .uni-pagination__child-btn{
  208. // }
  209. // .pagInation > .uni-pagination>.uni-pagination__btn > .uni-pagination__child-btn > span{
  210. // }
  211. </style>