circle.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="content">
  3. <view class="content1 flex flex-between">
  4. <view class="search flex">
  5. <view class="left flex" @click="search">
  6. <image src="../../static/imgs/cirlce/search.png" mode="widthFix" class="search-img"></image>
  7. <text class="search-val"> {{searchVal?searchVal:'搜索圈子'}}</text>
  8. <uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
  9. v-if="searchVal"></uni-icons>
  10. </view>
  11. </view>
  12. <view class="right relative">
  13. <image src="../../static/imgs/cirlce/hy.png" mode="widthFix" class="hy-search-img"
  14. @click="toChangeCard"></image>
  15. <u-badge :isDot="true" type="error" class="point position"></u-badge>
  16. </view>
  17. </view>
  18. <mescroll-body ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback" :up="upOption" :down="downOption">
  19. <view class="content2 flex flex-between">
  20. <view class="left flex title">
  21. <view class="line"></view>
  22. <view class="text-title">
  23. 我的圈子
  24. </view>
  25. </view>
  26. <!-- <view class="right">
  27. <uni-icons type="personadd-filled" size="30" @click="toCreateCircle"></uni-icons>
  28. </view> -->
  29. </view>
  30. <view class="" v-for="(item,index) in circleList" :key="index">
  31. <view class="flex title" v-if="item.name">
  32. <view class="line"></view>
  33. <view class="text-title">
  34. {{item.name}}
  35. </view>
  36. </view>
  37. <view class="row-tiem flex" v-if="!item.name" @click="toDetail(item.id)">
  38. <view class="left">
  39. <image src="../../static/imgs/mySet/ewm.png" mode="widthFix" class="img"></image>
  40. </view>
  41. <view class="right">
  42. <view class="top">{{item.circleName}}({{item.cardNum}})</view>
  43. <view class="bottom">
  44. <span v-for="item1 in item.circleLabel.split(',')" class="text">
  45. {{item1}}
  46. </span>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </mescroll-body>
  52. <image src="../../static/imgs/cirlce/add.png" mode="widthFix" class="add" @click="toCreateCircle"></image>
  53. <u-toast ref="uToast"></u-toast>
  54. </view>
  55. </template>
  56. <script>
  57. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  58. import {
  59. mapState,
  60. mapMutations
  61. } from 'vuex';
  62. export default {
  63. mixins: [MescrollMixin], // 使用mixin
  64. computed: {
  65. ...mapState(['hasLogin'])
  66. },
  67. data() {
  68. return {
  69. searchVal: '',
  70. circleList: [],
  71. userInfo:{},
  72. downOption: {
  73. auto: false,
  74. },
  75. upOption: {
  76. auto: false,
  77. },
  78. canReset: false,
  79. };
  80. },
  81. onLoad() {
  82. },
  83. onShow() {
  84. if (uni.getStorageSync("userInfo").phone) {
  85. this.userInfo = uni.getStorageSync("userInfo")
  86. this.$nextTick(function() {
  87. this.mescroll.resetUpScroll()
  88. });
  89. this.searchVal = uni.getStorageSync("cirlce_search_val") ? uni.getStorageSync("cirlce_search_val") : ''
  90. } else {
  91. uni.switchTab({
  92. url:"/pages/cardHolder/cardHolder"
  93. })
  94. }
  95. },
  96. methods: {
  97. delSearchVal() {
  98. this.searchVal = ""
  99. this.mescroll.resetUpScroll()
  100. },
  101. toChangeCard() {
  102. uni.navigateTo({
  103. url: "/pages/circle/changeCard"
  104. })
  105. },
  106. toCreateCircle() {
  107. uni.navigateTo({
  108. url: "/pages/circle/createCirclce"
  109. })
  110. },
  111. micOpen: function() {
  112. this.$refs.asr.show();
  113. },
  114. search() {
  115. uni.navigateTo({
  116. url: "/pages/circle/search"
  117. })
  118. },
  119. toDetail(val) {
  120. uni.navigateTo({
  121. url: "/pages/circle/detail?val=" + val
  122. })
  123. },
  124. upCallback(page) {
  125. uni.showLoading({
  126. title: '数据加载中'
  127. })
  128. let _data = {
  129. commonId: this.userInfo.id,
  130. page: page.num,
  131. limit: page.size,
  132. status:1
  133. }
  134. if (this.searchVal) {
  135. _data.circleName = this.searchVal
  136. }
  137. this.$request.baseRequest('admin.unimall.circleManagementInfo', 'list', _data, failres => {
  138. console.log('res+++++', failres.errmsg)
  139. this.$refs.uToast.show({
  140. type: 'error',
  141. message: failres.errmsg,
  142. })
  143. uni.hideLoading()
  144. }).then(res => {
  145. uni.hideLoading()
  146. console.log(11)
  147. let curPageData = res.data.items;
  148. let totalPage = res.data.total;
  149. let curPageLen = curPageData.length;
  150. this.mescroll.endByPage(curPageLen, totalPage);
  151. console.log(res.data)
  152. // this.makeData(res.data)
  153. if (page.num == 1) this.circleList = []; //如果是第一页需手动置空列表
  154. this.circleList = this.circleList.concat(curPageData); //追加新数据
  155. for (let i = 0; i < this.circleList.length; i++) {
  156. if (this.circleList[i].addedFlag == 0) {
  157. if (i == 0) {
  158. this.circleList.unshift({
  159. name: '推荐圈子'
  160. });
  161. } else {
  162. this.circleList.splice(i, 0, {
  163. name: '推荐圈子'
  164. })
  165. }
  166. console.log(this.circleList)
  167. return
  168. }
  169. }
  170. })
  171. },
  172. input(res) {
  173. console.log('----input:', res)
  174. },
  175. clear(res) {
  176. uni.showToast({
  177. title: 'clear事件,清除值为:' + res.value,
  178. icon: 'none'
  179. })
  180. },
  181. blur(res) {
  182. uni.showToast({
  183. title: 'blur事件,输入值为:' + res.value,
  184. icon: 'none'
  185. })
  186. },
  187. focus(e) {
  188. uni.showToast({
  189. title: 'focus事件,输出值为:' + e.value,
  190. icon: 'none'
  191. })
  192. },
  193. cancel(res) {
  194. uni.showToast({
  195. title: '点击取消,输入值为:' + res.value,
  196. icon: 'none'
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .content1 {
  204. margin: 50rpx 25rpx 14rpx 25rpx;
  205. .search {
  206. width: 100%;
  207. .left {
  208. background: #fff;
  209. border-radius: 38rpx;
  210. padding: 18rpx;
  211. width: 100%;
  212. }
  213. .search-val {
  214. color: #B3B3B3;
  215. }
  216. }
  217. .hy-search-img {
  218. width: 38rpx;
  219. margin-left: 40rpx;
  220. }
  221. .search-img {
  222. width: 38rpx;
  223. margin-right: 40rpx;
  224. }
  225. .right {
  226. /deep/.u-badge {
  227. position: absolute;
  228. top: 0;
  229. right: -10rpx;
  230. }
  231. }
  232. }
  233. .line {
  234. width: 8rpx;
  235. height: 34rpx;
  236. background: #112253;
  237. border-radius: 3px;
  238. margin: 20rpx;
  239. }
  240. .title {
  241. margin: 20rpx 0;
  242. }
  243. .text-title {
  244. font-size: 32rpx;
  245. font-weight: bold;
  246. color: #1A1A1A;
  247. }
  248. .row-tiem {
  249. background: #fff;
  250. padding: 24rpx;
  251. margin: 0 34rpx;
  252. align-items: unset;
  253. .img {
  254. width: 122rpx;
  255. height: 122rpx;
  256. border-radius: 10px;
  257. margin-right: 30rpx;
  258. }
  259. .right {
  260. display: flex;
  261. flex-direction: column;
  262. justify-content: space-evenly;
  263. .top {
  264. font-size: 32rpx;
  265. font-weight: bold;
  266. color: #1A1A1A;
  267. }
  268. .bottom {
  269. margin-top: 10rpx;
  270. .text {
  271. background: #FAFAFA;
  272. border-radius: 20px;
  273. font-size: 26rpx;
  274. font-weight: 700;
  275. color: #666666;
  276. padding: 11rpx 40rpx;
  277. margin-right: 20rpx;
  278. }
  279. }
  280. }
  281. }
  282. .add{
  283. width:84rpx;
  284. position: fixed;
  285. bottom: 26rpx;
  286. right: 26rpx;
  287. }
  288. </style>