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.

usage-instructions.vue 1.5KB

2 년 전
2 년 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <web-view v-if="isTextSrc" :src="textSrc"></web-view>
  3. <view class="content" v-else>
  4. {{textContent}}
  5. </view>
  6. </template>
  7. <script setup lang="ts">
  8. import {
  9. reactive,
  10. ref
  11. } from "vue";
  12. import {
  13. navTo
  14. } from "@/utils/utils"
  15. import {
  16. onLoad,
  17. onShow
  18. } from "@dcloudio/uni-app";
  19. import {
  20. stringToJson
  21. } from "@/utils/network/encryption.js";
  22. import {
  23. request
  24. } from "@/utils/network/request.js";
  25. import {
  26. infoQuery, envs
  27. } from "@/utils/network/api.js"
  28. const textContent = ref('')
  29. const textSrc = ref('')
  30. const isTextSrc = ref(false)
  31. // 获取文本信息----用户协议
  32. const getInfo = (type) => {
  33. //参数说明
  34. let options = {
  35. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  36. data: {
  37. businessType: 'PRIVILEGE_USE'
  38. }, //请求参数
  39. method: "POST", //提交方式(默认POST)
  40. showLoading: true, //是否显示加载中(默认显示)
  41. };
  42. //调用方式
  43. request(infoQuery, options)
  44. .then((res) => {
  45. let data = stringToJson(res.bizContent)
  46. if (data.textType == "URL") {
  47. textSrc.value = envs[process.env.NODE_ENV].baseUrl + data.text
  48. isTextSrc.value = true
  49. } else {
  50. textContent.value = data.text
  51. isTextSrc.value = false
  52. }
  53. console.log("textSrc.value", textSrc.value);
  54. })
  55. .catch((err) => {
  56. console.log(err);
  57. });
  58. }
  59. onShow(() => {
  60. getInfo()
  61. })
  62. </script>
  63. <style lang="scss" scoped>
  64. .content {
  65. padding: 0 40rpx;
  66. font-size: 28rpx;
  67. font-weight: 400;
  68. color: #333333;
  69. line-height: 40px;
  70. }
  71. </style>