index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. const api = require("../../api/index.js")
  2. const app = getApp()
  3. // index.js
  4. const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
  5. Page({
  6. data: {
  7. phone:app.globalData.phone,
  8. motto: 'Hello World',
  9. userInfo: {
  10. avatarUrl: defaultAvatarUrl,
  11. nickName: '',
  12. },
  13. hasUserInfo: false,
  14. canIUseGetUserProfile: wx.canIUse('getUserProfile'),
  15. canIUseNicknameComp: wx.canIUse('input.type.nickname'),
  16. keyword:'',
  17. btnList:[
  18. {
  19. type:'1',
  20. label:'我要查风险',
  21. color:'#4095e5',
  22. page:'/pages/riskAssessment/riskAssessment'
  23. },
  24. {
  25. type:'2',
  26. label:'我要申诉',
  27. color:'#fcca00',
  28. page:'/pages/form/appeal/appeal'
  29. },
  30. {
  31. type:'3',
  32. label:'我要维权',
  33. color:'#bd3124',
  34. page:'/pages/form/rightsProtection/rightsProtection'
  35. },
  36. {
  37. type:'4',
  38. label:'我要申请',
  39. color:'#000a7b',
  40. page:'/pages/form/application/application'
  41. }
  42. ],
  43. visible1:false
  44. },
  45. bindViewTap() {
  46. wx.navigateTo({
  47. url: '../logs/logs'
  48. })
  49. },
  50. onReady(){
  51. },
  52. onLoad(){
  53. // wx.navigateTo({
  54. // url: '/pages/login/login',
  55. // })
  56. // api.search().then(res=>{
  57. // console.log(res)
  58. // })
  59. var a = wx.getStorageSync('showDialog')
  60. this.setData(
  61. {
  62. visible1:a
  63. }
  64. )
  65. },
  66. onClose1(){
  67. this.setData(
  68. {
  69. visible1:false
  70. }
  71. )
  72. wx.setStorageSync('showDialog', false)
  73. },
  74. makePhoneCall(){
  75. wx.makePhoneCall({
  76. phoneNumber: this.data.phone
  77. })
  78. },
  79. //修改输入的关键词
  80. changeKeyword(e){
  81. this.setData(
  82. {
  83. keyword:e.detail
  84. }
  85. )
  86. },
  87. //点击输入框内部图标
  88. clickInnerIcon(e){
  89. // console.log(e)
  90. },
  91. //点击搜索按钮
  92. search(e){
  93. // console.log(e)
  94. // this.setData(
  95. // {
  96. // result:this.data.keyword
  97. // }
  98. // )
  99. },
  100. //点击四个功能按钮(我要查风险)
  101. btnClick:function(e){
  102. console.log(e)
  103. var page = e.currentTarget.dataset.page
  104. console.log(page)
  105. wx.navigateTo({
  106. url:page
  107. })
  108. },
  109. onChooseAvatar(e) {
  110. const { avatarUrl } = e.detail
  111. const { nickName } = this.data.userInfo
  112. this.setData({
  113. "userInfo.avatarUrl": avatarUrl,
  114. hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
  115. })
  116. },
  117. onInputChange(e) {
  118. const nickName = e.detail.value
  119. const { avatarUrl } = this.data.userInfo
  120. this.setData({
  121. "userInfo.nickName": nickName,
  122. hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
  123. })
  124. },
  125. })