case.vue 5.5 KB

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