Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

selectBuilding.vue 1.4 KiB

il y a 2 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="selectBuilding">
  3. <view class="searchStyle">
  4. <u-search placeholder="输入项目名称" v-model="search" @search="s" @custom="s"></u-search>
  5. </view>
  6. <view class="searchResultStyle">
  7. <view class="searchList" v-for="(item,index) in list" :key="index" @click="okSelect(item.id,item.propertyName)">
  8. {{item.propertyName}}
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. var config = require("@/config");
  15. export default {
  16. name: "selectBuilding",
  17. data() {
  18. return {
  19. search: "",
  20. list: [],
  21. };
  22. },
  23. methods:{
  24. s(e){
  25. this.init(e)
  26. },
  27. okSelect(id,name){
  28. let lopan = {
  29. id,
  30. name
  31. }
  32. uni.setStorageSync("buildingID", lopan);
  33. uni.navigateBack({
  34. delta:-1
  35. })
  36. },
  37. init(e){
  38. let data = {houseName:decodeURI(e)||''}
  39. uni.request({
  40. url: config.service.getUser,
  41. method: "GET",
  42. data,
  43. header: {
  44. 'content-type': 'application/json',
  45. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  46. },
  47. success: (res) => {
  48. console.log(res)
  49. this.list = res.data.data.zkProperties
  50. }
  51. })
  52. }
  53. },
  54. onLoad() {
  55. this.init("")
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .selectBuilding {
  61. .searchStyle {
  62. padding: 20rpx;
  63. }
  64. .searchResultStyle {
  65. padding: 0 30rpx;
  66. .searchList{
  67. border-bottom: 1rpx solid #E0E0E0;
  68. padding: 30rpx 0;
  69. font-size: 30rpx;
  70. }
  71. }
  72. }
  73. </style>