circle.vue 5.7 KB

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