page.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <!--mine/page/page.wxml-->
  4. <view class="title" v-if="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/content/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 if(that.isXieyi || that.isYinsi) {
  70. req.getRequest(url, form, data => {
  71. that.setData({
  72. params: data
  73. });
  74. });
  75. }else{
  76. req.getRequest(url, form, data => {
  77. that.params = data.text
  78. });
  79. }
  80. }
  81. }
  82. };
  83. </script>
  84. <style>
  85. @import './page.css';
  86. </style>