me.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. isShowAccoutDialog : false,
  9. isBindSuccess : false,
  10. userName :'未登录',
  11. password: null,
  12. openid: null
  13. },
  14. onLoad(e){
  15. this.setData({
  16. isBindSuccess : app.isLoginSuccess,
  17. // userName:
  18. })
  19. if(app.isLoginSuccess){
  20. this.data.userName=wx.getStorageSync('userName')
  21. this.setData({
  22. userName:this.data.userName
  23. })
  24. }
  25. },
  26. onShow() {
  27. },
  28. inputUserName(e){
  29. this.userName = e.detail.value
  30. },
  31. inputPassword(e){
  32. this.password = e.detail.value
  33. },
  34. isLogin(){
  35. if(!app.isLoginSuccess){
  36. wx.reLaunch({
  37. url: '../denglu/denglu',
  38. })
  39. }else{
  40. wx.showModal({
  41. title: '提示',
  42. content: '确认退出?',
  43. complete: (res) => {
  44. if (res.cancel) {
  45. }
  46. if (res.confirm) {
  47. this.clear()
  48. }
  49. }
  50. })
  51. }
  52. },
  53. bindViewClear(){
  54. wx.showModal({
  55. title: '提示',
  56. content: '确认清除缓存?',
  57. complete: (res) => {
  58. if (res.cancel) {
  59. }
  60. if (res.confirm) {
  61. this.clear()
  62. }
  63. }
  64. })
  65. },
  66. /**
  67. * 跳转我的巡查
  68. */
  69. bindViewMyXunCha(){
  70. wx.navigateTo({
  71. url: '../me_xuncha_list/me_xuncha_list',
  72. })
  73. },
  74. GoMailList(){
  75. wx.navigateTo({
  76. url: '../maillist/maillist',
  77. })
  78. },
  79. clear(){
  80. wx.clearStorage({
  81. success: (res) => {
  82. wx.showToast({
  83. title: '清理成功',
  84. })
  85. app.globalToken=null;
  86. app.isLoginSuccess=false;
  87. this.setData({
  88. isShowAccoutDialog : false,
  89. isBindSuccess : false,
  90. userName :"未登录",
  91. password: null,
  92. openid: null
  93. })
  94. wx.reLaunch({
  95. url: '../denglu/denglu'
  96. })
  97. },
  98. })
  99. },
  100. /**
  101. * 生命周期函数--监听页面初次渲染完成
  102. */
  103. onReady() {
  104. },
  105. /**
  106. * 生命周期函数--监听页面隐藏
  107. */
  108. onHide() {
  109. },
  110. /**
  111. * 生命周期函数--监听页面卸载
  112. */
  113. onUnload() {
  114. },
  115. /**
  116. * 页面相关事件处理函数--监听用户下拉动作
  117. */
  118. onPullDownRefresh() {
  119. },
  120. /**
  121. * 页面上拉触底事件的处理函数
  122. */
  123. onReachBottom() {
  124. },
  125. /**
  126. * 用户点击右上角分享
  127. */
  128. onShareAppMessage() {
  129. },
  130. bindViewTest(){
  131. // wx.navigateTo({
  132. // // url: '../xqzgdetail/xqzgdetail?logId='+this.data.buslogid,
  133. // url: '../fcdetail/fcdetail?logId='+this.data.buslogid,
  134. // })
  135. }
  136. // bindViewXqzgDetail(){
  137. // wx.navigateTo({
  138. // url: '../xqzgdetail/xqzgdetail?logId='+this.data.buslogid,
  139. // })
  140. // },
  141. // bindViewFcDetail(){
  142. // wx.navigateTo({
  143. // url: '../fcdetail/fcdetail?logId='+this.data.buslogid,
  144. // })
  145. // },
  146. // init_userInfo() {
  147. // let that = this
  148. // if (app.globalToken == null) {
  149. // wx.getUserProfile({
  150. // desc: 'desc',
  151. // success: (res) => {
  152. // this.getSysUserInfo(res.userInfo)
  153. // that.setData({
  154. // userInfo : res.userInfo
  155. // })
  156. // },
  157. // fail: res => {
  158. // console.log(res)
  159. // },
  160. // })
  161. // }
  162. // },
  163. // getSysUserInfo(info) {
  164. // let that = this
  165. // wx.login({
  166. // success(res) {
  167. // var code = res.code
  168. // var data = {
  169. // wxCode: code,
  170. // wxNickName: info.nickName,
  171. // wxAvatarUrl: info.avatarUrl
  172. // }
  173. // http.send_post("/auth/applogin", data, that.loginSuccess)
  174. // },
  175. // fail(res) {
  176. // console.log("ffff", res)
  177. // }
  178. // })
  179. // },
  180. // modalCancel(){
  181. // this.setData({
  182. // isShowAccoutDialog : false
  183. // })
  184. // },
  185. // modalSubmit(){
  186. // let obj = new Object()
  187. // obj.openid = this.openid
  188. // obj.userName = this.userName
  189. // obj.password = this.password
  190. // http.send_post("/system/minapp/AppLoginController/bindWxUser",obj,this.modalSubmitSuccess)
  191. // },
  192. // modalSubmitSuccess(res){
  193. // wx.showToast({
  194. // title: res.msg,
  195. // icon: "none"
  196. // })
  197. // if (res.code == 200) {
  198. // this.setData({
  199. // isShowAccoutDialog : false,
  200. // isBindSuccess : true
  201. // })
  202. // }
  203. // },
  204. })