developerTools.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. let _Http = getApp().globalData.http
  2. Page({
  3. data: {
  4. verification: false,
  5. password: ""
  6. },
  7. onLoad(options) {
  8. if (_Http.ENV != 'develop') {
  9. this.setData({
  10. verification: true
  11. })
  12. } else {
  13. this.init();
  14. }
  15. },
  16. init() {
  17. this.setData({
  18. runtimeEnvironment: _Http.ENV == 'develop' ? '开发环境' : '生产环境',
  19. "baseUrl": _Http.baseUrl,
  20. urls: _Http.urls,
  21. verification: false
  22. })
  23. },
  24. onInput(e) {
  25. this.setData({
  26. password: e.detail
  27. })
  28. },
  29. enterInto() {
  30. if (this.data.password != 'jxys@12345') return wx.showToast({
  31. title: '密码错误',
  32. icon: "none"
  33. })
  34. this.init()
  35. },
  36. onChange({
  37. detail
  38. }) {
  39. console.log(detail)
  40. let that = this;
  41. wx.showModal({
  42. title: getApp().globalData.Language.getMapText('提示'),
  43. content: `是否确定将服务地址修改为“${detail}”?`,
  44. cancelText: getApp().globalData.Language.getMapText('取消'),
  45. confirmText: getApp().globalData.Language.getMapText('确定'),
  46. complete: (res) => {
  47. if (res.cancel) that.setData({
  48. baseUrl: that.data.baseUrl
  49. })
  50. if (res.confirm) {
  51. that.setData({
  52. baseUrl: detail
  53. })
  54. _Http.baseUrl = detail;
  55. wx.showToast({
  56. title: getApp().globalData.Language.getMapText('修改成功'),
  57. })
  58. }
  59. }
  60. })
  61. }
  62. })