兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
4.9 KiB

  1. <template>
  2. <view>
  3. <view class="home-pages">
  4. <view style="position: absolute;top: 0; left: 0; height: 188rpx; width: 100%; z-index: 100; background-color: #FFFFFF; box-shadow: 0px 15px 10px -15px #E8E8E8;">
  5. <view style="margin: 28rpx 24rpx; display: flex;">
  6. <image :showLoading="true" :src="userInfo?userInfo.headImage : ''" style="width: 148rpx;height: 148rpx;border-radius: 50%;"></image>
  7. <view style="padding: 28rpx;">
  8. <view style="font-size: 32rpx;font-weight: 600">{{userInfo?userInfo.nickName : '点击登录'}}</view>
  9. <view style="font-size: 30rpx;margin-top: 20rpx;">积分余额{{userInfo.integerPrice}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="home-content">
  14. <user-card v-for="(item,i) in informationList" :key="i" :item="item"></user-card>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import userCard from '@/components/user-card/index-integer.vue'
  21. export default{
  22. components:{
  23. userCard
  24. },
  25. data(){
  26. return{
  27. userInfo:{
  28. integerPrice:0.00
  29. },
  30. current:1,
  31. activiteList:[],
  32. informationList:[],
  33. params:{
  34. pageNo:1,
  35. pageSize:10,
  36. total: null,
  37. isLock: true
  38. },
  39. }
  40. },
  41. onShow() {
  42. this.getmyInfo()
  43. },
  44. onLoad() {
  45. this.getinformation()
  46. // if(this.current == 0){
  47. // this.getActivity();
  48. // }else{
  49. // this.getinformation()
  50. // }
  51. },
  52. onPullDownRefresh() {
  53. this.activiteList = [];
  54. this.params.pageNo = 1;
  55. this.params.total = null;
  56. this.params.isLock = true;
  57. this.getinformation()
  58. },
  59. onReachBottom() {
  60. if(this.params.isLock){
  61. this.params.isLock = false;
  62. if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
  63. this.$Toast('没有更多数据!');
  64. setTimeout(()=>{
  65. this.params.isLock = true;
  66. },3000)
  67. return
  68. }
  69. this.params.pageNo+=1;
  70. this.$Toast('数据加载成功!');
  71. this.getinformation()
  72. }
  73. },
  74. onPullDownRefresh() {
  75. this.params.pageNo = 1;
  76. this.getinformation()
  77. // if(this.current == 0){
  78. // this.getActivity();
  79. // }else{
  80. // this.getinformation()
  81. // }
  82. },
  83. // 隐藏微信h5的标题栏
  84. onReady() {
  85. this.$com.displayNav()
  86. },
  87. methods:{
  88. getmyInfo(){
  89. this.$api('myInfo')
  90. .then(res=>{
  91. if(res.code == 200){
  92. this.role = res.result.role;
  93. this.userInfo = res.result;
  94. this.$store.commit('set_userInfo',res.result)
  95. }else{
  96. this.userInfo = null
  97. }
  98. })
  99. },
  100. // tabClick(e){
  101. // this.current = e.index;
  102. // this.params.pageNo = 1;
  103. // if(this.current == 0){
  104. // this.getActivity(2);
  105. // }else{
  106. // this.getinformation(2)
  107. // }
  108. // },
  109. // getActivity(type){
  110. // uni.showLoading()
  111. // this.$api('activity',this.params)
  112. // .then(res=>{
  113. // uni.hideLoading()
  114. // if(res.code == 200){
  115. // if(this.params.total== null) {
  116. // this.params.total = res.result.total
  117. // }
  118. // if(this.params.pageNo>1){
  119. // uni.hideLoading();
  120. // }
  121. // this.pages = this.pages.concat(res.result.pages);
  122. // this.params.isLock = true;
  123. // }else {
  124. // if(this.params.pageNo>1){
  125. // uni.hideLoading();
  126. // }
  127. // this.params.isLock = true;
  128. // }
  129. // })
  130. // },
  131. getinformation(type){
  132. uni.showLoading()
  133. this.$api('getIntegerList',this.params)
  134. .then(res=>{
  135. uni.hideLoading()
  136. if(res.code == 200){
  137. if(this.params.total== null) {
  138. this.params.total = res.result.total
  139. }
  140. if(this.params.pageNo>1){
  141. uni.hideLoading();
  142. }
  143. this.informationList = this.informationList.concat(res.result.records);
  144. this.params.isLock = true;
  145. }else {
  146. if(this.params.pageNo>1){
  147. uni.hideLoading();
  148. }
  149. this.params.isLock = true;
  150. }
  151. })
  152. // uni.showLoading()
  153. // this.$api('getFans',this.params)
  154. // .then(res=>{
  155. // uni.hideLoading()
  156. // if(res.code == 200){
  157. // this.pages = res.result.pages;
  158. // if(type == 2){
  159. // this.informationList = [...this.informationList,...res.result.records];
  160. // }else{
  161. // this.informationList = res.result.records;
  162. // uni.stopPullDownRefresh();
  163. // }
  164. // }
  165. // })
  166. },
  167. seeDetail(item){//查看详情
  168. uni.navigateTo({
  169. url:`/pages/home/course-detial?id=${item.id}`
  170. })
  171. },
  172. newDetail(item){//知识查看详情
  173. uni.navigateTo({
  174. url:`/pages/home/new-detail?id=${item.id}`
  175. })
  176. },
  177. lower(){
  178. if(this.params.pageNo >= this.pages) return;
  179. this.params.pageNo ++;
  180. if(this.current == 0){
  181. this.getActivity(2);
  182. }else{
  183. this.getinformation(2)
  184. }
  185. },
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .home-content {
  191. margin-top: 20rpx;
  192. }
  193. .home-pages {
  194. padding: 188rpx 29rpx 0;
  195. background-color: #F7F7F7;
  196. .scroll-Y {
  197. height: calc(100vh - 200rpx);
  198. padding-top: 20rpx;
  199. }
  200. }
  201. </style>