contract.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <!-- pages/contract/contract.wxml -->
  3. <view class="container">
  4. <rich-text class="rich_text" :nodes="htmlContent"></rich-text>
  5. </view>
  6. </template>
  7. <script>
  8. // pages/contract/contract.js
  9. var config = require('../../common/config.js');
  10. var http = require('../../common/http.js');
  11. var app = getApp();
  12. export default {
  13. data() {
  14. return {
  15. htmlContent: ''
  16. };
  17. }
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */,
  21. onLoad: function (options) {
  22. const contract_id = options.contract_id;
  23. this.loadHtmlContent(contract_id);
  24. },
  25. onShow: function () {},
  26. /**
  27. * 生命周期函数--监听页面初次渲染完成
  28. */
  29. onReady: function () {},
  30. /**
  31. * 生命周期函数--监听页面显示
  32. */
  33. /**
  34. * 生命周期函数--监听页面隐藏
  35. */
  36. onHide: function () {},
  37. /**
  38. * 生命周期函数--监听页面卸载
  39. */
  40. onUnload: function () {},
  41. /**
  42. * 页面相关事件处理函数--监听用户下拉动作
  43. */
  44. onPullDownRefresh: function () {},
  45. /**
  46. * 页面上拉触底事件的处理函数
  47. */
  48. onReachBottom: function () {},
  49. /**
  50. * 用户点击右上角分享
  51. */
  52. onShareAppMessage: function () {},
  53. methods: {
  54. loadHtmlContent(contract_id) {
  55. const me = this;
  56. http.getApi(config.API_CONTRACT_CONTENT + '&contract_id=' + contract_id, {}, function (resp) {
  57. if (resp.data.code === 200) {
  58. console.log(resp);
  59. me.setData({
  60. htmlContent: resp.data.data.data
  61. });
  62. } else {
  63. }
  64. });
  65. }
  66. }
  67. };
  68. </script>
  69. <style>
  70. @import './contract.css';
  71. </style>