addressBook.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="content">
  3. <searchInput :searchType="2"/>
  4. <addressBook :list="firendItem" :scrollTop="scrollTop" :isShowMenu="true" @linkTo="linkToCard"></addressBook>
  5. </view>
  6. </template>
  7. <script>
  8. import searchInput from '@/components/searchInput/index.vue'
  9. import addressBook from '@/components/addressBook.vue'
  10. import { openFSqlite, createFSQL, selectFSQL, addFSQL } from '../../util/f.js'
  11. export default {
  12. components:{searchInput, addressBook},
  13. data() {
  14. return {
  15. scrollTop: 0
  16. };
  17. },
  18. onShow() {
  19. this.getFriends(false)
  20. },
  21. onPageScroll(e) {
  22. this.scrollTop = e.scrollTop;
  23. },
  24. onPullDownRefresh() {
  25. this.getFriends(true)
  26. },
  27. methods: {
  28. getFriends (freshFlag) {
  29. // #ifndef H5
  30. var list = [];
  31. selectFSQL(this.userData.user.operId).then(res=>{
  32. this.indexList.forEach(name=>{
  33. var members = [];
  34. res.forEach(f=>{
  35. if(f.name===name){
  36. members.push(f);
  37. }
  38. });
  39. let obj = {
  40. name: name,
  41. members: members
  42. };
  43. list.push(obj);
  44. });
  45. this.$u.vuex('firendItem', list);
  46. if(freshFlag){
  47. uni.stopPullDownRefresh();
  48. }
  49. });
  50. // #endif
  51. // #ifndef APP-PLUS
  52. this.$socket.listGuests(this.userData.user.operId, res => {
  53. this.$u.vuex('firendItem', res.response.data)
  54. if(freshFlag){
  55. uni.stopPullDownRefresh();
  56. }
  57. })
  58. // #endif
  59. },
  60. linkToCard({id}){
  61. this.$u.route({
  62. url: 'pages/businessCard/businessCard',
  63. params:{ id: id, source: 1}
  64. });
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .content {
  71. height: 100%;
  72. }
  73. </style>