Commit 65233f66 by hank

修改视片流程

parent b0386bf4
...@@ -200,6 +200,15 @@ class UsersApi extends ApiClient { ...@@ -200,6 +200,15 @@ class UsersApi extends ApiClient {
} }
}) })
} }
/** 影片绑定设备 */
bindFilmDevice(data) {
return this.request({
method: 'post',
url: '/template/maintain/calendar',
data
})
}
/** 创建日程 */ /** 创建日程 */
createSchedule(data: IUpdateScheduleInfo) { createSchedule(data: IUpdateScheduleInfo) {
......
...@@ -59,6 +59,12 @@ class TeplateApi extends ApiClient { ...@@ -59,6 +59,12 @@ class TeplateApi extends ApiClient {
url: `/template/get/type/tag/list?p=${page}&c=${limit}` url: `/template/get/type/tag/list?p=${page}&c=${limit}`
}) })
} }
getTempalteFilmCount(id: string) {
return this.request({
method: 'GET',
url: `/template/get/film/count/${id}`
})
}
} }
export default new TeplateApi() export default new TeplateApi()
...@@ -66,7 +66,7 @@ class DeviceSelect extends Component { ...@@ -66,7 +66,7 @@ class DeviceSelect extends Component {
showTempalte: 'HORIZONTAL' showTempalte: 'HORIZONTAL'
}) })
cId === undefined && !fId &&
Taro.getStorage({ key: 'schedule-add-device' }) Taro.getStorage({ key: 'schedule-add-device' })
.then(res => { .then(res => {
let arr = JSON.parse(res.data).map(item => { let arr = JSON.parse(res.data).map(item => {
...@@ -205,43 +205,55 @@ class DeviceSelect extends Component { ...@@ -205,43 +205,55 @@ class DeviceSelect extends Component {
} }
console.log(cId, 'cId') console.log(cId, 'cId')
let checkedArr: any = [] let checkedArr: any = []
const equipmentsIds = [] const equipmentsIds: any = []
const equipmentTopicList = [] const equipmentTopicList: any = []
list.map(item => { list.map(item => {
if (checked.has(item.equipmentId)) { if (checked.has(item.equipmentId)) {
checkedArr.push(item) checkedArr.push(item)
if (cId || cId === '') { if (fId) {
equipmentsIds.push(item.equipmentId) equipmentsIds.push(item.equipmentId)
equipmentTopicList.push(item.mqttTopic) equipmentTopicList.push(item.mqttTopic)
} }
} }
}) })
if (cId || cId === '') { if (fId) {
let obj = { api.common
calendarName: 'DEFAULstring', .bindFilmDevice({
filmInfos: [ filmId: fId,
{ equipmentsIds: equipmentsIds,
filmId: fId, equipmentTopicList: equipmentTopicList
time: '00:00'
}
],
equipmentsIds: equipmentsIds,
equipmentTopicList: equipmentTopicList,
calendarType: 'DEFAUL',
calendarId: ''
}
if (cId === '') {
console.log('createSchedule')
delete obj.calendarId
api.common.createSchedule(obj).then(() => {
Taro.navigateBack()
}) })
} else { .then(() => {
obj.calendarId = cId showMyToast({
api.common.updateSchedule(obj).then(() => { title: '绑定成功'
})
Taro.navigateBack() Taro.navigateBack()
}) })
} // let obj = {
// calendarName: 'DEFAULstring',
// filmInfos: [
// {
// filmId: fId,
// time: '00:00'
// }
// ],
// equipmentsIds: equipmentsIds,
// equipmentTopicList: equipmentTopicList,
// calendarType: 'DEFAUL',
// calendarId: ''
// }
// if (!cId) {
// console.log('createSchedule')
// delete obj.calendarId
// api.common.createSchedule(obj).then(() => {
// Taro.navigateBack()
// })
// } else {
// obj.calendarId = cId
// api.common.updateSchedule(obj).then(() => {
// Taro.navigateBack()
// })
// }
} else { } else {
Taro.setStorage({ Taro.setStorage({
key: 'schedule-add-device', key: 'schedule-add-device',
......
...@@ -5,6 +5,7 @@ import { ITempItem } from '@/reducers/counter' ...@@ -5,6 +5,7 @@ import { ITempItem } from '@/reducers/counter'
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image } from '@tarojs/components'
import './index.scss' import './index.scss'
import api from '@/api'
type IProps = ITempItem type IProps = ITempItem
...@@ -24,7 +25,13 @@ class TempItem extends Component { ...@@ -24,7 +25,13 @@ class TempItem extends Component {
Taro.navigateTo({ url: `/pages/home/tempaltes/film_detail?filmId=${filmId}` }) Taro.navigateTo({ url: `/pages/home/tempaltes/film_detail?filmId=${filmId}` })
// Taro.navigateTo({ url: `/pages/home/device/my_film/index` }) // Taro.navigateTo({ url: `/pages/home/device/my_film/index` })
} else { } else {
Taro.navigateTo({ url: `/pages/home/tempaltes/detail?templateId=${templateId}` }) api.tempalte.getTempalteFilmCount(templateId).then(res => {
if (res.data === 0) {
Taro.navigateTo({ url: `/pages/home/tempaltes/film_detail?templateId=${templateId}` })
} else {
Taro.navigateTo({ url: `/pages/home/tempaltes/detail?templateId=${templateId}` })
}
})
} }
} }
......
...@@ -36,11 +36,12 @@ interface FilmDetail { ...@@ -36,11 +36,12 @@ interface FilmDetail {
class FilmDetail extends Component { class FilmDetail extends Component {
config: Config = { config: Config = {
navigationBarTitleText: '视片详情' navigationBarTitleText: '视片详情'
// navigationStyle: undefined
} }
constructor() { constructor() {
super() super()
const filmId = this.$router.params.filmId || '32263ed8295746c99ab66282c26fbc65' const filmId = this.$router.params.filmId
this.state = { this.state = {
filmId, filmId,
page: 1, page: 1,
...@@ -56,6 +57,11 @@ class FilmDetail extends Component { ...@@ -56,6 +57,11 @@ class FilmDetail extends Component {
componentWillMount() { componentWillMount() {
// this.getData() // this.getData()
// setTimeout(() => {
// Taro.navigateBack({
// delta: -1
// })
// }, 10000)
} }
componentDidShow() { componentDidShow() {
// this.getData() // this.getData()
...@@ -154,11 +160,13 @@ class FilmDetail extends Component { ...@@ -154,11 +160,13 @@ class FilmDetail extends Component {
render() { render() {
const { filmInfo, filmList, showModal, filmId } = this.state const { filmInfo, filmList, showModal, filmId } = this.state
const templateId = this.$router.params.templateId
filmInfo.templateName = filmInfo.filmName filmInfo.templateName = filmInfo.filmName
filmInfo.templateDescribe = filmInfo.filmDescribe filmInfo.templateDescribe = filmInfo.filmDescribe
console.log('film-detailRender')
return ( return (
<View className="film-detail"> <View className="film-detail">
<View className="film-detail-scroll"> {/* <View className="film-detail-scroll">
<ScrollView className="film-detail-scroll-view" scrollY> <ScrollView className="film-detail-scroll-view" scrollY>
<View className="film-detail-scroll-top"> <View className="film-detail-scroll-top">
<DetailTop {...filmInfo} /> <DetailTop {...filmInfo} />
...@@ -205,9 +213,11 @@ class FilmDetail extends Component { ...@@ -205,9 +213,11 @@ class FilmDetail extends Component {
/> />
</View> </View>
</Modal> </Modal>
) : null} ) : null} */}
<WebView <WebView
src={`${WEBVIEW_URL}/#/tempaltes/filmdetail?filmId=${filmId}&token=${token.getToken()}`} src={`${WEBVIEW_URL}/tempaltes/edit?${
templateId ? 'templateId=' + templateId : 'filmId=' + filmId
}&token=${token.getToken()}`}
/> />
</View> </View>
) )
......
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