change base url to ihome6

This commit is contained in:
郑茂强 2019-02-12 08:54:34 +08:00
parent 7e8c9d1afc
commit cc7a0d5062
11 changed files with 212 additions and 28 deletions

View File

@ -20,6 +20,7 @@ class App extends Component {
pages: [
//'pages/index/index', // index页面
'pages/home/home',//首页 ---------------------
'pages/login/login',//登入页面 ---------------------
'pages/shop/shop',//店铺页面 ---------------------
'pages/goods/goods',// 商品页面 ---------------------
'pages/goodsPublish/goodsPublish',// 商品发布页面 ---------------------
@ -35,6 +36,7 @@ class App extends Component {
'pages/myNeedsView/myNeedsView',// 单个需求查看页面
'pages/myNeedsEdit/myNeedsEdit',// 单个需求编辑页面
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
// 'pages/shopDescription/shopDescription',
],
window: {

View File

@ -60,7 +60,8 @@ class recommondShop extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
@ -89,7 +90,8 @@ class recommondShop extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
@ -115,7 +117,8 @@ class recommondShop extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {

View File

@ -38,7 +38,8 @@ class VoucherPoster extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {

View File

@ -67,7 +67,8 @@ class AllDemanding extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {

View File

@ -6,15 +6,12 @@ import { AtModal, AtModalHeader, AtModalContent, AtModalAction, AtIcon } from 't
import URL from '../../serviceAPI.config'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './grabOrderPage.scss'
import { SymbolDef } from '_terser@3.14.1@terser';
class GrabOrderPage extends Component {
config = {
navigationBarTitleText: '抢单页面'
navigationBarTitleText: '业主需求'
}
constructor() {
super(...arguments);

View File

@ -2,7 +2,6 @@ import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
import BottomNav from '../../component/bottomNav/bottomNav'
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
@ -136,7 +135,6 @@ class Home extends Component {
// 异步函数登入api
async login() {
Taro.login({
success(res) {
if (res.code) {
@ -154,22 +152,24 @@ class Home extends Component {
}
})
.then(response => {
if (response.data.err_msg === 'success') {
if (response.data.err_code === 0) {
console.log('微信登入成功', response)
Taro.setStorageSync('session_id', response.data.session_id)
Taro.setStorageSync('shopInfo', response.data.shop_info)
Taro.setStorageSync('userInfo', response.data.user_info)
} else {
Taro.showToast({
title: '登入失败' + response.data.err_msg,
icon: 'none',
duration: 2000
} else if (response.data.err_code === 888){
Taro.navigateTo({
url: '/pages/login/login'
})
}else{
Taro.showToast({
title: '登入失败' + response.data.err_msg,
icon: 'none',
duration: 2000
})
}
}
).catch(err => {
console.log('登入微信失败', err)
@ -298,7 +298,6 @@ class Home extends Component {
}
goToMyNeedsPublish() {
Taro.navigateTo({
url: '/pages/myNeedsPublish/myNeedsPublish'
})
@ -312,6 +311,7 @@ class Home extends Component {
await this.login()
this.getShops({})
this.getHomeCategoriesInfo()
console.log('didmount')
})()

View File

@ -37,7 +37,7 @@ class Index extends Component {
// url:'/pages/myNeeds/myNeeds',
//url:'/pages/myNeedsPublish/myNeedsPublish'
// url:'/pages/mySupplyDemand/mySupplyDemand'
url: '/pages/home/home'
url: '/pages/login/login'
// url:'/pages/allDemanding/allDemanding'
// url:'/pages/goodsPublish/goodsPublish'

124
src/pages/login/login.js Normal file
View File

@ -0,0 +1,124 @@
import Taro, { Component } from '@tarojs/taro'
import { View,Input,Button,Text,Image } from '@tarojs/components'
import URL from '../../serviceAPI.config'
import './login.scss'
class Login extends Component {
config = {
navigationBarTitleText: '登入'
}
constructor(){
this.state={
username:'',
password:'',
backgroundImage: 'background-image:url(' + URL.Base + '/Public/images/bg3.jpg);'
}
}
loginApi() {
Taro.request({
url: URL.Base+'user-login',
method: 'POST',
dataType: 'json',
data: {
username: this.state.username,
password: this.state.password,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(res => {
console.log('res',res)
if(res.data.err_code===0){
Taro.showToast({
title: res.data.msg,
icon: 'success',
duration: 1000
})
setTimeout(() => {
Taro.switchTab({
url: '/pages/home/home'
})
}, 1000);
}else{
Taro.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
}
})
}
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()
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
return (
<View className='login'>
<View className='background' style={this.state.backgroundImage}></View>
<View className='logo'>
<View className='image-wrapper'>
<View>
<Image style='width: 250px;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>
<Text className='register'>
立即注册
</Text>
<Button className='button button-orange' onClick={this.loginHandler}>登录</Button>
</View>
</View>
</View>
</View>
)
}
}
export default Login

View File

@ -0,0 +1,58 @@
.login{
position: relative;
.background{
height: 100vh;
}
.logo{
position: absolute;
top: 0;
height: 200px;
width: 100%;
background-color: #fff;
.image-wrapper{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
align-items: center;
.title{
margin-left: 15%;
font-size: 25rpx
}
}
}
.login-wrapper{
position: absolute;
background-color: #fff;
width:80%;
top: 30%;
left: 8%;
padding: 2%;
.title{
font-size: 40rpx
}
.bgtopWrap{
margin-top: 10%;
.username{
}
.password{
margin-top: 5%
}
.register{
float:right;
font-size: 23rpx;
}
.button{
margin-top: 10%
}
}
}
}

View File

@ -110,7 +110,8 @@ class Shop extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
@ -313,6 +314,7 @@ class Shop extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {

View File

@ -1,5 +1,6 @@
const LOCALURL = "http://192.168.1.230/"
// const LOCALURL = "http://192.168.1.230/"
const LOCALURL = "https://www.ihome6.com/"
const URL = {
Base: LOCALURL,
Login: LOCALURL + 'Applet-login', //登入接口
@ -12,16 +13,11 @@ const URL = {
GetShopItemDetail: LOCALURL + 'GoodsQuery-ajaxGoodsDetail',// 商品详情
UploadDSPorductImage: LOCALURL + 'Supply-fileUpload',// 上传供求图片
//所有业主供求
GetAllDemanding: LOCALURL + 'supply-allDemandList',// 获取所有业主需求
MySupplyDemand: LOCALURL + 'Supply-myList',// 我的供求
supplyDemandDetails: LOCALURL + 'supply-ajaxDemandDetail',// 单个供求详情
// 店铺信息
GoodsSearch: LOCALURL + 'GoodsSearch-search',// 店铺页面的信息
ShopDescription: LOCALURL + 'shop-ajaxShopInfo',// 获取店铺详情