Commit 65233f66 by hank

修改视片流程

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