Commit b21995d2 by hank

fix bug

parent 1e03b136
import { FilmListItem } from '@/conpoments/film_list_item'
import { ApiClient } from './client' import { ApiClient } from './client'
export interface IUpdateWifi { export interface IUpdateWifi {
...@@ -46,13 +47,17 @@ class UsersApi extends ApiClient { ...@@ -46,13 +47,17 @@ class UsersApi extends ApiClient {
/** 获取视片详情列表 */ /** 获取视片详情列表 */
getFilmDetailList(id: string, page: number) { getFilmDetailList(id: string, page: number) {
return this.request({ method: 'GET', url: `/template/get/equipment/list/${id}?p=${page}&c=10` }) return this.request({ method: 'GET', url: `/template/get/equipment/list/${id}?p=${page}&c=50` })
} }
/** 获取视片详情 */ /** 获取视片详情 */
getFilmDetailInfo(id: string) { getFilmDetailInfo(id: string) {
return this.request({ method: 'GET', url: `/template/get/film/info/${id}` }) return this.request({ method: 'GET', url: `/template/get/film/info/${id}` })
} }
/** 获取视片下设备列表详情 */
getFilmDeviceList(FilmId: string) {
return this.request({ url: `/template/get/equipment/list/${FilmId}`, data: { p: 1000, c: 10 } })
}
/** 获取我的视片列表 */ /** 获取我的视片列表 */
getMyFilmsList(page: number) { getMyFilmsList(page: number) {
......
...@@ -17,6 +17,12 @@ class UsersApi extends ApiClient { ...@@ -17,6 +17,12 @@ class UsersApi extends ApiClient {
data: { userPhone, codeInfo, userTerminal: 'APP' } data: { userPhone, codeInfo, userTerminal: 'APP' }
}) })
} }
getInfo() {
return this.request({
method: 'GET',
url: '/user/get/info'
})
}
} }
export default new UsersApi() export default new UsersApi()
...@@ -142,6 +142,7 @@ class DeviceDetail extends Component { ...@@ -142,6 +142,7 @@ class DeviceDetail extends Component {
equipmentStyle equipmentStyle
}) })
showMyToast({ title: '修改成功~' }) showMyToast({ title: '修改成功~' })
Taro.navigateBack()
} catch (error) { } catch (error) {
// console.error(error) // console.error(error)
showMyToast({ result: error, title: '修改失败~' }) showMyToast({ result: error, title: '修改失败~' })
......
...@@ -91,6 +91,10 @@ class MyDevice extends Component { ...@@ -91,6 +91,10 @@ class MyDevice extends Component {
this.getDate() this.getDate()
} }
componentDidShow() {
this.page = 1
this.getDate()
}
async getDate() { async getDate() {
this.cancelModal() this.cancelModal()
this.props.getFilmListData(this.page) this.props.getFilmListData(this.page)
...@@ -163,6 +167,10 @@ class MyDevice extends Component { ...@@ -163,6 +167,10 @@ class MyDevice extends Component {
}, 500) }, 500)
} }
goDetail(equipmentId) {
Taro.navigateTo({ url: `/pages/home/device/device_detail/index?equipmentId=${equipmentId}` })
}
shouldComponentUpdate(nextProps: IProps, _nextState) { shouldComponentUpdate(nextProps: IProps, _nextState) {
const { list } = this.props const { list } = this.props
const { list: _list } = nextProps const { list: _list } = nextProps
...@@ -203,7 +211,9 @@ class MyDevice extends Component { ...@@ -203,7 +211,9 @@ class MyDevice extends Component {
} }
]} ]}
> >
<DeviceItem {...item} /> <View onClick={() => this.goDetail(item.equipmentId)}>
<DeviceItem {...item} />
</View>
</AtSwipeAction> </AtSwipeAction>
))} ))}
</ListView> </ListView>
......
...@@ -2,6 +2,7 @@ import { ComponentClass } from 'react' ...@@ -2,6 +2,7 @@ import { ComponentClass } from 'react'
import Taro, { Component, Config } from '@tarojs/taro' import Taro, { Component, Config } from '@tarojs/taro'
import { View, Text, ScrollView, Button } from '@tarojs/components' import { View, Text, ScrollView, Button } from '@tarojs/components'
import DetailTop from './conpoments/detail_top' import DetailTop from './conpoments/detail_top'
import DeviceItem from '@/conpoments/device_item'
import './scss/film_detail.scss' import './scss/film_detail.scss'
import api from '@/api/index' import api from '@/api/index'
...@@ -18,6 +19,7 @@ type PageState = { ...@@ -18,6 +19,7 @@ type PageState = {
filmInfo: any filmInfo: any
filmId: string filmId: string
filmList: any[] filmList: any[]
deviceList: any[]
} }
type IProps = PageStateProps & PageDispatchProps & PageOwnProps type IProps = PageStateProps & PageDispatchProps & PageOwnProps
...@@ -40,7 +42,8 @@ class FilmDetail extends Component { ...@@ -40,7 +42,8 @@ class FilmDetail extends Component {
page: 1, page: 1,
count: 0, count: 0,
filmInfo: {}, filmInfo: {},
filmList: [] filmList: [],
deviceList: []
} }
this.chengDevice = this.chengDevice.bind(this) this.chengDevice = this.chengDevice.bind(this)
this.goEdit = this.goEdit.bind(this) this.goEdit = this.goEdit.bind(this)
...@@ -50,7 +53,6 @@ class FilmDetail extends Component { ...@@ -50,7 +53,6 @@ class FilmDetail extends Component {
this.getData() this.getData()
} }
componentDidShow() { componentDidShow() {
console.log(231131)
this.getData() this.getData()
} }
async getData() { async getData() {
...@@ -61,7 +63,7 @@ class FilmDetail extends Component { ...@@ -61,7 +63,7 @@ class FilmDetail extends Component {
api.common.getFilmDetailList(filmId, page) api.common.getFilmDetailList(filmId, page)
]) ])
console.log({ filmInfo, filmList }) console.log({ filmInfo, filmList })
const { list, count } = filmInfo const { list, count } = filmList
this.setState({ this.setState({
count, count,
filmInfo, filmInfo,
...@@ -78,7 +80,12 @@ class FilmDetail extends Component { ...@@ -78,7 +80,12 @@ class FilmDetail extends Component {
const url = `/pages/home/device/device_bind/index?filmId=${filmId}` const url = `/pages/home/device/device_bind/index?filmId=${filmId}`
Taro.navigateTo({ url }) Taro.navigateTo({ url })
} }
getFilmDeviceList() {
const { filmId } = this.state
api.common.getFilmDeviceList(filmId).tnen(res => {
console
})
}
goEdit() { goEdit() {
console.log('chengDevice') console.log('chengDevice')
const { filmId } = this.state const { filmId } = this.state
...@@ -103,6 +110,13 @@ class FilmDetail extends Component { ...@@ -103,6 +110,13 @@ class FilmDetail extends Component {
<DetailTop {...filmInfo} /> <DetailTop {...filmInfo} />
<View className="film-detail-list"> <View className="film-detail-list">
<Text>投放设备({filmList.length})</Text> <Text>投放设备({filmList.length})</Text>
{filmList.map(item => {
return (
<View key={item.equipmentId}>
<DeviceItem {...item} />
</View>
)
})}
</View> </View>
</ScrollView> </ScrollView>
</View> </View>
......
...@@ -192,7 +192,7 @@ class FilmDetail extends Component { ...@@ -192,7 +192,7 @@ class FilmDetail extends Component {
</View> </View>
</ScrollView> </ScrollView>
{/* {filmData[pageIndex]} */} {/* {filmData[pageIndex]} */}
{pageIndex} {/* {pageIndex} */}
<EditMenu {...pageList[pageIndex]} setValue={this.setValue} /> <EditMenu {...pageList[pageIndex]} setValue={this.setValue} />
</View> </View>
<View className="film-detail-bottom-bar"> <View className="film-detail-bottom-bar">
......
import { ComponentClass } from 'react' import { ComponentClass } from 'react'
import Taro, { Component, Config } from '@tarojs/taro' import Taro, { Component, Config } from '@tarojs/taro'
import { View, Text, Image, ScrollView, Button } from '@tarojs/components' import { View, Text, Image, ScrollView, Button } from '@tarojs/components'
import api from '@/api'
import './index.scss' import './index.scss'
import token from '@/common/token' import token from '@/common/token'
...@@ -42,10 +42,12 @@ class User extends Component { ...@@ -42,10 +42,12 @@ class User extends Component {
async getUserInfo() { async getUserInfo() {
if (process.env.TARO_ENV !== 'rn') { if (process.env.TARO_ENV !== 'rn') {
try { try {
const { // const {
userInfo: { avatarUrl, nickName } // userInfo: { avatarUrl, nickName }
} = await Taro.getUserInfo() // } = await Taro.getUserInfo()
this.setState({ avatarUrl, nickName }) // this.setState({ avatarUrl, nickName })
const { userName, userUrl } = await api.user.getInfo()
this.setState({ avatarUrl: userUrl, nickName: userName })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
......
...@@ -45,10 +45,16 @@ class Login extends Component { ...@@ -45,10 +45,16 @@ class Login extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
// this.state = {
// userPhone: '',
// checkCode: '',
// checked: false,
// getCodeTime: 0
// }
this.state = { this.state = {
userPhone: '', userPhone: '15501259989',
checkCode: '', checkCode: '123456',
checked: false, checked: true,
getCodeTime: 0 getCodeTime: 0
} }
} }
...@@ -141,6 +147,7 @@ class Login extends Component { ...@@ -141,6 +147,7 @@ class Login extends Component {
<Input <Input
type="number" type="number"
maxLength={6} maxLength={6}
value={checkCode}
placeholder="请输入验证码" placeholder="请输入验证码"
onInput={this.setCheckCode} onInput={this.setCheckCode}
className="login-check-code-input" className="login-check-code-input"
......
...@@ -136,7 +136,8 @@ class WifiList extends Component { ...@@ -136,7 +136,8 @@ class WifiList extends Component {
}) })
console.log(this.props.getFilmListData(1), this.props) console.log(this.props.getFilmListData(1), this.props)
showMyToast({ title: '设备添加成功~' }) showMyToast({ title: '设备添加成功~' })
Taro.redirectTo({ url: `/pages/home/device/device_detail/index?equipmentId=${equipmentId}` }) Taro.navigateBack()
// Taro.redirectTo({ url: `/pages/home/device/device_detail/index?equipmentId=${equipmentId}` })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
......
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