| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <template>
- <view class="select-school-index iPhone-bottom flex-common-css box-border-box">
- <Nav :leftShow='leftShow' title='选择学校'></Nav>
-
- <view class="bgc-f box-border-box p-24 mb-20">
- <view class="head-search mb-32">
- <input v-model="fromData.search" type="text" placeholder="搜索学校名称">
- <view class="fs-28 fc-f index-search-box-buttom" @click="search()">搜索</view>
- </view>
-
- <view class="head-address display-flex" v-if="schoolData.school_name">
- <image class="wh-48" src="@/static/img/index/dw.png" mode=""></image>
- <view class="ml-16">
- <view class="fs-36 fw-600 mb-12">{{schoolData.school_name||''}}</view>
- </view>
- </view>
- </view>
-
- <view class="box-border-box p-24 fs-28 fc-9 bgc-f">其他学校</view>
-
- <view class="scroll-view-css" v-if="list.length == 0">
- <EnBlank message="没有找到你搜索的学校"></EnBlank>
- </view>
- <scroll-view v-else scroll-y="true" class="scroll-view-css bgc-f box-border-box plr-32" @scrolltolower="scrolltolower">
-
- <view class="item-box fs-32 fw-400" v-for="(item,i) in list" :key="i" @click="selectSchool(item)">
- {{item.school_name}}
- </view>
- </scroll-view>
-
- <!-- <uni-popup ref="popup" type="bottom">
- <view class="pop-coupon box-border-box p-24">
- <view class="text-align-center fs-36 fw-600 box-title mb-32">
- 请选择楼栋
- <uni-icons @click="closePop" class="box-close" type="closeempty" size="20"></uni-icons>
- </view>
- <view class="head-search mb-32">
- <input type="text" placeholder="搜索楼栋名称">
- <view class="fs-28 fc-f index-search-box-buttom">搜索</view>
- </view>
-
- <view class="scroll-view-css">
- <view class="item-box item-box-f fs-32 fw-400"
- v-for="(item,i) in 20" :key="i" :class="id == i?'fc-41ABF5':''">
- <image src="@/static/img/common/y-select.png" mode=""></image>
- 楼栋1
- </view>
- </view>
- </view>
- </uni-popup> -->
- </view>
- </template>
- <script>
- import EnBlank from '@/components/en-utils/en-blank/en-blank.vue';
- import {getSchoolList} from '@/api/common.js';
- import tools from "@/service/tools";
- export default {
- components:{EnBlank},
- data(){
- return{
- indexType:1,//1首页 2校友圈
- leftShow:true,
- id:0,
-
- total:0,
- list:[],
- fromData:{
- search:'',
- page:1,
- },
- schoolData:{
- school_name:'',
- },
- }
- },
- onLoad(e) {
- this.indexType = Number(e.type);
- },
- onShow() {
- let school_id = uni.getStorageSync('school_id');
- let operate_id = uni.getStorageSync('operate_id');
- let school_name = uni.getStorageSync('school_name');
- let circleSchoolId = uni.getStorageSync('circleSchoolId');
- let circleSchoolName = uni.getStorageSync('circleSchoolName');
-
- if(!school_id||!operate_id){
- this.leftShow = false;
- }else{
- this.leftShow = true;
- if(this.indexType == 1){
- this.schoolData.school_name = school_name;
- }else{
- this.schoolData.school_name = circleSchoolId?circleSchoolName:school_name;
- }
-
- }
- this.list = [];
- this.fromData.page = 1;
- this.fromData.search = '';
- this.getList();
- },
- methods:{
- getList(){
- getSchoolList(this.fromData).then((res)=>{
- if(res.code === 1){
- this.list = [...this.list,...res.data.items];
- this.total = res.data.total;
- }
- })
- },
- scrolltolower(){
- if(this.list.length < this.total){
- this.fromData.page += 1;
- this.getList();
- }
- },
-
- search(){
- this.list = [];
- this.fromData.page = 1;
- this.getList();
- },
-
- selectSchool(item){
- if(this.indexType == 2){
- uni.setStorageSync('circleSchoolId',item.school_id);
- uni.setStorageSync('circleSchoolName',item.school_name);
- }else{
- uni.setStorageSync('school_id',item.school_id);
- uni.setStorageSync('operate_id',item.operate_id);
- uni.setStorageSync('school_name',item.school_name);
-
- uni.removeStorageSync('site_id')
- uni.removeStorageSync('site_name')
- uni.removeStorageSync('site_address')
- uni.removeStorageSync('site_logo')
- }
- if(this.leftShow){
- if(this.indexType == 1){
- uni.switchTab({
- url:'/pages/index/index'
- })
- }else{
- // 跳转校友圈
- uni.$emit('operateType', true);
- uni.navigateBack({
- delta: 1,
- });
- }
- }else{
- uni.switchTab({
- url:'/pages/index/index'
- })
- }
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .wh-48 {
- width: 48rpx;
- height: 48rpx;
- }
- .select-school-index{
- .head-search{
- position: relative;
- input{
- width: 100%;
- height: 72rpx;
- background: #F4F5F7;
- border-radius: 200rpx;
- font-size: 32rpx;
- box-sizing: border-box;
- padding: 0 130rpx 0 24rpx;
- }
- .index-search-box-buttom{
- position: absolute;
- right: 6rpx;
- top: 6rpx;
- width: 120rpx;
- height: 60rpx;
- background: linear-gradient( 90deg, #57CAFF 0%, #41ABF5 100%);
- border-radius: 200rpx;
- margin-left: auto;
- line-height: 60rpx;
- text-align: center;
- }
- }
- .item-box{
- box-sizing: border-box;
- padding: 24rpx 0;
- border-bottom: 1rpx solid #eee;
- }
- .item-box-f{
- width: 100%;
- position: absolute;
- box-sizing: border-box;
- padding-left: 60rpx;
- image{
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- left: 0;
- top: 28rpx;
- }
- }
- .pop-coupon{
- width: 100%;
- height: 70vh;
- background-color: #fff;
- border-radius: 24rpx 24rpx 0rpx 0rpx;
- padding-top: 32rpx !important;
- display: flex;
- flex-direction: column;
- .box-title{
- position: relative;
- .box-close{
- position: absolute;
- right: 22rpx;
- }
- }
-
- }
- }
- </style>
|