Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
H5_2.0
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
344f8819
authored
May 19, 2023
by
肖康
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
gid BUG
parent
91063030
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
166 additions
and
78 deletions
assets/css/classp/list.scss
components/addcar.vue
main.js
pages/classp/list.vue
pages/index/index.vue
router/index.js
util/util.js
assets/css/classp/list.scss
View file @
344f8819
...
@@ -11,13 +11,14 @@
...
@@ -11,13 +11,14 @@
font-size
:
34rpx
;
font-size
:
34rpx
;
font-weight
:
500
;
font-weight
:
500
;
color
:
$uni-color333
;
color
:
$uni-color333
;
background
:
#
fff
;
background
:
#
F5F5F7
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
0
32rpx
;
padding
:
0
32rpx
;
z-index
:
1
;
.icon
{
.icon
{
font-size
:
44rpx
;
font-size
:
44rpx
;
font-weight
:
normal
;
font-weight
:
normal
;
color
:
#d1d1d1
;
color
:
$uni-color999
;
margin-right
:
32rpx
;
margin-right
:
32rpx
;
}
}
...
@@ -29,12 +30,13 @@
...
@@ -29,12 +30,13 @@
}
}
.databox
{
.databox
{
margin-top
:
16rpx
;
width
:
100%
;
width
:
100%
;
padding
:
0
24rpx
;
padding
:
0
24rpx
;
background
:
#fff
;
background
:
#fff
;
margin-bottom
:
16rpx
;
margin-bottom
:
12rpx
;
border-radius
:
10px
10px
0px
0px
;
.group
{
.group
{
background
:
#fff
;
padding
:
24rpx
0
;
padding
:
24rpx
0
;
border-bottom
:
1rpx
solid
#F5F5F7
;
border-bottom
:
1rpx
solid
#F5F5F7
;
&
:last-child
{
border
:
0rpx
;}
&
:last-child
{
border
:
0rpx
;}
...
@@ -116,4 +118,46 @@
...
@@ -116,4 +118,46 @@
}
}
}
}
}
}
.nodatabox
{
padding-top
:
100rpx
;
text-align
:
center
;
image
{
display
:
block
;
margin
:
0
auto
;
width
:
356rpx
;
height
:
356rpx
;
margin-bottom
:
28rpx
;
}
color
:
$uni-color333
;
font-size
:
28rpx
;
.kfqqbtns
{
width
:
702rpx
;
height
:
88rpx
;
line-height
:
88rpx
;
background
:
#1969F9
;
border-radius
:
10px
;
position
:
fixed
;
left
:
24rpx
;
bottom
:
0rpx
;
font-size
:
28rpx
;
text-align
:
center
;
color
:
#fff
;
.icon
{
font-size
:
44rpx
;
color
:
#fff
;
margin-right
:
12rpx
;
position
:
relative
;
top
:
4rpx
;
}
}
}
.loadEnd
{
height
:
62rpx
;
line-height
:
62rpx
;
background
:
#F5F5F7
;
font-size
:
22rpx
;
text-align
:
center
;
color
:
#C6C7CC
;
}
}
}
\ No newline at end of file
components/addcar.vue
View file @
344f8819
...
@@ -126,6 +126,7 @@
...
@@ -126,6 +126,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
Api_Es
,
Ichunt_Api
,
Api_Url
}
from
'@/util/api.js'
;
export
default
{
export
default
{
name
:
"addcar"
,
name
:
"addcar"
,
props
:
{
props
:
{
...
@@ -144,10 +145,20 @@
...
@@ -144,10 +145,20 @@
},
},
methods
:
{
methods
:
{
addcarpopfunc
(
goods_id
){
addcarpopfunc
(
goods_id
){
console
.
log
(
goods_id
)
if
(
goods_id
){
if
(
goods_id
){
this
.
popIsShow
=!
this
.
popIsShow
;
this
.
popIsShow
=!
this
.
popIsShow
;
this
.
getData
(
goods_id
)
}
}
},
getData
:
function
(
goods_id
){
this
.
request
(
Api_Url
+
"/goods/detail"
,
'POST'
,
{
id
:
this
.
goods_id
},
true
,
true
).
then
(
res
=>
{
if
(
res
.
error_code
==
0
)
{
}
else
{
}
});
}
}
},
},
}
}
...
...
main.js
View file @
344f8819
import
App
from
'./App'
import
App
from
'./App'
import
{
request
}
from
'@/util/util.js'
import
{
request
,
setCookie
,
getCookie
}
from
'@/util/util.js'
import
filters
from
'@/filters'
import
filters
from
'@/filters'
import
router
from
'@/router/index.js'
import
router
from
'@/router/index.js'
import
{
RouterMount
}
from
'uni-simple-router'
import
{
RouterMount
}
from
'uni-simple-router'
import
directive
from
'@/directive'
import
directive
from
'@/directive'
import
w_md5
from
'@/util/md5.js'
// #ifndef VUE3
// #ifndef VUE3
import
Vue
from
'vue'
import
Vue
from
'vue'
...
@@ -16,12 +17,29 @@ App.mpType = 'app'
...
@@ -16,12 +17,29 @@ App.mpType = 'app'
//过滤器遍历
//过滤器遍历
Object
.
keys
(
filters
).
forEach
(
key
=>
Vue
.
filter
(
key
,
filters
[
key
]));
Object
.
keys
(
filters
).
forEach
(
key
=>
Vue
.
filter
(
key
,
filters
[
key
]));
//自定义指令
//自定义指令
Vue
.
use
(
directive
);
Vue
.
use
(
directive
);
//生成临时Yo4teW_gid和Yo4teW_csrf
let
time1s
=
parseInt
(
new
Date
().
getTime
()
/
1000
);
let
gid_
=
w_md5
.
hex_md5_32
(
w_md5
.
hex_md5_32
(
String
(
time1s
)
+
Math
.
random
())
+
"usersign"
)
let
csrf_
=
w_md5
.
hex_md5_32
(
w_md5
.
hex_md5_32
(
String
(
time1s
)
+
Math
.
random
())
+
"csrf"
)
if
(
!
getCookie
(
"Yo4teW_gid"
)){
setCookie
(
'Yo4teW_gid'
,
gid_
,
7
);
}
if
(
!
getCookie
(
"Yo4teW_csrf"
)){
setCookie
(
'Yo4teW_csrf'
,
csrf_
,
7
);
}
try
{
try
{
function
isPromise
(
obj
)
{
function
isPromise
(
obj
)
{
return
(
return
(
...
...
pages/classp/list.vue
View file @
344f8819
...
@@ -2,102 +2,125 @@
...
@@ -2,102 +2,125 @@
<view
class=
"classlistpage"
>
<view
class=
"classlistpage"
>
<div
class=
"lhead row verCenter"
>
<div
class=
"lhead row verCenter"
>
<view
class=
"back"
v-back
><text
class=
"icon iconfont icon-arrleft"
></text></view>
<view
class=
"back"
v-back
><text
class=
"icon iconfont icon-arrleft"
></text></view>
<view
class=
"titlesi elep"
>
分类列表分类列表分
</view>
<view
class=
"titlesi elep"
>
{{
class_id2_name
||
class_id1_name
}}
</view>
</div>
</div>
<view
class=
"databox"
>
<view
class=
"databox"
>
<view
class=
"group"
>
<view
class=
"group"
v-for=
"(item,index) in list"
:key=
"index"
>
<view
class=
"toprs1 row bothSide"
>
<view
class=
"toprs1 row bothSide"
>
<navigator
url=
"#
"
class=
"row"
>
<navigator
:url=
"'/item?goods_id='+item.goods_id
"
class=
"row"
>
<view
class=
"goodsName elep"
>
LM358adsasd
</view>
<view
class=
"goodsName elep"
>
{{
item
.
goods_name
}}
</view>
<view
class=
"actag"
>
95折
</view>
<view
class=
"actag"
v-if=
"item.ac_type==10"
>
{{
item
.
activity_info
.
sign
}}
</view>
</navigator>
</navigator>
<view
class=
"addcar"
style=
"display:none;"
@
click=
"addcarpopfunc('10001'
)"
>
加入购物车
</view>
<view
class=
"addcar"
v-if=
"item.is_buy==1"
@
click=
"addcarpopfunc(item.goods_id
)"
>
加入购物车
</view>
<view
class=
"kfbtns"
@
click=
"addcarpopfunc('10001'
)"
>
联系客服
</view>
<view
class=
"kfbtns"
v-if=
"item.is_buy!=1"
@
click=
"addcarpopfunc(item.goods_id
)"
>
联系客服
</view>
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
ST
</view>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
{{
item
.
brand_name
}}
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
600
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
{{
item
.
moq
}}
</view>
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
mouser
</view>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
{{
item
.
supplier_name
}}
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
6000000
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
{{
item
.
stock
}}
</view>
</view>
</view>
<view
class=
"toprs3 row bothSide"
>
<view
class=
"toprs3 row bothSide"
>
<view
class=
"row"
>
<view
class=
"row"
>
<text
class=
"labelsd"
>
价格:
</text>
<text
class=
"labelsd"
>
价格:
</text>
<view
class=
"row priceb"
>
<view
class=
"row priceb"
v-if=
"item.ladder_price[0]"
>
<text
class=
"p1"
>
660
+
</text>
<text
class=
"p1"
>
{{
item
.
ladder_price
[
0
].
purchases
}}
+
</text>
<text
class=
"p2"
>
¥
130.86
</text>
<text
class=
"p2"
>
¥
{{
item
.
ladder_price
[
0
].
price_ac
||
item
.
ladder_price
[
0
].
price_cn
}}
</text>
<text
class=
"p3"
>
$
130.86
</text>
<text
class=
"p3"
>
$
{{
item
.
ladder_price
[
0
].
price_ac_us
||
item
.
ladder_price
[
0
].
price_us
}}
</text>
</view>
</view>
</view>
</view>
<text
class=
"labelsd"
@
click=
"addcarpopfunc('10001')"
>
更多阶梯价
<text
<text
class=
"labelsd"
@
click=
"addcarpopfunc(item.goods_id)"
>
更多阶梯价
<text
class=
"icon iconfont icon-arrbot"
></text></text>
</view>
</view>
<view
class=
"group"
>
<view
class=
"toprs1 row bothSide"
>
<navigator
url=
"#"
class=
"row"
>
<view
class=
"goodsName elep"
>
LM358adsasd
</view>
<view
class=
"actag"
>
95折
</view>
</navigator>
<view
class=
"addcar"
style=
"display:none;"
@
click=
"addcarpopfunc('10001')"
>
加入购物车
</view>
<view
class=
"kfbtns"
@
click=
"addcarpopfunc('10001')"
>
联系客服
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
ST
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
600
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
mouser
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
6000000
</view>
</view>
<view
class=
"toprs3 row bothSide"
>
<view
class=
"row"
>
<text
class=
"labelsd"
>
价格:
</text>
<view
class=
"row priceb"
>
<text
class=
"p1"
>
660+
</text>
<text
class=
"p2"
>
¥130.86
</text>
<text
class=
"p3"
>
$130.86
</text>
</view>
</view>
<text
class=
"labelsd"
@
click=
"addcarpopfunc('10001')"
>
更多阶梯价
<text
class=
"icon iconfont icon-arrbot"
></text></text>
class=
"icon iconfont icon-arrbot"
></text></text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 数据已全部加载 -->
<view
v-if=
"isLoadEnd"
class=
"loadEnd"
>
—— 数据已全部加载 ——
</view>
<view
class=
"nodatabox"
v-show=
"isInitLogin&&list.length==0"
>
<image
src=
"https://img.ichunt.com/images/ichunt/202304/10/d502aef8d15d42187482a48915196270.png"
>
</image>
<view>
抱歉,没有找到商品,您可以直接咨询客服
</view>
<a
class=
"kfqqbtns"
:href=
"kfurl"
target=
"_balnk"
>
<text
class=
"icon iconfont icon-qq"
></text>
联系客服
</a>
</view>
<addCar
ref=
"addCarPop"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
Ichunt_Api
}
from
'@/util/api.js'
;
import
{
Api_Es
,
Ichunt_Api
}
from
'@/util/api.js'
;
import
addCar
from
'@/components/addcar.vue'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
obj
:
""
,
kfurl
:
""
,
list
:[],
isInitLogin
:
0
,
class_id1
:
""
,
class_id2
:
""
,
class_id1_name
:
""
,
class_id2_name
:
""
,
page
:
1
,
page_size
:
10
,
isLoadEnd
:
false
// 是否已全部加载完
};
};
},
},
async
onReachBottom
()
{
// 如果正在加载中或已全部加载完,则直接返回
if
(
this
.
isLoadEnd
)
{
return
;
}
// 开始加载数据
this
.
getData
();
},
onShow
()
{
onShow
()
{
this
.
getData
();
this
.
getData
();
this
.
getqqurl
()
},
onLoad
:
function
(
option
)
{
this
.
class_id1
=
option
.
class_id1
||
""
;
this
.
class_id2
=
option
.
class_id2
||
""
;
console
.
log
(
this
.
class_id1
,
this
.
class_id2
)
},
},
methods
:
{
methods
:
{
get
Data
()
{
get
qqurl
:
function
()
{
this
.
request
(
Ichunt_Api
+
"/api/c
lassify/getClassifyMap
"
,
'GET'
,
{},
).
then
(
res
=>
{
this
.
request
(
Ichunt_Api
+
"/api/c
ommon/data
"
,
'GET'
,
{},
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
if
(
res
.
err_code
===
0
)
{
this
.
obj
=
res
.
data
;
this
.
kfurl
=
res
.
data
.
kfqq_xk
.
data
this
.
actId
=
res
.
data
[
0
].
bcat_id
}
});
},
getData
()
{
this
.
request
(
Api_Es
+
"/optimum/goods"
,
'POST'
,
{
class_id1
:
13396
,
page
:
this
.
page
,
page_size
:
this
.
page_size
},
true
,
true
).
then
(
res
=>
{
this
.
isInitLogin
=
1
;
if
(
res
.
error_code
==
0
)
{
this
.
class_id1_name
=
res
.
data
.
class_id1_name
;
this
.
class_id2_name
=
res
.
data
.
class_id2_name
;
this
.
page
++
;
let
newDataList
=
res
.
data
.
goods_lists
||
[];
this
.
list
=
this
.
list
.
concat
(
newDataList
);
console
.
log
(
newDataList
,
this
.
list
)
if
(
newDataList
.
length
<
this
.
page_size
)
{
this
.
isLoadEnd
=
true
;
}
}
else
{
this
.
list
=
[]
}
}
});
});
},
addcarpopfunc
(
goods_id
)
{
this
.
$refs
.
addCarPop
.
addcarpopfunc
(
String
(
goods_id
));
}
}
},
},
components
:
{
components
:
{
addCar
}
}
};
};
</
script
>
</
script
>
...
...
pages/index/index.vue
View file @
344f8819
...
@@ -80,9 +80,9 @@
...
@@ -80,9 +80,9 @@
</view>
</view>
</view>
</view>
<view
class=
"goods-box"
>
<view
class=
"goods-box"
>
<view
class=
"titg"
>
精选物料
<
text>
简短的描述文字,简短的描述文字
</text><
/view>
<view
class=
"titg"
>
精选物料
</view>
<scroll-view
class=
"goods-con"
scroll-x=
"true"
>
<scroll-view
class=
"goods-con"
scroll-x=
"true"
>
<navigator
:url=
"'/item
/
'+item.goods_id"
class=
"goods-item"
<navigator
:url=
"'/item
?goods_id=
'+item.goods_id"
class=
"goods-item"
v-for=
"(item,index) in obj.h5_home_choice_goods"
:key=
"index"
>
v-for=
"(item,index) in obj.h5_home_choice_goods"
:key=
"index"
>
<image
:src=
"item.goods_images"
></image>
<image
:src=
"item.goods_images"
></image>
<view
class=
"xhg elep"
>
{{
item
.
goods_name
}}
</view>
<view
class=
"xhg elep"
>
{{
item
.
goods_name
}}
</view>
...
...
router/index.js
View file @
344f8819
...
@@ -5,6 +5,9 @@ import Router from 'uni-simple-router'
...
@@ -5,6 +5,9 @@ import Router from 'uni-simple-router'
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
//初始化
//初始化
const
router
=
new
Router
({
const
router
=
new
Router
({
h5
:{
loading
:
false
,
},
APP
:
{
APP
:
{
animation
:
{
animation
:
{
animationType
:
'pop-in'
,
animationType
:
'pop-in'
,
...
...
util/util.js
View file @
344f8819
...
@@ -3,10 +3,6 @@ import API_BASE from '../util/api.js'
...
@@ -3,10 +3,6 @@ import API_BASE from '../util/api.js'
* 请求封装
* 请求封装
*/
*/
const
request
=
(
url
=
''
,
type
=
'GET'
,
param
=
{},
Loading
,
headertype
)
=>
{
const
request
=
(
url
=
''
,
type
=
'GET'
,
param
=
{},
Loading
,
headertype
)
=>
{
const
Yo4teW_csrf
=
getCookie
(
'Yo4teW_csrf'
)
||
''
;
const
Yo4teW_gid
=
getCookie
(
'Yo4teW_gid'
)
||
''
;
const
Yo4teW_uid
=
getCookie
(
'Yo4teW_uid'
)
||
''
;
//是否启动加载
//是否启动加载
if
(
Loading
)
{
if
(
Loading
)
{
uni
.
showLoading
({
uni
.
showLoading
({
...
@@ -18,23 +14,15 @@ const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
...
@@ -18,23 +14,15 @@ const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
var
params
=
Object
.
assign
(
param
,
{
var
params
=
Object
.
assign
(
param
,
{
pf
:
2
pf
:
2
});
});
//请求es相关
//请求es相关
if
(
url
&&
(
url
.
indexOf
(
"so12.ichunt."
)
!=
-
1
||
url
.
indexOf
(
"so.liexin.net"
)
!=
-
1
)
)
{
if
(
url
.
indexOf
(
"so12.ichunt."
)
!=
-
1
||
url
.
indexOf
(
"/esapi/"
)
!=
-
1
)
{
params
=
Object
.
assign
(
param
,
{
hkyefgyd
:
1
});
params
=
Object
.
assign
(
param
,
{
hkyefgyd
:
1
});
}
}
//如果uid没有,就添加参数ygagatetffafa,绕过验证登录
if
(
!
Yo4teW_csrf
&&
!
Yo4teW_gid
&&
!
Yo4teW_uid
)
{
params
=
Object
.
assign
(
param
,
{
ygagatetffafa
:
1
});
}
//请求类型判断
//请求类型判断
let
header
=
{
let
header
=
{
"Content-Type"
:
"application/json; charset=utf-8"
"Content-Type"
:
"application/json; charset=utf-8"
}
}
if
(
headertype
)
{
if
(
headertype
)
{
header
=
{
header
=
{
'Content-Type'
:
'application/x-www-form-urlencoded'
'Content-Type'
:
'application/x-www-form-urlencoded'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment