alipay 样式 1.0.2

This commit is contained in:
郑茂强 2019-03-08 17:32:42 +08:00
parent 5ff153baeb
commit 0263f775a5
29 changed files with 214 additions and 135 deletions

View File

@ -7,6 +7,7 @@ import VoucherPosterComponent from './voucherPosterComponent/voucherPosterCompon
import onClickValueService from '../../util/onClickValueService' import onClickValueService from '../../util/onClickValueService'
import './filteredShopComponent.scss' import './filteredShopComponent.scss'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import { getGlobalStorage } from '../../util/getSetStoage';
const hornIcon = require('../../icons/horn.png') const hornIcon = require('../../icons/horn.png')
const houseIcon = require('../../icons/house.png') const houseIcon = require('../../icons/house.png')
@ -34,8 +35,8 @@ class recommondShop extends Component {
isOpenConsult: false, isOpenConsult: false,
consultTip: '', consultTip: '',
voucherResponseMsg: 'i am voucherResponseMsg', voucherResponseMsg: 'i am voucherResponseMsg',
userName: Taro.getStorageSync('user_identity').username || '', userName: getGlobalStorage('user_identity').username || '',
userPhone: Taro.getStorageSync('user_identity').userphone || '', userPhone: getGlobalStorage('user_identity').userphone || '',
isCanConsult: true, isCanConsult: true,
isCanVoucher: true isCanVoucher: true
@ -74,7 +75,7 @@ class recommondShop extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -113,7 +114,7 @@ class recommondShop extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -147,7 +148,7 @@ class recommondShop extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -212,8 +213,8 @@ class recommondShop extends Component {
this.setState({ this.setState({
isOpenVoucher: true, isOpenVoucher: true,
userName: Taro.getStorageSync('user_identity').username, userName: getGlobalStorage('user_identity').username,
userPhone: Taro.getStorageSync('user_identity').userphone userPhone: getGlobalStorage('user_identity').userphone
}, () => { }, () => {
this.getVoucherInfo({}) this.getVoucherInfo({})
}) })
@ -231,7 +232,6 @@ class recommondShop extends Component {
render() { render() {
const title = this.props.shop.shop_name const title = this.props.shop.shop_name
const imgUrl = URL.Base + this.props.shop.goods[0].goods_url const imgUrl = URL.Base + this.props.shop.goods[0].goods_url
const price = this.props.shop.goods[0].goods_price const price = this.props.shop.goods[0].goods_price

View File

@ -6,6 +6,7 @@ import { AtIcon } from 'taro-ui'
import './voucherPosterComponent.scss' import './voucherPosterComponent.scss'
import URL from '../../../serviceAPI.config' import URL from '../../../serviceAPI.config'
import loginExpired from '../../../util/loginExpired' import loginExpired from '../../../util/loginExpired'
import { getGlobalStorage } from '../../../util/getSetStoage';
@ -50,7 +51,7 @@ class VoucherPoster extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {

View File

@ -5,6 +5,7 @@ import { Picker } from 'taro-ui'
import './goodsTypeInteractionComp.scss' import './goodsTypeInteractionComp.scss'
import loginExpired from '../../util/loginExpired' import loginExpired from '../../util/loginExpired'
import { getGlobalStorage } from '../../util/getSetStoage';
let maxDepth = 0 let maxDepth = 0
let initialDataArray = [] let initialDataArray = []
@ -35,7 +36,7 @@ class GoodsTypeInteractionComp extends Component {
dataType: 'json', dataType: 'json',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -43,22 +44,22 @@ class GoodsTypeInteractionComp extends Component {
if (res.data.err_code === 0) { if (res.data.err_code === 0) {
console.log('商品分类目录', res) console.log('商品分类目录', res)
const recursionInteractionData=this.recursionInteraction(res.data.data) const recursionInteractionData = this.recursionInteraction(res.data.data)
maxDepth=0 maxDepth = 0
initialDataArray=[] initialDataArray = []
this.recursionInitialized(res.data.data) // this.recursionInitialized(res.data.data) //
const depthInArray=this.recursionDepth(res.data.data) const depthInArray = this.recursionDepth(res.data.data)
console.log('depthInArray',depthInArray) console.log('depthInArray', depthInArray)
console.log('initialDataArray',initialDataArray) console.log('initialDataArray', initialDataArray)
for(let i=initialDataArray.length;i<depthInArray.length;i++){ for (let i = initialDataArray.length; i < depthInArray.length; i++) {
initialDataArray.unshift([{name:'--',id:''}]) initialDataArray.unshift([{ name: '--', id: '' }])
} }
this.setState({ this.setState({
interactionMultiArray: recursionInteractionData, interactionMultiArray: recursionInteractionData,
multiIndex: depthInArray, multiIndex: depthInArray,
initailMultiArray:initialDataArray.reverse() initailMultiArray: initialDataArray.reverse()
}, () => { }, () => {
// 把全局变变量赋值给state之后初始化商品分类为空 不然第二次进去的时候会自动添加进去 // 把全局变变量赋值给state之后初始化商品分类为空 不然第二次进去的时候会自动添加进去
// console.log('联动数据', this.state.interactionMultiArray) // console.log('联动数据', this.state.interactionMultiArray)
@ -68,7 +69,7 @@ class GoodsTypeInteractionComp extends Component {
}) // 用递归来整理无限层次的数据 }) // 用递归来整理无限层次的数据
// console.log('联动数据', this.recursionInteraction(res.data.data)) // console.log('联动数据', this.recursionInteraction(res.data.data))
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse()) // console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
}else if (res.data.err_code === 88888) { } else if (res.data.err_code === 88888) {
loginExpired(res) loginExpired(res)
} else { } else {
Taro.showToast({ Taro.showToast({
@ -83,13 +84,10 @@ class GoodsTypeInteractionComp extends Component {
}) })
} }
//联动确认 //联动确认
bindMultiPickerChange(e) { bindMultiPickerChange(e) {
// 如果没有上商品 那就不执行 // 如果没有上商品 那就不执行
if(Taro.getStorageSync('shopInfo').shop_id){ if (getGlobalStorage('shopInfo').shop_id) {
this.setState({ this.setState({
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item }) 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 }) 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) this.recursionInitialized(data[0].children)
} }
initialDataArray.push(arrayTem) initialDataArray.push(arrayTem)
@ -320,9 +318,9 @@ class GoodsTypeInteractionComp extends Component {
componentDidMount() { componentDidMount() {
if(Taro.getStorageSync('shopInfo').shop_id){ if (getGlobalStorage('shopInfo').shop_id) {
this.getProductCateList(this.props.url) this.getProductCateList(this.props.url)
}else{ } else {
} }

View File

@ -6,6 +6,7 @@ import { Picker } from 'taro-ui'
import './interactionComponent.scss' import './interactionComponent.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
let maxDepth = 0 let maxDepth = 0
@ -35,7 +36,7 @@ class Interaction extends Component {
method: 'GET', method: 'GET',
dataType: 'json', dataType: 'json',
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }

View File

@ -5,6 +5,7 @@ import { Picker } from 'taro-ui'
import './shopTypeInteractionComp.scss' import './shopTypeInteractionComp.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class ShopTypeInteractionComp extends Component { class ShopTypeInteractionComp extends Component {
@ -33,7 +34,7 @@ class ShopTypeInteractionComp extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -46,7 +47,7 @@ class ShopTypeInteractionComp extends Component {
return return
} }
console.log('店铺分类目录', res) console.log('店铺分类目录', res)
if(!Taro.getStorageSync('shopTypeObject')){ if(!getGlobalStorage('shopTypeObject')){
Taro.setStorageSync('shopTypeObject',res.data.data) Taro.setStorageSync('shopTypeObject',res.data.data)
} }
this.setState({ this.setState({
@ -127,7 +128,7 @@ class ShopTypeInteractionComp extends Component {
} }
bindMultiPickerChange(e) { bindMultiPickerChange(e) {
// console.log('picker发送选择改变携带值为', e.detail.value) // console.log('picker发送选择改变携带值为', e.detail.value)
if (Taro.getStorageSync('shopInfo').shop_id) { if (getGlobalStorage('shopInfo').shop_id) {
this.setState({ this.setState({
multiIndex: e.detail.value, multiIndex: e.detail.value,
}, () => { }, () => {

View File

@ -11,6 +11,7 @@ import onClickValueService from '../../util/onClickValueService'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './allDemanding.scss' import './allDemanding.scss'
import eyeIcon from '../../icons/eye.png' import eyeIcon from '../../icons/eye.png'
import { getGlobalStorage } from '../../util/getSetStoage';
@ -69,7 +70,7 @@ class AllDemanding extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -139,7 +140,7 @@ class AllDemanding extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })

View File

@ -7,6 +7,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
import LoginService from '../../util/LoginService' import LoginService from '../../util/LoginService'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './goods.scss' import './goods.scss'
import { getGlobalStorage } from '../../util/getSetStoage';
class Goods extends Component { class Goods extends Component {
@ -46,7 +47,7 @@ class Goods extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -98,7 +99,7 @@ class Goods extends Component {
} }
// 收藏商品 // 收藏商品
saveItem() { saveItem() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -110,7 +111,7 @@ class Goods extends Component {
} }
//添加到购物车 //添加到购物车
addToCart() { addToCart() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }

View File

@ -13,6 +13,7 @@ import URL from '../../serviceAPI.config'
import './goodsPublish.scss' import './goodsPublish.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class GoodsPublish extends Component { class GoodsPublish extends Component {
@ -89,7 +90,7 @@ class GoodsPublish extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -164,7 +165,7 @@ class GoodsPublish extends Component {
}, },
header: { header: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -264,7 +265,7 @@ class GoodsPublish extends Component {
goToMyGoodListPage() { goToMyGoodListPage() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -283,7 +284,7 @@ class GoodsPublish extends Component {
} }
componentWillMount() { componentWillMount() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
} }
} }
@ -297,7 +298,7 @@ class GoodsPublish extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
Taro.showToast({ Taro.showToast({
title: '您还没有店铺,不能使用该功能,快去申请吧', title: '您还没有店铺,不能使用该功能,快去申请吧',
icon: 'none' icon: 'none'
@ -375,7 +376,7 @@ class GoodsPublish extends Component {
</View> </View>
{/* 店铺分类 */} {/* 店铺分类 */}
<ShopTypeInteractionComp url={URL.GetShopCategoryList} <ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={Taro.getStorageSync('shopInfo').shop_id} shopId={getGlobalStorage('shopInfo').shop_id}
selectedValue={this.state.shopTypeSelected} selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)} onPassDataToChild={this.getDataFromShopChild.bind(this)}
></ShopTypeInteractionComp> ></ShopTypeInteractionComp>

View File

@ -9,6 +9,7 @@ import RenderingView from './renderingView/renderingView'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './grabOrderPage.scss' import './grabOrderPage.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class GrabOrderPage extends Component { class GrabOrderPage extends Component {
@ -48,7 +49,7 @@ class GrabOrderPage extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -96,7 +97,7 @@ class GrabOrderPage extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -208,7 +209,7 @@ class GrabOrderPage extends Component {
demandId: demandId demandId: demandId
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -238,7 +239,7 @@ class GrabOrderPage extends Component {
} }
render() { render() {
const localStoageUserId = Taro.getStorageSync('userInfo').user_id const localStoageUserId = getGlobalStorage('userInfo').user_id
// 提示框 // 提示框
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}> const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>

View File

@ -144,6 +144,27 @@ class Home extends Component {
) )
} }
getUserLocation() { 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) => { return new Promise((resolve, reject) => {
Taro.getLocation({ Taro.getLocation({
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度 type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
@ -164,6 +185,9 @@ class Home extends Component {
} }
}
// 微信用户设置 // 微信用户设置
// wxUserSetting() { // wxUserSetting() {
// Taro.getSetting({ // Taro.getSetting({

View File

@ -8,6 +8,7 @@ import Logout from '../../util/logout'
import './individualCenter.scss' import './individualCenter.scss'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import onClickValueService from '../../util/onClickValueService'; import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
@ -100,10 +101,10 @@ class IndividualCenter extends Component {
// }) // })
} }
getInfoFromStorage() { getInfoFromStorage() {
const username = Taro.getStorageSync('userInfo').login_name||'' const username = getGlobalStorage('userInfo').login_name||''
const avatar = Taro.getStorageSync('userInfo').avatar||'' const avatar = getGlobalStorage('userInfo').avatar||''
const vip_level=Taro.getStorageSync('userInfo').vip_name||'' const vip_level=getGlobalStorage('userInfo').vip_name||''
const isShop = Taro.getStorageSync('shopInfo').shop_id ? true : false const isShop = getGlobalStorage('shopInfo').shop_id ? true : false
this.setState({ this.setState({
username, avatar, isShop,vip_level username, avatar, isShop,vip_level
}) })
@ -121,7 +122,8 @@ class IndividualCenter extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
console.log('login service')
LoginService() LoginService()
return return
} }

View File

@ -9,6 +9,7 @@ import URL from '../../serviceAPI.config'
import './myDemandSupplyEdit.scss' import './myDemandSupplyEdit.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
@ -50,7 +51,7 @@ class MyDemandSupplyEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -126,7 +127,7 @@ class MyDemandSupplyEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -177,7 +178,7 @@ class MyDemandSupplyEdit extends Component {
name: 'file', name: 'file',
header: { header: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -222,7 +223,7 @@ class MyDemandSupplyEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })

View File

@ -8,6 +8,7 @@ import URL from '../../serviceAPI.config'
import './myGoodList.scss' import './myGoodList.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import onClickValueService from '../../util/onClickValueService'; import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
class MyGoodList extends Component { class MyGoodList extends Component {
@ -83,7 +84,7 @@ class MyGoodList extends Component {
dataType: 'json', dataType: 'json',
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -137,7 +138,7 @@ class MyGoodList extends Component {
order: order order: order
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -220,7 +221,7 @@ class MyGoodList extends Component {
// order: order // order: order
// }, // },
// header: { // header: {
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), // 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
// 'content-type': 'application/x-www-form-urlencoded', // 'content-type': 'application/x-www-form-urlencoded',
// 'X-Requested-With': 'XMLHttpRequest' // 'X-Requested-With': 'XMLHttpRequest'
// } // }
@ -256,7 +257,7 @@ class MyGoodList extends Component {
goodsID: JSON.stringify(goodsID) goodsID: JSON.stringify(goodsID)
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -303,7 +304,7 @@ class MyGoodList extends Component {
goodsID: JSON.stringify(goodsID) goodsID: JSON.stringify(goodsID)
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -493,10 +494,11 @@ class MyGoodList extends Component {
// 单个商品选择 // 单个商品选择
handleCheckChange(e) { handleCheckChange(e) {
//如果goodid 一样的那么checked 就取反 //如果goodid 一样的那么checked 就取反
console.log('clicke')
const id = onClickValueService(e) const id = onClickValueService(e)
const newMyGoodList = this.state.myGoodList.map((item) => { const newMyGoodList = this.state.myGoodList.map((item) => {
if (item.goods_id === id) { if (item.goods_id === id) {
item.checked = !item.checked item['checked'] = !item.checked
} }
return item return item
}) })

View File

@ -8,6 +8,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './myGoodsEdit.scss' import './myGoodsEdit.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class MyGoodsEdit extends Component { class MyGoodsEdit extends Component {
config = { config = {
@ -41,7 +42,7 @@ class MyGoodsEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -63,9 +64,9 @@ class MyGoodsEdit extends Component {
// } // }
// } // }
// } // }
if (Taro.getStorageSync('shopTypeObject')) { if (getGlobalStorage('shopTypeObject')) {
let selectedValue = '' let selectedValue = ''
const shopTypeObject = Taro.getStorageSync('shopTypeObject') const shopTypeObject = getGlobalStorage('shopTypeObject')
for (let key in shopTypeObject) { for (let key in shopTypeObject) {
for (let item of shopTypeObject[key].c) { for (let item of shopTypeObject[key].c) {
if (item.id === res.data.goods.shop_class_id) { if (item.id === res.data.goods.shop_class_id) {
@ -157,7 +158,7 @@ class MyGoodsEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -234,7 +235,7 @@ class MyGoodsEdit extends Component {
}, },
header: { header: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -440,7 +441,7 @@ class MyGoodsEdit extends Component {
</View> </View>
{/* 店铺分类 */} {/* 店铺分类 */}
<ShopTypeInteractionComp url={URL.GetShopCategoryList} <ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={Taro.getStorageSync('shopInfo').shop_id} shopId={getGlobalStorage('shopInfo').shop_id}
selectedValue={this.state.shopTypeSelected} selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)} onPassDataToChild={this.getDataFromShopChild.bind(this)}

View File

@ -11,6 +11,7 @@ import LoginService from '../../util/LoginService'
import './myNeeds.scss' import './myNeeds.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import onClickValueService from '../../util/onClickValueService'; import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
class MyNeeds extends Component { class MyNeeds extends Component {
@ -87,7 +88,7 @@ class MyNeeds extends Component {
dataType: 'json', dataType: 'json',
data: param, data: param,
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -150,7 +151,7 @@ class MyNeeds extends Component {
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -295,7 +296,7 @@ class MyNeeds extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }

View File

@ -8,6 +8,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './myNeedsEdit.scss' import './myNeedsEdit.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class MyNeedsEdit extends Component { class MyNeedsEdit extends Component {
@ -52,7 +53,7 @@ class MyNeedsEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -154,7 +155,7 @@ class MyNeedsEdit extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -208,7 +209,7 @@ class MyNeedsEdit extends Component {
name: 'file', name: 'file',
header: { header: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -255,7 +256,7 @@ class MyNeedsEdit extends Component {
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }

View File

@ -11,6 +11,7 @@ import LoginService from '../../util/LoginService'
import './myNeedsPublish.scss' import './myNeedsPublish.scss'
import loginExpired from '../../util/loginExpired'; 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' }], needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
needsTypeSelected: { name: '业主需求', id: '4' }, needsTypeSelected: { name: '业主需求', id: '4' },
title: '', title: '',
contactName: Taro.getStorageSync('user_identity').username || '', contactName: getGlobalStorage('user_identity').username || '',
contactNumber: Taro.getStorageSync('user_identity').userphone || '', contactNumber: getGlobalStorage('user_identity').userphone || '',
contactAddress: '', contactAddress: '',
content: '', content: '',
pickerImageUrl: [], // 上传的图片 pickerImageUrl: [], // 上传的图片
@ -76,7 +77,7 @@ class MyNeedsPublish extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -133,7 +134,7 @@ class MyNeedsPublish extends Component {
name: 'file', name: 'file',
header: { header: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -274,7 +275,7 @@ class MyNeedsPublish extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }

View File

@ -9,6 +9,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
import './myNeedsView.scss' import './myNeedsView.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
@ -51,7 +52,7 @@ class SupplyDemandView extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -134,7 +135,7 @@ class SupplyDemandView extends Component {
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }

View File

@ -11,6 +11,7 @@ import loginExpired from '../../util/loginExpired'
import './mySupplyDemand.scss' import './mySupplyDemand.scss'
import onClickValueService from '../../util/onClickValueService'; import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
class MySupplyDemand extends Component { class MySupplyDemand extends Component {
@ -66,7 +67,7 @@ class MySupplyDemand extends Component {
}) })
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
@ -134,7 +135,7 @@ class MySupplyDemand extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -292,11 +293,11 @@ class MySupplyDemand extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
Taro.showToast({ Taro.showToast({
title: '您还没有店铺,不能使用该功能,快去申请吧', title: '您还没有店铺,不能使用该功能,快去申请吧',
icon: 'none' icon: 'none'

View File

@ -12,6 +12,7 @@ import ShopItem from '../../component/shopItemComponent/shopItemComponent'
//import BottomNav from '../../component/bottomNav/bottomNav' //import BottomNav from '../../component/bottomNav/bottomNav'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import onClickValueService from '../../util/onClickValueService'; import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
const locationIcon = require('../../assets/img/location.png') const locationIcon = require('../../assets/img/location.png')
@ -112,7 +113,7 @@ class Shop extends Component {
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -268,7 +269,7 @@ class Shop extends Component {
// 'content-type': 'application/x-www-form-urlencoded', // 'content-type': 'application/x-www-form-urlencoded',
// 'X-Requested-With': 'XMLHttpRequest' // 'X-Requested-With': 'XMLHttpRequest'
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -314,7 +315,7 @@ class Shop extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {

View File

@ -9,6 +9,7 @@ import LoginService from '../../util/LoginService'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './supplyDemandPublish.scss' import './supplyDemandPublish.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
class SupplyDemand extends Component { class SupplyDemand extends Component {
config = { config = {
@ -22,8 +23,8 @@ class SupplyDemand extends Component {
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择 demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态 demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
title: '', title: '',
contactName: Taro.getStorageSync('user_identity').username||'', contactName: getGlobalStorage('user_identity').username||'',
contactNumber: Taro.getStorageSync('user_identity').userphone||'', contactNumber: getGlobalStorage('user_identity').userphone||'',
contactAddress: '', contactAddress: '',
content: '', content: '',
pickerImageUrl: [], // 上传的图片 pickerImageUrl: [], // 上传的图片
@ -68,7 +69,7 @@ class SupplyDemand extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -124,7 +125,7 @@ class SupplyDemand extends Component {
}, },
header: { header: {
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz', 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
}, },
success(response) { success(response) {
@ -196,7 +197,7 @@ class SupplyDemand extends Component {
// 上传供求api // 上传供求api
publishButtonHandler() { publishButtonHandler() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -216,7 +217,7 @@ class SupplyDemand extends Component {
} }
} }
publishAndNewButton() { publishAndNewButton() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -236,7 +237,7 @@ class SupplyDemand extends Component {
} }
} }
goToMyDemSupPage() { goToMyDemSupPage() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -258,11 +259,11 @@ class SupplyDemand extends Component {
componentWillUnmount() { } componentWillUnmount() { }
componentDidShow() { componentDidShow() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
if (!Taro.getStorageSync('shopInfo').shop_id && Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
Taro.showToast({ Taro.showToast({
title: '您还没有店铺,不能使用该功能,快去申请吧', title: '您还没有店铺,不能使用该功能,快去申请吧',
icon: 'none' icon: 'none'

View File

@ -9,6 +9,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
import './supplyDemandView.scss' import './supplyDemandView.scss'
import loginExpired from '../../util/loginExpired'; import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
@ -43,7 +44,7 @@ class SupplyDemandView extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -88,7 +89,7 @@ class SupplyDemandView extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })

View File

@ -52,8 +52,8 @@ class Home extends Component {
otherData: [], // 底部导航栏 otherData: [], // 底部导航栏
isOpen: false, // 抢单消息提示 isOpen: false, // 抢单消息提示
grabOrderId: '',//抢到订单的id grabOrderId: '',//抢到订单的id
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字 userName: getGlobalStorage('user_identity').userName || '',//用户名字
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话 userPhone: getGlobalStorage('user_identity').userPhone || '',// 用户电话
isShowTopNav: false,// 是否显示返回顶部按钮 isShowTopNav: false,// 是否显示返回顶部按钮
loadMorePageIndex: 1,//下拉加载页面数 loadMorePageIndex: 1,//下拉加载页面数
isAddToList: false, isAddToList: false,
@ -83,7 +83,7 @@ class Home extends Component {
Taro.request({ Taro.request({
url: URL.ShopWxStore, url: URL.ShopWxStore,
header: { header: {
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), // 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -128,7 +128,7 @@ class Home extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
@ -214,7 +214,7 @@ class Home extends Component {
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}) })
@ -265,7 +265,7 @@ class Home extends Component {
} }
// 转到其他页面 // 转到其他页面
goToAllDemandingPage() { goToAllDemandingPage() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
return return
} }
@ -285,7 +285,7 @@ class Home extends Component {
this.setState({ isOpen: false }) this.setState({ isOpen: false })
} }
handleGrabConfirm() { handleGrabConfirm() {
if (!Taro.getStorageSync('userInfo').user_id) { if (!getGlobalStorage('userInfo').user_id) {
LoginService() LoginService()
} }
this.setState({ isOpen: false }) this.setState({ isOpen: false })
@ -329,7 +329,7 @@ class Home extends Component {
this.getHomeCategoriesInfo() this.getHomeCategoriesInfo()
}) })
// 本地缓存没有userid时 从新登入 // 本地缓存没有userid时 从新登入
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin() getGlobalStorage('userInfo').user_id ? true : weChatLogin()

32
src/util/getSetStoage.js Normal file
View 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 }

View File

@ -1,6 +1,7 @@
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import standardLogin from '../util/standardLogin' import standardLogin from '../util/standardLogin'
import weChatLogin from '../util/weChatLogin' import weChatLogin from '../util/weChatLogin'
import { getGlobalStorage } from './getSetStoage';
@ -32,7 +33,7 @@ export default function loginExpired(res) {
}) })
setTimeout(() => { setTimeout(() => {
const hasAccount = Taro.getStorageSync('accountInfo') const hasAccount = getGlobalStorage('accountInfo')
if (hasAccount) { if (hasAccount) {
standardLogin(hasAccount.username, hasAccount.password).then(res => { standardLogin(hasAccount.username, hasAccount.password).then(res => {

View File

@ -1,11 +1,12 @@
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import URL from '../serviceAPI.config' import URL from '../serviceAPI.config'
import { getGlobalStorage } from './getSetStoage';
export default function logout() { export default function logout() {
Taro.request({ Taro.request({
url:URL.LogOut, url:URL.LogOut,
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}).then(res=>{ }).then(res=>{
Taro.showToast({ Taro.showToast({

View File

@ -9,6 +9,5 @@ export default function onClickValueService(e) {
value = e.currentTarget.dataset.eTapAA value = e.currentTarget.dataset.eTapAA
} }
value=typeof(value)==='string'?encodeURIComponent(value):value value=typeof(value)==='string'?encodeURIComponent(value):value
console.log('value',value)
return value return value
} }

View File

@ -1,17 +1,18 @@
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import URL from '../serviceAPI.config' import URL from '../serviceAPI.config'
import { setGlobalStorage, getGlobalStorage } from './getSetStoage';
const setUserInfoToStorage = () => { const setUserInfoToStorage = () => {
Taro.request({ Taro.request({
url: URL.ShopWxStore, url: URL.ShopWxStore,
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {
if (res.data.err_msg === 'success') { 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 { } else {
Taro.showToast({ Taro.showToast({
@ -45,10 +46,11 @@ export default function standardLogin(username, password) {
icon: 'success', icon: 'success',
duration: 1000 duration: 1000
}) })
Taro.setStorageSync('session_id', res.data.session_id)
Taro.setStorageSync('shopInfo', res.data.shop_info) setGlobalStorage('session_id', res.data.session_id)
Taro.setStorageSync('userInfo', res.data.user_info) setGlobalStorage('shopInfo', res.data.shop_info)
Taro.setStorageSync('accountInfo', { username: username, password: password }) setGlobalStorage('userInfo', res.data.user_info)
setGlobalStorage('accountInfo', { username: username, password: password })
setUserInfoToStorage() setUserInfoToStorage()
resolve('success') resolve('success')
} else { } else {

View File

@ -1,12 +1,13 @@
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import URL from '../serviceAPI.config' import URL from '../serviceAPI.config'
import { getGlobalStorage } from './getSetStoage';
//用户信息姓名和电话号码接口 //用户信息姓名和电话号码接口
const setUserInfoToStorage = () => { const setUserInfoToStorage = () => {
Taro.request({ Taro.request({
url: URL.ShopWxStore, url: URL.ShopWxStore,
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
} }
}) })
.then(res => { .then(res => {