富文本接口请求
This commit is contained in:
parent
45c0f1e05b
commit
cf792b854a
10
src/api/other.ts
Normal file
10
src/api/other.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { request } from '@/utils/request'
|
||||||
|
|
||||||
|
// 富文本案例介绍
|
||||||
|
export const editorApi = (data : { key : string }) => {
|
||||||
|
return request({
|
||||||
|
method: 'POST',
|
||||||
|
url: 'api/index/editor',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
@ -101,7 +101,7 @@
|
|||||||
"pages": [{
|
"pages": [{
|
||||||
"path": "pages/blank/rich-text",
|
"path": "pages/blank/rich-text",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": ""
|
||||||
// #ifdef WEB
|
// #ifdef WEB
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,24 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<view class="rich-text">
|
||||||
|
<mp-html :content="richText" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { editorApi } from '@/api/other.ts'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title ?: string
|
title ?: string
|
||||||
content : string
|
content : string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const content = decodeURIComponent(props.content)
|
const content = decodeURIComponent(props.content)
|
||||||
// 设置页面标题
|
const richText = ref()
|
||||||
if (props.title) {
|
const title = ref()
|
||||||
uni.setNavigationBarTitle({ title: props.title })
|
const params = {
|
||||||
|
key: 'expoApply'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
editor()
|
||||||
|
})
|
||||||
|
// 设置页面标题
|
||||||
|
// if (props.title) {
|
||||||
|
// // uni.setNavigationBarTitle({ title: props.title })
|
||||||
|
// }
|
||||||
|
// 请求
|
||||||
|
const editor = () => {
|
||||||
|
editorApi(params).then(res => {
|
||||||
|
if (res.code == 1) {
|
||||||
|
richText.value = res.data.editor
|
||||||
|
uni.setNavigationBarTitle({ title: res.data.title })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
|
||||||
<view class="rich-text">
|
|
||||||
<mp-html :content="content" />
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.rich-text {
|
.rich-text {
|
||||||
padding: 20rpx 10rpx;
|
padding: 30rpx;
|
||||||
|
text-indent: 60rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -33,9 +33,7 @@ const onLogout = () => {
|
|||||||
// 跳转富文本
|
// 跳转富文本
|
||||||
const toRichTextPage = (type: string) => {
|
const toRichTextPage = (type: string) => {
|
||||||
const agreements = settngStore.data.agreement
|
const agreements = settngStore.data.agreement
|
||||||
|
|
||||||
const content = encodeURIComponent(agreements[type as keyof typeof agreements])
|
const content = encodeURIComponent(agreements[type as keyof typeof agreements])
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `${pageUrl['rich-text']}?content=${content}`,
|
url: `${pageUrl['rich-text']}?content=${content}`,
|
||||||
})
|
})
|
||||||
|
@ -53,43 +53,43 @@ export const isIOSWithHomeIndicator = () => {
|
|||||||
*/
|
*/
|
||||||
export enum pageUrl {
|
export enum pageUrl {
|
||||||
// pages
|
// pages
|
||||||
'index' = '/pages/index/index',
|
'index' = '/pages/home/index',
|
||||||
'my' = '/pages/my/my',
|
'my' = '/pages/my/userCenter',
|
||||||
'cart' = '/pages/cart/cart',
|
'assistant' = 'pages/assistant/index',
|
||||||
'category' = '/pages/category/category',
|
'todo' = 'pages/todo/index',
|
||||||
|
|
||||||
// pagesGoods
|
// pagesGoods
|
||||||
'goods-list' = '/pagesGoods/pages/list/list',
|
'goods-list' = '/pagesShop/pages/list/list',
|
||||||
'goods-detail' = '/pagesGoods/pages/goods/goods',
|
'goods-detail' = '/pagesShop/pages/goods/goods',
|
||||||
'goods-evaluate' = '/pagesGoods/pages/evaluate/evaluate',
|
'goods-evaluate' = '/pagesShop/pages/evaluate/evaluate',
|
||||||
'goods-search' = '/pagesGoods/pages/search/search',
|
'goods-search' = '/pagesShop/pages/search/search',
|
||||||
|
|
||||||
// pagesOrder
|
// pagesOrder
|
||||||
'order-create' = '/pagesOrder/pages/create/create',
|
'order-create' = '/pagesShop/pages/create/create',
|
||||||
'order-detail' = '/pagesOrder/pages/detail/detail',
|
'order-detail' = '/pagesShop/pages/detail/detail',
|
||||||
'order-pay' = '/pagesOrder/pages/payment/pay',
|
'order-pay' = '/pagesShop/pages/payment/pay',
|
||||||
'order-payment' = '/pagesOrder/pages/payment/payment',
|
'order-payment' = '/pagesShop/pages/payment/payment',
|
||||||
'order-list' = '/pagesOrder/pages/list/list',
|
'order-list' = '/pagesShop/pages/list/list',
|
||||||
'order-receive' = '/pagesOrder/pages/receive/receive',
|
'order-receive' = '/pagesShop/pages/receive/receive',
|
||||||
'order-evaluate' = '/pagesOrder/pages/evaluate/evaluate',
|
'order-evaluate' = '/pagesShop/pages/evaluate/evaluate',
|
||||||
'order-refund' = '/pagesOrder/pages/refund/refund',
|
'order-refund' = '/pagesShop/pages/refund/refund',
|
||||||
'order-refund-list' = '/pagesOrder/pages/refund/list',
|
'order-refund-list' = '/pagesShop/pages/refund/list',
|
||||||
'order-refund-detail' = '/pagesOrder/pages/refund/detail',
|
'order-refund-detail' = '/pagesShop/pages/refund/detail',
|
||||||
'order-delivery' = '/pagesOrder/pages/delivery/delivery',
|
'order-delivery' = '/pagesShop/pages/delivery/delivery',
|
||||||
'order-center' = '/pagesOrder/pages/center/center',
|
'order-center' = '/pagesShop/pages/center/center',
|
||||||
'recharge-order-list' = '/pagesOrder/pages/recharge/list',
|
'recharge-order-list' = '/pagesShop/pages/recharge/list',
|
||||||
|
|
||||||
// pagesMember
|
// pagesMember
|
||||||
'login' = '/pagesMember/pages/login/login',
|
'login' = '/pagesShop/pages/login/login',
|
||||||
'setting' = '/pagesMember/pages/settings/settings',
|
'setting' = '/pagesShop/pages/settings/settings',
|
||||||
'profile' = '/pagesMember/pages/profile/profile',
|
'profile' = '/pagesShop/pages/profile/profile',
|
||||||
'address' = '/pagesMember/pages/address/address',
|
'address' = '/pagesShop/pages/address/address',
|
||||||
'address-form' = '/pagesMember/pages/address/address-form',
|
'address-form' = '/pagesShop/pages/address/address-form',
|
||||||
'balance' = '/pagesMember/pages/balance/balance',
|
'balance' = '/pagesShop/pages/balance/balance',
|
||||||
'balance-recharge' = '/pagesMember/pages/balance/recharge',
|
'balance-recharge' = '/pagesShop/pages/balance/recharge',
|
||||||
'coupon' = '/pagesMember/pages/coupon/coupon',
|
'coupon' = '/pagesShop/pages/coupon/coupon',
|
||||||
'coupon-center' = '/pagesMember/pages/coupon/center',
|
'coupon-center' = '/pagesShop/pages/coupon/center',
|
||||||
'favorite' = '/pagesMember/pages/favorite/favorite',
|
'favorite' = '/pagesShop/pages/favorite/favorite',
|
||||||
|
|
||||||
// pagesOther
|
// pagesOther
|
||||||
'rich-text' = '/pagesOther/pages/blank/rich-text',
|
'rich-text' = '/pagesOther/pages/blank/rich-text',
|
||||||
|
Loading…
Reference in New Issue
Block a user