Commit 79192f5e by hank

修复日程bug

parent 0b9ea683
...@@ -87,7 +87,7 @@ class App extends Component { ...@@ -87,7 +87,7 @@ class App extends Component {
}, },
{ {
pagePath: 'pages/home/film/index', pagePath: 'pages/home/film/index',
text: '视片', text: '视片及日程',
iconPath: './assets/images/film.png', iconPath: './assets/images/film.png',
selectedIconPath: './assets/images/film_ac.png' selectedIconPath: './assets/images/film_ac.png'
}, },
......
...@@ -43,6 +43,7 @@ class ScheduleItem extends Component { ...@@ -43,6 +43,7 @@ class ScheduleItem extends Component {
render() { render() {
let { templateUrl, filmName, templateDescribe, templateShow, isList, time } = this.props let { templateUrl, filmName, templateDescribe, templateShow, isList, time } = this.props
templateUrl = templateUrl || '' templateUrl = templateUrl || ''
console.log(templateShow, this.props)
let time2 = this.state.time let time2 = this.state.time
return ( return (
<View className="films-item"> <View className="films-item">
......
...@@ -113,7 +113,7 @@ class DeviceSelect extends Component { ...@@ -113,7 +113,7 @@ class DeviceSelect extends Component {
}) })
Taro.setStorage({ Taro.setStorage({
key: 'schedule-add-device', key: 'schedule-add-device',
data: JSON.stringify([...list]) data: JSON.stringify([...checkedArr])
}) })
Taro.navigateBack() Taro.navigateBack()
} }
......
...@@ -66,16 +66,21 @@ class Films extends Component { ...@@ -66,16 +66,21 @@ class Films extends Component {
checked: new Set(), checked: new Set(),
showTemplate: 'HORIZONTAL' showTemplate: 'HORIZONTAL'
}) })
}
async componentWillMount() {
Taro.getStorage({ key: 'schedule-add-films' }) Taro.getStorage({ key: 'schedule-add-films' })
.then(res => { .then(res => {
console.log(res.data) console.log(res.data, 'schedule-add-films')
let arr = JSON.parse(res.data).map(item => { let arr = JSON.parse(res.data).map(item => {
return item.filmId return item.filmId
}) })
console.log(Taro.getStorageSync('schedule-type-state'))
this.setState( this.setState(
{ {
checked: new Set(arr), checked: new Set(arr),
showTemplate: JSON.parse(res.data)[0]['templateShow'] || 'HORIZONTAL' showTemplate:
JSON.parse(res.data)[0]['templateShow'] || Taro.getStorageSync('schedule-type-state')
}, },
() => { () => {
this.page = 1 this.page = 1
...@@ -89,12 +94,9 @@ class Films extends Component { ...@@ -89,12 +94,9 @@ class Films extends Component {
checked: new Set(), checked: new Set(),
showTemplate: 'HORIZONTAL' showTemplate: 'HORIZONTAL'
}) })
this.getData()
}) })
} }
async componentWillMount() {
this.getData()
}
componentDidShow() { componentDidShow() {
this.getData() this.getData()
} }
...@@ -149,6 +151,10 @@ class Films extends Component { ...@@ -149,6 +151,10 @@ class Films extends Component {
showMyToast({ title: '不可选择不同版型的视片~' }) showMyToast({ title: '不可选择不同版型的视片~' })
return return
} }
Taro.setStorage({
key: 'schedule-type-state',
data: state
})
this.setState( this.setState(
{ {
showTemplate: state showTemplate: state
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
display: flex; display: flex;
text-align: center;
justify-content: center;
.bottom-btn-item { .bottom-btn-item {
width: 50%; width: 50%;
......
...@@ -141,13 +141,24 @@ class ScheduleAdd extends Component { ...@@ -141,13 +141,24 @@ class ScheduleAdd extends Component {
filmList: myFilmList filmList: myFilmList
}) })
} }
deleteAction() { async deleteAction() {
const { id } = this.$router.params const { id } = this.$router.params
api.common.deleteSchedule(id).then(() => { Taro.showModal({ content: '确定要删除?' }).then(async ({ confirm }) => {
showMyToast({ if (confirm) {
title: '删除成功' try {
}) api.common.deleteSchedule(id).then(() => {
Taro.navigateBack() showMyToast({
title: '删除成功'
})
setTimeout(() => {
Taro.navigateBack()
}, 500)
})
} catch (error) {
console.error(error)
showMyToast({ title: '失败' })
}
}
}) })
} }
enter() { enter() {
......
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