|
@@ -1,8 +1,12 @@
|
|
|
import { Component } from 'react'
|
|
|
import Taro from '@tarojs/taro'
|
|
|
import { connect } from 'react-redux'
|
|
|
-import {View, Map, Button} from '@tarojs/components'
|
|
|
-import dayjs from 'dayjs';
|
|
|
+import {View} from '@tarojs/components'
|
|
|
+import { AtButton } from 'taro-ui'
|
|
|
+
|
|
|
+import "taro-ui/dist/style/components/icon.scss";
|
|
|
+import "taro-ui/dist/style/components/button.scss";
|
|
|
+import "taro-ui/dist/style/components/loading.scss";
|
|
|
|
|
|
import { add, minus, asyncAdd } from '../../actions/counter'
|
|
|
|
|
@@ -26,124 +30,124 @@ class Index extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state={
|
|
|
- data:[],
|
|
|
- newArrder:{},
|
|
|
- newList:[
|
|
|
+ list:[
|
|
|
{
|
|
|
- longitude: 112.9513,
|
|
|
- latitude: 28.23529,
|
|
|
- title:'营销员1',
|
|
|
- label:{
|
|
|
- content:'营销员1'
|
|
|
- }
|
|
|
+ icon:'bell',
|
|
|
+ title:'打卡',
|
|
|
+ color:'#89ec6d',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'上班'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'下班'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- longitude: 112.9613,
|
|
|
- latitude: 28.23529,
|
|
|
- title:'营销员2',
|
|
|
+ icon:'map-pin',
|
|
|
+ title:'定位轨迹',
|
|
|
+ color:'#3f8ae5',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'我的路线'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'员工分布',
|
|
|
+ url:'/pages/staffDistribution/index'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- longitude: 112.9713,
|
|
|
- latitude: 28.23529,
|
|
|
- title:'营销员3',
|
|
|
- }
|
|
|
- ],
|
|
|
+ icon:'calendar',
|
|
|
+ title:'日报',
|
|
|
+ color:'#3f8ae5',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'添加日报'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon:'shopping-bag',
|
|
|
+ title:'出差',
|
|
|
+ color:'#89ec6d',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'填写出差单',
|
|
|
+ url:'/pages/outdoorActivities/index'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon:'camera',
|
|
|
+ title:'拍照上传',
|
|
|
+ color:'#3f8ae5',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'添加拍照'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon:'credit-card',
|
|
|
+ title:'费用申请',
|
|
|
+ color:'#b19c42',
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name:'填写申请单'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ ]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
componentDidShow () {
|
|
|
- const chooseLocation = requirePlugin('chooseLocation');
|
|
|
- const location = chooseLocation.getLocation();
|
|
|
- console.log(location);
|
|
|
+ let token = Taro.getStorageSync('token');
|
|
|
+ if(!token){
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: '/pages/login/index',
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
- Taro.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- isHighAccuracy:true,
|
|
|
- success: (res)=> {
|
|
|
- const latitude = res.latitude
|
|
|
- const longitude = res.longitude
|
|
|
- console.log(latitude,longitude)
|
|
|
- this.setState({
|
|
|
- newArrder:{
|
|
|
- latitude,
|
|
|
- longitude
|
|
|
- },
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- Taro.startLocationUpdateBackground({
|
|
|
- success:()=>{
|
|
|
- Taro.onLocationChange((data) => {
|
|
|
- let arr = this.state.data
|
|
|
- arr.push({
|
|
|
- long:data.longitude,
|
|
|
- latitude:data.latitude
|
|
|
- })
|
|
|
- console.log(arr,'arr')
|
|
|
- this.setState({
|
|
|
- data:this.state.data
|
|
|
- })
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
}
|
|
|
|
|
|
render () {
|
|
|
return (
|
|
|
- <View>
|
|
|
- <Map
|
|
|
- id="allmap"
|
|
|
- {...this.state.newArrder}
|
|
|
- markers={this.state.newList}
|
|
|
- polyline={[{
|
|
|
- points: [{
|
|
|
- longitude: 112.9513,
|
|
|
- latitude: 28.23529
|
|
|
- }, {
|
|
|
- longitude: 112.9713,
|
|
|
- latitude: 28.23529
|
|
|
- }, {
|
|
|
- longitude: 112.9913,
|
|
|
- latitude: 28.23529
|
|
|
- }, {
|
|
|
- longitude: 112.9313,
|
|
|
- latitude: 28.23529
|
|
|
- },{
|
|
|
- longitude: 112.9313,
|
|
|
- latitude: 28.23529
|
|
|
- },{
|
|
|
- longitude: 112.9313,
|
|
|
- latitude: 28.23529
|
|
|
- }],
|
|
|
- color: "#33c9FFDD",
|
|
|
- width: 3,
|
|
|
- dottedLine: true
|
|
|
- }]}
|
|
|
- circles={[
|
|
|
- {
|
|
|
- longitude: 112.9513,
|
|
|
- latitude: 28.23529,
|
|
|
- color:'#DC3E28',
|
|
|
- fillColor:'#DC3E28',
|
|
|
- radius:50
|
|
|
- }
|
|
|
- ]}
|
|
|
- />
|
|
|
- <Button onClick={()=>{
|
|
|
- const key = 'BP4BZ-JQJED-5DG4N-H6JND-KC5PK-D2BDL'; //使用在腾讯位置服务申请的key
|
|
|
- const referer = '科德高企培育'; //调用插件的app的名称
|
|
|
- const location = JSON.stringify({
|
|
|
- latitude: 39.89631551,
|
|
|
- longitude: 116.323459711
|
|
|
- });
|
|
|
- const category = '生活服务,娱乐休闲';
|
|
|
-
|
|
|
- Taro.navigateTo({
|
|
|
- url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
|
|
|
- });
|
|
|
- }}>选址</Button>
|
|
|
+ <View className='list'>
|
|
|
+ {
|
|
|
+ this.state.list.map((value,key)=>(
|
|
|
+ <View key={key} className='item'>
|
|
|
+ <View className='left' style={{background:value.color}}>
|
|
|
+ <View className={'at-icon at-icon-'+value.icon} style={{color:'#FFF'}}/>
|
|
|
+ <View className='title'>{value.title}</View>
|
|
|
+ </View>
|
|
|
+ <View className='right'>
|
|
|
+ {
|
|
|
+ value.buttons.map((v,k)=>(
|
|
|
+ <AtButton
|
|
|
+ key={k}
|
|
|
+ type='secondary'
|
|
|
+ size='small'
|
|
|
+ className='button'
|
|
|
+ onClick={()=>{
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: v.url,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {v.name}
|
|
|
+ </AtButton>
|
|
|
+ ))
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ ))
|
|
|
+ }
|
|
|
</View>
|
|
|
)
|
|
|
}
|