Initial Commit

master1
unknown 4 years ago
commit 24ce26e6a7

@ -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: {},
}

14
.gitignore vendored

@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

@ -0,0 +1,31 @@
App({
/**
* 当小程序初始化完成时会触发 onLaunch全局只触发一次
*/
onLaunch: function () {
},
/**
* 当小程序启动或从后台进入前台显示会触发 onShow
*/
onShow: function (options) {
},
/**
* 当小程序从前台进入后台会触发 onHide
*/
onHide: function () {
},
/**
* 当小程序发生脚本错误或者 api 调用失败时会触发 onError 并带上错误信息
*/
onError: function (msg) {
}
})

@ -0,0 +1,47 @@
{
"pages": [
"pages/index/index",
"pages/search/search",
"pages/photo/photo",
"pages/user/user",
"pages/map/map"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarTitleText": "区域地图",
"navigationBarTextStyle": "white"
},
"tabBar": {
"color": "#999",
"selectedColor": "#ff5767",
"backgroundColor": "#fbfbfb",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/zhuye.jpg",
"selectedIconPath": "images/zhuye-o.jpg"
},
{
"pagePath": "pages/map/map",
"text": "地图",
"iconPath": "images/map-o.png",
"selectedIconPath": "images/map.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "images/me.jpg",
"selectedIconPath": "images/me-o.jpg"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

@ -0,0 +1,15 @@
Page({
/**
* 页面的初始数据
*/
data: {
},
// 跳转到搜索页面
search: function () {
wx.navigateTo({
url: '../../pages/search/search'
})
}
})

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

@ -0,0 +1,9 @@
<view class='page_row' bindtap="suo">
<view class="search">
<view class="df search_arr">
<icon class="searchcion" size='16' type='search'></icon>
<input class="sousuo" disabled placeholder="搜索" bindtap='search'/>
</view>
</view>
</view>

@ -0,0 +1,33 @@
.search{
width: 98%;
padding: 10rpx 0;
}
.search_arr {
border: 1px solid #d0d0d0;
border-radius: 10rpx;
margin-left: 20rpx;
}
.search_arr input{
margin-left: 60rpx;
height: 60rpx;
border-radius: 5px;
}
.sousuo {
padding-left: 38%;
width: 15%;
line-height: 150%;
text-align: center;
}
.page_row{
display: flex;
flex-direction: row
}
.searchcion {
margin: 10rpx 10rpx 10rpx 10rpx;
position: absolute;
margin-left:38%;
z-index: 2;
width: 15px;
height: 15px;
text-align: center;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -0,0 +1,26 @@
Page({
data: {
imgurl:""
},
onLoad: function (options) {
},
browse:function()
{
let that=this;
wx.chooseMedia({
count: 1,
mediaType: ['image','video'],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: 'back',
success(res) {
console.log(res.tempFiles[0].tempFilePath)
wx.setStorageSync('path',res.tempFiles[0].tempFilePath)
wx.switchTab({
url: '../map/map',
})
}
})
}
})

@ -0,0 +1,7 @@
{
"usingComponents": {
"SearchInput":"../../components/SearchInput/SearchInput"
},
"navigationBarTitleText": "主页",
"navigationBarBackgroundColor": "#ff5767"
}

@ -0,0 +1,14 @@
<!--搜索框结构-->
<view class="search">
<SearchInput></SearchInput>
</view>
<!--拍照框结构-->
<view class="photo">
<button style="height:100%;width: 50%; background-color: pink; " bindtap="browse">
<image mode="heightFix" src="/images/paizhao.jpg"></image>
<text style="padding: 50rpx;">请拍摄地图</text>
</button>
</view>
<view>
<image src="{{imgurl}}" mode="aspecFill" />
</view>

@ -0,0 +1,2 @@
.photo button{padding: 150px 0;}
.photo image{height: 150px;}

@ -0,0 +1,141 @@
Page({
/**
* 页面的初始数据
*/
data: {
path:"",
old_height:"",
old_width:"",
jingdu:"",
weidu:"",
translateX: 0, // 位移x坐标 单位px
translateY: 0, // 位移y坐标 单位px
distance: 0, // 双指接触点距离
scale: 1, // 缩放倍数
rotate: 0, // 旋转角度
oldRotate: 0, // 上一次旋转停止后的角度
startMove: { // 起始位移距离
x: 0,
y: 0,
},
startTouches: [] // 起始点touch数组
},
touchStart(e) {
const touches = e.touches
const { translateX, translateY } = this.data
const { pageX, pageY } = touches[0]
this.data.startMove = {
x: pageX - translateX,
y: pageY - translateY
}
this.data.startTouches = touches
},
touchMove(e) {
const touches = e.touches
const { pageX: onePageX, pageY: onePageY } = touches[0]
const { startMove, scale, distance: oldDistance, startTouches, oldRotate } = this.data
if (touches.length === 2 && startTouches.length === 2) {
const { pageX: twoPageX, pageY: twoPageY } = touches[1]
const distance = Math.sqrt((twoPageX - onePageX) ** 2 + (twoPageY - onePageY) ** 2)
let rotate = this.getAngle(touches[0], touches[1]) - this.getAngle(startTouches[0], startTouches[1]) + oldRotate
rotate = rotate > 360 ? rotate - 360 : rotate
this.data.distance = distance
this.setData({
scale: scale * (distance / (oldDistance || distance)),
rotate
})
} else if (startTouches.length !== 2) {
this.setData({
translateX: onePageX - startMove.x,
translateY: onePageY - startMove.y
})
}
},
touchEnd() {
this.data.oldRotate = this.data.rotate
},
getAngle(p1, p2) {
const x = p1.pageX - p2.pageX
const y = p1.pageY- p2.pageY
return Math.atan2(y, x) * 180 / Math.PI
},
//******************************************************** */
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
setInterval(()=>
{
var that = this
wx.getLocation({
success:function(res){
console.log(res)
that.setData({
jingdu:res.longitude,
weidu:res.latitude,
})
}
})
}, 2*1000);
},
weizhi:function(e){
console.log("表单提交啦")
console.log("经度"+e.detail.value.jingdu)
console.log("纬度"+e.detail.value.weidu)
wx.openLocation({
latitude: Number(e.detail.value.weidu),
longitude: Number(e.detail.value.jingdu),
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
let that = this,
width = that.data.width,
height = that.data.height;
that.setData({
old_width:width,
old_height:height
})
let filepath = wx.getStorageSync('path');
this.setData({
  path:filepath
});
console.log(filepath)
this.setData({
old_height:width,
old_width:height
});
}
})

@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "地图",
"navigationBarBackgroundColor": "#ff5767"
}

@ -0,0 +1,22 @@
<scroll-view class="img" style="height: 90vh; width: 100vw">
<image
src="{{path}}"
style="height: {{old_height}}; width: {{old_width}}; transform: translate({{translateX}}px, {{translateY}}px) scale({{scale}}) rotate({{rotate}}deg);"
catch:touchstart="touchStart"
catch:touchmove="touchMove"
catch:touchend="touchEnd"
/>
</scroll-view>
<!--经纬度-->
<form bindsubmit="weizhi">
<view class="jingwei">
<view>
经度<input type="text" name="jingdu" value='{{jingdu}}'/>
</view>
<view>
纬度<input type="text" name="weidu" value='{{weidu}}'/>
</view>
</view>
</form>

@ -0,0 +1,12 @@
.img image{
width: 100%;
}
.jingwei{
padding: 0rpx 20rpx;
display: flex;
position:fixed;
bottom:0;
}
.jingwei input{
flex-direction: row;
}

@ -0,0 +1,91 @@
Page({
/**
* 页面的初始数据
*/
data: {
},
// 拍摄按钮按下, 执行record 触发拍摄
record(){
this.data.cameraContext = wx.createCameraContext()
this.data.cameraContext.takePhoto({
quality:"high", //高质量的图片
success: res => {
//res.tempImagePath照片文件在手机内的的临时路径
let tempImagePath = res.tempImagePath
wx.saveFile({
tempFilePath: tempImagePath,
success: function (res) {
//返回保存时的临时路径 res.savedFilePath
const savedFilePath = res.savedFilePath
// 保存到本地相册
wx.saveImageToPhotosAlbum({
filePath: savedFilePath,
})
},
//保存失败回调(比如内存不足)
fail: console.log
})
}
})
},
error(e) {
console.log(e.detail)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

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

@ -0,0 +1,6 @@
<camera class="camera" frame-size="large"></camera>
<view class="out">
<button class="record" bindtap="record" ></button>
</view>

@ -0,0 +1,19 @@
.camera{
width: 100vw;
height: 100vh;
}
.out .record{
width: 180rpx;
height: 160rpx;
}
.record{
position: fixed;
bottom: 10rpx;
left: 0;
right: 0;
width: 120rpx;
height: 120rpx;
margin: auto;
border-radius: 50%;
}

@ -0,0 +1,66 @@
// pages/search/search.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "搜索",
"navigationBarBackgroundColor": "#ff5767"
}

@ -0,0 +1 @@
/* pages/search/search.wxss */

@ -0,0 +1,66 @@
// pages/user/user.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "我的",
"navigationBarBackgroundColor": "#ff5767"
}

@ -0,0 +1,2 @@
<!--pages/user/user.wxml-->
<text>pages/user/user.wxml</text>

@ -0,0 +1 @@
/* pages/user/user.wxss */

@ -0,0 +1,77 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true
},
"compileType": "miniprogram",
"libVersion": "2.22.1",
"appid": "wxf09dd26283e176c6",
"projectname": "map-photo",
"debugOptions": {
"hidedInDevtools": []
},
"scripts": {},
"staticServerOptions": {
"baseURL": "",
"servePath": ""
},
"isGameTourist": false,
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"game": {
"list": []
},
"plugin": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
}
}
}

@ -0,0 +1,53 @@
{
"setting": {},
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/photo/photo",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/search/search",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/user/user",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/map/map",
"query": "",
"scene": null,
"launchMode": "default"
}
]
}
}
}

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