8 changed files with 187 additions and 33 deletions
@ -1,15 +1,25 @@ |
|||||
import Vue from 'vue'; |
import Vue from 'vue'; |
||||
import { http } from 'plugins/request/index'; |
import { http } from 'plugins/request/index'; |
||||
import App from './App'; |
import App from './App'; |
||||
// import store from './store';
|
// import store from './store';
|
||||
|
|
||||
Vue.config.productionTip = false |
Vue.config.productionTip = false; |
||||
Vue.prototype.$http = http; |
Vue.prototype.$http = http; |
||||
|
|
||||
App.mpType = 'app' |
/** |
||||
|
* 打开某个页面 |
||||
|
* @param {string} path 页面完成路径 |
||||
|
* @param {string} query 参数字符串a=x&b=y |
||||
|
*/ |
||||
|
Vue.prototype.openPage = function(path, query = '') { |
||||
|
let url = query ? `${path}?${query}` : path; |
||||
|
uni.navigateTo({ url }); |
||||
|
}; |
||||
|
|
||||
const app = new Vue({ |
App.mpType = 'app'; |
||||
|
|
||||
|
const app = new Vue({ |
||||
// store,
|
// store,
|
||||
...App |
...App, |
||||
}) |
}); |
||||
app.$mount() |
app.$mount(); |
||||
|
@ -1,19 +1,29 @@ |
|||||
{ |
{ |
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
"pages": [ |
||||
{ |
{ |
||||
"path": "pages/index/index", |
"path": "pages/index/index", |
||||
"style": { |
"style": { |
||||
"navigationBarTitleText": "uni-app" |
"navigationBarTitleText": "山大健康码" |
||||
} |
} |
||||
} |
}, |
||||
], |
{ |
||||
"globalStyle": { |
"path": "pages/statistics/statistics", |
||||
"navigationBarTextStyle": "black", |
"style": { "navigationBarTitleText": "统计" } |
||||
"navigationBarTitleText": "uni-app", |
}, |
||||
"navigationBarBackgroundColor": "#F8F8F8", |
{ |
||||
"backgroundColor": "#F8F8F8" |
"path": "pages/get-code/get-code", |
||||
}, |
"style": { |
||||
"easycom": { |
"navigationBarTitleText": "领取健康码" |
||||
"autoscan": true |
} |
||||
|
} |
||||
|
], |
||||
|
"globalStyle": { |
||||
|
"navigationBarTextStyle": "black", |
||||
|
"navigationBarTitleText": "山大健康码", |
||||
|
"navigationBarBackgroundColor": "#F8F8F8", |
||||
|
"backgroundColor": "#F8F8F8" |
||||
|
}, |
||||
|
"easycom": { |
||||
|
"autoscan": true |
||||
} |
} |
||||
} |
} |
||||
|
@ -0,0 +1,25 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<button @tap="handleSelectLocation">选择位置</button> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
methods: { |
||||
|
handleSelectLocation() { |
||||
|
uni.chooseLocation({ |
||||
|
success: function(res) { |
||||
|
console.log('位置名称:' + res.name); |
||||
|
console.log('详细地址:' + res.address); |
||||
|
console.log('纬度:' + res.latitude); |
||||
|
console.log('经度:' + res.longitude); |
||||
|
}, |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,99 @@ |
|||||
|
<template> |
||||
|
<view class="padding"> |
||||
|
<!-- 日期组件 --> |
||||
|
<view></view> |
||||
|
<!-- 健康上报组件 --> |
||||
|
<view></view> |
||||
|
<!-- 校园轨迹组件 --> |
||||
|
<view class="card radius shadow-warp bg-white"> |
||||
|
<view class="card-head solid-bottom"> |
||||
|
<view class="card-head-avatar"> |
||||
|
<view class></view> |
||||
|
</view> |
||||
|
<view class="card-head-title">校园打卡</view> |
||||
|
<view class="card-head-action">icon</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="card-content"> |
||||
|
<view class="map-wrap"> |
||||
|
<map |
||||
|
:latitude="latitude" |
||||
|
:longitude="longitude" |
||||
|
:markers="covers" |
||||
|
style="width: 100%; height: 1000rpx;" |
||||
|
/> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
latitude: 37.87059, |
||||
|
longitude: 112.55067, |
||||
|
covers: [ |
||||
|
{ |
||||
|
latitude: 37.87059, |
||||
|
longitude: 112.55067, |
||||
|
iconPath: '../../static/location.png', |
||||
|
}, |
||||
|
{ |
||||
|
latitude: 37.87, |
||||
|
longitude: 112.5506, |
||||
|
iconPath: '../../static/location.png', |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
onLoad() { |
||||
|
this.getLocation(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
getLocation() { |
||||
|
uni.getLocation({ |
||||
|
type: 'wgs84', |
||||
|
success: res => { |
||||
|
this.longitude = res.longitude; |
||||
|
this.latitude = res.latitude; |
||||
|
console.log('当前位置的经度:' + res.longitude); |
||||
|
console.log('当前位置的纬度:' + res.latitude); |
||||
|
}, |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.card { |
||||
|
.card-head { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
height: 120rpx; |
||||
|
padding: 0 32rpx; |
||||
|
|
||||
|
.card-head-avatar { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
width: 56rpx; |
||||
|
height: 56rpx; |
||||
|
border-radius: 50%; |
||||
|
background-color: $blue; |
||||
|
color: $white; |
||||
|
} |
||||
|
|
||||
|
.card-head-title { |
||||
|
flex: 1; |
||||
|
margin: 0 20rpx; |
||||
|
font-size: 16px; |
||||
|
color: $black; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
After Width: | Height: | Size: 770 B |
Loading…
Reference in new issue