協力抗疫,碼力 全開」線上黑客馬拉松+疫同程+疫同
- 2020 年 2 月 6 日
- 筆記
項目名稱
疫同
項目介紹
疫同,一款尋找新型冠狀病毒感染的肺炎確診患者同行程的系統。集成確診同程線索發佈、信息審核、同乘查詢以及自主上報功能,從發佈到上報形成一套閉環,做到疫情的防控的作用。
實現思路
1.用戶上傳確診患者所乘坐過的行程線索,提交form表單
db.collection('Clue').add({ }) //雲數據庫增加表單
2.首頁使用db.RegExp模糊查找數據,並使用.skip()進行分頁加載
db.collection("busData").where( _.or([{ t_no: db.RegExp({ regexp: data.t_no, options: 'i', }), t_date: db.RegExp({ regexp: this.data.date, options: 'i', }), t_pos_start: db.RegExp({ regexp: data.t_city, options: 'i', }), }, { t_no: db.RegExp({ regexp: data.t_no, options: 'i', }), t_date: db.RegExp({ regexp: this.data.date, options: 'i', }), t_pos_end: db.RegExp({ regexp: data.t_city, options: 'i', }), } ]) ).skip(this.data.page).get({ success: res => { wx.hideLoading(); if (res.data.length == 0){ wx.showToast({ icon: 'none', title: '暫無數據' }) }else{ this.setData({ queryResult: res.data, page: this.data.page + 20 }) } }, fail: err => { wx.hideLoading(); wx.showToast({ icon: 'none', title: '暫無數據' }) } })
前端使用wx:for列表渲染和wx:if條件渲染數據
<view class="busList"> <view wx:for="{{queryResult}}" wx:key="item" class="listBox" id="{{item._id}}" bindtap="goTotrip"> <view class="boxListOne"> <view class="t_no"> <view wx:if="{{item.t_type == 1}}" class="t_type"> 飛機:</view> <view wx:if="{{item.t_type == 2}}" class="t_type"> 火車:</view> <view wx:if="{{item.t_type == 3}}" class="t_type"> 地鐵:</view> <view wx:if="{{item.t_type == 4}}" class="t_type"> 大巴:</view> <view wx:if="{{item.t_type == 5}}" class="t_type"> 公交車:</view> <view wx:if="{{item.t_type == 6}}" class="t_type"> 的士:</view> <view wx:if="{{item.t_type == 7}}" class="t_type"> 輪船:</view> <view wx:if="{{item.t_type == 8}}" class="t_type"> 公共場所:</view> {{item.t_no}} </view> <view class="t_date">{{item.t_date}}</view> </view> <view wx:if="{{item.t_pos_start.length > 0}}"> <view class="t_pos_start">{{item.t_pos_start}}</view> => <view class="t_pos_end">{{item.t_pos_end}}</view> </view> <view class="t_no_sub">{{item.t_no_sub}}</view> <view class="t_memo">{{item.t_memo}}</view> <view id="{{index}}" bindtap="copyLink" class="who">消息來源:{{item.who}}</view> </view> </view>
3.項目數據使用「2019ncov.nosugartech.com」的數據接口和小程序中用戶說上傳並核實的線索作為支撐。
錯誤數據反饋:[email protected], [email protected], [email protected]
若各地官方機構希望增補行程數據、尋人信息,可聯繫[email protected]
項目截圖



代碼鏈接
https://gitee.com/tysb7/tcb-hackthon-YT