File tree 1 file changed +1
-12
lines changed
1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -115,11 +115,7 @@ function getCart_xh() {
115
115
}
116
116
$ . get ( option , async ( err , resp , data ) => {
117
117
try {
118
- data = getSubstr ( data , "window.cartData = " , "window._PFM_TIMING" ) ;
119
- data = data . replace ( ' ;' , '' ) ;
120
- data = data . replace ( / \s + / g, '' ) ;
121
- data = JSON . parse ( data ) ;
122
-
118
+ data = JSON . parse ( data . match ( / w i n d o w \. c a r t D a t a = ( [ ^ ; ] * ) / ) [ 1 ] )
123
119
$ . areaId = data . areaId ; // locationId的传值
124
120
$ . traceId = data . traceId ; // traceid的传值
125
121
venderCart = data . cart . venderCart ;
@@ -208,13 +204,6 @@ function removeCart() {
208
204
} )
209
205
}
210
206
211
- function getSubstr ( str , leftStr , rightStr ) {
212
- let left = str . indexOf ( leftStr ) ;
213
- let right = str . indexOf ( rightStr , left ) ;
214
- if ( left < 0 || right < left ) return '' ;
215
- return str . substring ( left + leftStr . length , right ) ;
216
- }
217
-
218
207
function TotalBean ( ) {
219
208
return new Promise ( async resolve => {
220
209
const options = {
You can’t perform that action at this time.
0 commit comments