index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="content">
  3. <view class="top-bg">
  4. <image src="../../static/img/mourn-bg.png" mode="widthFix"></image>
  5. </view>
  6. <view class="list-wrap">
  7. <view class="list flex">
  8. <view class="list-tit">
  9. 器官(遗体、器官)捐献网上缅怀
  10. </view>
  11. <view class="search-wrap">
  12. <input type="text" v-model="keyword" placeholder="请输入捐赠者" placeholder-class="search-placeholder" />
  13. <image src="../../static/icon/search.png" mode="" @click="search()"></image>
  14. <!-- <image src="../../static/icon/blackf.png" mode=""></image> -->
  15. </view>
  16. <view class="mourn-mun">
  17. <image src="../../static/icon/blackf.png" mode="widthFix"></image>
  18. 悼念总数:{{mournAll}}
  19. </view>
  20. <scroll-view scroll-y="true" class="scroll-wrap flex" :style="{'height': height}" @scrolltolower="getMournList">
  21. <view class="list-item" v-for="item in list">
  22. <view class="item-img">
  23. <image :src="'https://cnqadmin.igxys.com' + item.image" mode=""></image>
  24. <image src="../../static/img/huak.png" mode=""></image>
  25. </view>
  26. <view class="item-name clamp">
  27. {{item.name}}
  28. </view>
  29. <view class="item-btn" @click="navto('/pages/mourn/detail?id=' + item.id)">
  30. 在线悼念
  31. </view>
  32. </view>
  33. <uni-load-more :status="loadingType"></uni-load-more>
  34. </scroll-view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { weixindata } from '@/utils/wxAuthorized.js';
  41. import {
  42. getMournList,
  43. getMournNum
  44. } from '@/api/mourn.js'
  45. export default {
  46. data() {
  47. return {
  48. height: '',
  49. mournAll: 0,
  50. list: [],
  51. keyword: '',
  52. page: 1,
  53. limit: 20,
  54. loadingType: 'more'
  55. }
  56. },
  57. onShow() {
  58. // this.playMusic()
  59. this.getMournList()
  60. this.getAllNum()
  61. },
  62. onLoad() {
  63. let obj = this
  64. if (this.$store.state.isPlay) {} else {
  65. if (this.$store.state.isAllow) {
  66. uni.showModal({
  67. title: '温馨提醒',
  68. content:'是否播放背景音乐?',
  69. cancelText:'否',
  70. confirmText:'是',
  71. success: function(res) {
  72. if (res.confirm) {
  73. obj.$api.playMusic(true)
  74. } else if (res.cancel) {
  75. obj.$store.state.isAllow = false
  76. }
  77. }
  78. })
  79. }
  80. }
  81. this.IndexShare()
  82. },
  83. onReady(res) {
  84. var obj = this;
  85. uni.getSystemInfo({
  86. success: resu => {
  87. const query = uni.createSelectorQuery();
  88. query.select('.scroll-wrap').boundingClientRect();
  89. query.exec(function(res) {
  90. obj.height = resu.windowHeight - res[0].top - 210 + 'px';
  91. });
  92. },
  93. fail: res => {}
  94. });
  95. },
  96. methods: {
  97. // 页面跳转
  98. navto(url) {
  99. console.log(this.$store.state.isPlay,'this.$store.state.isPlay')
  100. if(!this.$store.state.isPlay) {
  101. console.log('ddd')
  102. this.$api.playMusic(true)
  103. }
  104. uni.navigateTo({
  105. url: url
  106. })
  107. },
  108. // 关键字查询
  109. search() {
  110. let obj = this
  111. obj.list = []
  112. obj.page = 1
  113. obj.loadingType = 'more'
  114. console.log(obj.keyword)
  115. obj.getMournList()
  116. },
  117. // 获取捐赠人列表
  118. getMournList() {
  119. let obj = this
  120. if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  121. return
  122. }
  123. obj.loadingType = 'loading'
  124. getMournList({
  125. page: obj.page,
  126. search: obj.keyword,
  127. rows: obj.limit
  128. }).then(res => {
  129. console.log(res)
  130. obj.list = obj.list.concat(res.data.data)
  131. // obj.total = res.data.total
  132. obj.page++
  133. if(res.data.data.length == obj.limit) {
  134. obj.loadingType = 'more'
  135. }else {
  136. obj.loadingType = 'noMore'
  137. }
  138. })
  139. },
  140. // 获取全部数据
  141. getAllNum() {
  142. getMournNum().then(res => {
  143. console.log(res)
  144. this.mournAll = res.data
  145. })
  146. },
  147. IndexShare() {
  148. let obj = this;
  149. let item = {
  150. link: obj.$store.state.baseURL + '/index/#/pages/mourn/index', // 分享链接
  151. imgUrl: obj.$store.state.baseURL +'/index/static/img/002.png',
  152. desc: '生命有限/大爱无限/器官(遗体、组织)捐献/让生命在爱中传递......',
  153. title: '在线悼念捐献者',
  154. success: console.log('分享加载成功')
  155. };
  156. console.log('分享加', item);
  157. weixindata(item);
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. page {
  164. min-height: 100%;
  165. background-color:#d4e2f4;
  166. }
  167. .top-bg {
  168. width: 750rpx;
  169. image {
  170. width: 750rpx;
  171. }
  172. }
  173. .list-wrap {
  174. position: relative;
  175. width: 710rpx;
  176. margin: auto;
  177. margin-top: -300rpx;
  178. padding: 5rpx;
  179. background-color: #fff;
  180. .list {
  181. width: 100%;
  182. // min-height: 850rpx;
  183. border: 5rpx solid #006061;
  184. position: relative;
  185. padding-top: 124rpx;
  186. .scroll-wrap {
  187. flex-wrap: wrap;
  188. // align-items: flex-start;
  189. align-content: flex-start;
  190. }
  191. .list-tit {
  192. // width: 314rpx;
  193. position: absolute;
  194. top: 0;
  195. display: inline-block;
  196. padding: 0 15rpx;
  197. height: 54rpx;
  198. line-height: 54rpx;
  199. font-size: 20rpx;
  200. background-color: #006061;
  201. color: #fff;
  202. }
  203. .search-wrap {
  204. width: 200rpx;
  205. height: 32rpx;
  206. // background-color: red;
  207. position: absolute;
  208. right: 10rpx;
  209. top: 16rpx;
  210. font-size: 20rpx;
  211. .search-placeholder {
  212. font-size: 20rpx;
  213. }
  214. input {
  215. display: inline-block;
  216. border-radius: 10rpx;
  217. width: 200rpx;
  218. height: 32rpx;
  219. border: 1rpx solid #999;
  220. padding: 0 10rpx;
  221. }
  222. image {
  223. display: block;
  224. position: absolute;
  225. width: 25rpx;
  226. height: 25rpx;
  227. right: 10rpx;
  228. top: 10rpx;
  229. }
  230. }
  231. .mourn-mun {
  232. position: absolute;
  233. top: 70rpx;
  234. text-align: right;
  235. display: inline-block;
  236. flex-wrap: nowrap;
  237. align-items: center;
  238. right: 10rpx;
  239. image {
  240. width: 26rpx;
  241. margin-right: 5rpx;
  242. }
  243. }
  244. .list-item {
  245. height: 245rpx;
  246. width: 25%;
  247. display: inline-block;
  248. // text-align: center;
  249. .item-img {
  250. width: 121rpx;
  251. height: 145rpx;
  252. margin: auto;
  253. position: relative;
  254. image {
  255. width: 100%;
  256. height: 100%;
  257. position: absolute;
  258. }
  259. }
  260. .item-name {
  261. text-align: center;
  262. color: #000;
  263. font-size: 22rpx;
  264. font-weight: bold;
  265. padding-top: 20rpx;
  266. padding-bottom: 10rpx;
  267. }
  268. .item-btn {
  269. width: 92rpx;
  270. height: 30rpx;
  271. background-color: #006061;
  272. margin: auto;
  273. text-align: center;
  274. color: #fff;
  275. border-radius: 10rpx;
  276. font-size: 17rpx;
  277. line-height: 30rpx;
  278. }
  279. }
  280. }
  281. }
  282. </style>