Commit b21995d2 by hank

fix bug

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