select-school.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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-20">
  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. <image class="wh-48" src="@/static/img/index/dw.png" mode=""></image>
  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. let circleSchoolId = uni.getStorageSync('circleSchoolId');
  76. let circleSchoolName = uni.getStorageSync('circleSchoolName');
  77. if(!school_id||!operate_id){
  78. this.leftShow = false;
  79. }else{
  80. this.leftShow = true;
  81. if(this.indexType == 1){
  82. this.schoolData.school_name = school_name;
  83. }else{
  84. this.schoolData.school_name = circleSchoolId?circleSchoolName:school_name;
  85. }
  86. }
  87. this.list = [];
  88. this.fromData.page = 1;
  89. this.fromData.search = '';
  90. this.getList();
  91. },
  92. methods:{
  93. getList(){
  94. getSchoolList(this.fromData).then((res)=>{
  95. if(res.code === 1){
  96. this.list = [...this.list,...res.data.items];
  97. this.total = res.data.total;
  98. }
  99. })
  100. },
  101. scrolltolower(){
  102. if(this.list.length < this.total){
  103. this.fromData.page += 1;
  104. this.getList();
  105. }
  106. },
  107. search(){
  108. this.list = [];
  109. this.fromData.page = 1;
  110. this.getList();
  111. },
  112. selectSchool(item){
  113. if(this.indexType == 2){
  114. uni.setStorageSync('circleSchoolId',item.school_id);
  115. uni.setStorageSync('circleSchoolName',item.school_name);
  116. }else{
  117. uni.setStorageSync('school_id',item.school_id);
  118. uni.setStorageSync('operate_id',item.operate_id);
  119. uni.setStorageSync('school_name',item.school_name);
  120. uni.removeStorageSync('site_id')
  121. uni.removeStorageSync('site_name')
  122. uni.removeStorageSync('site_address')
  123. uni.removeStorageSync('site_logo')
  124. }
  125. if(this.leftShow){
  126. if(this.indexType == 1){
  127. uni.switchTab({
  128. url:'/pages/index/index'
  129. })
  130. }else{
  131. // 跳转校友圈
  132. uni.$emit('operateType', true);
  133. uni.navigateBack({
  134. delta: 1,
  135. });
  136. }
  137. }else{
  138. uni.switchTab({
  139. url:'/pages/index/index'
  140. })
  141. }
  142. },
  143. },
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .wh-48 {
  148. width: 48rpx;
  149. height: 48rpx;
  150. }
  151. .select-school-index{
  152. .head-search{
  153. position: relative;
  154. input{
  155. width: 100%;
  156. height: 72rpx;
  157. background: #F4F5F7;
  158. border-radius: 200rpx;
  159. font-size: 32rpx;
  160. box-sizing: border-box;
  161. padding: 0 130rpx 0 24rpx;
  162. }
  163. .index-search-box-buttom{
  164. position: absolute;
  165. right: 6rpx;
  166. top: 6rpx;
  167. width: 120rpx;
  168. height: 60rpx;
  169. background: linear-gradient( 90deg, #57CAFF 0%, #41ABF5 100%);
  170. border-radius: 200rpx;
  171. margin-left: auto;
  172. line-height: 60rpx;
  173. text-align: center;
  174. }
  175. }
  176. .item-box{
  177. box-sizing: border-box;
  178. padding: 24rpx 0;
  179. border-bottom: 1rpx solid #eee;
  180. }
  181. .item-box-f{
  182. width: 100%;
  183. position: absolute;
  184. box-sizing: border-box;
  185. padding-left: 60rpx;
  186. image{
  187. width: 40rpx;
  188. height: 40rpx;
  189. position: absolute;
  190. left: 0;
  191. top: 28rpx;
  192. }
  193. }
  194. .pop-coupon{
  195. width: 100%;
  196. height: 70vh;
  197. background-color: #fff;
  198. border-radius: 24rpx 24rpx 0rpx 0rpx;
  199. padding-top: 32rpx !important;
  200. display: flex;
  201. flex-direction: column;
  202. .box-title{
  203. position: relative;
  204. .box-close{
  205. position: absolute;
  206. right: 22rpx;
  207. }
  208. }
  209. }
  210. }
  211. </style>