select-school.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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.reLaunch({
  133. url:'/pages-school/school-circle'
  134. })
  135. }
  136. }else{
  137. uni.switchTab({
  138. url:'/pages/index/index'
  139. })
  140. }
  141. },
  142. },
  143. }
  144. </script>
  145. <style scoped lang="scss">
  146. .wh-48 {
  147. width: 48rpx;
  148. height: 48rpx;
  149. }
  150. .select-school-index{
  151. .head-search{
  152. position: relative;
  153. input{
  154. width: 100%;
  155. height: 72rpx;
  156. background: #F4F5F7;
  157. border-radius: 200rpx;
  158. font-size: 32rpx;
  159. box-sizing: border-box;
  160. padding: 0 130rpx 0 24rpx;
  161. }
  162. .index-search-box-buttom{
  163. position: absolute;
  164. right: 6rpx;
  165. top: 6rpx;
  166. width: 120rpx;
  167. height: 60rpx;
  168. background: linear-gradient( 90deg, #57CAFF 0%, #41ABF5 100%);
  169. border-radius: 200rpx;
  170. margin-left: auto;
  171. line-height: 60rpx;
  172. text-align: center;
  173. }
  174. }
  175. .item-box{
  176. box-sizing: border-box;
  177. padding: 24rpx 0;
  178. border-bottom: 1rpx solid #eee;
  179. }
  180. .item-box-f{
  181. width: 100%;
  182. position: absolute;
  183. box-sizing: border-box;
  184. padding-left: 60rpx;
  185. image{
  186. width: 40rpx;
  187. height: 40rpx;
  188. position: absolute;
  189. left: 0;
  190. top: 28rpx;
  191. }
  192. }
  193. .pop-coupon{
  194. width: 100%;
  195. height: 70vh;
  196. background-color: #fff;
  197. border-radius: 24rpx 24rpx 0rpx 0rpx;
  198. padding-top: 32rpx !important;
  199. display: flex;
  200. flex-direction: column;
  201. .box-title{
  202. position: relative;
  203. .box-close{
  204. position: absolute;
  205. right: 22rpx;
  206. }
  207. }
  208. }
  209. }
  210. </style>