commit 24ce26e6a7efd541ce44e31c2dcc387e52228374 Author: unknown Date: Tue Mar 29 13:30:35 2022 +0800 Initial Commit diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -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: {}, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14ea590 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Windows +[Dd]esktop.ini +Thumbs.db +$RECYCLE.BIN/ + +# macOS +.DS_Store +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes + +# Node.js +node_modules/ diff --git a/app.js b/app.js new file mode 100644 index 0000000..691b49e --- /dev/null +++ b/app.js @@ -0,0 +1,31 @@ +App({ + + /** + * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) + */ + onLaunch: function () { + + }, + + /** + * 当小程序启动,或从后台进入前台显示,会触发 onShow + */ + onShow: function (options) { + + }, + + /** + * 当小程序从前台进入后台,会触发 onHide + */ + onHide: function () { + + }, + + /** + * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 + */ + onError: function (msg) { + + } +}) + diff --git a/app.json b/app.json new file mode 100644 index 0000000..db554bd --- /dev/null +++ b/app.json @@ -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" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..e69de29 diff --git a/components/SearchInput/SearchInput.js b/components/SearchInput/SearchInput.js new file mode 100644 index 0000000..409d532 --- /dev/null +++ b/components/SearchInput/SearchInput.js @@ -0,0 +1,15 @@ +Page({ + /** + * 页面的初始数据 + */ + data: { + + }, + // 跳转到搜索页面 + search: function () { + wx.navigateTo({ + url: '../../pages/search/search' + }) + } +}) + diff --git a/components/SearchInput/SearchInput.json b/components/SearchInput/SearchInput.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/components/SearchInput/SearchInput.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/components/SearchInput/SearchInput.wxml b/components/SearchInput/SearchInput.wxml new file mode 100644 index 0000000..474430f --- /dev/null +++ b/components/SearchInput/SearchInput.wxml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/components/SearchInput/SearchInput.wxss b/components/SearchInput/SearchInput.wxss new file mode 100644 index 0000000..15e77a0 --- /dev/null +++ b/components/SearchInput/SearchInput.wxss @@ -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; + } diff --git a/images/map-o.png b/images/map-o.png new file mode 100644 index 0000000..780a2a8 Binary files /dev/null and b/images/map-o.png differ diff --git a/images/map.png b/images/map.png new file mode 100644 index 0000000..84335c0 Binary files /dev/null and b/images/map.png differ diff --git a/images/me-o.jpg b/images/me-o.jpg new file mode 100644 index 0000000..910cecf Binary files /dev/null and b/images/me-o.jpg differ diff --git a/images/me.jpg b/images/me.jpg new file mode 100644 index 0000000..731f976 Binary files /dev/null and b/images/me.jpg differ diff --git a/images/paizhao.jpg b/images/paizhao.jpg new file mode 100644 index 0000000..2f7d96c Binary files /dev/null and b/images/paizhao.jpg differ diff --git a/images/zhuye-o.jpg b/images/zhuye-o.jpg new file mode 100644 index 0000000..8414970 Binary files /dev/null and b/images/zhuye-o.jpg differ diff --git a/images/zhuye.jpg b/images/zhuye.jpg new file mode 100644 index 0000000..e964967 Binary files /dev/null and b/images/zhuye.jpg differ diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..6358b25 --- /dev/null +++ b/pages/index/index.js @@ -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', + }) + } + }) + } + }) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..3c4110d --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "SearchInput":"../../components/SearchInput/SearchInput" + }, + "navigationBarTitleText": "主页", + "navigationBarBackgroundColor": "#ff5767" +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..96483fd --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..4a8637e --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,2 @@ +.photo button{padding: 150px 0;} +.photo image{height: 150px;} \ No newline at end of file diff --git a/pages/map/map.js b/pages/map/map.js new file mode 100644 index 0000000..9962819 --- /dev/null +++ b/pages/map/map.js @@ -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 + }); + + +} +}) \ No newline at end of file diff --git a/pages/map/map.json b/pages/map/map.json new file mode 100644 index 0000000..8196e28 --- /dev/null +++ b/pages/map/map.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "地图", + "navigationBarBackgroundColor": "#ff5767" +} \ No newline at end of file diff --git a/pages/map/map.wxml b/pages/map/map.wxml new file mode 100644 index 0000000..0955560 --- /dev/null +++ b/pages/map/map.wxml @@ -0,0 +1,22 @@ + + + + + + +
+ + +经度 + + +纬度 + + +
\ No newline at end of file diff --git a/pages/map/map.wxss b/pages/map/map.wxss new file mode 100644 index 0000000..a584c26 --- /dev/null +++ b/pages/map/map.wxss @@ -0,0 +1,12 @@ +.img image{ + width: 100%; +} +.jingwei{ + padding: 0rpx 20rpx; + display: flex; + position:fixed; + bottom:0; +} +.jingwei input{ + flex-direction: row; +} \ No newline at end of file diff --git a/pages/photo/photo.js b/pages/photo/photo.js new file mode 100644 index 0000000..e3c274c --- /dev/null +++ b/pages/photo/photo.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/photo/photo.json b/pages/photo/photo.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/photo/photo.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/photo/photo.wxml b/pages/photo/photo.wxml new file mode 100644 index 0000000..7743111 --- /dev/null +++ b/pages/photo/photo.wxml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pages/photo/photo.wxss b/pages/photo/photo.wxss new file mode 100644 index 0000000..f14a04e --- /dev/null +++ b/pages/photo/photo.wxss @@ -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%; + } + \ No newline at end of file diff --git a/pages/search/search.js b/pages/search/search.js new file mode 100644 index 0000000..1ef660f --- /dev/null +++ b/pages/search/search.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/search/search.json b/pages/search/search.json new file mode 100644 index 0000000..c8d515c --- /dev/null +++ b/pages/search/search.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "搜索", + "navigationBarBackgroundColor": "#ff5767" +} \ No newline at end of file diff --git a/pages/search/search.wxml b/pages/search/search.wxml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pages/search/search.wxml @@ -0,0 +1 @@ + diff --git a/pages/search/search.wxss b/pages/search/search.wxss new file mode 100644 index 0000000..ab78402 --- /dev/null +++ b/pages/search/search.wxss @@ -0,0 +1 @@ +/* pages/search/search.wxss */ \ No newline at end of file diff --git a/pages/user/user.js b/pages/user/user.js new file mode 100644 index 0000000..6547a73 --- /dev/null +++ b/pages/user/user.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/user/user.json b/pages/user/user.json new file mode 100644 index 0000000..e2953f8 --- /dev/null +++ b/pages/user/user.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的", + "navigationBarBackgroundColor": "#ff5767" +} \ No newline at end of file diff --git a/pages/user/user.wxml b/pages/user/user.wxml new file mode 100644 index 0000000..cea8fdb --- /dev/null +++ b/pages/user/user.wxml @@ -0,0 +1,2 @@ + +pages/user/user.wxml diff --git a/pages/user/user.wxss b/pages/user/user.wxss new file mode 100644 index 0000000..f380f15 --- /dev/null +++ b/pages/user/user.wxss @@ -0,0 +1 @@ +/* pages/user/user.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..0e8b95b --- /dev/null +++ b/project.config.json @@ -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": [] + } + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..5e9adbc --- /dev/null +++ b/project.private.config.json @@ -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" + } + ] + } + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..cd24f35 --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file