@@ -29,7 +29,7 @@ export const getHomeData = function(params) { | |||
*/ | |||
export const getPlatform = function(params) { | |||
return request({ | |||
url: '/city/queryCityList', | |||
url: '/platform/platforms', | |||
method: "GET", | |||
params | |||
}) |
@@ -63,7 +63,7 @@ Component({ | |||
this.setData({ loading: true }) | |||
get(this.data.url, Object.assign({}, { page: this.data.page, limit: this.data.limit }, this.data.params || {})).then(res => { | |||
let records; | |||
if (res.code == 0) { | |||
if (res.code === 0) { | |||
records = getDataByPath(res, this.data.dataPath || "data.records") | |||
} else { | |||
records = []; | |||
@@ -71,10 +71,11 @@ Component({ | |||
if (records.length < this.data.limit) { | |||
this.setData({ more: false }) | |||
} | |||
this.triggerEvent("update-list", records) | |||
this.triggerEvent("update-list", records) | |||
}).catch(e => { | |||
wx.showToast({ | |||
title: e || '系统错误', | |||
title: '系统错误', | |||
icon: 'error', | |||
duration: 1500, | |||
}); | |||
}).finally(() => { |
@@ -31,9 +31,9 @@ | |||
} | |||
.empty-text { | |||
font-size: 32rpx; | |||
font-size: 30rpx; | |||
font-family: "PingFangSC-Regular", "PingFang SC"; | |||
font-weight: normal; | |||
color: #B6CADC; | |||
color: rgba(0, 0, 0, 0.4); | |||
margin-top: 26rpx; | |||
} |
@@ -6,6 +6,6 @@ | |||
</view> | |||
<view class="info_item">租户:{{data.tenantName}}</view> | |||
<view class="info_item">任务地点:{{data.patrolLocation}}</view> | |||
<view class="info_item">期望时间:{{data.taskStartName}}</view> | |||
<view class="info_item">期望时间:{{data.taskStartTime}}</view> | |||
<view wx:if="{{type === 'list'}}" class="info_item">任务状态:<text style="color: {{statusList[data.status].color}}">{{statusList[data.status].text}}</text></view> | |||
</view> |
@@ -1,5 +1,5 @@ | |||
const __request_base_url__ = { | |||
develop: "https://api.gongche.dev.taauav.com/api", | |||
develop: "http://192.168.11.11:7011/pilot/miniprogram", | |||
trial: "https://api.gongche.dev.taauav.com/api", | |||
release: "https://api.gongche.taauav.com/api" | |||
} |
@@ -1,5 +1,6 @@ | |||
// package_A/page/TaskDetail/index.js | |||
import {statusList, baseRules, orderRules} from '../../../utils/data.js' | |||
import {getEquipments, getCloudBox, getMounts} from '../../../api/task.js' | |||
Page({ | |||
@@ -11,24 +12,21 @@ Page({ | |||
dataSource: {}, | |||
statusList, | |||
messageList: [ | |||
{label: '任务执行时间', value: "taskStartTime", icon: ""}, | |||
{label: '任务地点', value: "patrolLocation", icon: ""}, | |||
{label: '任务发起人', value: "taskName", icon: ""}, | |||
{label: '租户名称', value: "tenantName", icon: ""}, | |||
{label: '需要直播', value: "isLive", icon: ""}, | |||
{label: '备注', value: "createTime", icon: ""} | |||
{label: '任务执行时间', value: "taskStartTime", icon: "handletime"}, | |||
{label: '任务地点', value: "patrolLocation", icon: "location"}, | |||
{label: '任务发起人', value: "taskName", icon: "user"}, | |||
{label: '租户名称', value: "tenantName", icon: "tenant"}, | |||
{label: '需要直播', value: "isLive", icon: "islive"}, | |||
{label: '备注', value: "createTime", icon: "notes"} | |||
], | |||
form: {}, | |||
formRules: {}, | |||
formOptions: { | |||
equipmentId: {current: -1, list: [{value: 1, label: '倾斜摄影'}, | |||
{value: 2, label: '正射影像'}]}, | |||
equipmentMountId: {current: -1, list: [{value: 1, label: '倾斜摄影'}, | |||
{value: 2, label: '正射影像'}]}, | |||
equipmentId: {current: -1, list: [], key:'name'}, | |||
equipmentMountId: {current: -1, list: [], key:'name'}, | |||
photographyWay: {current: -1, list: [{value: 1, label: '倾斜摄影'}, | |||
{value: 2, label: '正射影像'}]}, | |||
cloudBoxId: {current: -1, list: [{value: 1, label: '倾斜摄影'}, | |||
{value: 2, label: '正射影像'}]} | |||
{value: 2, label: '正射影像'}], key:'label'}, | |||
cloudBoxId: {current: -1, list: [], key:'boxName'} | |||
}, | |||
disabled: false | |||
}, | |||
@@ -46,15 +44,57 @@ Page({ | |||
} else { | |||
formRules = Object.assign(baseRules, orderRules) | |||
} | |||
if(dataSource.status > 14) { | |||
this.setData({disabled: true}) | |||
} | |||
this.setData({dataSource, taskIsLive: dataSource.isLive, formRules}) | |||
} | |||
}, | |||
onShow() { | |||
this.getEquipmentsList() | |||
this.getCloudBoxList() | |||
this.getMountsList() | |||
}, | |||
/** | |||
* 获取无人机列表 | |||
* @param {*} e | |||
*/ | |||
getEquipmentsList() { | |||
getEquipments().then(res=> { | |||
if(res.code === 0) { | |||
let dataList = res.data | |||
let formOptions = this.data.formOptions | |||
formOptions.equipmentId.list = dataList | |||
this.setData(formOptions) | |||
} | |||
}) | |||
}, | |||
getCloudBoxList() { | |||
getCloudBox().then(res=> { | |||
if(res.code === 0) { | |||
let dataList = res.data | |||
let formOptions = this.data.formOptions | |||
formOptions.cloudBoxId.list = dataList | |||
this.setData(formOptions) | |||
} | |||
}) | |||
}, | |||
getMountsList() { | |||
getMounts().then(res=> { | |||
if(res.code === 0) { | |||
let dataList = res.data | |||
let formOptions = this.data.formOptions | |||
formOptions.equipmentMountId.list = dataList | |||
this.setData(formOptions) | |||
} | |||
}) | |||
}, | |||
/** | |||
* | |||
* 选择 | |||
* @param {*} e | |||
*/ | |||
updateChange(e) { | |||
console.log('事件触发'); | |||
let index = e.currentTarget.dataset.index | |||
let current = parseInt(e.detail.value) | |||
let value = this.data.formOptions[index].list[current].value |
@@ -13,8 +13,8 @@ | |||
<text class="message_head">待接单任务</text> | |||
<view class="message_list"> | |||
<view class="message_item" wx:for="{{messageList}}" wx:key="index"> | |||
<image style="width: 28rpx;height: 28rpx;margin-right: 20rpx;" src="../../../assets/img/home.png"></image> | |||
<text>{{item.label}}:<text>{{item.value}}</text></text> | |||
<image style="width: 28rpx;height: 28rpx;margin-right: 20rpx;" src="{{'../../../assets/img/'+item.icon+'.png'}}"></image> | |||
<text>{{item.label}}:<text wx:if="{{item.value === 'isLive'}}">{{dataSource[item.value] === 0 ? '否' : '是'}}</text><text wx:else>{{dataSource[item.value]}}</text></text> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -23,25 +23,26 @@ | |||
<view class="form_item {{item.warning?'warning':''}}" wx:for="{{formRules}}" wx:key="index"> | |||
<text class="item_label">{{item.name}}</text> | |||
<picker bindchange="updateChange" data-index="{{index}}" value="{{formOptions[item.value].current}}" range="{{formOptions[item.value].list}}" range-key="{{item.rangeKey}}" disabled="{{disabled}}" class="picker_box"> | |||
<view class="picker" wx:if="{{formOptions[item.value].list[formOptions[item.value].current].label}}"> | |||
{{formOptions[item.value].list[formOptions[item.value].current].label}} | |||
<view class="picker" wx:if="{{formOptions[item.value].list[formOptions[item.value].current][item.key]}}"> | |||
{{formOptions[item.value].list[formOptions[item.value].current][item.key]}} | |||
</view> | |||
<view wx:else class="picker"> | |||
{{item.placeholder}} | |||
</view> | |||
<image wx:if="{{!disabled}}" style="width: 20rpx; height: 12rpx; position: absolute; top: 20rpx;right: 20rpx;" src="../../../assets/img/down.png"></image> | |||
</picker> | |||
<text class="tips">{{item.placeholder}}</text> | |||
</view> | |||
</view> | |||
<!-- 飞行信息 --> | |||
<view class="fly_message"> | |||
<text>飞行开始时间:{{dataSource.startTime}}</text> | |||
<text>飞行结束时间:{{dataSource.endTime}}</text> | |||
<text wx:if="{{dataSource.status > 14}}">飞行开始时间:{{dataSource.flightStarTime}}</text> | |||
<text wx:if="{{dataSource.status > 24}}" style="margin-top: 30rpx;">飞行结束时间:{{dataSource.flightEndTime}}</text> | |||
</view> | |||
<!-- 按钮区域 --> | |||
<view class="btn_list"> | |||
<view class="get_order">接单</view> | |||
<view class="get_order">开始飞行</view> | |||
<view class="get_order">结束飞行</view> | |||
<view wx:if="{{dataSource.status === 10}}" class="btn_item order_btn">接单</view> | |||
<view wx:if="{{dataSource.status === 15}}" class="btn_item start_btn">开始飞行</view> | |||
<view wx:if="{{dataSource.status === 20}}" class="btn_item end_btn">结束飞行</view> | |||
</view> | |||
</view> |
@@ -81,6 +81,7 @@ | |||
padding-left: 20rpx; | |||
line-height: 50rpx; | |||
border: 1rpx solid #dedede; | |||
position: relative; | |||
} | |||
.tips{ | |||
position: absolute; | |||
@@ -92,4 +93,34 @@ | |||
} | |||
.warning.form_item .tips{ | |||
display: block; | |||
} | |||
.fly_message { | |||
box-sizing: border-box; | |||
width: 100%; | |||
padding: 0 60rpx 40rpx 60rpx; | |||
color: #666666; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
} | |||
.btn_list { | |||
box-sizing: border-box; | |||
width: 100%; | |||
padding: 40rpx 60rpx; | |||
} | |||
.btn_item { | |||
width: 100%; | |||
height: 90rpx; | |||
line-height: 90rpx; | |||
text-align: center; | |||
border-radius: 46rpx; | |||
color: #ffffff; | |||
font-size: 34rpx; | |||
} | |||
.order_btn, .start_btn { | |||
background-color: rgba(63, 143, 251, 1); | |||
} | |||
.end_btn { | |||
background-color: rgba(232, 86, 86, 1); | |||
} |
@@ -7,63 +7,69 @@ Page({ | |||
*/ | |||
data: { | |||
current: "", | |||
list:[ { | |||
"id":"2", | |||
"tenantName":"江宁区河湖张办公室", | |||
"patrolLocation":"七乡河", | |||
"platformName":"河湖长眼管理平台", | |||
"taskStartName":"2022/8/1", | |||
"status":15, | |||
"isLive":0, | |||
"createTime":"2022/7/9" | |||
list:[], | |||
params: { | |||
sortStartTime: 2 | |||
}, | |||
{ | |||
"id":"3", | |||
"tenantName":"江宁区河湖张办公室", | |||
"patrolLocation":"七乡河", | |||
"platformName":"河湖长眼管理平台", | |||
"taskStartName":"2022/8/1", | |||
"status":20, | |||
"isLive":0, | |||
"createTime":"2022/7/9" | |||
}, | |||
{ | |||
"id":"3", | |||
"tenantName":"江宁区河湖张办公室", | |||
"patrolLocation":"七乡河", | |||
"platformName":"河湖长眼管理平台", | |||
"taskStartName":"2022/8/1", | |||
"status":20, | |||
"isLive":0, | |||
"createTime":"2022/7/9" | |||
}], | |||
params: {}, | |||
sortList:[ | |||
{label: '由远及近', value: 1}, | |||
{label: '由近到远', value: 2} | |||
{label: '正序', value: 1}, | |||
{label: '倒序', value: 2} | |||
], | |||
statusList:[ | |||
{label: '全部', value: 'all'}, | |||
{label: '待接单', value: 10}, | |||
{label: '已接单待飞行', value: 15}, | |||
{label: '已接单', value: 15}, | |||
{label: '飞行中', value: 20}, | |||
{label: '已完成', value: 25} | |||
], | |||
platformOptions:[ | |||
{label: '河湖长眼管理平台', value: 1}, | |||
{label: '林场巡检平台', value: 2}, | |||
], | |||
sortCurrent: -1, | |||
statusCurrent: -1, | |||
platformCurrent: -1, | |||
platformOptions:[], | |||
sortCurrent: 1, | |||
statusCurrent: 0, | |||
platformCurrent: 0, | |||
date: '' | |||
}, | |||
onLoad(e) { | |||
let status = parseInt(e.status) | |||
if(e.status !== 'all') { // 全部任务 | |||
let params = this.data.params | |||
params.status = status | |||
let statusList = this.data.statusList | |||
statusList.forEach((item, index)=> { | |||
if(item.value === status) { | |||
this.setData({statusCurrent: index}) | |||
} | |||
}) | |||
this.setData({params, current: '/task/totalList'}) | |||
} else { | |||
this.setData({current: '/task/totalList'}) | |||
} | |||
}, | |||
onShow() { | |||
this.getPlatformData() | |||
}, | |||
/* 更新数据 */ | |||
updateList(e) { | |||
let list = this.data.list.concat(e.detail || []) | |||
this.setData({ list }) | |||
}, | |||
/* 重置数据 */ | |||
resetList() { | |||
this.setData({ list: [] }) | |||
}, | |||
/** | |||
* 获取平台列表 | |||
* @param {*} | |||
*/ | |||
getPlatformData() { | |||
getPlatform().then(res=> { | |||
if(res.code === 0) { | |||
let platformOptions = res.data | |||
platformOptions.unshift({platformName: '全部'}) | |||
this.setData({platformOptions}) | |||
} | |||
}) | |||
}, | |||
/** | |||
@@ -74,17 +80,29 @@ Page({ | |||
const current = e.detail.current | |||
const type = e.target.dataset.type | |||
let params = this.data.params | |||
let value = this.data.sortList[current].value | |||
params[type] = value | |||
if(type === 'sort') { | |||
if(type === 'sortStartTime') { | |||
let value = this.data.sortList[current].value | |||
params[type] = value | |||
this.setData({ | |||
sortCurrent: current | |||
}) | |||
} else if(type === 'status') { | |||
let value = this.data.statusList[current].value | |||
if(value === 'all') { | |||
delete params.status | |||
} else { | |||
params[type] = value | |||
} | |||
this.setData({ | |||
statusCurrent: current | |||
}) | |||
} else if(type === 'platform') { | |||
} else if(type === 'platformName') { | |||
let value = this.data.platformOptions[current].platformName | |||
if(value === '全部') { | |||
delete params.platformName | |||
} else { | |||
params[type] = value | |||
} | |||
this.setData({ | |||
platformCurrent: current | |||
}) |
@@ -2,9 +2,9 @@ | |||
<view class="task_container"> | |||
<!-- 筛选条件 --> | |||
<view class="select_container"> | |||
<Select data="{{sortList}}" data-type="sort" rangeKey="label" current="{{sortCurrent}}" bind:updateChange="updatePicker"></Select> | |||
<Select data="{{sortList}}" data-type="sortStartTime" rangeKey="label" current="{{sortCurrent}}" bind:updateChange="updatePicker"></Select> | |||
<Select data="{{statusList}}" data-type="status" rangeKey="label" current="{{statusCurrent}}" bind:updateChange="updatePicker"></Select> | |||
<Select data="{{platformOptions}}" data-type="platform" rangeKey="label" current="{{platformCurrent}}" bind:updateChange="updatePicker"></Select> | |||
<Select data="{{platformOptions}}" data-type="platformName" rangeKey="platformName" current="{{platformCurrent}}" bind:updateChange="updatePicker"></Select> | |||
<picker value="{{date}}" mode="date" bindchange="selectTime" style="width: 160rpx;padding-right: 20rpx;"> | |||
<view wx:if="{{date}}">{{date}}</view> | |||
<view wx:else>日期</view> | |||
@@ -13,7 +13,7 @@ | |||
<!-- 列表 --> | |||
<List id="list" class="task_list" url="{{current}}" bind:update-list="updateList" list="{{list}}" bind:reset-list="resetList" params="{{params}}"> | |||
<view class="task_item" data-current="{{index}}" wx:for="{{list}}" wx:key="index"> | |||
<image style="width:60rpx;height:60rpx;border-radius:50%;" src="../../../assets/img/home.png"></image> | |||
<image style="width:60rpx;height:60rpx;border-radius:50%;" src="{{item.avatar || '../../../assets/img/home.png'}}"></image> | |||
<view class="task_main" data-item="{{item}}" bindtap="showDetail"> | |||
<task-info data="{{item}}" type="list"></task-info> | |||
</view> |
@@ -3,12 +3,14 @@ | |||
box-sizing: border-box; | |||
width: 100%; | |||
height: 100vh; | |||
padding-top: 90rpx; | |||
background-color: rgba(240, 242, 245, 1); | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: center; | |||
color: #333333; | |||
position: relative; | |||
} | |||
.select_container { | |||
width: 100%; | |||
@@ -17,6 +19,10 @@ | |||
display: flex; | |||
justify-content: space-evenly; | |||
align-items: center; | |||
position: fixed; | |||
top: 0; | |||
left: 0; | |||
z-index: 99; | |||
} | |||
/* 列表样式 */ | |||
@@ -24,6 +30,7 @@ | |||
box-sizing: border-box; | |||
width: 100%; | |||
height: 100%; | |||
padding-bottom: 20rpx; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; |
@@ -1,51 +1,56 @@ | |||
// pages/task/task.js | |||
import {getBanner, getHomeData} from '../../api/task.js' | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
bannerList: [ | |||
{cover: 'http://h.hiphotos.baidu.com/image/pic/item/7c1ed21b0ef41bd5f2c2a9e953da81cb39db3d1d.jpg'}, | |||
{cover: "http://c.hiphotos.baidu.com/image/pic/item/30adcbef76094b36de8a2fe5a1cc7cd98d109d99.jpg"}, | |||
{cover: 'http://e.hiphotos.baidu.com/image/pic/item/a1ec08fa513d2697e542494057fbb2fb4316d81e.jpg'}, | |||
{cover: 'http://g.hiphotos.baidu.com/image/pic/item/6d81800a19d8bc3e770bd00d868ba61ea9d345f2.jpg'} | |||
], // 轮播图 | |||
dataSource: { | |||
platformName: '智慧河长管理平台', | |||
createTime: '2022-10-22', | |||
tenantName: '江宁租户', | |||
patrolLocation: '江宁区河湖长办公室', | |||
taskStartName: '2022-10-22', | |||
status: 20 | |||
bannerList: [], // 轮播图 | |||
dataList: { | |||
todoTaskList: [], | |||
receivedList: [], | |||
completedList: [] | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onLoad: function (options) { | |||
onShow: function () { | |||
this.getBannerList() | |||
this.getHomeList() | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
* 获取banner列表 | |||
* @param {*} e | |||
*/ | |||
onReady: function () { | |||
getBannerList() { | |||
getBanner().then(res=> { | |||
if(res.code === 0) { | |||
let bannerList = res.data | |||
this.setData({bannerList}) | |||
} | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
* 获取首页数据列表 | |||
* @param {*} e | |||
*/ | |||
onShow: function () {}, | |||
getHomeList() { | |||
getHomeData().then(res=> { | |||
let dataList = res.data | |||
this.setData({dataList}) | |||
}) | |||
}, | |||
/** | |||
* 进入任务列表 | |||
*/ | |||
goTaskPage(e) { | |||
console.log(e.currentTarget.dataset.status); | |||
let status = e.currentTarget.dataset.status | |||
wx.navigateTo({ | |||
url: '/package_A/page/alltask/index', | |||
url: '/package_A/page/alltask/index?status=' + status, | |||
}) | |||
}, | |||
@@ -57,40 +62,6 @@ Page({ | |||
wx.navigateTo({ | |||
url: '/package_A/page/TaskDetail/index?data=' + JSON.stringify(detail), | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function () { | |||
} | |||
}) |
@@ -27,37 +27,37 @@ | |||
<view class="task_card"> | |||
<view class="card_head"> | |||
<view class="card_label"> | |||
<image class="task_icon" src="../../assets/img/home.png"></image> | |||
<image class="task_icon" src="../../assets/img/alarm.png"></image> | |||
<text style="color:rgba(51, 51, 51, 1); font-size: 34rpx; font-weight: bold;">待接单任务</text> | |||
</view> | |||
<view class="more">更多 ></view> | |||
<view bindtap="goTaskPage" data-status="{{10}}" class="more">更多 ></view> | |||
</view> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataSource}}"> | |||
<task-info data="{{dataSource}}" type="home"></task-info> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataList.todoTaskList[0]}}"> | |||
<task-info data="{{dataList.todoTaskList[0]}}" type="home"></task-info> | |||
</view> | |||
</view> | |||
<view class="task_card"> | |||
<view class="card_head"> | |||
<view class="card_label"> | |||
<image class="task_icon" src="../../assets/img/home.png"></image> | |||
<image class="task_icon" src="../../assets/img/list.png"></image> | |||
<text style="color:rgba(51, 51, 51, 1); font-size: 34rpx; font-weight: bold;">已接单任务</text> | |||
</view> | |||
<view class="more">更多 ></view> | |||
<view class="more" bindtap="goTaskPage" data-status="{{15}}">更多 ></view> | |||
</view> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataSource}}"> | |||
<task-info data="{{dataSource}}" type="home"></task-info> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataList.receivedList[0]}}"> | |||
<task-info data="{{dataList.receivedList[0]}}" type="home"></task-info> | |||
</view> | |||
</view> | |||
<view class="task_card"> | |||
<view class="card_head"> | |||
<view class="card_label"> | |||
<image class="task_icon" src="../../assets/img/home.png"></image> | |||
<image class="task_icon" src="../../assets/img/finish.png"></image> | |||
<text style="color:rgba(51, 51, 51, 1); font-size: 34rpx; font-weight: bold;">已完成任务</text> | |||
</view> | |||
<view class="more">更多 ></view> | |||
<view class="more" bindtap="goTaskPage" data-status="{{25}}">更多 ></view> | |||
</view> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataSource}}"> | |||
<task-info data="{{dataSource}}" type="home"></task-info> | |||
<view class="task_main" bindtap="goTaskDetail" data-detail="{{dataList.completedList[0]}}"> | |||
<task-info data="{{dataList.completedList[0]}}" type="home"></task-info> | |||
</view> | |||
</view> | |||
</view> |
@@ -57,9 +57,14 @@ | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
.card_label { | |||
display: flex; | |||
justify-content: flex-start; | |||
align-items: center; | |||
} | |||
.task_icon { | |||
width: 34rpx; | |||
height: 40rpx; | |||
width: 48rpx; | |||
height: 48rpx; | |||
margin-right: 15rpx; | |||
} | |||
.more { |
@@ -11,10 +11,10 @@ export const request = function(data) { | |||
// 接口api拼接环境地址 | |||
data.url = baseurl + data.url | |||
// 处理需要token的请求 | |||
if(!isWithoutToken(data)) { | |||
let baseHeader = {authorization: wx.getStorageSync('token')} | |||
data.header = Object.assign(data.header || {}, baseHeader) | |||
} | |||
// if(!isWithoutToken(data)) { | |||
// let baseHeader = {authorization: wx.getStorageSync('token')} | |||
// data.header = Object.assign(data.header || {}, baseHeader) | |||
// } | |||
wx.request({ | |||
...data, | |||
success: function(res) { |
@@ -1,19 +1,95 @@ | |||
const formatTime = date => { | |||
const year = date.getFullYear() | |||
const month = date.getMonth() + 1 | |||
const day = date.getDate() | |||
const hour = date.getHours() | |||
const minute = date.getMinutes() | |||
const second = date.getSeconds() | |||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` | |||
} | |||
const formatNumber = n => { | |||
n = n.toString() | |||
return n[1] ? n : `0${n}` | |||
} | |||
module.exports = { | |||
formatTime | |||
} | |||
export const formatTime = date => { | |||
const year = date.getFullYear() | |||
const month = date.getMonth() + 1 | |||
const day = date.getDate() | |||
const hour = date.getHours() | |||
const minute = date.getMinutes() | |||
const second = date.getSeconds() | |||
return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute, second].map(formatNumber).join(':')}` | |||
} | |||
const formatNumber = n => { | |||
n = n.toString() | |||
return n[1] ? n : `0${n}` | |||
} | |||
export let isType = (type, target) => Object.prototype.toString.call(target) == `[object ${type}]` | |||
export function getDataByPath(data, dataPath) { | |||
dataPath = dataPath.split('.'); | |||
for (let key of dataPath) { | |||
if (!data) return null; | |||
data = data[key] | |||
} | |||
return data; | |||
} | |||
/** | |||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换 | |||
* 即谷歌、高德 转 百度 | |||
*/ | |||
var x_PI = 3.14159265358979324 * 3000.0 / 180.0; | |||
var PI = 3.1415926535897932384626; | |||
var a = 6378245.0; | |||
var ee = 0.00669342162296594323; | |||
export function out_of_china(lng, lat) { | |||
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false); | |||
} | |||
export function gcj02tobd09(lng, lat) { | |||
var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI); | |||
var theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI); | |||
var bd_lng = z * Math.cos(theta) + 0.0065; | |||
var bd_lat = z * Math.sin(theta) + 0.006; | |||
return [bd_lng, bd_lat] | |||
} | |||
export function transformlat(lng, lat) { | |||
var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); | |||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; | |||
ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0; | |||
ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0; | |||
return ret | |||
} | |||
export function transformlng(lng, lat) { | |||
var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); | |||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; | |||
ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0; | |||
ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0; | |||
return ret | |||
} | |||
export function wgs84togcj02(coordinate) { | |||
let lng = coordinate[0]; | |||
let lat = coordinate[1]; | |||
if (out_of_china(lng, lat)) { | |||
return [lng, lat] | |||
} | |||
else { | |||
var dlat = transformlat(lng - 105.0, lat - 35.0); | |||
var dlng = transformlng(lng - 105.0, lat - 35.0); | |||
var radlat = lat / 180.0 * PI; | |||
var magic = Math.sin(radlat); | |||
magic = 1 - ee * magic * magic; | |||
var sqrtmagic = Math.sqrt(magic); | |||
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); | |||
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); | |||
var mglat = parseFloat(lat) + parseFloat(dlat); | |||
var mglng = parseFloat(lng) + parseFloat(dlng); | |||
return [mglng, mglat] | |||
} | |||
} | |||
export function foramtRegion(arr,data){ | |||
for(let item of data){ | |||
let tem=[] | |||
for(let key of arr){ | |||
if(item[key]){ | |||
tem.push(item[key]) | |||
}else{ | |||
break; | |||
} | |||
} | |||
item.region=tem.join("/"); | |||
} | |||
return data; | |||
} | |||