2018-12-24 17:35:51 +08:00
|
|
|
|
todo list:
|
2018-12-25 17:26:35 +08:00
|
|
|
|
首页:
|
|
|
|
|
商品发布页面:
|
|
|
|
|
|
|
|
|
|
供求发布页面
|
2018-12-24 17:35:51 +08:00
|
|
|
|
全部业主需求页面:
|
|
|
|
|
我的供求页面:
|
2018-12-26 17:32:35 +08:00
|
|
|
|
我的商品列表页面
|
2018-12-27 17:31:17 +08:00
|
|
|
|
商品编辑页面
|
|
|
|
|
|
2019-01-14 17:04:08 +08:00
|
|
|
|
我的需求列表页面:
|
2018-12-29 17:15:59 +08:00
|
|
|
|
接口问题:
|
|
|
|
|
优惠卷和询价
|
2019-01-02 17:31:07 +08:00
|
|
|
|
bug: 商品编辑 增加图片后 图片顺序乱了
|
2019-01-04 17:33:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-08 13:51:26 +08:00
|
|
|
|
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
2019-02-21 17:06:08 +08:00
|
|
|
|
import Taro, { Component } from '@tarojs/taro'
|
2019-03-05 17:32:53 +08:00
|
|
|
|
import { View, Input, Button, Image } from '@tarojs/components'
|
|
|
|
|
import URL from '../../serviceAPI.config'
|
2019-03-01 14:37:50 +08:00
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
import './login.scss'
|
2019-03-01 14:37:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
class Login extends Component {
|
2019-03-04 17:42:02 +08:00
|
|
|
|
config = {
|
2019-03-05 17:32:53 +08:00
|
|
|
|
navigationBarTitleText: '登入'
|
|
|
|
|
}
|
|
|
|
|
constructor() {
|
|
|
|
|
this.state = {
|
|
|
|
|
username: '',
|
|
|
|
|
password: '',
|
|
|
|
|
backgroundImage: 'background-image:url(' + URL.Base + '/Public/images/bg3.jpg);'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//用户信息姓名和电话号码接口
|
|
|
|
|
setUserInfoToStorage() {
|
|
|
|
|
Taro.request({
|
|
|
|
|
url: URL.ShopWxStore,
|
|
|
|
|
header: {
|
|
|
|
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
2019-03-01 14:37:50 +08:00
|
|
|
|
}
|
2019-03-05 17:32:53 +08:00
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.data.err_msg === 'success') {
|
|
|
|
|
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Taro.showToast({
|
|
|
|
|
title: res.data.err_msg,
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 1500
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
loginApi() {
|
|
|
|
|
Taro.request({
|
|
|
|
|
url: URL.Base + 'user-login',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
username: this.state.username,
|
|
|
|
|
password: this.state.password,
|
2019-03-01 14:37:50 +08:00
|
|
|
|
},
|
2019-03-05 17:32:53 +08:00
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
|
|
|
'X-Requested-With': 'XMLHttpRequest'
|
2019-03-01 14:37:50 +08:00
|
|
|
|
}
|
2019-03-05 17:32:53 +08:00
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.data.err_code === 0) {
|
|
|
|
|
|
|
|
|
|
Taro.showToast({
|
|
|
|
|
title: res.data.err_msg && '登入成功',
|
|
|
|
|
icon: 'success',
|
|
|
|
|
duration: 1000
|
|
|
|
|
})
|
|
|
|
|
Taro.setStorageSync('session_id', res.data.session_id)
|
|
|
|
|
Taro.setStorageSync('shopInfo', res.data.shop_info)
|
|
|
|
|
Taro.setStorageSync('userInfo', res.data.user_info)
|
|
|
|
|
Taro.setStorageSync('accountInfo',{username:this.state.username,password:this.state.password})
|
|
|
|
|
|
|
|
|
|
this.setUserInfoToStorage()
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// Taro.navigateBack({
|
|
|
|
|
// delta: 1
|
|
|
|
|
// })
|
|
|
|
|
Taro.reLaunch({
|
|
|
|
|
url:'/pages/home/home'
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Taro.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
2019-03-01 14:37:50 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
usernameHandler(e) {
|
|
|
|
|
let value = e.detail.value
|
|
|
|
|
this.setState({ username: value })
|
|
|
|
|
}
|
|
|
|
|
passwordHandler(e) {
|
|
|
|
|
let value = e.detail.value
|
|
|
|
|
this.setState({ password: value })
|
|
|
|
|
}
|
|
|
|
|
loginHandler() {
|
|
|
|
|
this.loginApi()
|
|
|
|
|
}
|
2019-03-01 14:37:50 +08:00
|
|
|
|
componentDidMount() {
|
2019-02-21 17:06:08 +08:00
|
|
|
|
|
2019-03-01 14:37:50 +08:00
|
|
|
|
}
|
2019-02-21 17:06:08 +08:00
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
|
|
console.log(this.props, nextProps)
|
|
|
|
|
}
|
2019-02-21 17:06:08 +08:00
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
componentWillUnmount() { }
|
2019-02-21 17:06:08 +08:00
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
componentDidShow() { }
|
2019-02-21 17:06:08 +08:00
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
componentDidHide() { }
|
2019-03-01 14:37:50 +08:00
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
2019-03-05 17:32:53 +08:00
|
|
|
|
<View className='login'>
|
|
|
|
|
<View className='background' style={this.state.backgroundImage}></View>
|
|
|
|
|
<View className='logo'>
|
|
|
|
|
<View className='image-wrapper'>
|
|
|
|
|
<View className='image-inner-wrapper'>
|
|
|
|
|
<Image style='width: 240px;height: 80px;background: #fff;' src={URL.Base + '/Public/images/com-logo.png'} />
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
<View className='title'>全屋定制商城</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
<View className='login-wrapper'>
|
|
|
|
|
<View className='title'>用户登入</View>
|
|
|
|
|
<View className='bgtopWrap'>
|
|
|
|
|
<View className='loginWrap'>
|
|
|
|
|
<View className='username'>
|
|
|
|
|
<Input type='text' focus={true} name='username' maxLength='11' placeholder='请输入用户名/手机号' value={this.state.username} onInput={this.usernameHandler} />
|
|
|
|
|
</View>
|
|
|
|
|
<View className='password'>
|
|
|
|
|
<Input type='password' name='password' placeholder='请输入密码' value={this.state.password} onInput={this.passwordHandler} />
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
<Button className='button button-orange' onClick={this.loginHandler}>登录</Button>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
2019-03-01 14:37:50 +08:00
|
|
|
|
)
|
|
|
|
|
}
|
2019-02-21 17:06:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-05 17:32:53 +08:00
|
|
|
|
export default Login
|