myCustomer.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // pages/my/myCustomer/myCustomer.js
  2. let App = getApp();
  3. let util = require("../../../utils/util.js");
  4. var WxParse = require("../../../wxParse/wxParse.js");
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. appAssetsUrl: App.appAssetsUrl,
  11. items: [],
  12. wgFillInfo: {},
  13. richtext: null,
  14. parm: {
  15. cardno: util.getCardNo(),
  16. fbtype: "",
  17. feedback: "",
  18. },
  19. },
  20. // radio
  21. radioChange(e) {
  22. this.data.parm.fbtype = e.detail.value;
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad: function (options) {
  28. this.loadDic();
  29. this.loadkfInfo();
  30. },
  31. loadkfInfo() {
  32. let _this = this;
  33. App._post_form(
  34. "wgfillinfo/apiSelectwgfillinfo",
  35. "application/json",
  36. null,
  37. function (res) {
  38. if (res.code === 0) {
  39. _this.setData({
  40. richtext: res.wgFillInfo.ccs.replace(
  41. /<img/g,
  42. `<img style=' max-width:100%;'`
  43. ),
  44. });
  45. console.log(_this.data.wgFillInfo, 1111);
  46. WxParse.wxParse("article", "html", res.wgFillInfo.ccs, _this, 5);
  47. }
  48. }
  49. );
  50. },
  51. loadDic() {
  52. let _this = this;
  53. App._post_form(
  54. "bizcatelog/apiSelectBizcatelog/fbtype",
  55. "application/json",
  56. null,
  57. function (res) {
  58. if (res.code === 0) {
  59. _this.data.parm.fbtype = res.dictList[0].itemcode;
  60. _this.setData({
  61. items: res.dictList,
  62. });
  63. }
  64. }
  65. );
  66. },
  67. input(e) {
  68. if (e.detail.value) {
  69. this.data.parm.feedback = e.detail.value;
  70. }
  71. },
  72. sub() {
  73. let _this = this;
  74. if (util.UserLoginStatus()) {
  75. if (this.data.parm.feedback === "") {
  76. wx.showToast({
  77. title: "请输入您的想法",
  78. icon: "none",
  79. });
  80. return;
  81. }
  82. App._post_form(
  83. "WgMemberFb/apiInsertWgMemberFb",
  84. "application/json",
  85. JSON.stringify(_this.data.parm),
  86. function (res) {
  87. if (res.code === 0) {
  88. wx.showToast({
  89. title: "提交成功!",
  90. duration: 1500,
  91. });
  92. setTimeout(function () {
  93. wx.switchTab({
  94. url: "/pages/my/index/index",
  95. });
  96. }, 1500);
  97. }
  98. }
  99. );
  100. }
  101. },
  102. /**
  103. * 生命周期函数--监听页面初次渲染完成
  104. */
  105. onReady: function () {},
  106. /**
  107. * 生命周期函数--监听页面显示
  108. */
  109. onShow: function () {},
  110. /**
  111. * 生命周期函数--监听页面隐藏
  112. */
  113. onHide: function () {},
  114. /**
  115. * 生命周期函数--监听页面卸载
  116. */
  117. onUnload: function () {},
  118. /**
  119. * 页面相关事件处理函数--监听用户下拉动作
  120. */
  121. onPullDownRefresh: function () {},
  122. /**
  123. * 页面上拉触底事件的处理函数
  124. */
  125. onReachBottom: function () {},
  126. /**
  127. * 用户点击右上角分享
  128. */
  129. onShareAppMessage: function () {},
  130. });