Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
mallapp
Commits
e83c1e4a
Commit
e83c1e4a
authored
May 29, 2020
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
59e8dfd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
278 additions
and
52 deletions
+278
-52
style6.vue
components/goods/style6.vue
+165
-0
index.vue
pages/index/index.vue
+1
-0
api.js
plugin/api.js
+112
-52
No files found.
components/goods/style6.vue
0 → 100644
View file @
e83c1e4a
<
template
>
<view
style=
"padding: 12px; padding-bottom: 0;width:100%;"
:style=
"
{
'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '',
}"
>
<view
class=
"good-four"
v-for=
"(item, gli) in goodList"
:key=
"gli"
@
click=
"openGood"
:style=
"
{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '',
}"
>
<view
class=
"tips"
v-if=
"goodsInfo.showGoodsTag"
>
<image
:src=
"goodsInfo.goodsTagPicUrl"
mode=
"widthFix"
style=
"width: 100%;"
/>
</view>
<view
class=
"img-box"
>
<image
style=
"width: 100%; height: 100%;"
:mode=
"goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src=
"item.picUrl"
/>
</view>
<view
class=
"good-info"
>
<view
class=
"good-name"
v-if=
"goodsInfo.showGoodsName"
>
{{
item
.
name
}}
</view>
<view
class=
"good-price-info"
>
<view
class=
"price"
:style=
"
{'color':mainColor}">
{{
goodsInfo
.
showGoodsPrice
?
item
.
price
:
""
}}
</view>
<view
class=
"buy"
v-if=
"goodsInfo.showBuyBtn"
>
<u-icon
name=
"cart-o"
size=
"40"
:color=
"mainColor"
v-if=
"goodsInfo.buyBtn == 'cart'"
/>
<u-icon
name=
"add-o"
size=
"40"
:color=
"mainColor"
v-else-if=
"goodsInfo.buyBtn == 'add'"
/>
<u-button
type=
"primary"
size=
"mini"
:ripple=
"true"
:color=
"goodsInfo.buttonColor"
:custom-style=
"`backgroundColor:$
{goodsInfo.buttonColor},color:${
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>
{{
goodsInfo
.
buyBtnText
}}
</u-button
>
</view>
</view>
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
props
:
[
"goodList"
,
"goodsInfo"
],
data
()
{
return
{
mainColor
:
""
,
activeKey
:
0
,
};
},
created
()
{
this
.
mainColor
=
this
.
$uiConfig
.
mainColor
;
},
methods
:
{
openGood
(
e
)
{
console
.
log
(
e
);
},
},
};
</
script
>
<
style
>
.good-four
{
position
:
relative
;
margin-bottom
:
14px
;
display
:
flex
;
height
:
102px
;
border
:
1
rpx
solid
transparent
;
border-radius
:
10
rpx
;
box-sizing
:
border-box
;
padding
:
0
1px
1px
0
;
overflow
:
hidden
;
}
.good-four
.tips
{
width
:
64
rpx
;
height
:
64
rpx
;
position
:
absolute
;
top
:
0
;
left
:
0
;
z-index
:
4
;
}
.good-four
.img-box
{
width
:
100px
;
height
:
100px
;
}
.good-four
.good-info
{
padding
:
12px
;
flex
:
1
;
width
:
1
rpx
;
border
:
10
rpx
;
padding-bottom
:
0
;
display
:
flex
;
flex-direction
:
column
;
/* width:20%; */
}
.good-four
.good-info
.good-name
{
font-size
:
13px
;
height
:
34px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
-webkit-box
;
-webkit-line-clamp
:
2
;
-webkit-box-orient
:
vertical
;
}
.good-four
.good-info
.good-price-info
{
display
:
flex
;
justify-items
:
center
;
align-items
:
flex-end
;
height
:
22px
;
flex
:
1
;
padding-bottom
:
10
rpx
;
}
.good-four
.good-info
.good-price-info
.price
{
color
:
#ff4544
;
flex
:
1
;
font-size
:
14px
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.good-four
.good-info
.good-price-info
.buy
{
width
:
24px
;
text-align
:
right
;
}
</
style
>
pages/index/index.vue
View file @
e83c1e4a
...
...
@@ -9,6 +9,7 @@
:current=
"active"
:bar-width=
"80"
:font-size=
"32"
:bold=
"false"
@
change=
"changeHandler"
></u-tabs>
<template
v-for=
"(item, i) in myPageData.home_pages.navs"
>
...
...
plugin/api.js
View file @
e83c1e4a
export
default
{
install
(
Vue
,
options
)
{
Vue
.
prototype
.
host
=
"https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
install
(
Vue
,
options
)
{
Vue
.
prototype
.
host
=
"https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
Vue
.
prototype
.
host2
=
"http://192.168.0.110:8200"
//Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue
.
prototype
.
request
=
function
(
param
,
success
,
failed
)
{
//网络请求
uni
.
request
({
url
:
this
.
host
+
"&r="
+
param
.
data
.
r
,
method
:
param
.
method
||
"GET"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
},
data
:
param
.
data
,
success
:
res
=>
{
if
(
res
.
data
.
code
!=
0
&&
res
.
data
.
msg
!=
"商品未上架"
)
{
wx
.
showModal
({
content
:
'网络开小差了,刷新页面重新加载吧'
,
showCancel
:
false
})
console
.
group
(
"发生了异常情况"
);
console
.
error
(
res
.
data
.
msg
);
console
.
groupEnd
();
}
else
{
typeof
success
==
"function"
&&
success
(
res
.
data
);
}
},
fail
:
(
e
)
=>
{
console
.
log
(
"网络请求fail:"
+
JSON
.
stringify
(
e
));
uni
.
showModal
({
content
:
""
+
res
.
errMsg
});
typeof
failed
==
"function"
&&
failed
(
res
.
data
);
}
});
}
Vue
.
prototype
.
request
=
function
(
param
,
success
,
failed
)
{
//网络请求
uni
.
request
({
url
:
this
.
host
+
"&r="
+
param
.
data
.
r
,
method
:
param
.
method
||
"GET"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
},
data
:
param
.
data
,
success
:
res
=>
{
if
(
res
.
data
.
code
!=
0
&&
res
.
data
.
msg
!=
"商品未上架"
)
{
wx
.
showModal
({
content
:
'网络开小差了,刷新页面重新加载吧'
,
showCancel
:
false
})
console
.
group
(
"发生了异常情况"
);
console
.
error
(
res
.
data
.
msg
);
console
.
groupEnd
();
}
else
{
typeof
success
==
"function"
&&
success
(
res
.
data
);
}
},
fail
:
(
e
)
=>
{
console
.
log
(
"网络请求fail:"
+
JSON
.
stringify
(
e
));
uni
.
showModal
({
content
:
""
+
res
.
errMsg
});
typeof
failed
==
"function"
&&
failed
(
res
.
data
);
}
});
}
Vue
.
prototype
.
apiheader
=
function
()
{
return
{
'X-Access-Token'
:
'_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
'[]'
,
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
'19992'
,
'content-type'
:
"application/json"
}
}
Vue
.
prototype
.
request2
=
function
(
param
,
success
,
failed
)
{
//网络请求
uni
.
request
({
url
:
this
.
host2
+
param
.
url
,
method
:
param
.
method
||
"Post"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
},
data
:
{
"MallBaseId"
:
0
,
"TenantId"
:
0
,
"OpenId"
:
this
.
GetOpenId
(),
MiniAppId
:
this
.
GetMiniAppId
(),
msg
:
param
.
data
},
success
:
res
=>
{
if
(
res
.
data
.
resultCode
!=
1
)
{
// wx.showModal({
// content: '网络开小差了,刷新页面重新加载吧',
// showCancel: false
// })
console
.
group
(
"发生了异常情况"
);
console
.
error
(
res
.
data
.
msg
);
console
.
groupEnd
();
}
else
{
typeof
success
==
"function"
&&
success
(
res
.
data
);
}
},
fail
:
(
e
)
=>
{
console
.
log
(
"网络请求fail:"
+
JSON
.
stringify
(
e
));
uni
.
showModal
({
content
:
""
+
res
.
errMsg
});
typeof
failed
==
"function"
&&
failed
(
res
.
data
);
}
});
}
// 获取小程序APPID
Vue
.
prototype
.
GetMiniAppId
=
function
()
{
return
'wxacd9f8cc3480d29e'
}
//获取OpenId
Vue
.
prototype
.
GetOpenId
=
function
()
{
return
'ow_7I5ZQKhAB66yvOTGI35Xk-Kmg'
}
//公用判断图片地址 判断是否包含http
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
let
str
=
''
if
(
url
&&
url
!=
''
)
{
if
(
url
.
indexOf
(
'http'
)
!=
-
1
)
{
str
=
url
}
else
{
str
=
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com'
+
url
;
}
return
str
;
}
}
// Vue.prototype.post = function(obj, success, failed) {
// this.sendRequest(obj.url, 'POST', obj.data, success, failed)
// }
Vue
.
prototype
.
apiheader
=
function
()
{
return
{
'X-Access-Token'
:
'_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
'[]'
,
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
'19992'
,
'content-type'
:
"application/json"
}
}
// Vue.prototype.get = function(obj, success, failed) {
// this.sendRequest(obj.url, 'GET', obj.data, success, failed)
// }
}
}
\ No newline at end of file
// Vue.prototype.post = function(obj, success, failed) {
// this.sendRequest(obj.url, 'POST', obj.data, success, failed)
// }
// Vue.prototype.get = function(obj, success, failed) {
// this.sendRequest(obj.url, 'GET', obj.data, success, failed)
// }
}
}
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