page.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view>
  3. <!--mine/page/page.wxml-->
  4. <!-- <view class="title">{{ title }}</view> -->
  5. <view class="content"><rich-text :nodes="params"></rich-text></view>
  6. </view>
  7. </template>
  8. <script>
  9. // mine/page/page.js
  10. const app = getApp();
  11. const req = require('../../utils/request.js');
  12. export default {
  13. data() {
  14. return {
  15. title: '',
  16. isXieyi: false, //用户协议
  17. isYinsi: false, //隐私政策
  18. isOpen: false,
  19. isGroup: false,
  20. params: ''
  21. };
  22. },
  23. components: {},
  24. props: {},
  25. onLoad: function(options) {
  26. this.id = options.id;
  27. if (options.isXieyi) {
  28. this.isXieyi = true;
  29. }
  30. if (options.isYinsi) {
  31. this.isYinsi = true;
  32. }
  33. if (options.isOpen) {
  34. this.isOpen = true;
  35. }
  36. if (options.isGroup) {
  37. this.isGroup = true;
  38. }
  39. this.title = options.title;
  40. // if (this.title) {
  41. // uni.setNavigationBarTitle({
  42. // title: this.title
  43. // });
  44. // }
  45. this.getData();
  46. },
  47. methods: {
  48. getData() {
  49. var that = this;
  50. let url = false;
  51. let form = {};
  52. if (that.isXieyi) {
  53. url = '/api/protocol';
  54. } else if (that.isYinsi) {
  55. url = '/api/params/value';
  56. form.type = 'PRIVACY_AGREEMENT';
  57. } else {
  58. url = '/api/help/detail';
  59. form.id = that.id;
  60. }
  61. if (that.isOpen) {
  62. req.getRequest('/api/config', {}, function(res) {
  63. that.params = res.OPEN_GROUP;
  64. });
  65. } else if (that.isGroup) {
  66. req.getRequest('/api/config', {}, function(res) {
  67. that.params = res.Head_Agreement;
  68. });
  69. } else {
  70. req.getRequest(url, form, data => {
  71. that.setData({
  72. params: data
  73. });
  74. });
  75. }
  76. }
  77. }
  78. };
  79. </script>
  80. <style>
  81. @import './page.css';
  82. </style>