Commit e6c34a86 by 姜雷

调整条码页和公告获取

parent c53ffc87
...@@ -30,6 +30,7 @@ type PageDispatchProps = { ...@@ -30,6 +30,7 @@ type PageDispatchProps = {
type PageOwnProps = {}; type PageOwnProps = {};
type PageState = { type PageState = {
ScreenBrightness: number;
showPayOrder: boolean; showPayOrder: boolean;
showBig: boolean; showBig: boolean;
accounts: CustomerBeanAccountVo[]; accounts: CustomerBeanAccountVo[];
...@@ -71,6 +72,7 @@ class BarCode extends Component { ...@@ -71,6 +72,7 @@ class BarCode extends Component {
constructor(props: PageOwnProps) { constructor(props: PageOwnProps) {
super(props); super(props);
this.state = { this.state = {
ScreenBrightness: 1,
showPayOrder: false, showPayOrder: false,
showBig: false, showBig: false,
accounts: [], accounts: [],
...@@ -137,6 +139,33 @@ class BarCode extends Component { ...@@ -137,6 +139,33 @@ class BarCode extends Component {
.catch(err => { .catch(err => {
console.log(err); console.log(err);
}); });
console.log('调整亮度');
Taro.getScreenBrightness()
.then(({ value }) => {
console.log(value);
this.setState({
ScreenBrightness: value,
});
Taro.setScreenBrightness({
value: 1,
});
})
.catch(err => {
console.log(err);
Taro.setScreenBrightness({
value: 1,
});
});
}
componentWillUnmount() {
console.log('调整亮度');
const { ScreenBrightness } = this.state;
console.log(ScreenBrightness);
Taro.setScreenBrightness({
value: ScreenBrightness,
});
} }
fetchOrder(id: number) { fetchOrder(id: number) {
...@@ -169,9 +198,7 @@ class BarCode extends Component { ...@@ -169,9 +198,7 @@ class BarCode extends Component {
} }
drawBarCode(showBig: boolean) { drawBarCode(showBig: boolean) {
const { userinfo } = this.props; const { userinfo } = this.props;
Taro.setScreenBrightness({
value: 1,
});
if (showBig) { if (showBig) {
wxbarcode.barcode('BarCode', userinfo.idBar, 646, 188); wxbarcode.barcode('BarCode', userinfo.idBar, 646, 188);
} else { } else {
......
...@@ -126,9 +126,9 @@ class Home extends Component { ...@@ -126,9 +126,9 @@ class Home extends Component {
url: '/pages/Feedback/Feedback', url: '/pages/Feedback/Feedback',
}); });
} }
goAnn() { goAnn(id: number) {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/Announcement/Announcement?sectionId=896', url: '/pages/Announcement/Announcement?sectionId=' + id,
}); });
} }
...@@ -160,7 +160,7 @@ class Home extends Component { ...@@ -160,7 +160,7 @@ class Home extends Component {
}) })
.catch(console.log); .catch(console.log);
} }
formatePhone = phone => { formatePhone = (phone: string) => {
let newPhone = phone.replace(/([0-9]{3})([0-9]{4})([0-9]{4})/, '$1****$3'); let newPhone = phone.replace(/([0-9]{3})([0-9]{4})([0-9]{4})/, '$1****$3');
return newPhone; return newPhone;
}; };
...@@ -248,7 +248,9 @@ class Home extends Component { ...@@ -248,7 +248,9 @@ class Home extends Component {
<Image className='bg' src={AnnouncementBg} /> <Image className='bg' src={AnnouncementBg} />
<View className='Home-Announcement-title'> <View className='Home-Announcement-title'>
<Text>最新公告</Text> <Text>最新公告</Text>
<View className='Home-Announcement-more' onClick={this.goAnn}> <View
className='Home-Announcement-more'
onClick={() => this.goAnn(annItem.id)}>
更多 更多
<Image className='more-icon' src={MoreIcon} /> <Image className='more-icon' src={MoreIcon} />
</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 to comment