金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.2 KiB

  1. <template>
  2. <view id="brand-detail">
  3. <!--<wxparser rich-text="{{richText.brand_detail}}" />-->
  4. <u-parse :content="richText.brand_detail" v-if="richText.brand_detail" />
  5. </view>
  6. </template>
  7. <script>
  8. import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
  9. import uParse from '@/components/gaoyia-parse/parse.vue';
  10. export default {
  11. data() {
  12. return {
  13. richText: ''
  14. };
  15. },
  16. onLoad(e) {
  17. this.getBrandDetail(e.id);
  18. },
  19. components: {
  20. uParse
  21. },
  22. props: {},
  23. methods: {
  24. //获取品牌详情
  25. getBrandDetail(id) {
  26. wx.showLoading({
  27. title: "加载中",
  28. mask: true
  29. });
  30. this.$http.get({
  31. api: 'api/brand/detail/' + id
  32. }).then(res => {
  33. if (res.statusCode == 200) {
  34. res = res.data;
  35. if (res.status) {
  36. this.setData({
  37. richText: res.data.detail
  38. });
  39. wx.setNavigationBarTitle({
  40. title: res.data.detail.name
  41. });
  42. } else {
  43. wx.showModal({
  44. content: res.message || '请求失败',
  45. showCancel: false
  46. });
  47. }
  48. } else {
  49. wx.showModal({
  50. content: res.message || '请求失败',
  51. showCancel: false
  52. });
  53. }
  54. this.setData({
  55. show: false
  56. });
  57. wx.hideLoading();
  58. }).catch(rej => {
  59. wx.hideLoading();
  60. wx.showModal({
  61. content: res.message || '请求失败',
  62. showCancel: false
  63. });
  64. });
  65. },
  66. setData: function (obj) {
  67. let that = this;
  68. let keys = [];
  69. let val, data;
  70. Object.keys(obj).forEach(function (key) {
  71. keys = key.split('.');
  72. val = obj[key];
  73. data = that.$data;
  74. keys.forEach(function (key2, index) {
  75. if (index + 1 == keys.length) {
  76. that.$set(data, key2, val);
  77. } else {
  78. if (!data[key2]) {
  79. that.$set(data, key2, {});
  80. }
  81. }
  82. data = data[key2];
  83. });
  84. });
  85. }
  86. },
  87. computed: {},
  88. watch: {}
  89. };
  90. </script>
  91. <style rel="stylesheet/less" lang="less">
  92. @import "detail";
  93. </style>