commit e778e2d7a4094448777d073c118c8b5b0dd56704 Author: mk <2403457699@qq.com> Date: Wed Aug 23 14:59:33 2023 +0800 init diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/app.js b/app.js new file mode 100644 index 0000000..4d0768d --- /dev/null +++ b/app.js @@ -0,0 +1,12 @@ +// app.js +App({ + onLaunch: function () { + //显示红字,badge + }, + globalData: { + userInfo: null + }, + globalData: { + userInfo: null + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..f24ea38 --- /dev/null +++ b/app.json @@ -0,0 +1,63 @@ +{ + "pages": [ + "pages/index/index", + "pages/logs/logs", + "pages/login/login", + "pages/message/message", + "pages/work/work", + "pages/information/information", + "pages/mine/mine" + ], + "subPackages":[ + { + "root": "subpages/addhouse", + "name": "addhouse", + "pages": [ + "pages/addhouse/addhouse" + ] + } + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "WeChat", + "navigationBarTextStyle": "black" + }, + "tabBar": { + "color": "#2c2c2c", + "selectedColor": "#e40031", + "backgroundColor": "#FFFFFF", + "borderStyle": "white", + "list": [ + { + "pagePath": "pages/index/index", + "text": "消息", + "iconPath": "images/home/message.png", + "selectedIconPath": "images/home/messageSelected.png" + }, + { + "pagePath": "pages/work/work", + "text": "工作", + "iconPath": "images/home/work.png", + "selectedIconPath": "images/home/workSelected.png" + }, + { + "pagePath": "pages/information/information", + "text": "数据", + "iconPath": "images/home/information.png", + "selectedIconPath": "images/home/informationSelected.png" + }, + { + "pagePath": "pages/mine/mine", + "text": "我的", + "iconPath": "images/home/mine.png", + "selectedIconPath": "images/home/mineSelected.png" + } + ] + }, + "networkTimeout": { + "request": 60000 + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/images/home/information.png b/images/home/information.png new file mode 100644 index 0000000..5807cd6 Binary files /dev/null and b/images/home/information.png differ diff --git a/images/home/informationSelected.png b/images/home/informationSelected.png new file mode 100644 index 0000000..5ce8e3c Binary files /dev/null and b/images/home/informationSelected.png differ diff --git a/images/home/message.png b/images/home/message.png new file mode 100644 index 0000000..1c1a286 Binary files /dev/null and b/images/home/message.png differ diff --git a/images/home/messageSelected.png b/images/home/messageSelected.png new file mode 100644 index 0000000..7cc758c Binary files /dev/null and b/images/home/messageSelected.png differ diff --git a/images/home/mine.png b/images/home/mine.png new file mode 100644 index 0000000..bb9278a Binary files /dev/null and b/images/home/mine.png differ diff --git a/images/home/mineSelected.png b/images/home/mineSelected.png new file mode 100644 index 0000000..dfbfd6d Binary files /dev/null and b/images/home/mineSelected.png differ diff --git a/images/home/work.png b/images/home/work.png new file mode 100644 index 0000000..ec78b39 Binary files /dev/null and b/images/home/work.png differ diff --git a/images/home/workSelected.png b/images/home/workSelected.png new file mode 100644 index 0000000..e0946b6 Binary files /dev/null and b/images/home/workSelected.png differ diff --git a/images/login/hi.png b/images/login/hi.png new file mode 100644 index 0000000..b70cf2c Binary files /dev/null and b/images/login/hi.png differ diff --git a/images/login/password.png b/images/login/password.png new file mode 100644 index 0000000..15473fa Binary files /dev/null and b/images/login/password.png differ diff --git a/images/login/user.png b/images/login/user.png new file mode 100644 index 0000000..9a833bc Binary files /dev/null and b/images/login/user.png differ diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..0bc1771 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,48 @@ +// index.js +// 获取应用实例 +const app = getApp() + +Page({ + data: { + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false + }, + // 事件处理函数 + bindViewTap() { + wx.navigateTo({ + url: '../logs/logs' + }) + }, + onLoad() { + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + getUserInfo(e) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + console.log(e) + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + } +}) diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..f9587da --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "消息" +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..e69de29 diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..eb64203 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,19 @@ +/**index.wxss**/ +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + color: #aaa; +} + +.userinfo-avatar { + overflow: hidden; + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file diff --git a/pages/information/information.js b/pages/information/information.js new file mode 100644 index 0000000..7a1b2d6 --- /dev/null +++ b/pages/information/information.js @@ -0,0 +1,66 @@ +// pages/information/information.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/information/information.json b/pages/information/information.json new file mode 100644 index 0000000..ee740a9 --- /dev/null +++ b/pages/information/information.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "数据" +} \ No newline at end of file diff --git a/pages/information/information.wxml b/pages/information/information.wxml new file mode 100644 index 0000000..f22846c --- /dev/null +++ b/pages/information/information.wxml @@ -0,0 +1,2 @@ + +pages/information/information.wxml diff --git a/pages/information/information.wxss b/pages/information/information.wxss new file mode 100644 index 0000000..e30e2a7 --- /dev/null +++ b/pages/information/information.wxss @@ -0,0 +1 @@ +/* pages/information/information.wxss */ \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js new file mode 100644 index 0000000..aafeaa0 --- /dev/null +++ b/pages/login/login.js @@ -0,0 +1,130 @@ +// pages/register/register.js +import {userLoginlog} from "../../utils/api" +Page({ + + /** + * 页面的初始数据 + */ + data: { + formData:{ + mobile:'', + password:'', + appId:'wxaf87b420b87e2d79' + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + handelBlurMobile(e){ + this.setData({ + 'formData.mobile': e.detail.value + }) + console.log(this.data.formData) + }, + handelBlurPassword(e){ + this.setData({ + 'formData.password': e.detail.value + }) + console.log(this.data.formData) + }, + handelClickSubmit(){ + if(!this.data.formData.mobile){ + wx.showToast({ + title: '请填写手机号', + icon:'none', + duration:3000 + }) + return + } + if(!this.data.formData.password){ + wx.showToast({ + title: '请输入密码', + icon:'none', + duration:3000 + }) + return + } + wx.showLoading({ + title:"登录中..." + }) + const parm = { + wxCode :'', + ...this.data.formData + } + wx.login({ + success: (res) => { + parm.wxCode = res.code + userLoginlog(parm).then((res)=>{ + wx.hideLoading() + console.log(res); + if(res.code == 0){ + wx.switchTab({ + url: '/pages/work/work', + }) + }else{ + wx.showToast({ + title: res.msg, + icon:'none', + duration:2000 + }) + } + }).catch(err=>{ + wx.hideLoading() + console.log(err); + }) + }, + }) + }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json new file mode 100644 index 0000000..326a045 --- /dev/null +++ b/pages/login/login.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "", + "usingComponents": {}, + "navigationBarBackgroundColor": "#1673ee" + } \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml new file mode 100644 index 0000000..8a62fc7 --- /dev/null +++ b/pages/login/login.wxml @@ -0,0 +1,15 @@ + + + + 欢迎加入亿星社区 + + + + + + + + + 忘记密码 + + diff --git a/pages/login/login.wxss b/pages/login/login.wxss new file mode 100644 index 0000000..c3ac3ca --- /dev/null +++ b/pages/login/login.wxss @@ -0,0 +1,77 @@ +/* pages/register/register.wxss */ +page { + width: 100%; + min-height: 100vh; + overflow-y: auto; + } + .header { + height: 400rpx; + width: 100%; + background: linear-gradient(180deg, #1673ee 0%, #66A6FD 63%, #F7F7F7 100%); + box-sizing: border-box; + padding: 100rpx 0rpx 100rpx 50rpx; + font-size: 40rpx; + color: #FFFFFF; + display: flex; + flex-direction: column; + } + .header image { + width: 106rpx; + height: 94rpx; + } + .header view { + margin-top:30rpx ; + } + .login{ + width: 100%; + height: auto; + position: relative; + top: -90rpx; + border-radius: 60rpx 60rpx 0 0; + background-color: #fff; + box-sizing: border-box; + padding:80rpx 60rpx 0; + } + .login .input_box { + display: flex; + flex-direction: column; + width: 100%; + } + .login input{ + width: auto; + height: 93rpx; + background: #F5F5FA; + border-radius: 47rpx; + padding-left: 80rpx; + } + .login image { + width: 46rpx; + height: 46rpx; + position: relative; + left: 20rpx; + top: 70rpx; + } + .login text{ + display: inline-block; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3E92FF; + margin-top: 36rpx; + padding-left: 20rpx; + } + .login button{ + display: block; + background: linear-gradient(87deg, #81B5FB 0%, #3E92FF 100%); + border-radius: 43rpx; + width: auto !important; + color: #fff; + font-size: 32rpx; + font-family: PingFang SC; + margin: 85rpx 0 0 !important; + box-sizing: border-box; + font-weight: 300; + height: 86rpx; + line-height: 86rpx; + padding: 0 !important; + } \ No newline at end of file diff --git a/pages/logs/logs.js b/pages/logs/logs.js new file mode 100644 index 0000000..85f6aac --- /dev/null +++ b/pages/logs/logs.js @@ -0,0 +1,18 @@ +// logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad() { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return { + date: util.formatTime(new Date(log)), + timeStamp: log + } + }) + }) + } +}) diff --git a/pages/logs/logs.json b/pages/logs/logs.json new file mode 100644 index 0000000..3ee76c1 --- /dev/null +++ b/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "查看启动日志", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/logs/logs.wxml b/pages/logs/logs.wxml new file mode 100644 index 0000000..0b6b645 --- /dev/null +++ b/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log.date}} + + diff --git a/pages/logs/logs.wxss b/pages/logs/logs.wxss new file mode 100644 index 0000000..94d4b88 --- /dev/null +++ b/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/pages/message/message.js b/pages/message/message.js new file mode 100644 index 0000000..f916eb2 --- /dev/null +++ b/pages/message/message.js @@ -0,0 +1,66 @@ +// pages/message/message.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/message/message.json b/pages/message/message.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/message/message.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/message/message.wxml b/pages/message/message.wxml new file mode 100644 index 0000000..324a389 --- /dev/null +++ b/pages/message/message.wxml @@ -0,0 +1,2 @@ + +pages/message/message.wxml diff --git a/pages/message/message.wxss b/pages/message/message.wxss new file mode 100644 index 0000000..2251458 --- /dev/null +++ b/pages/message/message.wxss @@ -0,0 +1 @@ +/* pages/message/message.wxss */ \ No newline at end of file diff --git a/pages/mine/mine.js b/pages/mine/mine.js new file mode 100644 index 0000000..c553b9a --- /dev/null +++ b/pages/mine/mine.js @@ -0,0 +1,66 @@ +// pages/mine/mine.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/mine/mine.json b/pages/mine/mine.json new file mode 100644 index 0000000..9f5c5e2 --- /dev/null +++ b/pages/mine/mine.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的" +} \ No newline at end of file diff --git a/pages/mine/mine.wxml b/pages/mine/mine.wxml new file mode 100644 index 0000000..d236877 --- /dev/null +++ b/pages/mine/mine.wxml @@ -0,0 +1,2 @@ + +pages/mine/mine.wxml diff --git a/pages/mine/mine.wxss b/pages/mine/mine.wxss new file mode 100644 index 0000000..91eea05 --- /dev/null +++ b/pages/mine/mine.wxss @@ -0,0 +1 @@ +/* pages/mine/mine.wxss */ \ No newline at end of file diff --git a/pages/work/work.js b/pages/work/work.js new file mode 100644 index 0000000..8ec5553 --- /dev/null +++ b/pages/work/work.js @@ -0,0 +1,66 @@ +// pages/work/work.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/work/work.json b/pages/work/work.json new file mode 100644 index 0000000..ccd7324 --- /dev/null +++ b/pages/work/work.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "工作" +} \ No newline at end of file diff --git a/pages/work/work.wxml b/pages/work/work.wxml new file mode 100644 index 0000000..02d6e52 --- /dev/null +++ b/pages/work/work.wxml @@ -0,0 +1,2 @@ + +pages/work/work.wxml diff --git a/pages/work/work.wxss b/pages/work/work.wxss new file mode 100644 index 0000000..5b08b4c --- /dev/null +++ b/pages/work/work.wxss @@ -0,0 +1 @@ +/* pages/work/work.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..ce7ed97 --- /dev/null +++ b/project.config.json @@ -0,0 +1,52 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "condition": false + }, + "compileType": "miniprogram", + "libVersion": "2.19.4", + "appid": "wxaf87b420b87e2d79", + "projectname": "miniprogram-92", + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 4 + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..77aed84 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,21 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "epmet-work-minniprogram", + "setting": { + "compileHotReLoad": true, + "urlCheck": false + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "登录", + "pathName": "pages/login/login", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/subpages/addhouse/pages/addhouse/addhouse.js b/subpages/addhouse/pages/addhouse/addhouse.js new file mode 100644 index 0000000..11e866b --- /dev/null +++ b/subpages/addhouse/pages/addhouse/addhouse.js @@ -0,0 +1,66 @@ +// subpages/addhouse/pages/addhouse/addhouse.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/subpages/addhouse/pages/addhouse/addhouse.json b/subpages/addhouse/pages/addhouse/addhouse.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/subpages/addhouse/pages/addhouse/addhouse.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/subpages/addhouse/pages/addhouse/addhouse.wxml b/subpages/addhouse/pages/addhouse/addhouse.wxml new file mode 100644 index 0000000..79583cb --- /dev/null +++ b/subpages/addhouse/pages/addhouse/addhouse.wxml @@ -0,0 +1,2 @@ + +subpages/addhouse/pages/addhouse/addhouse.wxml diff --git a/subpages/addhouse/pages/addhouse/addhouse.wxss b/subpages/addhouse/pages/addhouse/addhouse.wxss new file mode 100644 index 0000000..1c08203 --- /dev/null +++ b/subpages/addhouse/pages/addhouse/addhouse.wxss @@ -0,0 +1 @@ +/* subpages/addhouse/pages/addhouse/addhouse.wxss */ \ No newline at end of file diff --git a/utils/api.js b/utils/api.js new file mode 100644 index 0000000..a754768 --- /dev/null +++ b/utils/api.js @@ -0,0 +1,15 @@ +var fly = require('./request.js') +module.exports = { + getInvitation:getInvitation, + userLoginlog:userLoginlog, +} + +function getInvitation(id){ + return fly.get(`app-user/user/ma/v3/getInvitation/${id}`) +} +/** + *小程序用户登录日志 + */ +function userLoginlog (para) { + return fly.post('auth/gov/loginbypassword', para) +} \ No newline at end of file diff --git a/utils/checkVersion.js b/utils/checkVersion.js new file mode 100644 index 0000000..885cf51 --- /dev/null +++ b/utils/checkVersion.js @@ -0,0 +1,34 @@ +export default function checkVersion() { + return new Promise((resolve, reject) => { + if (wx.canIUse('getUpdateManager')) { + const updateManager = wx.getUpdateManager() + updateManager.onCheckForUpdate(res => { + if (res.hasUpdate) { + updateManager.onUpdateReady(() => { + wx.showModal({ + title: '更新提示', + content: '新版本已经准备好, 是否重启应用', + success (successRes) { + if (successRes.confirm) { + updateManager.applyUpdate() + } + } + }) + resolve(true) + }) + updateManager.onUpdateFailed(() => { + wx.showModal({ + title: '更新提示', + content: '新版本已经上线了,请您删除当前小程序,重新搜索打开~' + }) + reject(false) + }) + } else { + resolve(true) + } + }) + } else { + reject(false) + } + }) + } \ No newline at end of file diff --git a/utils/config.js b/utils/config.js new file mode 100644 index 0000000..139d262 --- /dev/null +++ b/utils/config.js @@ -0,0 +1,24 @@ +module.exports = { + BASEURL: BASEURL, + WEBROOT: WEBROOT, + Token: getToken, + userId: "" + }; + + function BASEURL() { + // return 'https://epdc-shibei.elinkservice.cn/epdc-api/api/' // 正式环境 + // return 'http://10.10.10.66:9094/epdc-api/api/' // 王童本地环境地址 + return 'http://192.168.1.144/api/' // 测试环境 + } + + function WEBROOT() { + // return 'https://epdc-shibei.elinkservice.cn/epidemic/appraise.html#/cadre-list' // 街道干部评价h5地址 + // return 'http://lihenian.gitee.io/epidemic/appraise.html#/cadre-list' // 街道干部评价h5地址测试环境 + // https://lyljdgs.qingdaoshibei.cn/app/mobileapp/qlsb/index.aspx + return 'https://lyljdgs.qingdaoshibei.cn/app/mobileapp/qlsb/index.aspx'// 2020-05-20 + } + + function getToken() { + return wx.getStorageSync("token"); + } + \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..6232fd6 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,68 @@ +var global = require('./config.js') +const request = function (url, options) { + let token = wx.getStorageSync('token') + if (token==undefined || token==null) { + token = '' + } + return new Promise((resolve, reject) => { + wx.request({ + url: `${global.BASEURL()}${url}`, + method: options.method, + data: options.method === 'GET' ? options.data : JSON.stringify(options.data), + header: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': token + }, + success (response) { + if (response.statusCode === 200) { + if(response.data.code===0){ + resolve(response.data) + }else{ + let errmsg = response.data.msg + if(errmsg==undefined || errmsg=='undefined' ){ + errmsg = '未返回错误信息' + } + wx.showToast({ + title: errmsg, + icon: 'none', + duration: 3000 + }) + reject(response.data) + } + } else { + wx.showToast({ + title: '网络问题,请稍后再试。', + icon: 'none', + duration: 2000 + }) + reject(false) + } + }, + fail (error) { + wx.showToast({ + title: '网络问题,请稍后再试。', + icon: 'none', + duration: 2000 + }) + reject(error.data) + } + }) + }) +} +function get(url, options = {}) { + return request(url, { method: 'GET', data: options }) +} + +function post(url, options = {}) { + return request(url, { method: 'POST', data: options }) +} + +function put(url, options = {}) { + return request(url, { method: 'PUT', data: options }) +} + +module.exports = { + get: get, + post: post, + put: put +} diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..8c28615 --- /dev/null +++ b/utils/util.js @@ -0,0 +1,26 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') + } + + const formatNumber = n => { + n = n.toString() + return n[1] ? n : '0' + n + } + + const formatRichText = html => { + let newContent= html.replace(/\