wyl 1 year ago
parent 6b7cbb0ebb
commit 2fb12eab5b

@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

@ -1,2 +1,2 @@
# map ![](111.png)

@ -0,0 +1,19 @@
// app.js
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
globalData: {
userInfo: null
}
})

@ -0,0 +1,14 @@
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

@ -0,0 +1,10 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

@ -0,0 +1,35 @@
search: function (res) {
var type = e.target.dataset.type;
this.nearbySearch(type);
}
nearbySearch: function (res) {
var location = this.data.latitude + ',' + this.data.longitude
let _this = this;
qqmapsdk.search({
keyword: keyword,
location: location,
success: function (res) {
var markers = [];
for (var i = 0; i < res.data.length; i++) {
markers.push({
title: res.data[i].location.lat,
id: res.data[i].id,
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
iconPath: "images/location.png",
width: 20,
height: 20,
callout: {
content: res.data[i].title,
color: '#000',
display: 'ALWAYS'
}
})
}
_this.setData({
markers: markers,
perimeter: res.data
})
}
})
}

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,22 @@
<view class="outer">
<map id="map" longitude='{{longitude}}' latitude='{{latitude}}' markers='{{markers}}' show-location></map>
<view class='nav'>
<image src='images/酒店.png' mode="aspectFit"></image>
<text bindtap='search' data-type='酒店'>酒店</text>
<image src='images/美食.png' mode="aspectFit"></image>
<text bindtap='search' data-type='美食'>美食</text>
<text bindtap='search' data-type='娱乐'>娱乐</text>
<text bindtap='search' data-type='超市'>超市</text>
<text bindtap='search' data-type='公园'>公园</text>
</view>
<view class='location'>
<scroll-view scroll-y>
<block wx:for="{{perimeter}}" wx:key="key">
<view class="content">
<view class="title">{{item.title}}</view>
<view class="address">位置:{{item.address}}</view>
</view>
</block>
</scroll-view>
</view>
</view>

@ -0,0 +1,46 @@
.outer,map{
width:100%;
height:100vh
}
.outer{
position:relative;
}
.location{
position: absolute;
bottom:0;
z-index:100
}
.nav{
position: absolute;
top:0;
z-index:100;
background: #fff;
border-bottom:1px solid #dfdfdf;
}
.nav text{
display:inline-block;
height:100rpx;
line-height: 100rpx;
border-right:1px solid #dfdfdf;
padding:30rpx;
}
.nav image{
width:40rpx;
height:40rpx;
}
scroll-view{
height:600rpx;
background:#fff;
}
scroll-view .content{
border-bottom:1px solid #dfdfdf;
width:100%;
padding:30rpx;
}
scroll-view .title{
font-size:16px;
}
scroll-view .address{
font-size:10px;
color:rgb(83, 78, 78)
}

@ -0,0 +1,18 @@
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

@ -0,0 +1,6 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>

@ -0,0 +1,8 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

@ -0,0 +1,52 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"bundle": false,
"userConfirmedBundleSwitch": false,
"urlCheck": true,
"scopeDataCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"preloadBackgroundData": false,
"minified": true,
"autoAudits": false,
"newFeature": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"useIsolateContext": true,
"nodeModules": false,
"enhance": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"enableEngineNative": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false,
"minifyWXML": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"condition": false
},
"compileType": "miniprogram",
"libVersion": "2.19.4",
"appid": "wx04c517846836da71",
"projectname": "miniprogram-92",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "miniprogram-2",
"setting": {
"compileHotReLoad": true
}
}

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -0,0 +1,19 @@
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
}
Loading…
Cancel
Save