<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 失物招領頁面 [TOC] 功能點: * [ ] Mock * [ ] 分頁加載數據 * [ ] 上拉加載更多 * [ ] Tab * [ ] 搜索 項目完整代碼: ``` https://gitee.com/zengqs/uni-app-course-2019/tree/master/lostAndFind ``` ## Mock數據 /common/api/lost.js ``` const Mock = require('mockjs') export default { getList(map = {}) { console.log(map); return new Promise((resolve, reject) => { //返回分頁數據 let mockOption = { errno: 0, errmsg: '獲取信息成功', data: { count: 28, totalPages: 3, pageSize: () => { return parseInt(map.pageSize || 5); }, currentPage: () => { return parseInt(map.page || 1); }, 'data|10': [{ 'id': '@increment()', // "title": "雨傘", //項目名稱 title: () => { if (map.key) { return map.key } else { return "雨傘" } }, 'name': '@cname()', "address": "廣州番禺職業技術學院6號樓6517", "telphone": /^1[345789]\d{9}$/, "images": ["@image('200x200')", "@image('200x200')", "@image('200x200')"], // "type|1": ["丟失", "撿到"], "type": () => { if (map.type == "" || map.type == '全部') { let list = ["丟失", "撿到"]; return list[Mock.Random.integer(0, list.length - 1)]; } else { return map.type } }, "date": "@date()" }] } } resolve(Mock.mock(mockOption)) }); }, getInfo(id, map = {}) { return new Promise((resolve, reject) => { let mockOption = { errno: 0, errmsg: '獲取信息成功', 'data': { 'id': '@increment()', // "title": "雨傘", //項目名稱 title: () => { if (map.key) { return map.key } else { return "雨傘" } }, 'name': '@cname()', "address": "廣州番禺職業技術學院6號樓6517", "telphone": /^1[345789]\d{9}$/, "images": ["@image('200x200')", "@image('200x200')", "@image('200x200')"], // "type|1": ["丟失", "撿到"], "type": () => { if (map.type == "" || map.type == '全部') { let list = ["丟失", "撿到"]; return list[Mock.Random.integer(0, list.length - 1)]; } else { return map.type } }, "date": "@date()" } } resolve(Mock.mock(mockOption)) }) }, } ``` 文件:/common/api/index.js ``` import lost from './lost.js' export default { lost, } export { lost } ``` ## 查找頁面 文件: `/pages/tabbar/lost/index.vue` ![](https://box.kancloud.cn/af40f632b3aa93dadb21af0f4b581627_417x739.png) ``` <template> <view class="ts-column ts-flex-item"> <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"> <swiper-item> <view class="swiper-item"> <ts-banner class="ts-row ts-flex-item" image="http://dev.zengqs.com/resource/images/app/syb/banner-1.jpg" :height="350"></ts-banner> </view> </swiper-item> <swiper-item> <view class="swiper-item"> <ts-banner class="ts-row ts-flex-item" image="http://dev.zengqs.com/resource/images/app/syb/banner-2.jpg" :height="350"></ts-banner> </view> </swiper-item> <swiper-item> <view class="swiper-item"> <ts-banner class="ts-row ts-flex-item" image="http://dev.zengqs.com/resource/images/app/syb/banner-3.jpg" :height="350"></ts-banner> </view> </swiper-item> <swiper-item> <view class="swiper-item"> <ts-banner class="ts-row ts-flex-item" image="http://dev.zengqs.com/resource/images/app/syb/banner-4.jpg" :height="350"></ts-banner> </view> </swiper-item> <swiper-item> <view class="swiper-item"> <ts-banner class="ts-row ts-flex-item" image="http://dev.zengqs.com/resource/images/app/syb/banner-1.jpg" :height="350"></ts-banner> </view> </swiper-item> </swiper> <ts-search-bar :keywords="keywords" @search="doSearch"></ts-search-bar> <view class="ts-row ts-flex-item"> <ts-segmented-control :values="tabs" styleType="text" @clickItem="onClickItem"></ts-segmented-control> </view> <view class="ts-column" v-for="(item ,index) in searchResult" :key="index"> <view class="ts-row ts-padding" style="align-items:flex-start;"> <view class=""> <image src="http://dev.zengqs.com/resource/images/app/lost/female-350x420.jpg" style="width: 100upx; height: 100upx; border-radius: 75upx;"></image> </view> <view class="ts-section ts-padding-left"> <view class="ts-section-title"> <view class="ts-row"> <view class="ts-flex-item" style="align-items: flex-end;"> <text class="ts-h4">{{item.name}} </text> <text class="ts-h6 ts-padding-left">{{item.telphone}}</text> </view> <view> <ts-badge :text="item.type" type="success" size="small"></ts-badge> </view> </view> </view> <view class="ts-section-body"> <view class="ts-row ts-h4" style="justify-content: space-between;"> {{item.title}} </view> <view class="ts-row" style="justify-content: space-between;"> {{item.address}} </view> <view class="ts-row" style="flex-wrap: wrap;"> <view class="ts-row ts-padding-right ts-padding-bottom" v-for="(img,idx) in item.images" :key="idx" style="width: 150upx; height: 150upx;"> <image :src="img" style="width: 100%; height: 100%;"></image> </view> </view> </view> </view> </view> <ts-gap></ts-gap> </view> <ts-load-more :loadingType="loadingType"></ts-load-more> </view> </template> <script> import api from '@/common/api'; export default { data() { return { currentTab: 0, tabs: ['全部', '丟失', '撿到'], searchResult: [], type: '全部', keywords: '', page: 0, loadingType: 0, } }, async onReachBottom() { await this.loadMoreSearcheResult(); }, async onLoad() { await this.loadMoreSearcheResult(); }, methods: { async doSearch(keywords = "") { this.keywords = keywords; let types = ['全部', '丟失', '撿到']; this.type = types[this.currentTab]; this.searchResult = []; this.loadingType = 0; await this.loadMoreSearcheResult(); }, async loadMoreSearcheResult() { //上拉的狀態:0-loading前;1-loading中;2-沒有更多了 if (this.loadingType !== 0) { return; } this.loadingType = 1; this.page = this.page + 1; // api.lost.getList({ // page: this.page, // key: this.keywords, // type: this.type, // }).then(res => { // if (res.errno === 0) { // const data = res.data; // if (data && data.data) { // this.searchResult = this.searchResult.concat(data.data); // } // if (data.totalPages === data.currentPage) { // this.loadingType = 2; //2-沒有更多了 // } else { // this.loadingType = 0; //開啟新一輪加載 // } // } else { // console.log(res.errmsg); // } // }); let res = await api.lost.getList({ page: this.page, key: this.keywords, type: this.type, pageSize: 5, }); if (res.errno === 0) { const data = res.data; if (data && data.data) { console.log(data); this.searchResult = this.searchResult.concat(data.data); } if (data.totalPages === data.currentPage) { this.loadingType = 2; //2-沒有更多了 } else { this.loadingType = 0; //開啟新一輪加載 } } else { console.log(res.errmsg); } }, async onClickItem(index) { if (this.currentTab !== index) { this.currentTab = index; await this.doSearch(); } } } } </script> <style> </style> ``` ## 發布頁面 ![](https://box.kancloud.cn/83f809c7504f3f7255df98e281be3e13_424x741.png) ``` <template> <view class="ts-column ts-padding"> <view class="ts-row"> <view class="ts-row ts-padding" style="flex:1;"> <ts-button :borderRadius="30" type="success" :inverted="type!='lost'" @click="switchType">丟失</ts-button> </view> <view class="ts-row ts-padding" style="flex:1;"> <ts-button :borderRadius="30" type="success" :inverted="type==='lost'" @click="switchType">撿到</ts-button> </view> </view> <view class="ts-row ts-padding"> </view> <view class="ts-row"> <view class="ts-row" style="flex:1;"> 我的名字 </view> <view class="ts-row" style="flex:3;"> <input type="text" placeholder="請填寫您的姓名" /> </view> </view> <view class="ts-row"> <view class="ts-row" style="flex:1;"> 聯系方式 </view> <view class="ts-row" style="flex:3;"> <input type="text" placeholder="請填寫您的手機號碼" /> </view> </view> <view class="ts-row"> <view class="ts-row" style="flex:1;"> {{typeMessage}}物品 </view> <view class="ts-row" style="flex:3;"> <input type="text" placeholder="請填寫丟失物品的名稱" /> </view> </view> <view class="ts-row"> <view class="ts-row" style="flex:1;"> {{typeMessage}}地點 </view> <view class="ts-row" style="flex:3;"> <input type="text" placeholder="請填寫丟失物品的地點" /> </view> </view> <view class="ts-column"> <view class="ts-row ts-flex-item ts-h6"> 上傳{{typeMessage}}物品的圖片,方便找回,最多上傳3張圖片。 </view> <view class="ts-row ts-flex-item"> <ts-image-uploader :count="3"></ts-image-uploader> </view> </view> <view class="ts-column"> <view class="ts-row ts-flex-item"> <ts-button>發布</ts-button> </view> </view> </view> </template> <script> import tsImageUploader from "@/components/teaset/components/ts-image-uploader/ts-image-uploader.vue" export default { components: { tsImageUploader }, data() { return { type: "lost" } }, methods: { switchType() { this.type = this.type == "lost" ? "" : "lost"; } }, computed: { typeMessage() { return (this.type == "lost" ? "丟失" : "撿到"); } } } </script> <style> view { font-size: 32upx; line-height: 2.2em; } input { border-bottom: #C0C0C0 solid 1px; display: flex; flex: 3; } </style> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看