select-school.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="select-school-index iPhone-bottom flex-common-css box-border-box">
  3. <Nav :leftShow='leftShow' title='选择学校'></Nav>
  4. <view class="bgc-f box-border-box p-24 mb-28">
  5. <view class="head-search mb-32">
  6. <input v-model="fromData.search" type="text" placeholder="搜索学校名称">
  7. <view class="fs-28 fc-f index-search-box-buttom" @click="search()">搜索</view>
  8. </view>
  9. <view class="head-address display-flex" v-if="schoolData.school_name">
  10. <uni-icons type="location-filled" size="24"></uni-icons>
  11. <view class="ml-16">
  12. <view class="fs-36 fw-600 mb-12">{{schoolData.school_name||''}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="box-border-box p-24 fs-28 fc-9 bgc-f">其他学校</view>
  17. <view class="scroll-view-css" v-if="list.length == 0">
  18. <EnBlank message="没有找到你搜索的学校"></EnBlank>
  19. </view>
  20. <scroll-view v-else scroll-y="true" class="scroll-view-css bgc-f box-border-box plr-32" @scrolltolower="scrolltolower">
  21. <view class="item-box fs-32 fw-400" v-for="(item,i) in list" :key="i" @click="selectSchool(item)">
  22. {{item.school_name}}
  23. </view>
  24. </scroll-view>
  25. <!-- <uni-popup ref="popup" type="bottom">
  26. <view class="pop-coupon box-border-box p-24">
  27. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  28. 请选择楼栋
  29. <uni-icons @click="closePop" class="box-close" type="closeempty" size="20"></uni-icons>
  30. </view>
  31. <view class="head-search mb-32">
  32. <input type="text" placeholder="搜索楼栋名称">
  33. <view class="fs-28 fc-f index-search-box-buttom">搜索</view>
  34. </view>
  35. <view class="scroll-view-css">
  36. <view class="item-box item-box-f fs-32 fw-400"
  37. v-for="(item,i) in 20" :key="i" :class="id == i?'fc-41ABF5':''">
  38. <image src="@/static/img/common/y-select.png" mode=""></image>
  39. 楼栋1
  40. </view>
  41. </view>
  42. </view>
  43. </uni-popup> -->
  44. </view>
  45. </template>
  46. <script>
  47. import EnBlank from '@/components/en-utils/en-blank/en-blank.vue';
  48. import {getSchoolList} from '@/api/common.js';
  49. import tools from "@/service/tools";
  50. export default {
  51. components:{EnBlank},
  52. data(){
  53. return{
  54. indexType:1,//1首页 2校友圈
  55. leftShow:true,
  56. id:0,
  57. total:0,
  58. list:[],
  59. fromData:{
  60. search:'',
  61. page:1,
  62. },
  63. schoolData:{
  64. school_name:'',
  65. },
  66. }
  67. },
  68. onLoad(e) {
  69. this.indexType = Number(e.type);
  70. },
  71. onShow() {
  72. let school_id = uni.getStorageSync('school_id');
  73. let operate_id = uni.getStorageSync('operate_id');
  74. let school_name = uni.getStorageSync('school_name');
  75. if(!school_id||!operate_id){
  76. this.leftShow = false;
  77. }else{
  78. this.leftShow = true;
  79. this.schoolData.school_name = school_name;
  80. }
  81. this.list = [];
  82. this.fromData.page = 1;
  83. this.fromData.search = '';
  84. this.getList();
  85. },
  86. methods:{
  87. getList(){
  88. getSchoolList(this.fromData).then((res)=>{
  89. if(res.code === 1){
  90. this.list = [...this.list,...res.data.items];
  91. this.total = res.data.total;
  92. }
  93. })
  94. },
  95. scrolltolower(){
  96. if(this.list.length < this.total){
  97. this.fromData.page += 1;
  98. this.getList();
  99. }
  100. },
  101. search(){
  102. this.list = [];
  103. this.fromData.page = 1;
  104. this.getList();
  105. },
  106. selectSchool(item){
  107. uni.setStorageSync('school_id',item.school_id);
  108. uni.setStorageSync('operate_id',item.operate_id);
  109. uni.setStorageSync('school_name',item.school_name);
  110. if(this.leftShow){
  111. if(type == 1){
  112. uni.switchTab({
  113. url:'/pages/index/index'
  114. })
  115. }else{
  116. // 跳转校友圈
  117. }
  118. }else{
  119. uni.switchTab({
  120. url:'/pages/index/index'
  121. })
  122. }
  123. },
  124. },
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .select-school-index{
  129. .head-search{
  130. position: relative;
  131. input{
  132. width: 100%;
  133. height: 72rpx;
  134. background: #F4F5F7;
  135. border-radius: 200rpx;
  136. font-size: 32rpx;
  137. box-sizing: border-box;
  138. padding: 0 130rpx 0 24rpx;
  139. }
  140. .index-search-box-buttom{
  141. position: absolute;
  142. right: 6rpx;
  143. top: 6rpx;
  144. width: 120rpx;
  145. height: 60rpx;
  146. background: linear-gradient( 90deg, #57CAFF 0%, #41ABF5 100%);
  147. border-radius: 200rpx;
  148. margin-left: auto;
  149. line-height: 60rpx;
  150. text-align: center;
  151. }
  152. }
  153. .item-box{
  154. box-sizing: border-box;
  155. padding: 24rpx 0;
  156. border-bottom: 1rpx solid #eee;
  157. }
  158. .item-box-f{
  159. width: 100%;
  160. position: absolute;
  161. box-sizing: border-box;
  162. padding-left: 60rpx;
  163. image{
  164. width: 40rpx;
  165. height: 40rpx;
  166. position: absolute;
  167. left: 0;
  168. top: 28rpx;
  169. }
  170. }
  171. .pop-coupon{
  172. width: 100%;
  173. height: 70vh;
  174. background-color: #fff;
  175. border-radius: 24rpx 24rpx 0rpx 0rpx;
  176. padding-top: 32rpx !important;
  177. display: flex;
  178. flex-direction: column;
  179. .box-title{
  180. position: relative;
  181. .box-close{
  182. position: absolute;
  183. right: 22rpx;
  184. }
  185. }
  186. }
  187. }
  188. </style>