diff --git a/app.js b/app.js index f3934cf..62c4a6b 100644 --- a/app.js +++ b/app.js @@ -11,31 +11,7 @@ App({ * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) */ onLaunch: function() { - // var dbPost = new DBPost(); - // var loginTime = dbPost.getloginTimeData(); //获取上次登陆时间,没有记录为0 - // if (loginTime) { - // var timestamp = +new Date(); - // timestamp = timestamp / 1000; - // timestamp = parseInt(timestamp); - // var difference = timestamp - loginTime; //两次时间差 - // if (difference >= 86400) { - // wx.clearStorageSync(); - // wx.redirectTo({ - // url: 'welcome/login/login' - // }) - // console.log("登录超时") - // } else { - // wx.switchTab({ - // url: 'pages/post/post' - // }) - // console.log("校验通过") - // } - // } else { - // wx.redirectTo({ - // url: 'welcome/login/login' - // }) - // console.log("无登录记录") - // } + }, /** diff --git a/app.json b/app.json index 7a7d318..b02df7a 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,6 @@ { "pages": [ - "welcome/welcome/welcome", + "welcome/welcome/welcome", "welcome/login/login", "pages/post/post", "pages/feedBack/feedBack", @@ -12,7 +12,6 @@ "pages/post/QRcode/QRcode", "pages/user/xinxi/xinxi", "welcome/signin/signin", - "pages/user/guanyu/guanyu", "pages/user/user" ], @@ -39,5 +38,6 @@ "selectedIconPath": "images/home/user2.png" } ] - } + }, + "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/images/home/dianming2.png b/images/home/dianming2.png index 44b80f4..620812b 100644 Binary files a/images/home/dianming2.png and b/images/home/dianming2.png differ diff --git a/images/home/user2.png b/images/home/user2.png index 6b06569..327103e 100644 Binary files a/images/home/user2.png and b/images/home/user2.png differ diff --git a/images/info.png b/images/info.png new file mode 100644 index 0000000..65695c1 Binary files /dev/null and b/images/info.png differ diff --git a/manage/select/select.wxss b/manage/select/select.wxss index 63283b1..da2c3b1 100644 --- a/manage/select/select.wxss +++ b/manage/select/select.wxss @@ -1,4 +1,4 @@ -/* manage/select/select.wxss */ + /* manage/select/select.wxss */ /* welcome/signin/signin.wxss */ diff --git a/pages/feedBack/feedBack.js b/pages/feedBack/feedBack.js index 7d4b49f..b7c57b9 100644 --- a/pages/feedBack/feedBack.js +++ b/pages/feedBack/feedBack.js @@ -85,7 +85,7 @@ Page({ _type: "程序错误", placeholder:"首先恭喜你遇到了Bug!我们一起来干掉它如何?" }) - console.log(this.data.type) + console.log(this.data._type) }, box_2() { //优化改进点击事件 this.setData({ @@ -96,7 +96,7 @@ Page({ placeholder: "觉得界面太丑?你有好的点子?欢迎成为我们的UI设计师!!" }) - console.log(this.data.type) + console.log(this.data._type) }, box_3() { //新功能点击事件 this.setData({ @@ -107,7 +107,7 @@ Page({ placeholder: "Come on! 来点紧张刺激的怎么样~" }) - console.log(this.data.type) + console.log(this.data._type) }, fankui(e) { //反馈内容输入 this.data.feedBack = e.detail.value diff --git a/pages/post/QRcode/QRcode.js b/pages/post/QRcode/QRcode.js index f3b1b7c..2b975f7 100644 --- a/pages/post/QRcode/QRcode.js +++ b/pages/post/QRcode/QRcode.js @@ -116,6 +116,9 @@ Page({ }, sumit: function() { + wx.removeStorage({ + key:"shijianchuo" + }) wx.switchTab({ url: '../post' }) diff --git a/pages/post/QRcode/QRcode.json b/pages/post/QRcode/QRcode.json index 1d75f8c..05a6324 100644 --- a/pages/post/QRcode/QRcode.json +++ b/pages/post/QRcode/QRcode.json @@ -1,4 +1,4 @@ { - "navigationBarBackgroundColor": "#0061bf", + "navigationBarBackgroundColor": "#003b97", "navigationBarTitleText": "正在签到" } \ No newline at end of file diff --git a/pages/user/guanyu/guanyu.js b/pages/user/guanyu/guanyu.js index 17d4029..4a240c6 100644 --- a/pages/user/guanyu/guanyu.js +++ b/pages/user/guanyu/guanyu.js @@ -5,7 +5,7 @@ Page({ * 页面的初始数据 */ data: { - + }, /** diff --git a/pages/user/guanyu/guanyu.wxml b/pages/user/guanyu/guanyu.wxml index 9c6a8df..879b014 100644 --- a/pages/user/guanyu/guanyu.wxml +++ b/pages/user/guanyu/guanyu.wxml @@ -8,7 +8,7 @@ 说明: 本小程序致力于提高查课的效率。 - 版本: 1.0 + 版本: 2.0 diff --git a/project.config.json b/project.config.json index 28b493e..2678383 100644 --- a/project.config.json +++ b/project.config.json @@ -15,6 +15,8 @@ "appid": "wx0df150c438e4c8f0", "projectname": "studyPlus", "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, "condition": { "search": { "current": -1, 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/welcome/login/login.js b/welcome/login/login.js index f1185f9..c526138 100644 --- a/welcome/login/login.js +++ b/welcome/login/login.js @@ -30,7 +30,27 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - + var login_state = wx.getStorageSync('login_state'); + if(login_state==1){ + wx.showToast({ + title: "登录超时", + image:"../../images/info.png", + duration: 2000 + }) + } else if (login_state == 2) { + wx.showToast({ + image: "../../images/info.png", + title: "您可能没注册过", + duration: 2000 + }) + } else if (login_state == 3){ + wx.showToast({ + title: '您已经注册过了', + image: "../../images/info.png", + duration: 2000 + }) + } + wx.removeStorageSync('login_state') }, /** @@ -165,15 +185,5 @@ Page({ } }); - - - - - - - - - - } }) \ No newline at end of file diff --git a/welcome/signin/signin.js b/welcome/signin/signin.js index dfe4c35..f869a1f 100644 --- a/welcome/signin/signin.js +++ b/welcome/signin/signin.js @@ -18,7 +18,7 @@ Page({ newnicheng: '', newmima: '', disabled: true, - disabled1: true, //是否可用 + disabled1: true, //是否可用 opacity: 0.4, //不透明度 yanzhengjishu: 0, //验证计数 newxuehao: 0, //验证学号 @@ -26,7 +26,7 @@ Page({ xueyuan: 0, //1705 banji: 0, //213 geren: 0, //28 - openid: 0 + openid: 3 }, /** @@ -268,7 +268,7 @@ Page({ } } }, - //密码的输入框 + //密码的输入框 mima: function(e) { var that = this console.log('输入值为', e.detail.value) @@ -297,7 +297,7 @@ Page({ - //提交按钮确认 + //提交按钮确认 sumit: function() { var that = this; var dbPost = new DBPost(); @@ -363,23 +363,6 @@ Page({ } } }) - - - - - - - - - - - - - - - - - }, @@ -392,84 +375,103 @@ Page({ newxuehao: (a + b + c) }) var that = this; - wx.request({ - url: 'https://powerrain.cn/rcs/API/yanzheng.php', //仅为示例,并非真实的接口地址 - data: { - code: that.data.newxuehao - }, - header: { - 'content-type': 'application/json' // 默认值 - }, - success: function(res) { - console.log(res.data); - if (res.data == null) { - that.data.openid = 1; - } else { - that.data.openid = res.data.openid; - } - console.log(that.data.openid) - if (!that.data.openid) { - wx.showToast({ - title: '验证成功', - icon: 'success', - duration: 2000 - }) - if (that.data.yanzhengjishu != 0) { //判断是否可以点击完成注册 - that.setData({ - disabled: false, - opacity: 1 - }) - } else { - that.setData({ - disabled: true, - opacity: 0.4 - }) - } - } else { - that.setData({ - disabled: true, - opacity: 0.4 - }) - wx.vibrateShort() - wx.showModal({ - title: '警告', - content: '此学号已经被其他人绑定', - confirmText: '重新选择', - cancelText: '联系客服', - confirmColor: '#10aeff', + + wx.login({ + success(res) { + if (res.code) { + wx.request({ + url: 'https://powerrain.cn/rcs/API/yanzheng.php', + data: { + xuehao: that.data.newxuehao, + code:res.code + }, + header: { + 'content-type': 'application/json' // 默认值 + }, success: function(res) { - if (res.confirm) { - console.log('用户点击重新选择') - } else if (res.cancel) { + console.log(res.data); + if(res.data=='1') { + wx.setStorageSync('login_state', 3) + wx.navigateTo({ + url: '../login/login' + }) + } + if (res.data == '3') { + that.data.openid = 0; + } else if(res.data == '2') { + that.data.openid = 1; + } + console.log(that.data.openid) + if (that.data.openid==0) { + wx.showToast({ + title: '验证成功', + icon: 'success', + duration: 2000 + }) + if (that.data.yanzhengjishu != 0) { //判断是否可以点击完成注册 + that.setData({ + disabled: false, + opacity: 1 + }) + } else { + that.setData({ + disabled: true, + opacity: 0.4 + }) + } + } else if(that.data.openid ==1) { + that.setData({ + disabled: true, + opacity: 0.4 + }) + wx.vibrateShort() wx.showModal({ - title: '联系客服', - content: 'QQ:1144131090', - confirmText: '复制', + title: '警告', + content: '此学号已经被其他人绑定', + confirmText: '重新选择', + cancelText: '联系客服', confirmColor: '#10aeff', success: function(res) { if (res.confirm) { - wx.setClipboardData({ - data: '1144131090', + console.log('用户点击重新选择') + } else if (res.cancel) { + wx.showModal({ + title: '联系客服', + content: 'QQ:1144131090', + confirmText: '复制', + confirmColor: '#10aeff', success: function(res) { - wx.showToast({ - title: '复制成功', - icon: 'success' - }) + if (res.confirm) { + wx.setClipboardData({ + data: '1144131090', + success: function(res) { + wx.showToast({ + title: '复制成功', + icon: 'success' + }) + } + }) + console.log('用户点击确定') + } else if (res.cancel) { + console.log('用户点击取消') + } } }) - console.log('用户点击确定') - } else if (res.cancel) { - console.log('用户点击取消') + console.log('用户点击联系客服') } } }) - console.log('用户点击联系客服') } } }) + } else { + console.log('登录失败!' + res.errMsg) } } }) + + + this.setData({ yanzhengjishu: this.data.yanzhengjishu + 1 //验证计数 }) diff --git a/welcome/welcome/welcome.js b/welcome/welcome/welcome.js index c9fba8f..f8bb8a5 100644 --- a/welcome/welcome/welcome.js +++ b/welcome/welcome/welcome.js @@ -1,25 +1,64 @@ // welcome/welcome/welcome.js +import { + DBPost +} from '../../db/DBpost.js'; Page({ /** * 页面的初始数据 */ data: { - }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - + wx.showLoading({ + title: '登录中', + }) + var dbPost = new DBPost(); + var loginTime = dbPost.getloginTimeData(); //获取上次登陆时间,没有记录为0 + if (loginTime) { + var timestamp = +new Date(); + timestamp = timestamp / 1000; + timestamp = parseInt(timestamp); + var difference = timestamp - loginTime; //两次时间差 + if (difference >= 86400) { + wx.clearStorageSync(); + setTimeout(function () { + wx.hideLoading(); + wx.redirectTo({ + url: '../login/login' + }) + }, 2000) + wx.setStorageSync('login_state', 1) + console.log("登录超时") + } else { + setTimeout(function () { + wx.hideLoading(); + wx.switchTab({ + url: '../../pages/post/post' + }) + }, 2000) + console.log("校验通过") + } + } else { + setTimeout(function () { + wx.hideLoading(); + wx.redirectTo({ + url: '../login/login' + }) + wx.setStorageSync('login_state', 2) + }, 2000) + console.log("无登录记录") + } }, /**