Commit 52db00c8 by hank

fix bug

parent 1c245d90
......@@ -8,7 +8,7 @@ const EventBus = (function() {
// 将消息保存到当前的消息队列中
on: function(msgName, func) {
if (this.msgQueues.hasOwnProperty(msgName)) {
if (typeof this.msgQueues === 'function') {
if (typeof this.msgQueues[msgName] === 'function') {
this.msgQueues[msgName] = [this.msgQueues[msgName], func]
} else {
this.msgQueues[msgName] = [...this.msgQueues[msgName], func]
......@@ -20,7 +20,6 @@ const EventBus = (function() {
// 消息队列中仅保存一个消息
one: function(msgName, func) {
// 无需检查msgName是否存在
this.msgQueues[msgName] = func
},
// 发送消息
......@@ -32,6 +31,7 @@ const EventBus = (function() {
if (typeof this.msgQueues[msgName] === 'function') {
this.msgQueues[msgName](msg)
} else {
console.log(msgName)
this.msgQueues[msgName].map(fn => {
console.log(fn, 'fn')
fn(msg)
......
export const FETCH_TIME_OUT = 5000
// export const BASE_URL = 'https://server.bdideal.com'
// export const WEBVIEW_URL = 'https://visual.bdideal.com'
export const BASE_URL = 'https://dev-server.bdideal.com'
export const WEBVIEW_URL = 'https://dev-visual.bdideal.com'
export const BASE_URL = 'https://server.bdideal.com'
export const WEBVIEW_URL = 'https://visual.bdideal.com'
// export const BASE_URL = 'https://dev-server.bdideal.com'
// export const WEBVIEW_URL = 'https://dev-visual.bdideal.com'
// export const WEBVIEW_URL = 'http://127.0.0.1:8080'
/** 蓝牙的服务 uuid */
......
......@@ -6,7 +6,7 @@ import { View, Text, Image } from '@tarojs/components'
import { formatTime } from '@/common/utils'
import './index.scss'
import api from '@/api/index'
import events from '@/common/events'
type IProps = ITempItem
interface PageState {}
......@@ -39,6 +39,7 @@ class TempItem extends Component {
Taro.navigateTo({ url: `/pages/home/tempaltes/film_detail?templateId=${templateId}` })
} else {
Taro.navigateTo({ url: `/pages/home/tempaltes/detail?templateId=${templateId}` })
events.emit('detailShow', templateId)
}
this.isload = false
Taro.hideLoading()
......
......@@ -66,14 +66,16 @@ class Tempaltes extends Component {
async componentWillMount() {
console.log('componentWillMount')
this.getData()
events.on('detailShow', e => {
events.off('detailShow')
events.off('detailClose')
events.one('detailShow', e => {
console.log('detailShow', e)
Taro.hideTabBar()
this.setState({
templateId: e
})
})
events.on('detailClose', e => {
events.one('detailClose', e => {
console.log('detailClose')
Taro.showTabBar()
this.setState({
......
......@@ -8,7 +8,7 @@
box-sizing: border-box;
flex-direction: column;
background: rgba(0, 0, 0, 0.5);
position: absolute;
position: fixed;
top: 0;
height: 100vh;
z-index: 1000;
......
......@@ -7,6 +7,8 @@ import { getWindiwHeight } from '@/common/utils'
import { View, Text, ScrollView, Button, Radio, RadioGroup, Label } from '@tarojs/components'
import ListView from '@/conpoments/list_view'
import TempItem from './conpoments/temp_item'
import TempDetail from './detail'
import events from '@/common/events'
import './scss/type_detail.scss'
import { SHOWTYPE } from '@/common/enum'
......@@ -28,6 +30,7 @@ type PageState = {
showModal: boolean
typeId: string
tagId: string
templateId: string
tempList: any[]
windowHeight: number
templateShow: string
......@@ -58,6 +61,7 @@ class TemplateTypeDetail extends Component {
showModal: false,
filmDataList: [],
typeId,
templateId: '',
templateShow: templateShow || 'HORIZONTAL',
windowHeight: getWindiwHeight(),
tempList: [],
......@@ -75,10 +79,29 @@ class TemplateTypeDetail extends Component {
this.typeChange = this.typeChange.bind(this)
}
componentDidShow() {
this.setState({
templateId: ''
})
}
componentWillMount() {
console.log(events)
events.on('detailShow', e => {
console.log('detailShow', e)
this.setState({
templateId: e
})
})
events.on('detailClose', e => {
this.setState({
templateId: ''
})
})
const typeName = this.$router.params.typeName
Taro.setNavigationBarTitle({ title: typeName })
this.getData()
// console.log('object', Taro.get)
}
......@@ -181,6 +204,7 @@ class TemplateTypeDetail extends Component {
typeData,
filmDataList,
windowHeight,
templateId,
count,
tagsList,
tagId,
......@@ -264,31 +288,9 @@ class TemplateTypeDetail extends Component {
</ListView>
)}
</View>
{templateId && <TempDetail templateId={templateId} />}
</View>
)
}
}
// interface IProps {
// detailData: any
// filmDataList: any[]
// }
// function TempDetailContent(props: IProps) {
// const { detailData, filmDataList } = props
// return (
// <View>
// <DetailTop {...detailData} />
// <View className="temp-detail-list">
// <Text className="temp-detail-list-title">我的作品({filmDataList.length})</Text>
// <View className="temp-detail-list-content">
// {filmDataList.map(item => (
// <TempItem {...item} key={item.templateId} />
// ))}
// </View>
// </View>
// </View>
// )
// }
export default TemplateTypeDetail as ComponentClass<PageOwnProps, PageState>
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