index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!-- 文章展示 -->
  2. <template>
  3. <s-layout :bgStyle="{ color: 'transparent' }" :title="state.title" class="set-wrap">
  4. <view>
  5. <!-- #ifdef H5 -->
  6. <!-- <iframe src="http://42.194.163.46:9005/chatbot/Daahm2N28l24ECJx"
  7. style="width: 100%; height: calc(100vh - 50px);"></iframe> -->
  8. <!-- #endif -->
  9. <!-- #ifdef MP-WEIXIN -->
  10. <!-- <web-view src="http://42.194.163.46:9005/chatbot/Daahm2N28l24ECJx"
  11. style="width: 100vw; height: 100vh;"></web-view> -->
  12. <!-- #endif -->
  13. </view>
  14. </s-layout>
  15. <view>
  16. </view>
  17. </template>
  18. <script setup>
  19. import { onLoad } from '@dcloudio/uni-app';
  20. import { reactive, ref } from 'vue';
  21. import ArticleApi from '@/sheep/api/promotion/article';
  22. const webviewstyle = ref({
  23. width: "100%",
  24. height: "100%",
  25. top: "100px",
  26. });
  27. const state = reactive({
  28. title: '',
  29. content: '',
  30. });
  31. async function getRichTextContent(id, title) {
  32. const { code, data } = await ArticleApi.getArticle(id, title);
  33. if (code !== 0) {
  34. return;
  35. }
  36. state.content = data.content;
  37. // 标题不一致时,修改标题
  38. if (state.title !== data.title) {
  39. state.title = data.title;
  40. uni.setNavigationBarTitle({
  41. title: state.title,
  42. });
  43. }
  44. }
  45. onLoad((options) => {
  46. if (options.title) {
  47. state.title = options.title;
  48. uni.setNavigationBarTitle({
  49. title: state.title,
  50. });
  51. }
  52. getRichTextContent(options.id, options.title);
  53. });
  54. </script>
  55. <style lang="scss" scoped>
  56. .set-title {
  57. margin: 0 30rpx;
  58. }
  59. iframe {
  60. border: none;
  61. }
  62. .richtext {}
  63. </style>