|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <template>
- <web-view v-if="isTextSrc" :src="textSrc"></web-view>
- <view class="content" v-else>
- {{textContent}}
- </view>
- </template>
-
-
- <script setup lang="ts">
- import {
- reactive,
- ref
- } from "vue";
- import {
- navTo
- } from "@/utils/utils"
- import {
- onLoad,
- onShow
- } from "@dcloudio/uni-app";
- import {
- stringToJson
- } from "@/utils/network/encryption.js";
- import {
- request
- } from "@/utils/network/request.js";
- import {
- infoQuery, envs
- } from "@/utils/network/api.js"
-
- const textContent = ref('')
- const textSrc = ref('')
- const isTextSrc = ref(false)
- // 获取文本信息----用户协议
- const getInfo = (type) => {
- //参数说明
- let options = {
- type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
- data: {
- businessType: 'PRIVILEGE_USE'
- }, //请求参数
- method: "POST", //提交方式(默认POST)
- showLoading: true, //是否显示加载中(默认显示)
- };
-
- //调用方式
- request(infoQuery, options)
- .then((res) => {
- let data = stringToJson(res.bizContent)
- if (data.textType == "URL") {
- textSrc.value = envs[process.env.NODE_ENV].baseUrl + data.text
- isTextSrc.value = true
- } else {
- textContent.value = data.text
- isTextSrc.value = false
- }
- console.log("textSrc.value", textSrc.value);
- })
- .catch((err) => {
- console.log(err);
- });
- }
- onShow(() => {
- getInfo()
- })
- </script>
-
- <style lang="scss" scoped>
- .content {
- padding: 0 40rpx;
- font-size: 28rpx;
- font-weight: 400;
- color: #333333;
- line-height: 40px;
- }
- </style>
|