index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // pages/my/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. nvabarData: {
  9. showCapsule: 0, //是否显示左上角图标,消息中心 1表示显示 0表示不显示
  10. showBack: 1, //返回
  11. title: '贷款产品', //导航栏 中间的标题
  12. // 此页面 页面内容距最顶部的距离
  13. height: app.globalData.height * 2 + 20,
  14. },
  15. star:'5',
  16. loanDetail:{},
  17. img: '',
  18. claimid:'',
  19. video:'',
  20. ecode:'',
  21. num:'0',
  22. },
  23. loadDetail: function () {
  24. console.log(this.data.pid);
  25. },
  26. clickApply(event){
  27. console.log(event)
  28. if (wx.getStorageSync('user') == "") {
  29. wx.redirectTo({
  30. url: '/pages/login/index'
  31. })
  32. } else {
  33. if (wx.getStorageSync('user').roles != "0") {
  34. wx.navigateTo({
  35. url: '/pages/loanDetailapply/index?id=' + event.target.dataset.id + '&uid=' + event.target.dataset.uid + '&num=' + event.target.dataset.num + '&ecode=' + event.target.dataset.ecode + '&img=' + event.target.dataset.img // 希望跳转过去的页面
  36. })
  37. }else{
  38. wx.showModal({
  39. title: '提示',
  40. content: '您没有进行企业认证,请到我的-我的企业中进行认证',
  41. confirmText: '去认证',
  42. success(res) {
  43. if (res.confirm) {
  44. wx.navigateTo({
  45. url: '/pages/attestation/index'
  46. })
  47. } else if (res.cancel) {
  48. wx.redirectTo({
  49. url: '/pages/home/index'
  50. })
  51. }
  52. }
  53. })
  54. }
  55. }
  56. },
  57. /**
  58. * 生命周期函数--监听页面加载
  59. */
  60. onLoad: function (options) {
  61. this.setData({
  62. claimid: options.claimid
  63. });
  64. if (options.img.substring(0,4)=='http'){
  65. this.setData({
  66. img: options.img
  67. });
  68. }else{
  69. this.setData({
  70. img: app.globalData.imageUrl + options.img
  71. });
  72. }
  73. wx.request({
  74. method: "post",
  75. url: app.globalData.publicUrl + 'api/financial/searchauto/successnum',
  76. data: {
  77. "id": options.claimid
  78. },
  79. success: (res) => {
  80. if (res.data.errcode == 0) {
  81. this.setData({
  82. num: res.data.data.num
  83. })
  84. }
  85. }
  86. })
  87. },
  88. /**
  89. * 生命周期函数--监听页面显示
  90. */
  91. onShow: function () {
  92. let finalid = this.data.claimid;
  93. wx.request({
  94. method: "get",
  95. url: app.globalData.publicUrl + 'api/financial/financeclaims/' + finalid,
  96. success: (res)  =>  {
  97. if (res.data.errcode  ==  0) {
  98. console.log(res.data);
  99. this.setData({
  100. loanDetail:res.data.data,
  101. video: app.globalData.imageUrl + res.data.data.video,
  102. ecode: res.data.data.ensure_id
  103. })
  104. console.log(this.data.loanDetail,"aaaaa");
  105. wx.request({
  106. method: "get",
  107. url: app.globalData.publicUrl + 'api/financial/dictionary' ,
  108. data:{
  109. "code":this.data.ecode
  110. },
  111. success: (res) => {
  112. if (res.data.errcode == 0) {
  113. this.setData({
  114. ecode: res.data.data[0].name
  115. })
  116. }
  117. }
  118. })
  119. }
  120. }
  121. })
  122. // 视频一进来 就全屏播放了
  123. // this.videoContext = wx.createVideoContext('myvideo', this);
  124. // this.videoContext.requestFullScreen({ direction: 90 });
  125. },
  126. })