circle.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="content">
  3. <view class="content1 flex">
  4. <!-- <uni-search-bar @confirm="search" v-model="searchValue" @blur="blur" @focus="focus" @input="input"
  5. @cancel="cancel" @clear="clear" cancelButton="false" placeholder="搜索圈子">
  6. </uni-search-bar> -->
  7. <view class="search flex flex-between" @click="search">
  8. <view class="left flex">
  9. <uni-icons type="search" size="24"></uni-icons>
  10. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  11. </view>
  12. <view class="right">
  13. <uni-icons type="mic" size="24" @click.stop="micOpen"></uni-icons>
  14. </view>
  15. </view>
  16. <view class="right flex relative">
  17. <uni-icons type="personadd-filled" size="30"></uni-icons>
  18. <u-badge :isDot="true" type="error" class="point"></u-badge>
  19. </view>
  20. </view>
  21. <view class="content2 flex flex-between">
  22. <view class="left">
  23. 我得圈子
  24. </view>
  25. <view class="right">
  26. <uni-icons type="personadd-filled" size="30"></uni-icons>
  27. </view>
  28. </view>
  29. <!-- <mescroll-body ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback">
  30. <view class="content3" v-for="(item,index) in circleList">
  31. </view>
  32. </mescroll-body> -->
  33. <view class="content3 flex">
  34. <view class="row-tiem" @click="toDetail">
  35. <view class="left">
  36. <image src="../../static/logo.png" mode="widthFix" class="img"></image>
  37. </view>
  38. <view class="right">
  39. <view class="top">北京技术(155)</view>
  40. <view class="bottom">
  41. <span>粮食贸易</span>
  42. <span>粮食贸易</span>
  43. <span>粮食贸易</span>
  44. <span>粮食贸易</span>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  54. import {
  55. mapState,
  56. mapMutations
  57. } from 'vuex';
  58. export default {
  59. mixins: [MescrollMixin], // 使用mixin
  60. computed: {
  61. ...mapState(['hasLogin'])
  62. },
  63. data() {
  64. return {
  65. searchVal: '',
  66. searchValue: '',
  67. circleList: [],
  68. userInfo: {},
  69. };
  70. },
  71. onShow() {
  72. this.searchVal = uni.getStorageSync("cirlce_search_val") ? uni.getStorageSync("cirlce_search_val") : ''
  73. // this.$nextTick(function() {
  74. // this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  75. // this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  76. // this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  77. // });
  78. // if (this.hasLogin || uni.getStorageSync("userInfo").username) {
  79. // this.userInfo = uni.getStorageSync("userInfo")
  80. // this.isLogin = true
  81. // } else {
  82. // uni.navigateTo({
  83. // url: "/pages/login/login"
  84. // })
  85. // }
  86. },
  87. methods: {
  88. micOpen: function() {
  89. this.$refs.asr.show();
  90. },
  91. search() {
  92. uni.navigateTo({
  93. url: "/pages/circle/search"
  94. })
  95. },
  96. toDetail(val) {
  97. uni.navigateTo({
  98. url: "/pages/circle/detail"
  99. })
  100. },
  101. upCallback(page) {
  102. uni.showLoading({
  103. title: '数据加载中'
  104. })
  105. this.$request.baseRequest('pincheCarSharingApp', 'list', {
  106. remark2: this.route,
  107. carpoolingType: this.type,
  108. companyId: 1,
  109. pageNum: page.num,
  110. pageSize: page.size,
  111. }, failres => {
  112. console.log('res+++++', failres.errmsg)
  113. this.$refs.uToast.show({
  114. type: 'error',
  115. message: failres.errmsg,
  116. })
  117. uni.hideLoading()
  118. }).then(res => {
  119. // if (res.errno == 200) {
  120. uni.hideLoading()
  121. console.log(11)
  122. let curPageData = res.data.items;
  123. let totalPage = res.data.total;
  124. let curPageLen = curPageData.length;
  125. this.mescroll.endByPage(curPageLen, totalPage);
  126. console.log(res.data)
  127. // this.makeData(res.data)
  128. if (page.num == 1) this.infoList = []; //如果是第一页需手动置空列表
  129. this.infoList = this.infoList.concat(curPageData); //追加新数据
  130. // }
  131. })
  132. },
  133. input(res) {
  134. console.log('----input:', res)
  135. },
  136. clear(res) {
  137. uni.showToast({
  138. title: 'clear事件,清除值为:' + res.value,
  139. icon: 'none'
  140. })
  141. },
  142. blur(res) {
  143. uni.showToast({
  144. title: 'blur事件,输入值为:' + res.value,
  145. icon: 'none'
  146. })
  147. },
  148. focus(e) {
  149. uni.showToast({
  150. title: 'focus事件,输出值为:' + e.value,
  151. icon: 'none'
  152. })
  153. },
  154. cancel(res) {
  155. uni.showToast({
  156. title: '点击取消,输入值为:' + res.value,
  157. icon: 'none'
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .content1 {
  165. .right {
  166. /deep/.u-badge {
  167. position: absolute;
  168. top: 0;
  169. right: 6rpx;
  170. }
  171. }
  172. }
  173. .content3 {
  174. .img {
  175. width: 100rpx;
  176. }
  177. .right {
  178. display: flex;
  179. flex-direction: column;
  180. justify-content: space-between;
  181. }
  182. }
  183. </style>