circle.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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" @click="toCreateCircle"></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. toCreateCircle(){
  89. uni.navigateTo({
  90. url: "/pages/circle/createCirclce"
  91. })
  92. },
  93. micOpen: function() {
  94. this.$refs.asr.show();
  95. },
  96. search() {
  97. uni.navigateTo({
  98. url: "/pages/circle/search"
  99. })
  100. },
  101. toDetail(val) {
  102. uni.navigateTo({
  103. url: "/pages/circle/detail"
  104. })
  105. },
  106. upCallback(page) {
  107. uni.showLoading({
  108. title: '数据加载中'
  109. })
  110. this.$request.baseRequest('pincheCarSharingApp', 'list', {
  111. remark2: this.route,
  112. carpoolingType: this.type,
  113. companyId: 1,
  114. pageNum: page.num,
  115. pageSize: page.size,
  116. }, failres => {
  117. console.log('res+++++', failres.errmsg)
  118. this.$refs.uToast.show({
  119. type: 'error',
  120. message: failres.errmsg,
  121. })
  122. uni.hideLoading()
  123. }).then(res => {
  124. // if (res.errno == 200) {
  125. uni.hideLoading()
  126. console.log(11)
  127. let curPageData = res.data.items;
  128. let totalPage = res.data.total;
  129. let curPageLen = curPageData.length;
  130. this.mescroll.endByPage(curPageLen, totalPage);
  131. console.log(res.data)
  132. // this.makeData(res.data)
  133. if (page.num == 1) this.infoList = []; //如果是第一页需手动置空列表
  134. this.infoList = this.infoList.concat(curPageData); //追加新数据
  135. // }
  136. })
  137. },
  138. input(res) {
  139. console.log('----input:', res)
  140. },
  141. clear(res) {
  142. uni.showToast({
  143. title: 'clear事件,清除值为:' + res.value,
  144. icon: 'none'
  145. })
  146. },
  147. blur(res) {
  148. uni.showToast({
  149. title: 'blur事件,输入值为:' + res.value,
  150. icon: 'none'
  151. })
  152. },
  153. focus(e) {
  154. uni.showToast({
  155. title: 'focus事件,输出值为:' + e.value,
  156. icon: 'none'
  157. })
  158. },
  159. cancel(res) {
  160. uni.showToast({
  161. title: '点击取消,输入值为:' + res.value,
  162. icon: 'none'
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .content1 {
  170. .right {
  171. /deep/.u-badge {
  172. position: absolute;
  173. top: 0;
  174. right: 6rpx;
  175. }
  176. }
  177. }
  178. .content3 {
  179. .img {
  180. width: 100rpx;
  181. }
  182. .right {
  183. display: flex;
  184. flex-direction: column;
  185. justify-content: space-between;
  186. }
  187. }
  188. </style>