alipay 样式 1.0.2
This commit is contained in:
parent
5ff153baeb
commit
0263f775a5
@ -7,6 +7,7 @@ import VoucherPosterComponent from './voucherPosterComponent/voucherPosterCompon
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
import './filteredShopComponent.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
const hornIcon = require('../../icons/horn.png')
|
||||
const houseIcon = require('../../icons/house.png')
|
||||
@ -34,8 +35,8 @@ class recommondShop extends Component {
|
||||
isOpenConsult: false,
|
||||
consultTip: '',
|
||||
voucherResponseMsg: 'i am voucherResponseMsg',
|
||||
userName: Taro.getStorageSync('user_identity').username || '',
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone || '',
|
||||
userName: getGlobalStorage('user_identity').username || '',
|
||||
userPhone: getGlobalStorage('user_identity').userphone || '',
|
||||
isCanConsult: true,
|
||||
isCanVoucher: true
|
||||
|
||||
@ -74,7 +75,7 @@ class recommondShop extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -113,7 +114,7 @@ class recommondShop extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -147,7 +148,7 @@ class recommondShop extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -212,8 +213,8 @@ class recommondShop extends Component {
|
||||
|
||||
this.setState({
|
||||
isOpenVoucher: true,
|
||||
userName: Taro.getStorageSync('user_identity').username,
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone
|
||||
userName: getGlobalStorage('user_identity').username,
|
||||
userPhone: getGlobalStorage('user_identity').userphone
|
||||
}, () => {
|
||||
this.getVoucherInfo({})
|
||||
})
|
||||
@ -231,7 +232,6 @@ class recommondShop extends Component {
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
const title = this.props.shop.shop_name
|
||||
const imgUrl = URL.Base + this.props.shop.goods[0].goods_url
|
||||
const price = this.props.shop.goods[0].goods_price
|
||||
|
@ -6,6 +6,7 @@ import { AtIcon } from 'taro-ui'
|
||||
import './voucherPosterComponent.scss'
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import loginExpired from '../../../util/loginExpired'
|
||||
import { getGlobalStorage } from '../../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -50,7 +51,7 @@ class VoucherPoster extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
|
@ -5,6 +5,7 @@ import { Picker } from 'taro-ui'
|
||||
|
||||
import './goodsTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
@ -35,7 +36,7 @@ class GoodsTypeInteractionComp extends Component {
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -43,22 +44,22 @@ class GoodsTypeInteractionComp extends Component {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品分类目录', res)
|
||||
|
||||
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
||||
maxDepth=0
|
||||
initialDataArray=[]
|
||||
const recursionInteractionData = this.recursionInteraction(res.data.data)
|
||||
maxDepth = 0
|
||||
initialDataArray = []
|
||||
|
||||
this.recursionInitialized(res.data.data) //
|
||||
const depthInArray=this.recursionDepth(res.data.data)
|
||||
console.log('depthInArray',depthInArray)
|
||||
console.log('initialDataArray',initialDataArray)
|
||||
for(let i=initialDataArray.length;i<depthInArray.length;i++){
|
||||
initialDataArray.unshift([{name:'--',id:''}])
|
||||
const depthInArray = this.recursionDepth(res.data.data)
|
||||
console.log('depthInArray', depthInArray)
|
||||
console.log('initialDataArray', initialDataArray)
|
||||
for (let i = initialDataArray.length; i < depthInArray.length; i++) {
|
||||
initialDataArray.unshift([{ name: '--', id: '' }])
|
||||
}
|
||||
|
||||
this.setState({
|
||||
interactionMultiArray: recursionInteractionData,
|
||||
multiIndex: depthInArray,
|
||||
initailMultiArray:initialDataArray.reverse()
|
||||
initailMultiArray: initialDataArray.reverse()
|
||||
}, () => {
|
||||
// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
@ -68,7 +69,7 @@ class GoodsTypeInteractionComp extends Component {
|
||||
}) // 用递归来整理无限层次的数据
|
||||
// console.log('联动数据', this.recursionInteraction(res.data.data))
|
||||
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
|
||||
}else if (res.data.err_code === 88888) {
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -83,13 +84,10 @@ class GoodsTypeInteractionComp extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//联动确认
|
||||
bindMultiPickerChange(e) {
|
||||
// 如果没有上商品 那就不执行
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
if (getGlobalStorage('shopInfo').shop_id) {
|
||||
this.setState({
|
||||
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item })
|
||||
}, () => {
|
||||
@ -118,7 +116,7 @@ class GoodsTypeInteractionComp extends Component {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
}
|
||||
if(data[0].children.length){
|
||||
if (data[0].children.length) {
|
||||
this.recursionInitialized(data[0].children)
|
||||
}
|
||||
initialDataArray.push(arrayTem)
|
||||
@ -320,9 +318,9 @@ class GoodsTypeInteractionComp extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
if (getGlobalStorage('shopInfo').shop_id) {
|
||||
this.getProductCateList(this.props.url)
|
||||
}else{
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { Picker } from 'taro-ui'
|
||||
|
||||
import './interactionComponent.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
let maxDepth = 0
|
||||
@ -35,7 +36,7 @@ class Interaction extends Component {
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import { Picker } from 'taro-ui'
|
||||
|
||||
import './shopTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class ShopTypeInteractionComp extends Component {
|
||||
@ -33,7 +34,7 @@ class ShopTypeInteractionComp extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -46,7 +47,7 @@ class ShopTypeInteractionComp extends Component {
|
||||
return
|
||||
}
|
||||
console.log('店铺分类目录', res)
|
||||
if(!Taro.getStorageSync('shopTypeObject')){
|
||||
if(!getGlobalStorage('shopTypeObject')){
|
||||
Taro.setStorageSync('shopTypeObject',res.data.data)
|
||||
}
|
||||
this.setState({
|
||||
@ -127,7 +128,7 @@ class ShopTypeInteractionComp extends Component {
|
||||
}
|
||||
bindMultiPickerChange(e) {
|
||||
// console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||
if (Taro.getStorageSync('shopInfo').shop_id) {
|
||||
if (getGlobalStorage('shopInfo').shop_id) {
|
||||
this.setState({
|
||||
multiIndex: e.detail.value,
|
||||
}, () => {
|
||||
|
@ -11,6 +11,7 @@ import onClickValueService from '../../util/onClickValueService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
import eyeIcon from '../../icons/eye.png'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -69,7 +70,7 @@ class AllDemanding extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -139,7 +140,7 @@ class AllDemanding extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
|
@ -7,6 +7,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './goods.scss'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class Goods extends Component {
|
||||
|
||||
@ -46,7 +47,7 @@ class Goods extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -98,7 +99,7 @@ class Goods extends Component {
|
||||
}
|
||||
// 收藏商品
|
||||
saveItem() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -110,7 +111,7 @@ class Goods extends Component {
|
||||
}
|
||||
//添加到购物车
|
||||
addToCart() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import URL from '../../serviceAPI.config'
|
||||
|
||||
import './goodsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class GoodsPublish extends Component {
|
||||
|
||||
@ -89,7 +90,7 @@ class GoodsPublish extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -164,7 +165,7 @@ class GoodsPublish extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -264,7 +265,7 @@ class GoodsPublish extends Component {
|
||||
|
||||
|
||||
goToMyGoodListPage() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -283,7 +284,7 @@ class GoodsPublish extends Component {
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
}
|
||||
@ -297,7 +298,7 @@ class GoodsPublish extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
@ -375,7 +376,7 @@ class GoodsPublish extends Component {
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={Taro.getStorageSync('shopInfo').shop_id}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></ShopTypeInteractionComp>
|
||||
|
@ -9,6 +9,7 @@ import RenderingView from './renderingView/renderingView'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import './grabOrderPage.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class GrabOrderPage extends Component {
|
||||
@ -48,7 +49,7 @@ class GrabOrderPage extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -96,7 +97,7 @@ class GrabOrderPage extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -208,7 +209,7 @@ class GrabOrderPage extends Component {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -238,7 +239,7 @@ class GrabOrderPage extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const localStoageUserId = Taro.getStorageSync('userInfo').user_id
|
||||
const localStoageUserId = getGlobalStorage('userInfo').user_id
|
||||
|
||||
// 提示框
|
||||
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
|
||||
|
@ -144,6 +144,27 @@ class Home extends Component {
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
|
||||
if (process.env.TARO_ENV === 'alipay') {
|
||||
return new Promise((resolve, reject) => {
|
||||
my.getLocation({
|
||||
success(res) {
|
||||
my.hideLoading();
|
||||
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
my.hideLoading();
|
||||
my.alert({ title: '定位失败' });
|
||||
reject(res)
|
||||
},
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
@ -164,6 +185,9 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
// wxUserSetting() {
|
||||
// Taro.getSetting({
|
||||
|
@ -8,6 +8,7 @@ import Logout from '../../util/logout'
|
||||
import './individualCenter.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -100,10 +101,10 @@ class IndividualCenter extends Component {
|
||||
// })
|
||||
}
|
||||
getInfoFromStorage() {
|
||||
const username = Taro.getStorageSync('userInfo').login_name||''
|
||||
const avatar = Taro.getStorageSync('userInfo').avatar||''
|
||||
const vip_level=Taro.getStorageSync('userInfo').vip_name||''
|
||||
const isShop = Taro.getStorageSync('shopInfo').shop_id ? true : false
|
||||
const username = getGlobalStorage('userInfo').login_name||''
|
||||
const avatar = getGlobalStorage('userInfo').avatar||''
|
||||
const vip_level=getGlobalStorage('userInfo').vip_name||''
|
||||
const isShop = getGlobalStorage('shopInfo').shop_id ? true : false
|
||||
this.setState({
|
||||
username, avatar, isShop,vip_level
|
||||
})
|
||||
@ -121,7 +122,8 @@ class IndividualCenter extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
console.log('login service')
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import URL from '../../serviceAPI.config'
|
||||
|
||||
import './myDemandSupplyEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -50,7 +51,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -126,7 +127,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -177,7 +178,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -222,7 +223,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
|
@ -8,6 +8,7 @@ import URL from '../../serviceAPI.config'
|
||||
import './myGoodList.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class MyGoodList extends Component {
|
||||
@ -83,7 +84,7 @@ class MyGoodList extends Component {
|
||||
dataType: 'json',
|
||||
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -137,7 +138,7 @@ class MyGoodList extends Component {
|
||||
order: order
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -220,7 +221,7 @@ class MyGoodList extends Component {
|
||||
// order: order
|
||||
// },
|
||||
// header: {
|
||||
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
// 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
// 'content-type': 'application/x-www-form-urlencoded',
|
||||
// 'X-Requested-With': 'XMLHttpRequest'
|
||||
// }
|
||||
@ -256,7 +257,7 @@ class MyGoodList extends Component {
|
||||
goodsID: JSON.stringify(goodsID)
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -303,7 +304,7 @@ class MyGoodList extends Component {
|
||||
goodsID: JSON.stringify(goodsID)
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -493,10 +494,11 @@ class MyGoodList extends Component {
|
||||
// 单个商品选择
|
||||
handleCheckChange(e) {
|
||||
//如果goodid 一样的那么checked 就取反
|
||||
console.log('clicke')
|
||||
const id = onClickValueService(e)
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
if (item.goods_id === id) {
|
||||
item.checked = !item.checked
|
||||
item['checked'] = !item.checked
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
@ -8,6 +8,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myGoodsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class MyGoodsEdit extends Component {
|
||||
config = {
|
||||
@ -41,7 +42,7 @@ class MyGoodsEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -63,9 +64,9 @@ class MyGoodsEdit extends Component {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (Taro.getStorageSync('shopTypeObject')) {
|
||||
if (getGlobalStorage('shopTypeObject')) {
|
||||
let selectedValue = ''
|
||||
const shopTypeObject = Taro.getStorageSync('shopTypeObject')
|
||||
const shopTypeObject = getGlobalStorage('shopTypeObject')
|
||||
for (let key in shopTypeObject) {
|
||||
for (let item of shopTypeObject[key].c) {
|
||||
if (item.id === res.data.goods.shop_class_id) {
|
||||
@ -157,7 +158,7 @@ class MyGoodsEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -234,7 +235,7 @@ class MyGoodsEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -440,7 +441,7 @@ class MyGoodsEdit extends Component {
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={Taro.getStorageSync('shopInfo').shop_id}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import LoginService from '../../util/LoginService'
|
||||
import './myNeeds.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class MyNeeds extends Component {
|
||||
|
||||
@ -87,7 +88,7 @@ class MyNeeds extends Component {
|
||||
dataType: 'json',
|
||||
data: param,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -150,7 +151,7 @@ class MyNeeds extends Component {
|
||||
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -295,7 +296,7 @@ class MyNeeds extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myNeedsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class MyNeedsEdit extends Component {
|
||||
|
||||
@ -52,7 +53,7 @@ class MyNeedsEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -154,7 +155,7 @@ class MyNeedsEdit extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -208,7 +209,7 @@ class MyNeedsEdit extends Component {
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -255,7 +256,7 @@ class MyNeedsEdit extends Component {
|
||||
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import LoginService from '../../util/LoginService'
|
||||
|
||||
import './myNeedsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -28,8 +29,8 @@ class MyNeedsPublish extends Component {
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
title: '',
|
||||
contactName: Taro.getStorageSync('user_identity').username || '',
|
||||
contactNumber: Taro.getStorageSync('user_identity').userphone || '',
|
||||
contactName: getGlobalStorage('user_identity').username || '',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone || '',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
@ -76,7 +77,7 @@ class MyNeedsPublish extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -133,7 +134,7 @@ class MyNeedsPublish extends Component {
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -274,7 +275,7 @@ class MyNeedsPublish extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
|
||||
import './myNeedsView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -51,7 +52,7 @@ class SupplyDemandView extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -134,7 +135,7 @@ class SupplyDemandView extends Component {
|
||||
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import loginExpired from '../../util/loginExpired'
|
||||
|
||||
import './mySupplyDemand.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class MySupplyDemand extends Component {
|
||||
@ -66,7 +67,7 @@ class MySupplyDemand extends Component {
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -134,7 +135,7 @@ class MySupplyDemand extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -292,11 +293,11 @@ class MySupplyDemand extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
|
@ -12,6 +12,7 @@ import ShopItem from '../../component/shopItemComponent/shopItemComponent'
|
||||
//import BottomNav from '../../component/bottomNav/bottomNav'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
const locationIcon = require('../../assets/img/location.png')
|
||||
|
||||
@ -112,7 +113,7 @@ class Shop extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -268,7 +269,7 @@ class Shop extends Component {
|
||||
// 'content-type': 'application/x-www-form-urlencoded',
|
||||
// 'X-Requested-With': 'XMLHttpRequest'
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -314,7 +315,7 @@ class Shop extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
|
@ -9,6 +9,7 @@ import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './supplyDemandPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
class SupplyDemand extends Component {
|
||||
config = {
|
||||
@ -22,8 +23,8 @@ class SupplyDemand extends Component {
|
||||
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
||||
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
||||
title: '',
|
||||
contactName: Taro.getStorageSync('user_identity').username||'',
|
||||
contactNumber: Taro.getStorageSync('user_identity').userphone||'',
|
||||
contactName: getGlobalStorage('user_identity').username||'',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone||'',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
@ -68,7 +69,7 @@ class SupplyDemand extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -124,7 +125,7 @@ class SupplyDemand extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
@ -196,7 +197,7 @@ class SupplyDemand extends Component {
|
||||
|
||||
// 上传供求api
|
||||
publishButtonHandler() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -216,7 +217,7 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
}
|
||||
publishAndNewButton() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -236,7 +237,7 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
}
|
||||
goToMyDemSupPage() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -258,11 +259,11 @@ class SupplyDemand extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
|
@ -9,6 +9,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
|
||||
import './supplyDemandView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -43,7 +44,7 @@ class SupplyDemandView extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -88,7 +89,7 @@ class SupplyDemandView extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
|
@ -52,8 +52,8 @@ class Home extends Component {
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字
|
||||
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话
|
||||
userName: getGlobalStorage('user_identity').userName || '',//用户名字
|
||||
userPhone: getGlobalStorage('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
@ -83,7 +83,7 @@ class Home extends Component {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
// 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -128,7 +128,7 @@ class Home extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -214,7 +214,7 @@ class Home extends Component {
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
@ -265,7 +265,7 @@ class Home extends Component {
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
@ -285,7 +285,7 @@ class Home extends Component {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
this.setState({ isOpen: false })
|
||||
@ -329,7 +329,7 @@ class Home extends Component {
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||
getGlobalStorage('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
32
src/util/getSetStoage.js
Normal file
32
src/util/getSetStoage.js
Normal file
@ -0,0 +1,32 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
|
||||
const setGlobalStorage = (key, value) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.setStorageSync({
|
||||
key: key,
|
||||
data: value
|
||||
})
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.setStorageSync({
|
||||
key: key,
|
||||
data: value
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getGlobalStorage = (key) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
getGlobalStorage(key)
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
|
||||
let res = my.getStorageSync({
|
||||
key: key,
|
||||
})
|
||||
res.data=res.data?res.data:{username:'',userphone:'',user_id:''}
|
||||
return res.data ||res.APDataStorage
|
||||
}
|
||||
}
|
||||
export { setGlobalStorage, getGlobalStorage }
|
@ -1,6 +1,7 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import standardLogin from '../util/standardLogin'
|
||||
import weChatLogin from '../util/weChatLogin'
|
||||
import { getGlobalStorage } from './getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -32,7 +33,7 @@ export default function loginExpired(res) {
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
const hasAccount = Taro.getStorageSync('accountInfo')
|
||||
const hasAccount = getGlobalStorage('accountInfo')
|
||||
|
||||
if (hasAccount) {
|
||||
standardLogin(hasAccount.username, hasAccount.password).then(res => {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import URL from '../serviceAPI.config'
|
||||
import { getGlobalStorage } from './getSetStoage';
|
||||
|
||||
export default function logout() {
|
||||
Taro.request({
|
||||
url:URL.LogOut,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
}).then(res=>{
|
||||
Taro.showToast({
|
||||
|
@ -9,6 +9,5 @@ export default function onClickValueService(e) {
|
||||
value = e.currentTarget.dataset.eTapAA
|
||||
}
|
||||
value=typeof(value)==='string'?encodeURIComponent(value):value
|
||||
console.log('value',value)
|
||||
return value
|
||||
}
|
@ -1,17 +1,18 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import URL from '../serviceAPI.config'
|
||||
import { setGlobalStorage, getGlobalStorage } from './getSetStoage';
|
||||
|
||||
|
||||
const setUserInfoToStorage = () => {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||
setGlobalStorage('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -45,10 +46,11 @@ export default function standardLogin(username, password) {
|
||||
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: username, password: password })
|
||||
|
||||
setGlobalStorage('session_id', res.data.session_id)
|
||||
setGlobalStorage('shopInfo', res.data.shop_info)
|
||||
setGlobalStorage('userInfo', res.data.user_info)
|
||||
setGlobalStorage('accountInfo', { username: username, password: password })
|
||||
setUserInfoToStorage()
|
||||
resolve('success')
|
||||
} else {
|
||||
|
@ -1,12 +1,13 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import URL from '../serviceAPI.config'
|
||||
import { getGlobalStorage } from './getSetStoage';
|
||||
|
||||
//用户信息姓名和电话号码接口
|
||||
const setUserInfoToStorage = () => {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
|
Loading…
Reference in New Issue
Block a user