diff --git a/src/Carpool/.eslintrc.js b/src/Carpool/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/src/Carpool/.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/src/Carpool/README.md b/src/Carpool/README.md new file mode 100644 index 0000000..e097b0c --- /dev/null +++ b/src/Carpool/README.md @@ -0,0 +1,12 @@ +# 云开发 quickstart + +这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力: + +- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库 +- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理 +- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码 + +## 参考文档 + +- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html) + diff --git a/src/Carpool/miniprogram/app.js b/src/Carpool/miniprogram/app.js new file mode 100644 index 0000000..8f961e6 --- /dev/null +++ b/src/Carpool/miniprogram/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch: function () { + if (!wx.cloud) { + console.error('请使用 2.2.3 或以上的基础库以使用云能力'); + } else { + wx.cloud.init({ + // env 参数说明: + // env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源 + // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 + // 如不填则使用默认环境(第一个创建的环境) + env: 'cloud1-3gvvw1ak18d30298', + traceUser: true, + }); + } + + this.globalData = {}; + } +}); diff --git a/src/Carpool/miniprogram/app.json b/src/Carpool/miniprogram/app.json new file mode 100644 index 0000000..1c8b4b9 --- /dev/null +++ b/src/Carpool/miniprogram/app.json @@ -0,0 +1,40 @@ +{ + "pages": [ + "pages/list/list", + "pages/home/home", + "pages/fabu/fabu", + "pages/jiaru/jiaru", + "pages/xinguan/xinguan", + "pages/xinping/xinping", + "pages/index/index", + "pages/login/login", + "pages/jialook/jialook", + "pages/xinlook/xinlook", + "pages/shenqing/shenqing", + "pages/shenguan/shenguan", + "pages/wode/wode", + "pages/yonghu/yonghu", + "pages/wolook/wolook" + + ], + "window": { + "backgroundColor": "#F6F6F6", + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#F6F6F6", + "navigationBarTitleText": "地图导航", + "navigationBarTextStyle": "black" + }, + "sitemapLocation": "sitemap.json", + "style": "v2", + "lazyCodeLoading": "requiredComponents", + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "requiredPrivateInfos": [ + "getLocation" + ] + + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/app.wxss b/src/Carpool/miniprogram/app.wxss new file mode 100644 index 0000000..89bc37e --- /dev/null +++ b/src/Carpool/miniprogram/app.wxss @@ -0,0 +1,26 @@ +.container { + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; +} + +button { + background: initial; +} + +button:focus{ + outline: 0; +} + +button::after{ + border: none; +} + + +page { + background: #f6f6f6; + display: flex; + flex-direction: column; + justify-content: flex-start; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.js b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.js new file mode 100644 index 0000000..ac223b7 --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.js @@ -0,0 +1,70 @@ +Component({ + properties: { + type: { + type: String, + value: '' + }, + NavigationOrNot: { + type: Boolean, + value: false + } + }, + data: { + gaodeType: 'car' + }, + lifetimes: { + attached: function() { + // 在组件实例进入页面节点树时执行 + }, + ready: function() { + // 在组件布局完成后执行 + this.initialize() + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + } + }, + watch: { + 'properties.NavigationOrNot'(val) { + console.log('type变化', val) + } + }, + methods: { + initialize: function() { + // 自定义的初始化方法 + console.log('initialize', this.properties) + this.setData({ + gaodeType: this.properties.type + }) + // 例如设置一些初始状态 + }, + setType: function(type) { + this.setData({ + gaodeType: type + }) + this.triggerEvent('changeType', { + gaode_type: type + }); + }, + goToCar: function() { + // 处理驾车逻辑 + console.log('驾车') + this.setType('car') + }, + goToWalk: function() { + // 处理步行逻辑 + console.log('步行') + this.setType('walk') + }, + goToBus: function() { + // 处理公交逻辑 + console.log('公交') + this.setType('bus') + }, + goToRide: function() { + // 处理骑行逻辑 + console.log('骑行') + this.setType('riding') + } + } +}) diff --git a/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.json b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxml b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxml new file mode 100644 index 0000000..61155ab --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxml @@ -0,0 +1,6 @@ + + 驾车 + 步行 + 公交 + 骑行 + diff --git a/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxss b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxss new file mode 100644 index 0000000..5fc7631 --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeHeader/GaodeHeader.wxss @@ -0,0 +1,23 @@ +.flex-style{ + display: -webkit-box; + display: -webkit-flex; + display: flex; + opacity: 0.3; + pointer-events: none; +} +.flex-style.active { + background: #ffffff; + opacity: 1; + pointer-events: initial; +} +.flex-item{ + height: 35px; + line-height: 35px; + text-align: center; + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1 +} +.flex-item.active{ + color:#0091ff; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.js b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.js new file mode 100644 index 0000000..c82806c --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.js @@ -0,0 +1,100 @@ +// components/GaodeInputTips/GaodeInputTips.js +var amapFile = require('../../libs/amap-wx.js'); +var config = require('../../libs/config.js'); +var lonlat; +var city; +Component({ + /** + * 组件的属性列表 + */ + properties: { + city: { + type: String, + value: '' + }, + longitude: { + type: String, + value: '' + }, + latitude: { + type: String, + value: '' + }, + inputType: { + type: String, + value: '' + }, + defaultValue: { + type: String, + value: '请输入' + } + }, + + /** + * 组件的初始数据 + */ + data: { + tips: {}, + tipsShow: false + }, + lifetimes: { + attached: function() { + // 在组件实例进入页面节点树时执行 + }, + ready: function(e) { + // 在组件布局完成后执行 + console.log('搜索框', e) + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + } + }, + /** + * 组件的方法列表 + */ + methods: { + bindInput: function(e){ + console.log('输入内容', e) + var that = this; + var keywords = e.detail.value; + if (keywords === '') { + that.setData({ + tips: [] + }); + return false + } + var key = config.Config.key; + var myAmapFun = new amapFile.AMapWX({key: key}); + myAmapFun.getInputtips({ + keywords: keywords, + location: lonlat, + city: city, + success: function(data){ + if(data && data.tips){ + that.setData({ + tips: data.tips + }); + } + } + }) + }, + bindSearch: function(e){ + console.log('点击搜索', e.target.dataset.info) + console.log('点击搜索', e.target.dataset) + this.triggerEvent('customEvent', { + info: e.target.dataset.info, + inputType: this.properties.inputType + }); + }, + handleFocus: function(e) { + this.setData({ + tipsShow: true + }); + }, + handleBlur: function(e) { + this.setData({ + tipsShow: false + }); + } + } +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.json b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxml b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxml new file mode 100644 index 0000000..fa7e7df --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxml @@ -0,0 +1,8 @@ + + + + + {{i.name}} + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxss b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxss new file mode 100644 index 0000000..043808b --- /dev/null +++ b/src/Carpool/miniprogram/components/GaodeInputTips/GaodeInputTips.wxss @@ -0,0 +1,28 @@ +.section { + height: 30px; + width: 100%; +} + +.section input { + width: 90%; + margin: 5px auto; + border: 1px solid #c3c3c3; + height: 30px; + border-radius: 3px; + padding: 0 5px; +} + +.text_box { + margin: 10px 25px; + border-bottom: 1px solid #c3c3c3; + padding-bottom: 10px +} + +.tips_container { + position: absolute; + z-index: 999; + background: #FFF; + width: 100%; + max-height: 50vh; + overflow: auto; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudTipModal/index.js b/src/Carpool/miniprogram/components/cloudTipModal/index.js new file mode 100644 index 0000000..2d44c6e --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudTipModal/index.js @@ -0,0 +1,60 @@ +// miniprogram/components/cloudTipModal/index.js +const { isMac } = require('../../envList.js'); + +Component({ + + /** + * 页面的初始数据 + */ + data: { + showUploadTip: false, + tipText: isMac ? 'sh ./uploadCloudFunction.sh' : './uploadCloudFunction.bat' + }, + properties: { + showUploadTipProps: Boolean + }, + observers: { + showUploadTipProps: function(showUploadTipProps) { + this.setData({ + showUploadTip: showUploadTipProps + }); + } + }, + methods: { + onCheckEnv(){ + wx.showLoading({ + title: '', + }); + wx.cloud + .callFunction({ + name: 'quickstartFunctions', + data: { + type: 'getOpenId', + }, + }) + .then(() => { + wx.hideLoading(); + this.setData({ + showUploadTip: !this.data.showUploadTip + }); + }) + .catch((e) => { + // 报错信息提示环境不存在 + wx.hideLoading(); + if(e.message.includes('env not exists') || e.message.includes('Environment not found') || e.message.includes('env check invalid be filterd')){ + wx.showToast({ + title: '环境未找到', + icon: 'error', + duration: 2000 + }) + } + }); + }, + + onCheckEnvCancel(){ + this.setData({ + showUploadTip: !this.data.showUploadTip + }); + }, + } +}); diff --git a/src/Carpool/miniprogram/components/cloudTipModal/index.json b/src/Carpool/miniprogram/components/cloudTipModal/index.json new file mode 100644 index 0000000..4575d1b --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudTipModal/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "component": true +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudTipModal/index.wxml b/src/Carpool/miniprogram/components/cloudTipModal/index.wxml new file mode 100644 index 0000000..4e74c9c --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudTipModal/index.wxml @@ -0,0 +1,14 @@ + + + + + + 云开发环境未找到 + 请点击上方「云开发」按钮,开通云开发环境后重试。 + 如果已经开通云开发,请检查环境ID与 `miniprogram/app.js` 中的 `env` 参数是否一致。 + + 重新检测 + 取消 + + + diff --git a/src/Carpool/miniprogram/components/cloudTipModal/index.wxss b/src/Carpool/miniprogram/components/cloudTipModal/index.wxss new file mode 100644 index 0000000..9ef2b39 --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudTipModal/index.wxss @@ -0,0 +1,54 @@ +.install_tip_back { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0,0,0,0.4); + z-index: 1; +} + +.install_tip_detail { + position: fixed; + background-color: white; + right: 0; + bottom: 0; + left: 0; + top: 65%; + border-radius: 40rpx 40rpx 0 0; + padding: 50rpx; + z-index: 9; +} + +.install_tip_detail_title { + font-weight: 400; + font-size: 40rpx; + text-align: center; +} + +.install_tip_detail_tip { + font-size: 25rpx; + color: rgba(0,0,0,0.4); + margin-top: 20rpx; + text-align: left; +} +.install_tip_detail_buttons { + padding-top: 50rpx; + display: flex; +} +.install_tip_detail_button { + color: #07C160; + font-weight: 500; + background-color: rgba(0,0,0,0.1); + width: 40%; + text-align: center; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + margin: 0 auto; +} + +.install_tip_detail_button_primary { + background-color: #07C160; + color: #fff; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.js b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.js new file mode 100644 index 0000000..536b2f7 --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.js @@ -0,0 +1,39 @@ +Component({ + data: { + modalVisible: false, + tipText: '云开发>云模板>模板中心', + }, + properties: { + installModulePageTitleProps: String, + modalVisibleProps: Boolean, + tipTextProps: String, + installModuleNameProps: String, + }, + observers: { + modalVisibleProps: function (modalVisibleProps) { + this.setData({ + modalVisible: modalVisibleProps, + }); + }, + tipTextProps: function (tipTextProps) { + this.setData({ + tipText: tipTextProps, + }); + }, + }, + methods: { + hideModal() { + if (this.data.modalVisible) { + this.setData({ + modalVisible: false, + }); + } + }, + onViewDetail() { + this.hideModal(); + wx.navigateTo({ + url: `/pages/cloudbaseModuleInstallTips/index?moduleName=${this.properties.installModuleNameProps}&title=${this.properties.installModulePageTitleProps}`, + }); + }, + }, +}); diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.json b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.json new file mode 100644 index 0000000..4575d1b --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "component": true +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxml b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxml new file mode 100644 index 0000000..615d163 --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxml @@ -0,0 +1,11 @@ + + + + + 体验前需安装云模板 + 请按照以下路径安装对应云模板 + {{ tipText }} + 查看详情{{ installModuleName }} + + + diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxss b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxss new file mode 100644 index 0000000..ae36531 --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallModal/index.wxss @@ -0,0 +1,57 @@ +.install_tip_back { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0,0,0,0.4); + z-index: 1; +} + +.install_tip_detail { + position: fixed; + background-color: white; + right: 0; + bottom: 0; + left: 0; + top: 60%; + border-radius: 40rpx 40rpx 0 0; + padding: 50rpx; + z-index: 9; +} + +.install_tip_detail_title { + font-weight: 400; + font-size: 40rpx; + text-align: center; +} + +.install_tip_detail_tip { + font-size: 25rpx; + color: rgba(0,0,0,0.4); + margin-top: 20rpx; + text-align: center; +} + +.install_tip_detail_shell { + margin: 70rpx 0; + display: flex; + justify-content: center; +} + +.install_tip_detail_copy { + color: #546488; + margin-left: 10rpx; +} + +.install_tip_detail_button { + color: #07C160; + font-weight: 500; + background-color: rgba(0,0,0,0.1); + width: 60%; + text-align: center; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + margin: 0 auto; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.js b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.js new file mode 100644 index 0000000..0d7e89c --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.js @@ -0,0 +1,24 @@ +// components/cloudbaseModuleInstallPath/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + installModuleName: String, + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.json b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxml b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxml new file mode 100644 index 0000000..c7ba516 --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxml @@ -0,0 +1 @@ +可以在“云开发>云模板>模板中心>{{installModuleName}}”找到该模板 \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxss b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxss new file mode 100644 index 0000000..128ffdc --- /dev/null +++ b/src/Carpool/miniprogram/components/cloudbaseModuleInstallPath/index.wxss @@ -0,0 +1,7 @@ +.tip { + font-size: 23rpx; + color: rgba(0, 0, 0, 0.5); + width: 90%; + text-align: center; + margin: 30rpx auto 0 auto; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/mpCodeModal/index.js b/src/Carpool/miniprogram/components/mpCodeModal/index.js new file mode 100644 index 0000000..65b369b --- /dev/null +++ b/src/Carpool/miniprogram/components/mpCodeModal/index.js @@ -0,0 +1,21 @@ +Component({ + data: { + modalVisible: false, + }, + properties: { + visible: Boolean, + imageSrc: String, + }, + observers: { + visible: function (visible) { + this.setData({ + modalVisible: visible + }); + }, + }, + methods: { + onClose() { + this.setData({ modalVisible: false }); + } + } +}); diff --git a/src/Carpool/miniprogram/components/mpCodeModal/index.json b/src/Carpool/miniprogram/components/mpCodeModal/index.json new file mode 100644 index 0000000..4575d1b --- /dev/null +++ b/src/Carpool/miniprogram/components/mpCodeModal/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "component": true +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/mpCodeModal/index.wxml b/src/Carpool/miniprogram/components/mpCodeModal/index.wxml new file mode 100644 index 0000000..28eea72 --- /dev/null +++ b/src/Carpool/miniprogram/components/mpCodeModal/index.wxml @@ -0,0 +1,8 @@ + + + X + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/components/mpCodeModal/index.wxss b/src/Carpool/miniprogram/components/mpCodeModal/index.wxss new file mode 100644 index 0000000..ce7b993 --- /dev/null +++ b/src/Carpool/miniprogram/components/mpCodeModal/index.wxss @@ -0,0 +1,95 @@ +.modal_container { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0,0,0,0.4); + z-index: 1; + width: 100%; + height: 100%; +} + +.icon_close { + position: fixed; + right: 40rpx; + top: 40rpx; + width: 70rpx; + height: 70rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + /* background-color: #07c160; */ + background-color: rgba(0,0,0,0.7); + color: white; + font-size: 32rpx; + font-weight: bold; +} + +.code_img { + width: 400rpx; + height: 400rpx; + margin-top: 50%; + margin-left: 50%; + transform: translateX(-50%); + border-radius: 30rpx; +} + +.install_tip_back { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0,0,0,0.4); + z-index: 1; +} + +.install_tip_detail { + position: fixed; + background-color: white; + right: 0; + bottom: 0; + left: 0; + top: 60%; + border-radius: 40rpx 40rpx 0 0; + padding: 50rpx; + z-index: 9; +} + +.install_tip_detail_title { + font-weight: 400; + font-size: 40rpx; + text-align: center; +} + +.install_tip_detail_tip { + font-size: 25rpx; + color: rgba(0,0,0,0.4); + margin-top: 20rpx; + text-align: center; +} + +.install_tip_detail_shell { + margin: 70rpx 0; + display: flex; + justify-content: center; +} + +.install_tip_detail_copy { + color: #546488; + margin-left: 10rpx; +} + +.install_tip_detail_button { + color: #07C160; + font-weight: 500; + background-color: rgba(0,0,0,0.1); + width: 60%; + text-align: center; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + margin: 0 auto; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/envList.js b/src/Carpool/miniprogram/envList.js new file mode 100644 index 0000000..118a1ef --- /dev/null +++ b/src/Carpool/miniprogram/envList.js @@ -0,0 +1,6 @@ +const envList = [{"envId":"cloud1-3gvvw1ak18d30298","alias":"cloud1"}] +const isMac = false +module.exports = { + envList, + isMac +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/images/mapicon_navi.png b/src/Carpool/miniprogram/images/mapicon_navi.png new file mode 100644 index 0000000..f2555fc Binary files /dev/null and b/src/Carpool/miniprogram/images/mapicon_navi.png differ diff --git a/src/Carpool/miniprogram/images/mapicon_navi_e.png b/src/Carpool/miniprogram/images/mapicon_navi_e.png new file mode 100644 index 0000000..4b9ed6c Binary files /dev/null and b/src/Carpool/miniprogram/images/mapicon_navi_e.png differ diff --git a/src/Carpool/miniprogram/images/mapicon_navi_s.png b/src/Carpool/miniprogram/images/mapicon_navi_s.png new file mode 100644 index 0000000..27ed2d0 Binary files /dev/null and b/src/Carpool/miniprogram/images/mapicon_navi_s.png differ diff --git a/src/Carpool/miniprogram/images/marker.png b/src/Carpool/miniprogram/images/marker.png new file mode 100644 index 0000000..c49ce3a Binary files /dev/null and b/src/Carpool/miniprogram/images/marker.png differ diff --git a/src/Carpool/miniprogram/images/marker_checked.png b/src/Carpool/miniprogram/images/marker_checked.png new file mode 100644 index 0000000..60bc466 Binary files /dev/null and b/src/Carpool/miniprogram/images/marker_checked.png differ diff --git a/src/Carpool/miniprogram/images/markers.png b/src/Carpool/miniprogram/images/markers.png new file mode 100644 index 0000000..86b39f5 Binary files /dev/null and b/src/Carpool/miniprogram/images/markers.png differ diff --git a/src/Carpool/miniprogram/libs/amap-wx.130.js b/src/Carpool/miniprogram/libs/amap-wx.130.js new file mode 100644 index 0000000..718d6ef --- /dev/null +++ b/src/Carpool/miniprogram/libs/amap-wx.130.js @@ -0,0 +1,31 @@ +function AMapWX(a){this.key=a.key;this.requestConfig={key:a.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};this.MeRequestConfig={key:a.key,serviceName:"https://restapi.amap.com/rest/me"}} +AMapWX.prototype.getWxLocation=function(a,b){wx.getLocation({type:"gcj02",success:function(c){c=c.longitude+","+c.latitude;wx.setStorage({key:"userLocation",data:c});b(c)},fail:function(c){wx.getStorage({key:"userLocation",success:function(d){d.data&&b(d.data)}});a.fail({errCode:"0",errMsg:c.errMsg||""})}})}; +AMapWX.prototype.getMEKeywordsSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.city&&(d.city=b.city);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&&(d.pageSize=b.pageSize);b.sig&&(d.sig= +b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/local",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; +AMapWX.prototype.getMEIdSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.id&&(d.id=b.id);b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/id",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&& +0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; +AMapWX.prototype.getMEPolygonSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.polygon&&(d.polygon=b.polygon);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&&(d.pageSize=b.pageSize); +b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/polygon",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; +AMapWX.prototype.getMEaroundSearch=function(a){if(!a.options)return a.fail({errCode:"0",errMsg:"\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570"});var b=a.options,c=this.MeRequestConfig,d={key:c.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"};b.layerId&&(d.layerId=b.layerId);b.keywords&&(d.keywords=b.keywords);b.center&&(d.center=b.center);b.radius&&(d.radius=b.radius);b.filter&&(d.filter=b.filter);b.sortrule&&(d.sortrule=b.sortrule);b.pageNum&&(d.pageNum=b.pageNum);b.pageSize&& +(d.pageSize=b.pageSize);b.sig&&(d.sig=b.sig);wx.request({url:c.serviceName+"/cpoint/datasearch/around",data:d,method:"GET",header:{"content-type":"application/json"},success:function(e){(e=e.data)&&e.status&&"1"===e.status&&0===e.code?a.success(e.data):a.fail({errCode:"0",errMsg:e})},fail:function(e){a.fail({errCode:"0",errMsg:e.errMsg||""})}})}; +AMapWX.prototype.getGeo=function(a){var b=this.requestConfig,c=a.options;b={key:this.key,extensions:"all",s:b.s,platform:b.platform,appname:this.key,sdkversion:b.sdkversion,logversion:b.logversion};c.address&&(b.address=c.address);c.city&&(b.city=c.city);c.batch&&(b.batch=c.batch);c.sig&&(b.sig=c.sig);wx.request({url:"https://restapi.amap.com/v3/geocode/geo",data:b,method:"GET",header:{"content-type":"application/json"},success:function(d){(d=d.data)&&d.status&&"1"===d.status?a.success(d):a.fail({errCode:"0", +errMsg:d})},fail:function(d){a.fail({errCode:"0",errMsg:d.errMsg||""})}})}; +AMapWX.prototype.getRegeo=function(a){function b(d){var e=c.requestConfig;wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:c.key,location:d,extensions:"all",s:e.s,platform:e.platform,appname:c.key,sdkversion:e.sdkversion,logversion:e.logversion},method:"GET",header:{"content-type":"application/json"},success:function(g){if(g.data.status&&"1"==g.data.status){g=g.data.regeocode;var h=g.addressComponent,f=[],k=g.roads[0].name+"\u9644\u8fd1",m=d.split(",")[0],n=d.split(",")[1];if(g.pois&& +g.pois[0]){k=g.pois[0].name+"\u9644\u8fd1";var l=g.pois[0].location;l&&(m=parseFloat(l.split(",")[0]),n=parseFloat(l.split(",")[1]))}h.provice&&f.push(h.provice);h.city&&f.push(h.city);h.district&&f.push(h.district);h.streetNumber&&h.streetNumber.street&&h.streetNumber.number?(f.push(h.streetNumber.street),f.push(h.streetNumber.number)):f.push(g.roads[0].name);f=f.join("");a.success([{iconPath:a.iconPath,width:a.iconWidth,height:a.iconHeight,name:f,desc:k,longitude:m,latitude:n,id:0,regeocodeData:g}])}else a.fail({errCode:g.data.infocode, +errMsg:g.data.info})},fail:function(g){a.fail({errCode:"0",errMsg:g.errMsg||""})}})}var c=this;a.location?b(a.location):c.getWxLocation(a,function(d){b(d)})}; +AMapWX.prototype.getWeather=function(a){function b(g){var h="base";a.type&&"forecast"==a.type&&(h="all");wx.request({url:"https://restapi.amap.com/v3/weather/weatherInfo",data:{key:d.key,city:g,extensions:h,s:e.s,platform:e.platform,appname:d.key,sdkversion:e.sdkversion,logversion:e.logversion},method:"GET",header:{"content-type":"application/json"},success:function(f){if(f.data.status&&"1"==f.data.status)if(f.data.lives){if((f=f.data.lives)&&00&&(d=d[0],e=c(d),e["liveData"]=d,a.success(e))):b.data.forecasts&&b.data.forecasts[0]&&a.success({forecast:b.data.forecasts[0]}):a.fail({errCode:b.data.infocode,errMsg:b.data.info})},fail:function(b){a.fail({errCode:"0",errMsg:b.errMsg||""})}})}function e(e){wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:b.key,location:e,extensions:"all",s:c.s,platform:c.platform,appname:b.key,sdkversion:c.sdkversion,logversion:c.logversion},method:"GET",header:{"content-type":"application/json"},success:function(b){var c,e;b.data.status&&"1"==b.data.status?(e=b.data.regeocode,e.addressComponent?c=e.addressComponent.adcode:e.aois&&e.aois.length>0&&(c=e.aois[0].adcode),d(c)):a.fail({errCode:b.data.infocode,errMsg:b.data.info})},fail:function(b){a.fail({errCode:"0",errMsg:b.errMsg||""})}})}var b=this,c=b.requestConfig;a.city?d(a.city):b.getWxLocation(a,function(a){e(a)})},AMapWX.prototype.getPoiAround=function(a){function d(d){var e={key:b.key,location:d,s:c.s,platform:c.platform,appname:b.key,sdkversion:c.sdkversion,logversion:c.logversion};a.querytypes&&(e["types"]=a.querytypes),a.querykeywords&&(e["keywords"]=a.querykeywords),wx.request({url:"https://restapi.amap.com/v3/place/around",data:e,method:"GET",header:{"content-type":"application/json"},success:function(b){var c,d,e,f;if(b.data.status&&"1"==b.data.status){if(b=b.data,b&&b.pois){for(c=[],d=0;d{ + console.log(res) + wx.showToast({ + title:'提交成功', + }) + // wx.navigateTo({ + // url: '../fenye/fenye', + // }) + }) +} +, +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/fabu/fabu.json b/src/Carpool/miniprogram/pages/fabu/fabu.json new file mode 100644 index 0000000..b042efa --- /dev/null +++ b/src/Carpool/miniprogram/pages/fabu/fabu.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车发布", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/fabu/fabu.wxml b/src/Carpool/miniprogram/pages/fabu/fabu.wxml new file mode 100644 index 0000000..9a8917c --- /dev/null +++ b/src/Carpool/miniprogram/pages/fabu/fabu.wxml @@ -0,0 +1,66 @@ +背景图片 + + +微信昵称: + + + + +手机号: + + + + +拼车总费用: + + + + + 出发日期: + + + 当前选择:{{date}} + + + + + + 出发时间: + + + + + 当前选择: {{time}} + + + + + + +拼车人数: + + + + + +出发地点: + + + + + +到达地点: + + + + + + +对拼车人员的要求(非必填) + + + + + + + diff --git a/src/Carpool/miniprogram/pages/fabu/fabu.wxss b/src/Carpool/miniprogram/pages/fabu/fabu.wxss new file mode 100644 index 0000000..e8599db --- /dev/null +++ b/src/Carpool/miniprogram/pages/fabu/fabu.wxss @@ -0,0 +1,43 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + background-color: white; +} + +.world{ + margin-top: 30rpx; +} + +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/home/home.js b/src/Carpool/miniprogram/pages/home/home.js new file mode 100644 index 0000000..0c122ef --- /dev/null +++ b/src/Carpool/miniprogram/pages/home/home.js @@ -0,0 +1,65 @@ +Page({ + jiaru(){ + wx.navigateTo({ + url: '../jiaru/jiaru', + }) + }, + kongguan(){ + wx.navigateTo({ + url: '../kongguan_chakan_yonghu/kongguan_chakan_yonghu', + }) + }, + fabu(){ + wx.navigateTo({ + url: '../fabu/fabu', + }) + }, + guanli(){ + wx.navigateTo({ + url: '../list/list', + }) + }, + kongguan(){ + wx.redirectTo({ + url: '../login/login', + }) + + }, + + kuaisu(){ + wx.navigateTo({ + url: '../kslook /kslook', + }) + }, + xinping(){ + wx.navigateTo({ + url: '../xinping/xinping', + }) + }, + daohang(){ + wx.navigateTo({ + url: '../index/index', + }) + }, + shen(){ + wx.navigateTo({ + url: '../shenguan/shenguan', + }) + }, + wo(){ + wx.navigateTo({ + url: '../wode/wode', + }) + }, + onLoad(){ + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: function(res) { + console.log(res.data.nickName); // 输出获取到的数据 + }, + fail: function(err) { + console.error('获取缓存失败', err); + } + }) + } + }) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/home/home.json b/src/Carpool/miniprogram/pages/home/home.json new file mode 100644 index 0000000..cf037ce --- /dev/null +++ b/src/Carpool/miniprogram/pages/home/home.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/home/home.wxml b/src/Carpool/miniprogram/pages/home/home.wxml new file mode 100644 index 0000000..ed049ca --- /dev/null +++ b/src/Carpool/miniprogram/pages/home/home.wxml @@ -0,0 +1,43 @@ +背景图片 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/home/home.wxss b/src/Carpool/miniprogram/pages/home/home.wxss new file mode 100644 index 0000000..6922d27 --- /dev/null +++ b/src/Carpool/miniprogram/pages/home/home.wxss @@ -0,0 +1,14 @@ +image{ + width: 100%; + height: 400rpx; +} +page{ + background-color:#B6C2D6; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/index/index.js b/src/Carpool/miniprogram/pages/index/index.js new file mode 100644 index 0000000..ca9ea4a --- /dev/null +++ b/src/Carpool/miniprogram/pages/index/index.js @@ -0,0 +1,306 @@ +var amapFile = require('../../libs/amap-wx.130.js'); +var gaode_key = require('../../libs/config'); +var markersData = []; + +Page({ + data: { + markers: [], + latitude: '', + longitude: '', + city: '', + city_e: '', // 目的地 + latitude_e: '', // 目的地x + longitude_e: '', // 目的地y + textData: {}, + gaode_type: 'car', + polyline: [], + includePoints: [], + transits: [], // 公交车信息 + mapEndObj: {}, // 目的地信息 + taxi_cost: '', // 出租车价格 + multi_cost:'', // 多人拼车价格 + bigger_cost:'', // 大型车 + distance: '', + daohang: false, + mapState: true + }, + makertap: function (e) { + var id = e.markerId; + var that = this; + that.showMarkerInfo(markersData, id); + that.changeMarkerColor(markersData, id); + }, + onLoad: function () { + this.getPoiData() // 获取当前位置或指定位置周边 + }, + // 切换方式 + changeGaodeType(event) { + console.log('切换方式,绘制路线', event.detail); + this.setData({ + gaode_type: event.detail.gaode_type, + mapState: false + }) + if (!this.data.longitude_e) { + return + } + // 绘制路线 + this.getRoute(this.data.mapEndObj, 'end') + }, + handleCustomEvent: function (event) { + console.log('接收到组件传递的数据:', event.detail); + const data = event.detail + this.setData({ + mapEndObj: data.info + }) + this.getRoute(data.info, data.inputType) + }, + // 路线搜索 默认驾车 + getRoute: function (info, type) { + var that = this; + console.log('搜索目的地及路线', info, type) + if (type === 'start') { + const markersData = [{ + iconPath: "../../img/marker_checked.png", + id: 0, + latitude: info.location.split(',')[1], + longitude: info.location.split(',')[0], + width: 23, + height: 33, + name: info.name, + address: info.district + }] + that.setData({ + city: info.name, + daohang: false, + city_e: '', + latitude: info.location.split(',')[1], + longitude: info.location.split(',')[0], + city: info.name, + polyline: [], + markers: markersData, + includePoints: [{ + latitude: info.location.split(',')[1], + longitude: info.location.split(',')[0] + }] + }); + that.showMarkerInfo(markersData, 0); + return + } else { + that.setData({ + daohang: true, + city_e: info.name, + latitude_e: info.location.split(',')[1], + longitude_e: info.location.split(',')[0], + city_e: info.name + }); + } + + var key = gaode_key.Config.key; + var myAmapFun = new amapFile.AMapWX({ + key: key + }); + const gaodeParams = { + origin: `${this.data.longitude},${this.data.latitude}`, + destination: `${this.data.longitude_e},${this.data.latitude_e}`, + success: function (data) { + console.log('路线', data) + var points = []; + if (data.paths && data.paths[0] && data.paths[0].steps) { + var steps = data.paths[0].steps; + for (var i = 0; i < steps.length; i++) { + var poLen = steps[i].polyline.split(';'); + for (var j = 0; j < poLen.length; j++) { + points.push({ + longitude: parseFloat(poLen[j].split(',')[0]), + latitude: parseFloat(poLen[j].split(',')[1]) + }) + } + } + } + const markersData = [{ + iconPath: "../../img/mapicon_navi_s.png", + id: 0, + latitude: that.data.latitude, + longitude: that.data.longitude, + width: 23, + height: 33 + }, { + iconPath: "../../img/mapicon_navi_e.png", + id: 1, + latitude: that.data.latitude_e, + longitude: that.data.longitude_e, + width: 24, + height: 34 + }] + that.setData({ + polyline: [{ + points: points, + color: "#0091ff", + width: 6 + }], + markers: markersData, + includePoints: [{ + latitude: that.data.latitude, + longitude: that.data.longitude + }, { + latitude: that.data.latitude_e, + longitude: that.data.longitude_e + }], + mapState: true + }); + that.showMarkerInfo(markersData, 1); + + if (that.data.gaode_type === 'car') { + if(data.paths[0] && data.paths[0].distance){ + that.setData({ + distance: (parseInt(data.paths[0].distance) / 1000).toFixed(2) + '千米' // 保留两位小数 + }); + } + if(data.taxi_cost){ + that.setData({ + taxi_cost: '出租车约' + parseInt(data.taxi_cost)*1.25.toFixed(2) + '元,适宜乘坐1~4人', + multi_cost: '拼车约' + parseInt(data.taxi_cost)*0.85.toFixed(2) + '元,适宜乘坐1~4人', + bigger_cost: '商务车约' + parseInt(data.taxi_cost)*2.25.toFixed(2) + '元,适宜乘坐5~8人', + }); + } + } else if (that.data.gaode_type === 'riding') { + if(data.paths[0] && data.paths[0].distance){ + that.setData({ + distance: (parseInt(data.paths[0].distance) / 1000).toFixed(2) + '千米' + }); + } + if(data.taxi_cost){ + that.setData({ + taxi_cost: '打车约' + parseInt(data.taxi_cost)*1.3.toFixed(2) + '元,适宜乘坐1~4人' + }); + } + } else if (that.data.gaode_type === 'walk') { + if(data.paths[0] && data.paths[0].distance){ + that.setData({ + distance: (parseInt(data.paths[0].distance) / 1000).toFixed(2) + '千米' // 保留两位小数 + }); + } + if(data.paths[0] && data.paths[0].duration){ + that.setData({ + cost: parseInt(data.paths[0].duration/60) + '分钟' + }); + } + } else if (that.data.gaode_type === 'bus') { + console.log('公交', data) + } + }, + fail: function(info){ + console.log('出现问题', info) + } + } + if (this.data.gaode_type === 'car') { + // 驾车 + myAmapFun.getDrivingRoute(gaodeParams) + } else if (this.data.gaode_type === 'walk') { + // 步行 + myAmapFun.getWalkingRoute(gaodeParams) + } else if (this.data.gaode_type === 'bus') { + // 公交 + myAmapFun.getTransitRoute({ + origin: `${this.data.longitude},${this.data.latitude}`, + destination: `${this.data.longitude_e},${this.data.latitude_e}`, + city: '广州', + success: function(data){ + console.log('公交信息', data.transits) + if(data && data.transits){ + var transits = data.transits; + for(var i = 0; i < transits.length; i++){ + var segments = transits[i].segments; + transits[i].transport = []; + for(var j = 0; j < segments.length; j++){ + if(segments[j].bus && segments[j].bus.buslines && segments[j].bus.buslines[0] && segments[j].bus.buslines[0].name){ + var name = segments[j].bus.buslines[0].name + if(j!==0){ + name = '--' + name; + } + transits[i].transport.push(name); + } + } + } + } + that.setData({ + transits: transits, + mapState: true + }); + + }, + fail: function(info){ + wx.showModal({ + title: info + }) + console.log('出现问题', info) + } + }) + + } else if (this.data.gaode_type === 'riding') { + // 骑行 + myAmapFun.getRidingRoute(gaodeParams) + } + + + }, + // 地点搜索 如果搜索目的地搜索导航 + getPoiData: function (keywords, searchType) { + var that = this; + let params = { + iconPathSelected: '../../img/marker_checked.png', //如:..­/..­/img/marker_checked.png + iconPath: '../../img/marker.png', //如:..­/..­/img/marker.png + success: function (data) { + console.log('当前位置', data) + markersData = data.markers; + // 搜索当前位置 附近poi + console.log('搜索当前位置,清除目的地信息') + that.setData({ + markers: markersData, + latitude: markersData[0].latitude, + longitude: markersData[0].longitude, + city: markersData[0].name, + }); + that.showMarkerInfo(markersData, 0); + }, + fail: function (info) { + wx.showModal({ + title: info.errMsg + }) + } + } + if (keywords) { + params.querykeywords = keywords; + } + var myAmapFun = new amapFile.AMapWX({ + key: gaode_key.Config.key + }); + myAmapFun.getPoiAround(params) + }, + + showMarkerInfo: function (data, i) { + var that = this; + that.setData({ + textData: { + name: data[i].name, + desc: data[i].address + } + }); + }, + changeMarkerColor: function (data, i) { + var that = this; + var markers = []; + for (var j = 0; j < data.length; j++) { + if (j == i) { + data[j].iconPath = "../../img/marker_checked.png"; //如:..­/..­/img/marker_checked.png + } else { + data[j].iconPath = "../../img/marker.png"; //如:..­/..­/img/marker.png + } + markers.push(data[j]); + } + that.setData({ + markers: markers + }); + } + +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/index/index.json b/src/Carpool/miniprogram/pages/index/index.json new file mode 100644 index 0000000..8a9ff0e --- /dev/null +++ b/src/Carpool/miniprogram/pages/index/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "GaodeHeader": "/components/GaodeHeader/GaodeHeader", + "GaodeInputTips": "/components/GaodeInputTips/GaodeInputTips" + } +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/index/index.wxml b/src/Carpool/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..96ed7f0 --- /dev/null +++ b/src/Carpool/miniprogram/pages/index/index.wxml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + {{j}} + + + + + 搜索中... + + + {{textData.name}} + {{textData.desc}} + + {{distance}} + {{taxi_cost}} + {{multi_cost}} + {{bigger_cost}} + + diff --git a/src/Carpool/miniprogram/pages/index/index.wxss b/src/Carpool/miniprogram/pages/index/index.wxss new file mode 100644 index 0000000..fe9948b --- /dev/null +++ b/src/Carpool/miniprogram/pages/index/index.wxss @@ -0,0 +1,53 @@ +.section{ + height: 80px; + width: 100%; +} +.section input{ + width:90%; + margin:5px auto; + border:1px solid #c3c3c3; + height:30px; + border-radius: 3px; + padding: 0 5px; +} +.map_container{ + position: absolute; + top: 110px; + bottom: 100px; + left: 0; + right: 0; +} +.map{ + width: 100%; + height: 100%; +} +/*最下总体框架*/ +.map_text{ + position: absolute; + left: 0; + right: 0; + text-outline: 10px; + bottom: 0px; + height: 80px; + background: rgb(255, 255, 255); + padding: 0 15px; +} +/*地图首页下方显示地址的框*/ +text{ + margin: 5px 0; + display: block; + font-size: 15px; +} +/*地图首页下方框中文字*/ +.h1{ + margin: 25px 10; + font-size:18px; +} +/* 公交样式 */ +.text_box{ + margin: 0 15px; + padding: 0px 0; + border-bottom: 0px solid #ff0000; + font-size: 13px; +} +.text_box .text_item{display:inline-block;line-height: 8px;} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jialook/jialook.js b/src/Carpool/miniprogram/pages/jialook/jialook.js new file mode 100644 index 0000000..5fba5e2 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jialook/jialook.js @@ -0,0 +1,54 @@ +Page({ + data:{ + nicheng:'', + weixinhao:'', + date:'', + price:'', + time:'', + qidian:'', + zhongdian:'', + ask:'', + renshu:'', + id:'' + }, + onLoad(options) { + console.log('携带的数据',options.id) + wx.cloud.database().collection("pinche").where({ + _id:options.id + }).get({ + success:(res)=>{ + let kong=res.data[0] + console.log(kong) + this.setData({ + id:kong._id, + nicheng:kong.nicheng, + weixinhao:kong.weixinhao, + date:kong.date, + time:kong.time, + qidian:kong.qidian, + zhongdian:kong.zhongdian, + renshu:kong.renshu, + price:kong.price + }) + + } + }) +}, +fanhui(e){ + if(this.data.renshu=='0'){ + wx.showToast({ + icon:'none', + title:'加入拼车人数已满' + }) + return + } + + wx.navigateTo({ + url: '../shenqing/shenqing?id='+ this.data.nicheng, + }) + + + + +} +}) diff --git a/src/Carpool/miniprogram/pages/jialook/jialook.json b/src/Carpool/miniprogram/pages/jialook/jialook.json new file mode 100644 index 0000000..4221e15 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jialook/jialook.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "拼车详细信息", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jialook/jialook.wxml b/src/Carpool/miniprogram/pages/jialook/jialook.wxml new file mode 100644 index 0000000..acd147d --- /dev/null +++ b/src/Carpool/miniprogram/pages/jialook/jialook.wxml @@ -0,0 +1,52 @@ +背景图片 + +发布拼车人微信昵称: + + + + +发布拼车人手机号: + + + + +拼车总费用: + + + + + 出发日期: + + + + + 出发时间: + + + + + + +出发地点: + + + + + +到达地点: + + + + +拼车剩余人数: + + + + +对拼车人员的要求(非必填) + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jialook/jialook.wxss b/src/Carpool/miniprogram/pages/jialook/jialook.wxss new file mode 100644 index 0000000..055c817 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jialook/jialook.wxss @@ -0,0 +1,38 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + height: 100px; + background-color: white; +} +.describe{ + font-size: 40rpx; +} +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.titles{ + font-size: 40rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jiaru/jiaru.js b/src/Carpool/miniprogram/pages/jiaru/jiaru.js new file mode 100644 index 0000000..eeb0a35 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jiaru/jiaru.js @@ -0,0 +1,241 @@ +let db=wx.cloud.database() +let page +let num = 1 +let con =1 +Page({ + + data: { + key:null, + number:'', + list:[], + pages:'', + conter:'', + tip:0 + }, + +search(){ + console.log(this.data.key) + let key=this.data.key + if(this.data.key){ + console.log('可以执行搜索') + this.getcounter() + db.collection('pinche') + .where({ + zhongdian:db.RegExp({ + regexp:key, + options:'i', + }) + }).skip(4*page).limit(4).get().then(res=>{ + console.log('请求到的数据',res) + if(res.data.length==0){ + this.setData({ + pages:0 + }) + }else{ + this.setData({ + pages:page+1 + }) + } + num=0 + this.setData({ + list:res.data + }) + }) + }else{ + this.onLoad(); + } +}, +//获取文本框内容 +getkey(e){ + this.setData({ + key:e.detail.value + }) +}, +//获取符合要求数据的条数 +getcounter(){ + db.collection('pinche') + .where({ + zhongdian:db.RegExp({ + regexp:this.data.key, + options:'i', + }) + }).count().then(res=>{ + if(res.total==0){ + con =0 + }else{ + con =1 + } + this.setData({ + conter:Math.ceil(res.total/4), + tip:1 + }) + }) +}, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + num = 1 + this.setData({ + tip:0 + }) + page = 0 + this.getnum() + this.getList() + this.setData({ + pages:page+1 + }) + }, + //获取数据库中数据个数 + getnum(){ + wx.cloud.database().collection('pinche').where({ + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + }, + //获取数据 + getList(){ + wx.cloud.database().collection('pinche').where({ + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + }, + //下一页 + bind(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + if(page0){ + page-- + this.search() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + }) + }else{ + if(page>0){ + page-- + this.getList() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + })} + }, + //首页 + start(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=0 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=0 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + //尾页 + end(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=this.data.conter-1 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=this.data.number-1 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + golook(e){ + wx.navigateTo({ + url: '../jialook/jialook?id='+e.currentTarget.dataset.item._id, + }) + }, +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jiaru/jiaru.json b/src/Carpool/miniprogram/pages/jiaru/jiaru.json new file mode 100644 index 0000000..fb26b2f --- /dev/null +++ b/src/Carpool/miniprogram/pages/jiaru/jiaru.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车加入", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jiaru/jiaru.wxml b/src/Carpool/miniprogram/pages/jiaru/jiaru.wxml new file mode 100644 index 0000000..d9fe161 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jiaru/jiaru.wxml @@ -0,0 +1,24 @@ +背景图片 + + + + + 起点:{{item.qidian}} + + 终点:{{item.zhongdian}} + + + + + + + + +{{pages}}/{{number}} + + +{{pages}}/{{conter}} + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/jiaru/jiaru.wxss b/src/Carpool/miniprogram/pages/jiaru/jiaru.wxss new file mode 100644 index 0000000..f6994e5 --- /dev/null +++ b/src/Carpool/miniprogram/pages/jiaru/jiaru.wxss @@ -0,0 +1,70 @@ +page{ + background-color:#B6C2D6; +} +.images{ + width: 100%; + height: 400rpx; +} +.cont{ + position: relative; +} + +.imge{ + height: 70rpx; + width: 70rpx; +} +.list{ + border: 1px solid; + padding: 13rpx; +} +.button-container { + display: flex; + justify-content: space-around; + position: fixed; + bottom: 0px; + width: 99%; +} +.yema{ + font-size: 40rpx; +} + +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} +.button-containe { + display: flex; + justify-content: space-around; +} +.option{ + position: relative; +} +.button3{ + position:absolute; + right: 0rpx; + top:0rpx; +} +.button4{ + position:absolute; + right: 0rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; + width: 85%; +} +.serach{ + border: 1px solid; + height: 60rpx; + width:85%; + background-color: white; + padding-left: 10rpx; +} +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/list/list.js b/src/Carpool/miniprogram/pages/list/list.js new file mode 100644 index 0000000..ec3073d --- /dev/null +++ b/src/Carpool/miniprogram/pages/list/list.js @@ -0,0 +1,64 @@ +const app = getApp() +Page({ + + data: { + zhanghao:'', + password:'' + }, + getzhanghao(e){ + //console.log('获取账号',e.detail.value) + this.setData({ + zhanghao:e.detail.value + }) + }, + getpassword(e){ + //console.log('获取密码',e.detail.value) + this.setData({ + password:e.detail.value + }) + }, + login(){ + let zhanghao=this.data.zhanghao + let password=this.data.password + //console.log('账号',zhanghao,'密码',password) + wx.cloud.database().collection('admin').where({ + zhanghao:zhanghao + }). get({ + success(res){ + if(res.data.length==0){ + wx.showToast({ + icon:'none', + title: '账号不正确', + }) + return + } + let admin=res.data[0] + if(password==admin.password){ + app.globalData.token = zhanghao + console.log('登录成功') + wx.showToast({ + title: '登录成功', + }) + wx.navigateTo({ + url: '../xinguan/xinguan', + }) + } + else{ + console.log('登录失败') + wx.showToast({ + icon:'none', + title: '密码不正确', + }) + } + }, + fail(res){ + wx.showToast({ + icon:'none', + title: '获取数据失败', + }) + } + + }) + } + +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/list/list.json b/src/Carpool/miniprogram/pages/list/list.json new file mode 100644 index 0000000..d741695 --- /dev/null +++ b/src/Carpool/miniprogram/pages/list/list.json @@ -0,0 +1,7 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "管理员登录", + "navigationBarBackgroundColor": "#B6C2D6" + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/list/list.wxml b/src/Carpool/miniprogram/pages/list/list.wxml new file mode 100644 index 0000000..7032b1d --- /dev/null +++ b/src/Carpool/miniprogram/pages/list/list.wxml @@ -0,0 +1,13 @@ +背景图片 + +账号: + + + +密码: + + + +权限:管理员 + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/list/list.wxss b/src/Carpool/miniprogram/pages/list/list.wxss new file mode 100644 index 0000000..6bd30af --- /dev/null +++ b/src/Carpool/miniprogram/pages/list/list.wxss @@ -0,0 +1,39 @@ +.input{ + background-color: white; + width: 70%; + height: 70rpx; + float: left; + border: black 1px solid; + padding-left: 10rpx; +} +.zhanghao{ + font-size: 50rpx; + +} +.mima{ + font-size: 50rpx; +} +image{ + width: 100%; + height: 400rpx; +} +page{ + background-color:#B6C2D6; +} +.zhang{ + display: flex; + margin: 20rpx; + margin-top: 80rpx; + margin-left: 50rpx; + +} +.mi{ + display: flex; + margin: 20rpx; + margin-top: 30rpx; + margin-left: 50rpx; +} +.tipe{ + font-size: 40rpx; + margin-left: 50rpx; +} diff --git a/src/Carpool/miniprogram/pages/login/login.js b/src/Carpool/miniprogram/pages/login/login.js new file mode 100644 index 0000000..044fb41 --- /dev/null +++ b/src/Carpool/miniprogram/pages/login/login.js @@ -0,0 +1,52 @@ +let db=wx.cloud.database() +let nikname +Page({ + data: { + userInfo: '', + nicheng:'', + }, + onLoad() { + + let user = wx.getStorageSync('user') + console.log('进入小程序index页面获取缓存', user) + this.setData({ + userInfo: user + }) + }, + //授权登录 + login (){ + wx.getUserProfile({ + desc: '必须点击授权才可以继续使用', + success: res => { + let user = res.userInfo + //把用户信息缓存到本地 + + wx.setStorageSync('user', user) + console.log('用户信息', res.userInfo) + nikname = res.userInfo.nickName + this.ge(); + this.setData({ + userInfo: user, + nicheng:nikname + }) + + }, + fail: res => { + console.log('授权失败', res) + } + }) + }, + //退出登录 + loginOut (){ + this.setData ({ + userInfo: '' + }) + wx.setStorageSync('user', null) + }, + ge(){ + + wx.redirectTo({ + url: '../home/home', + }) + } +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/login/login.json b/src/Carpool/miniprogram/pages/login/login.json new file mode 100644 index 0000000..09d7b47 --- /dev/null +++ b/src/Carpool/miniprogram/pages/login/login.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车登录", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/login/login.wxml b/src/Carpool/miniprogram/pages/login/login.wxml new file mode 100644 index 0000000..41fd8af --- /dev/null +++ b/src/Carpool/miniprogram/pages/login/login.wxml @@ -0,0 +1,8 @@ +背景图片 + + + + + {{userInfo.nickName}} + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/login/login.wxss b/src/Carpool/miniprogram/pages/login/login.wxss new file mode 100644 index 0000000..0214d41 --- /dev/null +++ b/src/Carpool/miniprogram/pages/login/login.wxss @@ -0,0 +1,52 @@ +.login-button { + position: absolute; /* 使用绝对定位 */ + top: 50%; /* 垂直居中 */ + left: 50%; /* 水平居中 */ + transform: translate(-50%, 175%); /* 通过平移使其真正居中 */ + background-color: rgb(0, 255, 0); /* 设置按钮背景为蓝色 */ + color: rgb(0, 0, 0); /* 设置按钮文字颜色为白色,以确保文字可读性 */ + width: 60px; /* 设置按钮宽度 */ + height: 60px; /* 设置按钮高度 */ + border-radius: 30px; /* 使按钮变为圆形 */ + border: 2px solid rgba(128, 128, 128, 1.5); /* 添加白色边框 */ + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7); /* 添加阴影效果 */ + display: flex; /* 使用 Flexbox 进行内容对齐 */ + align-items: center; /* 垂直居中对齐 */ + justify-content: center; /* 水平居中对齐 */ + font-size: 20px; /* 设置字体大小 */ + cursor: hand; /* 鼠标悬停时显示为手型 */ + +} +image{ + width: 100%; + height: 600rpx; +} +.login-button:hover { + background-color: rgb(0, 255, 0); /* 悬停时改变背景颜色 */ + +} +page{ + background-color:#B6C2D6; +} + +.root { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.touxiang { + width: 200rpx; + height: 200rpx; + border-radius: 50% ; + margin-top: 30rpx; + margin-bottom: 10rpx; +} + +.out{ + position: relative; + text-indent: -1; + background-color: red; + color:white +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/picture/2.png b/src/Carpool/miniprogram/pages/picture/2.png new file mode 100644 index 0000000..922ac1d Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/2.png differ diff --git a/src/Carpool/miniprogram/pages/picture/di.png b/src/Carpool/miniprogram/pages/picture/di.png new file mode 100644 index 0000000..d31c03c Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/di.png differ diff --git a/src/Carpool/miniprogram/pages/picture/fa.png b/src/Carpool/miniprogram/pages/picture/fa.png new file mode 100644 index 0000000..5030b12 Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/fa.png differ diff --git a/src/Carpool/miniprogram/pages/picture/guan.png b/src/Carpool/miniprogram/pages/picture/guan.png new file mode 100644 index 0000000..2237220 Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/guan.png differ diff --git a/src/Carpool/miniprogram/pages/picture/jia.png b/src/Carpool/miniprogram/pages/picture/jia.png new file mode 100644 index 0000000..ec6b42a Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/jia.png differ diff --git a/src/Carpool/miniprogram/pages/picture/li.png b/src/Carpool/miniprogram/pages/picture/li.png new file mode 100644 index 0000000..1a06004 Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/li.png differ diff --git a/src/Carpool/miniprogram/pages/picture/shen.png b/src/Carpool/miniprogram/pages/picture/shen.png new file mode 100644 index 0000000..3f5fec2 Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/shen.png differ diff --git a/src/Carpool/miniprogram/pages/picture/xin.png b/src/Carpool/miniprogram/pages/picture/xin.png new file mode 100644 index 0000000..fbe06eb Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/xin.png differ diff --git a/src/Carpool/miniprogram/pages/picture/yong.png b/src/Carpool/miniprogram/pages/picture/yong.png new file mode 100644 index 0000000..e2abc94 Binary files /dev/null and b/src/Carpool/miniprogram/pages/picture/yong.png differ diff --git a/src/Carpool/miniprogram/pages/shenguan/shenguan.js b/src/Carpool/miniprogram/pages/shenguan/shenguan.js new file mode 100644 index 0000000..bb89d97 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenguan/shenguan.js @@ -0,0 +1,233 @@ +let db=wx.cloud.database() +let page +let num = 1 +let con =1 +Page({ + + data: { + key:null, + number:'', + list:[], + pages:'', + conter:'', + tip:0, + + }, + + onLoad(options) { + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: res=> { + console.log(res.data.nickName); // 输出获取到的数据 + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + + + + }, + + }) + num = 1 + this.setData({ + tip:0 + }) + page = 0 + + this.setData({ + pages:page+1 + }) + }, + //获取数据库中数据个数 + getnum(){ + + }, + //获取数据 + getList(){ + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: res=> { + console.log(res.data.nickName); // 输出获取到的数据 + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + + + + }, + + }) + }, + //下一页 + bind(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + if(page0){ + page-- + this.search() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + }) + }else{ + if(page>0){ + page-- + this.getList() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + })} + }, + //首页 + start(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=0 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=0 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + //尾页 + end(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=this.data.conter-1 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=this.data.number-1 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + golook(e){ + wx.navigateTo({ + url: '../yonghu/yonghu?id='+e.currentTarget.dataset.item._id, + }) + }, +}) + + + diff --git a/src/Carpool/miniprogram/pages/shenguan/shenguan.json b/src/Carpool/miniprogram/pages/shenguan/shenguan.json new file mode 100644 index 0000000..07aa916 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenguan/shenguan.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车申请管理", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenguan/shenguan.wxml b/src/Carpool/miniprogram/pages/shenguan/shenguan.wxml new file mode 100644 index 0000000..61ff909 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenguan/shenguan.wxml @@ -0,0 +1,22 @@ +背景图片 + + + 昵称:{{item.nicheng}} + + 性别:{{item.sex}} + + + + + + + + +{{pages}}/{{number}} + + +{{pages}}/{{conter}} + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenguan/shenguan.wxss b/src/Carpool/miniprogram/pages/shenguan/shenguan.wxss new file mode 100644 index 0000000..f6994e5 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenguan/shenguan.wxss @@ -0,0 +1,70 @@ +page{ + background-color:#B6C2D6; +} +.images{ + width: 100%; + height: 400rpx; +} +.cont{ + position: relative; +} + +.imge{ + height: 70rpx; + width: 70rpx; +} +.list{ + border: 1px solid; + padding: 13rpx; +} +.button-container { + display: flex; + justify-content: space-around; + position: fixed; + bottom: 0px; + width: 99%; +} +.yema{ + font-size: 40rpx; +} + +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} +.button-containe { + display: flex; + justify-content: space-around; +} +.option{ + position: relative; +} +.button3{ + position:absolute; + right: 0rpx; + top:0rpx; +} +.button4{ + position:absolute; + right: 0rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; + width: 85%; +} +.serach{ + border: 1px solid; + height: 60rpx; + width:85%; + background-color: white; + padding-left: 10rpx; +} +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenqing/shenqing.js b/src/Carpool/miniprogram/pages/shenqing/shenqing.js new file mode 100644 index 0000000..ede10d2 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenqing/shenqing.js @@ -0,0 +1,196 @@ +const db=wx.cloud.database() +Page({ + + /** + * 页面的初始数据 + */ + data: { + nicheng:'', + nikname:'', + weixinhao:'', + sno:'', + array: ['请选择', '男', '女'], + arr: ['请选择', '航空工程学院', '空中交通管理学院', '交通工程学院', '法学院', '中欧航空工程师学院', '安全科学与工程学院', '经济管理学院', '马克思主义学院', '外国语学院', '理学院', '电子信息与自动化学院', '计算机科学与技术学院', '职业技术学院'], + objectArray: [ + { + id: 0, + name: '请选择' + }, + { + id: 1, + name: '男' + }, + { + id: 2, + name: '女' + }, + { + id: 3, + name: '航空工程学院' + }, + { + id: 4, + name: '中欧航空工程师学院' + }, + { + id: 5, + name: '空中交通管理学院' + }, + { + id: 6, + name: '法学院' + }, + { + id: 7, + name: '交通工程学院' + }, + { + id: 8, + name: '安全科学与工程学院' + }, + { + id: 9, + name: '经济管理学院' + }, + { + id: 10, + name: '马克思主义学院' + }, + { + id: 11, + name: '外国语学院' + }, + { + id: 12, + name: '理学院' + }, + { + id: 13, + name: '电子信息与自动化学院' + }, + { + id: 14, + name: '计算机科学与技术学院' + }, + { + id: 15, + name: '职业技术学院' + }, + ], + index: 0, + ind:0, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (options.id) { + console.log('接收到的 ID:', options.id); + } + this.setData({ + nikname:options.id + }) + }, + bindPickerChange: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + index: e.detail.value, + }) + + }, + bindPicker: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + ind: e.detail.value, + }) + }, + gettitle(e){ + this.setData({ + nicheng:e.detail.value + }) + }, + getweixin(e){ + this.setData({ + weixinhao:e.detail.value + }) + }, + getsno(e){ + this.setData({ + sno:e.detail.value + }) + }, + submit(res){ + let nicheng = this.data.nicheng + let weixinhao = this.data.weixinhao + let nikname = this.data.nikname + let sex =this.data.array[this.data.index] + let xueyuan =this.data.arr[this.data.ind] + let sno =this.data.sno + if(this.data.nicheng==''){ + wx.showToast({ + icon:'none', + title:'请填写微信昵称' + }) + return + } + if(this.data.weixinhao==''){ + wx.showToast({ + icon:'none', + title:'请填写手机号' + }) + return + } + if(this.data.weixinhao==''){ + wx.showToast({ + icon:'none', + title:'请填写手机号' + }) + return + } + if(sex=='请选择'){ + wx.showToast({ + icon:'none', + title:'请选择性别' + }) + return + } + if(sno==''){ + wx.showToast({ + icon:'none', + title:'请输入学号' + }) + return + } + if(xueyuan=='请选择'){ + wx.showToast({ + icon:'none', + title:'请选择学院' + }) + return + } + + db.collection("qingdan"). + add({ + data:{ + nicheng:nicheng, + weixinhao:weixinhao, + sex:sex, + xueyuan:xueyuan, + sno:sno, + nikname:nikname, + station:'请选择', + qing:0 + } + }).then(res=>{ + console.log(res) + wx.showToast({ + title:'提交成功', + }) + // wx.navigateTo({ + // url: '../fenye/fenye', + // }) + }) +} +, +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenqing/shenqing.json b/src/Carpool/miniprogram/pages/shenqing/shenqing.json new file mode 100644 index 0000000..59a4c3f --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenqing/shenqing.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "校园拼车申请", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenqing/shenqing.wxml b/src/Carpool/miniprogram/pages/shenqing/shenqing.wxml new file mode 100644 index 0000000..521ae25 --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenqing/shenqing.wxml @@ -0,0 +1,34 @@ +背景图片 + +微信昵称: + + + + +手机号: + + + + 性别: + + + {{array[index]}} + + + + +学号: + + + + 学院: + + + {{arr[ind]}} + + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/shenqing/shenqing.wxss b/src/Carpool/miniprogram/pages/shenqing/shenqing.wxss new file mode 100644 index 0000000..e8599db --- /dev/null +++ b/src/Carpool/miniprogram/pages/shenqing/shenqing.wxss @@ -0,0 +1,43 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + background-color: white; +} + +.world{ + margin-top: 30rpx; +} + +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wode/wode.js b/src/Carpool/miniprogram/pages/wode/wode.js new file mode 100644 index 0000000..dc370ac --- /dev/null +++ b/src/Carpool/miniprogram/pages/wode/wode.js @@ -0,0 +1,233 @@ +let db=wx.cloud.database() +let page +let num = 1 +let con =1 +Page({ + + data: { + key:null, + number:'', + list:[], + pages:'', + conter:'', + tip:0, + + }, + + onLoad(options) { + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: res=> { + console.log(res.data.nickName); // 输出获取到的数据 + wx.cloud.database().collection('qingdan').where({ + nicheng:res.data.nickName + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + + + + }, + + }) + num = 1 + this.setData({ + tip:0 + }) + page = 0 + + this.setData({ + pages:page+1 + }) + }, + //获取数据库中数据个数 + getnum(){ + + }, + //获取数据 + getList(){ + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: res=> { + console.log(res.data.nickName); // 输出获取到的数据 + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + wx.cloud.database().collection('qingdan').where({ + nikname:res.data.nickName + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + + + + }, + + }) + }, + //下一页 + bind(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + if(page0){ + page-- + this.search() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + }) + }else{ + if(page>0){ + page-- + this.getList() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + })} + }, + //首页 + start(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=0 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=0 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + //尾页 + end(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=this.data.conter-1 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=this.data.number-1 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + golook(e){ + wx.navigateTo({ + url: '../wolook/wolook?id='+e.currentTarget.dataset.item._id, + }) + }, +}) + + + diff --git a/src/Carpool/miniprogram/pages/wode/wode.json b/src/Carpool/miniprogram/pages/wode/wode.json new file mode 100644 index 0000000..d2c14d1 --- /dev/null +++ b/src/Carpool/miniprogram/pages/wode/wode.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "我的拼车申请", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wode/wode.wxml b/src/Carpool/miniprogram/pages/wode/wode.wxml new file mode 100644 index 0000000..dc0f383 --- /dev/null +++ b/src/Carpool/miniprogram/pages/wode/wode.wxml @@ -0,0 +1,22 @@ +背景图片 + + + 发起拼车人昵称:{{item.nikname}} + + 申请情况:{{item.station}} + + + + + + + + +{{pages}}/{{number}} + + +{{pages}}/{{conter}} + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wode/wode.wxss b/src/Carpool/miniprogram/pages/wode/wode.wxss new file mode 100644 index 0000000..f6994e5 --- /dev/null +++ b/src/Carpool/miniprogram/pages/wode/wode.wxss @@ -0,0 +1,70 @@ +page{ + background-color:#B6C2D6; +} +.images{ + width: 100%; + height: 400rpx; +} +.cont{ + position: relative; +} + +.imge{ + height: 70rpx; + width: 70rpx; +} +.list{ + border: 1px solid; + padding: 13rpx; +} +.button-container { + display: flex; + justify-content: space-around; + position: fixed; + bottom: 0px; + width: 99%; +} +.yema{ + font-size: 40rpx; +} + +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} +.button-containe { + display: flex; + justify-content: space-around; +} +.option{ + position: relative; +} +.button3{ + position:absolute; + right: 0rpx; + top:0rpx; +} +.button4{ + position:absolute; + right: 0rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; + width: 85%; +} +.serach{ + border: 1px solid; + height: 60rpx; + width:85%; + background-color: white; + padding-left: 10rpx; +} +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wolook/wolook.js b/src/Carpool/miniprogram/pages/wolook/wolook.js new file mode 100644 index 0000000..24555de --- /dev/null +++ b/src/Carpool/miniprogram/pages/wolook/wolook.js @@ -0,0 +1,56 @@ +let num +Page({ + data:{ + nicheng:'', + weixinhao:'', + sex:'', + xueyuan:'', + sno:'', + station:'', + qing:'', + renshu:'', + date:'' + + }, + + onLoad(options) { + console.log('携带的数据',options.id) + wx.cloud.database().collection("qingdan").where({ + _id:options.id + }).get({ + success:(res)=>{ + let kong=res.data[0] + console.log(kong) + this.setData({ + id1:kong._id, + nicheng:kong.nikname, + station:kong.station, + }) + wx.cloud.database().collection('pinche').where({ + nicheng:this.data.nicheng + }).get({ + success:(res)=>{ + let pin=res.data[0] + console.log(pin) + this.setData({ + id2:pin._id, + weixinhao:pin.weixinhao, + date:pin.date, + sno:pin.qidian, + xueyuan:pin.zhongdian + }) + } + }) + + } + + }) + +}, +submit(){ + wx.navigateBack({ + delta: 1 + }) +}, + +}) diff --git a/src/Carpool/miniprogram/pages/wolook/wolook.json b/src/Carpool/miniprogram/pages/wolook/wolook.json new file mode 100644 index 0000000..27d0153 --- /dev/null +++ b/src/Carpool/miniprogram/pages/wolook/wolook.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "我的拼车申请详情", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wolook/wolook.wxml b/src/Carpool/miniprogram/pages/wolook/wolook.wxml new file mode 100644 index 0000000..9f2f839 --- /dev/null +++ b/src/Carpool/miniprogram/pages/wolook/wolook.wxml @@ -0,0 +1,40 @@ +背景图片 + +发布拼车人微信昵称: + + + + +发布拼车人手机号: + + + + +出发时间: + + + + + +出发地点: + + + + + +终点: + + + + + +申请情况: + + + + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/wolook/wolook.wxss b/src/Carpool/miniprogram/pages/wolook/wolook.wxss new file mode 100644 index 0000000..e8599db --- /dev/null +++ b/src/Carpool/miniprogram/pages/wolook/wolook.wxss @@ -0,0 +1,43 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + background-color: white; +} + +.world{ + margin-top: 30rpx; +} + +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinguan/xinguan.js b/src/Carpool/miniprogram/pages/xinguan/xinguan.js new file mode 100644 index 0000000..c93c19c --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinguan/xinguan.js @@ -0,0 +1,243 @@ +let db=wx.cloud.database() +let page +let num = 1 +let con =1 +Page({ + + data: { + key:null, + number:'', + list:[], + pages:'', + conter:'', + tip:0 + + }, +//查询符合要求的数据 +search(){ + console.log(this.data.key) + let key=this.data.key + if(this.data.key){ + console.log('可以执行搜索') + this.getcounter() + db.collection('pingjia') + .where({ + nicheng:db.RegExp({ + regexp:key, + options:'i', + }) + }).skip(4*page).limit(4).get().then(res=>{ + console.log('请求到的数据',res) + if(res.data.length==0){ + this.setData({ + pages:0 + }) + }else{ + this.setData({ + pages:page+1 + }) + } + num=0 + this.setData({ + list:res.data + }) + }) + }else{ + this.onLoad(); + } +}, +//获取文本框内容 +getkey(e){ + this.setData({ + key:e.detail.value + }) +}, +//获取符合要求数据的条数 +getcounter(){ + db.collection('pingjia') + .where({ + nicheng:db.RegExp({ + regexp:this.data.key, + options:'i', + }) + }).count().then(res=>{ + if(res.total==0){ + con =0 + }else{ + con =1 + } + this.setData({ + conter:Math.ceil(res.total/4), + tip:1 + }) + }) +}, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + num = 1 + this.setData({ + tip:0 + }) + page = 0 + this.getnum() + this.getList() + this.setData({ + pages:page+1 + }) + }, + //获取数据库中数据个数 + getnum(){ + wx.cloud.database().collection('pingjia').where({ + }).count() + .then(res=>{ + console.log(Math.ceil(res.total/4)), + this.setData({ + number:Math.ceil(res.total/4) + }) + if(this.data.number==0){ + this.setData({ + number:1 + }) + } + }) + }, + //获取数据 + getList(){ + wx.cloud.database().collection('pingjia').where({ + }) + .skip(4*page).limit(4) + .get() + .then(res=>{ + console.log('请求成功',res) + this.setData({ + list:res.data + }) + }).catch(res=>{ + console.log('请求失败',res) + }) + }, + //下一页 + bind(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + if(page0){ + page-- + this.search() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + }) + }else{ + if(page>0){ + page-- + this.getList() + }else{ + wx.showToast({ + icon:'none', + title:'当前已经是第一页' + }) + } this.setData({ + pages:page+1 + })} + }, + //首页 + start(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=0 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=0 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + //尾页 + end(){ + if(con==0){ + wx.showToast({ + icon:'none', + title:'没有符合条件数据' + }) + return + } + if(num==0){ + page=this.data.conter-1 + this.search() + this.setData({ + pages:page+1 + }) + }else{ + page=this.data.number-1 + this.getList() + this.setData({ + pages:page+1 + }) + } + }, + + golook(e){ + wx.navigateTo({ + url: '../xinlook/xinlook?id='+e.currentTarget.dataset.item._id, + }) + }, +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinguan/xinguan.json b/src/Carpool/miniprogram/pages/xinguan/xinguan.json new file mode 100644 index 0000000..0022d90 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinguan/xinguan.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "信誉积分管理", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinguan/xinguan.wxml b/src/Carpool/miniprogram/pages/xinguan/xinguan.wxml new file mode 100644 index 0000000..1096a40 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinguan/xinguan.wxml @@ -0,0 +1,25 @@ +背景图片 + + + + + + 用户昵称:{{item.nicheng}} + + + + + + + + + + +{{pages}}/{{number}} + + +{{pages}}/{{conter}} + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinguan/xinguan.wxss b/src/Carpool/miniprogram/pages/xinguan/xinguan.wxss new file mode 100644 index 0000000..f6994e5 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinguan/xinguan.wxss @@ -0,0 +1,70 @@ +page{ + background-color:#B6C2D6; +} +.images{ + width: 100%; + height: 400rpx; +} +.cont{ + position: relative; +} + +.imge{ + height: 70rpx; + width: 70rpx; +} +.list{ + border: 1px solid; + padding: 13rpx; +} +.button-container { + display: flex; + justify-content: space-around; + position: fixed; + bottom: 0px; + width: 99%; +} +.yema{ + font-size: 40rpx; +} + +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} +.button-containe { + display: flex; + justify-content: space-around; +} +.option{ + position: relative; +} +.button3{ + position:absolute; + right: 0rpx; + top:0rpx; +} +.button4{ + position:absolute; + right: 0rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; + width: 85%; +} +.serach{ + border: 1px solid; + height: 60rpx; + width:85%; + background-color: white; + padding-left: 10rpx; +} +.mini{ +margin-right: 0rpx; +margin-top: -65rpx; + +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinlook/xinlook.js b/src/Carpool/miniprogram/pages/xinlook/xinlook.js new file mode 100644 index 0000000..0c02900 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinlook/xinlook.js @@ -0,0 +1,55 @@ +Page({ + data:{ + nicheng:'', + ask:'', + src:'', + station:'', + id:'', + score:100, + sc:100 + }, + getscore(e){ + this.setData({ + score:e.detail.value + }) + }, + onLoad(options) { + console.log('携带的数据',options.id) + wx.cloud.database().collection("pingjia").where({ + _id:options.id + }).get({ + success:(res)=>{ + let kong=res.data[0] + console.log(kong) + this.setData({ + id:kong._id, + nicheng:kong.nicheng, + ask:kong.ask, + sc:kong.score + }) + if(this.data.sc==''){ + this.setData({ + sc:100 + }) + } + } + + }) +}, +fanhui(){ + wx.cloud.database().collection("pingjia").where({ + _id:this.data.id + }).update({ + data:{ + score:this.data.score + } + }).then(res=>{ + console.log(res) + wx.showToast({ + title:'更改成功', + }) + }) + + +} +}) diff --git a/src/Carpool/miniprogram/pages/xinlook/xinlook.json b/src/Carpool/miniprogram/pages/xinlook/xinlook.json new file mode 100644 index 0000000..46086d8 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinlook/xinlook.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "评价详细信息", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinlook/xinlook.wxml b/src/Carpool/miniprogram/pages/xinlook/xinlook.wxml new file mode 100644 index 0000000..416f7a3 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinlook/xinlook.wxml @@ -0,0 +1,19 @@ +背景图片 + +被投诉对象微信昵称: + + + +被投诉对象的违规行为 + + + +被投诉对象信誉积分: + + + 更改被投诉对象信誉积分: + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinlook/xinlook.wxss b/src/Carpool/miniprogram/pages/xinlook/xinlook.wxss new file mode 100644 index 0000000..055c817 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinlook/xinlook.wxss @@ -0,0 +1,38 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + height: 100px; + background-color: white; +} +.describe{ + font-size: 40rpx; +} +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.titles{ + font-size: 40rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinping/xinping.js b/src/Carpool/miniprogram/pages/xinping/xinping.js new file mode 100644 index 0000000..35cdd21 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinping/xinping.js @@ -0,0 +1,117 @@ +const db=wx.cloud.database() +Page({ + + /** + * 页面的初始数据 + */ + data: { + nicheng:'', + ask:'', + src:'', + station:'', + score:'' + + }, + gettitle(e){ + this.setData({ + nicheng:e.detail.value + }) + }, + handleTextareaInput: function(e) { + this.setData({ + ask:e.detail.value + }); + }, + + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + clickBtn(){ + let that =this + wx.chooseMedia({ + count: 1, + mediaType: ['image','video'], + sourceType: ['album', 'camera'], + success(res) { + console.log(res.tempFiles[0].tempFilePath) + const tempFilePath = res.tempFiles[0].tempFilePath + that.uploadImg(tempFilePath) + } + }) + }, + uploadImg(temFile){ + wx.showLoading({ + title:'上传中', + }) + wx.cloud.uploadFile({ + cloudPath: Date.now()+".jpg", + filePath: temFile, // 文件路径 + success: res => { + console.log(res.fileID) + wx.hideLoading() + this.setData({ + src:res.fileID + }) + }, + fail: err => { + // handle error + } + }) + + }, + submit(res){ + let nicheng = this.data.nicheng + let ask = this.data.ask + if(this.data.nicheng==''){ + wx.showToast({ + icon:'none', + title:'请填写被投诉对象微信昵称' + }) + return + } + if(this.data.ask==''){ + wx.showToast({ + icon:'none', + title:'请填写被投诉对象违规行为' + }) + return + } + db.collection("pingjia").add({ + data:{ + nicheng:nicheng, + ask:ask, + src:this.data.src, + station:1, + score:'' + } + }).then(res=>{ + console.log(res) + wx.showToast({ + title:'提交成功', + }) + wx.redirectTo({ + url: '../home/home', + }) + wx.navigateBack({ + delta: 1 + }) + }) +}, + + + +}) \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinping/xinping.json b/src/Carpool/miniprogram/pages/xinping/xinping.json new file mode 100644 index 0000000..d7cebc0 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinping/xinping.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "信誉评价", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinping/xinping.wxml b/src/Carpool/miniprogram/pages/xinping/xinping.wxml new file mode 100644 index 0000000..c7613e3 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinping/xinping.wxml @@ -0,0 +1,19 @@ +背景图片 + + +被投诉对象昵称: + + + + 被投诉对象违规行为 + + + + + + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/xinping/xinping.wxss b/src/Carpool/miniprogram/pages/xinping/xinping.wxss new file mode 100644 index 0000000..9109658 --- /dev/null +++ b/src/Carpool/miniprogram/pages/xinping/xinping.wxss @@ -0,0 +1,43 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + background-color: white; +} + +.world{ + margin-top: 30rpx; +} + +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} diff --git a/src/Carpool/miniprogram/pages/yonghu/yonghu.js b/src/Carpool/miniprogram/pages/yonghu/yonghu.js new file mode 100644 index 0000000..314af7c --- /dev/null +++ b/src/Carpool/miniprogram/pages/yonghu/yonghu.js @@ -0,0 +1,156 @@ +let num +Page({ + data:{ + id1:'', + id2:'', + nicheng:'', + weixinhao:'', + sex:'', + xueyuan:'', + sno:'', + station:'', + qing:'', + renshu:'', + score:'100', + array: ['请选择', '同意', '拒绝'], + objectArray: [ + { + id: 0, + name: '请选择' + }, + { + id: 1, + name: '同意' + }, + { + id: 2, + name: '拒绝' + }, + + ], + index: 0, + }, + bindPickerChange: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + index: e.detail.value, + }) + + }, + onLoad(options) { + console.log('携带的数据',options.id) + wx.cloud.database().collection("qingdan").where({ + _id:options.id + }).get({ + success:(res)=>{ + let kong=res.data[0] + console.log(kong) + this.setData({ + id1:kong._id, + nicheng:kong.nicheng, + weixinhao:kong.weixinhao, + sex:kong.sex, + sno:kong.sno, + xueyuan:kong.xueyuan, + station:kong.station, + qing:kong.qing, + }) + wx.cloud.database().collection('pingjia').where({ + nicheng:this.data.nicheng + }).get({ + success:(res)=>{ + let ping=res.data[0] + console.log(ping) + this.setData({ + score:ping.score, + }) + } + }) + this.getstation(); + } + }) + wx.getStorage({ + key: 'user', // 替换为缓存中的key + success: res=> { + wx.cloud.database().collection('pinche').where({ + nicheng:res.data.nickName + }).get({ + success:(res)=>{ + let pin=res.data[0] + console.log(pin) + this.setData({ + id2:pin._id, + renshu:pin.renshu + }) + } + }) + } + }) + + +}, +getstation(){ + if(this.data.station=='同意'){ + this.setData({ + index:1 + }) + } + if(this.data.station=='拒绝'){ + this.setData({ + index:2 + }) + } + +}, +submit(){ + let station =this.data.array[this.data.index] + console.log(station) + if(station=='请选择'){ + wx.showToast({ + icon:'none', + title:'请选择审核情况' + }) + return + } + if(this.data.renshu=='0'&&station=='同意'){ + wx.showToast({ + icon:'none', + title:'人数上限已到达' + }) + return + } + if(this.data.qing=='1'){ + wx.showToast({ + icon:'none', + title:'该申请已经完成' + }) + return + } + if(station=='同意' &&this.data.qing !=1){ + num = this.data.renshu - 1; + wx.cloud.database().collection("pinche").where({ + _id:this.data.id2 + }).update({ + data:{ + renshu:num + } + }) + console.log(num) + } + + wx.cloud.database().collection("qingdan").where({ + _id:this.data.id1 + }).update({ + data:{ + station:station, + qing:1 + } + }).then(res=>{ + console.log(res) + wx.showToast({ + title:'提交成功', + }) + }) +}, + +}) diff --git a/src/Carpool/miniprogram/pages/yonghu/yonghu.json b/src/Carpool/miniprogram/pages/yonghu/yonghu.json new file mode 100644 index 0000000..57d95b9 --- /dev/null +++ b/src/Carpool/miniprogram/pages/yonghu/yonghu.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "申请人详细信息", + "navigationBarBackgroundColor": "#B6C2D6" +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/yonghu/yonghu.wxml b/src/Carpool/miniprogram/pages/yonghu/yonghu.wxml new file mode 100644 index 0000000..c8e0536 --- /dev/null +++ b/src/Carpool/miniprogram/pages/yonghu/yonghu.wxml @@ -0,0 +1,51 @@ +背景图片 + +微信昵称: + + + + +手机号: + + + + +性别: + + + + + +学号: + + + + + +学院: + + + + + +信誉积分: + + + + + +拼车剩余人数: + + + + 审核情况: + + + {{array[index]}} + + + + + + + \ No newline at end of file diff --git a/src/Carpool/miniprogram/pages/yonghu/yonghu.wxss b/src/Carpool/miniprogram/pages/yonghu/yonghu.wxss new file mode 100644 index 0000000..e8599db --- /dev/null +++ b/src/Carpool/miniprogram/pages/yonghu/yonghu.wxss @@ -0,0 +1,43 @@ +page{ + background-color:#B6C2D6; +} +image{ + width: 100%; + height: 400rpx; +} +.picker{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +input{ + border: 1px solid; + padding:5rpx; + margin: 5rpx; + background-color: white; +} +.textarea{ + border: 1px solid; + width: 99%; + background-color: white; +} + +.world{ + margin-top: 30rpx; +} + +.load{ + width: 70%; +} +.mini-btn{ + float: right; + margin-top: -65rpx; +} +.button-container { + display: flex; + justify-content: space-around; +} +.button{ + margin-top: 60rpx; +} \ No newline at end of file diff --git a/src/Carpool/miniprogram/sitemap.json b/src/Carpool/miniprogram/sitemap.json new file mode 100644 index 0000000..27b2b26 --- /dev/null +++ b/src/Carpool/miniprogram/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 diff --git a/src/Carpool/project.config.json b/src/Carpool/project.config.json new file mode 100644 index 0000000..8ba2435 --- /dev/null +++ b/src/Carpool/project.config.json @@ -0,0 +1,76 @@ +{ + "miniprogramRoot": "miniprogram/", + "cloudfunctionRoot": "cloudfunctions/", + "setting": { + "urlCheck": true, + "es6": true, + "enhance": true, + "postcss": true, + "preloadBackgroundData": false, + "minified": true, + "newFeature": true, + "coverView": true, + "nodeModules": false, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "uglifyFileName": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "compileHotReLoad": false, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "enableEngineNative": false, + "useIsolateContext": true, + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false, + "userConfirmedBundleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [], + "minifyWXSS": true + }, + "appid": "wxa152c601cde4b201", + "projectname": "quickstart-wx-cloud", + "libVersion": "3.6.1", + "cloudfunctionTemplateRoot": "cloudfunctionTemplate/", + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "plugin": { + "list": [] + }, + "game": { + "list": [] + }, + "miniprogram": { + "list": [ + { + "id": -1, + "name": "db guide", + "pathName": "pages/databaseGuide/databaseGuide" + } + ] + } + }, + "compileType": "miniprogram", + "srcMiniprogramRoot": "miniprogram/", + "packOptions": { + "ignore": [], + "include": [] + }, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + } +} \ No newline at end of file diff --git a/src/Carpool/project.private.config.json b/src/Carpool/project.private.config.json new file mode 100644 index 0000000..f57bc8c --- /dev/null +++ b/src/Carpool/project.private.config.json @@ -0,0 +1,151 @@ +{ + "setting": { + "compileHotReLoad": true, + "urlCheck": false, + "bigPackageSizeSupport": true + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "pages/wolook/wolook", + "pathName": "pages/wolook/wolook", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/wode/wode", + "pathName": "pages/wode/wode", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/yonghu/yonghu", + "pathName": "pages/yonghu/yonghu", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/shenguan/shenguan", + "pathName": "pages/shenguan/shenguan", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/shenqing/shenqing", + "pathName": "pages/shenqing/shenqing", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/xinlook/xinlook", + "pathName": "pages/xinlook/xinlook", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/jialook/jialook", + "pathName": "pages/jialook/jialook", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/login/login", + "pathName": "pages/login/login", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/index/index", + "pathName": "pages/index/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/xinping/xinping", + "pathName": "pages/xinping/xinping", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/xinguan/xinguan", + "pathName": "pages/xinguan/xinguan", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/jiaru/jiaru", + "pathName": "pages/jiaru/jiaru", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/fabu/fabu", + "pathName": "pages/fabu/fabu", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/home/home", + "pathName": "pages/home/home", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/list/list", + "pathName": "pages/list/list", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/index/index", + "pathName": "pages/index/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "首页-快速开始", + "pathName": "pages/index/index", + "query": "" + }, + { + "name": "商品列表", + "pathName": "pages/goods-list/index", + "query": "", + "scene": null + }, + { + "name": "云开发示例", + "pathName": "pages/examples/index", + "query": "", + "scene": null + }, + { + "name": "个人中心", + "pathName": "pages/user-center/index", + "query": "", + "scene": null + } + ] + } + }, + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "Carpool", + "libVersion": "2.20.3" +} \ No newline at end of file diff --git a/src/Carpool/uploadCloudFunction.bat b/src/Carpool/uploadCloudFunction.bat new file mode 100644 index 0000000..9ee62a0 --- /dev/null +++ b/src/Carpool/uploadCloudFunction.bat @@ -0,0 +1 @@ +"D:\andio\weixinkaifazhegongju\΢web߹\cli.bat" cloud functions deploy --e cloud1-3gvvw1ak18d30298 --n quickstartFunctions --r --project "D:\Carpool" --report_first --report \ No newline at end of file