Commit 3640c563 by hank

静态url 解析

parent b57cc7ec
......@@ -59,7 +59,8 @@ export function getHostUrl(frameUrl, dataUrl) {
} else {
let arr = frameUrl.split('/')
arr.splice(-1, 2)
console.log(arr.join(''))
let host = arr.join('/') + '/'
return host + dataUrl
}
}
/** ArrayBuffer转16进制字符串 */
......
......@@ -18,6 +18,7 @@ type PageOwnProps = {
open: boolean
activeIndex: number
setValue: () => void
frameUrl?: string
}
type PageState = {
......@@ -49,7 +50,7 @@ class EditMenu extends Component {
})
}
render() {
let { schemaData, itemList, setValue } = this.props
let { schemaData, itemList, setValue, frameUrl } = this.props
const activeIndex = this.state.activeIndex
itemList = itemList || []
return (
......@@ -67,7 +68,13 @@ class EditMenu extends Component {
key={index + item.name}
>
<AtList hasBorder={false}>
<MenuItem item={item} schemaData={schemaData} isList={false} setValue={setValue} />
<MenuItem
item={item}
schemaData={schemaData}
isList={false}
setValue={setValue}
frameUrl={frameUrl}
/>
</AtList>
</AtAccordion>
)
......
......@@ -2,6 +2,7 @@ import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Input, Button, Video } from '@tarojs/components'
import ListItem from '../list_item'
import { getHostUrl } from '@/common/utils'
import './index.scss'
import api from '@/api/index'
type PageStateProps = {}
......@@ -13,6 +14,7 @@ type PageOwnProps = {
schemaData: object
isList: boolean
setValue: () => void
frameUrl?: string
}
type PageState = {}
......@@ -122,7 +124,7 @@ class MenuItem extends Component {
console.log(arguments, 'inputValueChage')
}
render() {
const { schemaData, setValue } = this.props
const { schemaData, setValue, frameUrl } = this.props
let { item } = this.props
item = item || {
type: ''
......@@ -138,7 +140,7 @@ class MenuItem extends Component {
} else if (item.type === 'image') {
return (
<View>
<Image src={schemaData[item.dataKey].value} />
<Image src={getHostUrl(frameUrl, schemaData[item.dataKey].value)} />
<Button
onClick={() => {
this.chooseImg(item.dataKey)
......@@ -151,7 +153,7 @@ class MenuItem extends Component {
} else if (item.type === 'video') {
return (
<View>
<Video src={schemaData[item.dataKey].value} />
<Video src={getHostUrl(frameUrl, schemaData[item.dataKey].value)} />
<Button
onClick={() => {
this.chooseVideo(item.dataKey)
......
......@@ -280,7 +280,7 @@ class FilmDetail extends Component {
</View>
{/* {filmData[pageIndex]} */}
{/* {pageIndex} */}
<EditMenu {...pageList[pageIndex]} setValue={this.setValue} />
<EditMenu {...pageList[pageIndex]} frameUrl={filmInfo.frameUrl} setValue={this.setValue} />
</View>
<View className="film-detail-bottom-bar">
<Button type="primary" className="film-detail-bottom-bar-btn">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment