Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
d44ca0af
Commit
d44ca0af
authored
Feb 06, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
封装完成扫码弹窗,并测试通过
parent
0bc2313b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
46 deletions
+76
-46
scandialog.acss
custom_widgets/scandialog/scandialog.acss
+5
-2
scandialog.axml
custom_widgets/scandialog/scandialog.axml
+30
-28
scandialog.js
custom_widgets/scandialog/scandialog.js
+23
-8
home.axml
pages/home/home.axml
+10
-3
home.js
pages/home/home.js
+8
-5
No files found.
custom_widgets/scandialog/scandialog.acss
View file @
d44ca0af
/* position: absolute 加上 left:0rpx;top:0rpx;即可突破原来限制,显示在父控件的顶部位置 */
popUpScanBg{
/* 阴影,全屏 */
display: flex;
flex-direction: column;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.65) ;
left: 0rpx;
top: 0rpx;
}
.popUpScan{
position:
relativ
e;
position:
absolut
e;
margin-top: 286rpx;
height: 100%;
width: 100%;
left:0rpx;
top:0rpx;
background-color: #ffffff;
border-radius:8rpx 8rpx 0px 0px;
}
...
...
custom_widgets/scandialog/scandialog.axml
View file @
d44ca0af
<view class="popUpScanBg" >
<view class="popUpScanBg" a:if="{{dialogDisplay >= show}}">
<!-- 灰黑色背景 -->
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;background-color: rgba(0, 0, 0, 0.65);background-size:100% 100%;"/>
<view class="popUpScan">
<image class="close" mode="aspectFit" src="/images/icon_dialog_cancel.png" onTap="dialogClose"/>
<view class="popUpScan">
<image class="close" mode="aspectFit" src="/images/icon_dialog_cancel.png"/>
<!-- 初始状态 -->
<view onTap="scanDialogLoading" style="display:flex;flex-direction:column;" a:if="{{dialogDisplay == show}}">
<view class="scanRemindText">{{remindText}}</view>
<!-- 图片 -->
<image class="scanRemindIcon" mode="aspectFit" src="/images/icon_scan_remind.png"/>
<!-- x -->
</view>
<view style="position:absolute;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;" a:if="{{dialogDisplay == loading}}" >
<image mode="aspectFit" src="/images/icon_dialog_loading.png" style="position:relative;top:307rpx;width:239rpx;height:239rpx;margin:0 auto;"/>
<view style="position:absolute;font-size:38rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(0,0,0,0.85);line-height:45rpx;margin-top:404rpx;align-text:center;">支付中</view>
</view>
<view class="resultContainer" a:if="{{dialogDisplay == resultSuccess}}">
<image class="resultIcon" mode="aspectFit" src="/images/icon_success.png"/>
<view class="resultSuccessRemind">退款成功</view>
<view class="resultText">退款完成!会在1~2个工作日 返还到您的付款账户</view>
</view>
<view class="resultContainer" a:if="{{dialogDisplay == resultFailed}}">
<image class="resultIcon" mode="aspectFit" src="/images/icon_failed.png"/>
<view class="resultFailedRemind">退款失败</view>
<view class="resultText">核销失败!无效的订单码</view>
</view>
<!-- 初始状态 -->
<view style="display:flex;flex-direction:column;" a:if="{{dialogDisplay == show}}">
<view class="scanRemindText">{{remindText}}</view>
<!-- 图片 -->
<image class="scanRemindIcon" mode="aspectFit" src="/images/icon_scan_remind.png"/>
<!-- x -->
</view>
<!-- loading -->
<view style="position:absolute;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;" a:if="{{dialogDisplay == loading}}" >
<image mode="aspectFit" src="/images/icon_dialog_loading.png" style="position:relative;top:307rpx;width:239rpx;height:239rpx;margin:0 auto;"/>
<view style="position:absolute;font-size:38rpx;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:rgba(0,0,0,0.85);line-height:45rpx;margin-top:404rpx;align-text:center;">{{loadingText}}</view>
</view>
<!-- 结果页面-成功 -->
<view class="resultContainer" a:if="{{dialogDisplay == resultSuccess}}">
<image class="resultIcon" mode="aspectFit" src="/images/icon_success.png"/>
<view class="resultSuccessRemind">{{resultSuccessRemind}}</view>
<view class="resultText">{{resultSuccessText}}</view>
</view>
<!-- 结果页面-失败 -->
<view class="resultContainer" a:if="{{dialogDisplay == resultFailed}}">
<image class="resultIcon" mode="aspectFit" src="/images/icon_failed.png"/>
<view class="resultFailedRemind">{{resultFailureRemind}}</view>
<view class="resultText">{{resultFailureText}}</view>
</view>
</view>
</view>
custom_widgets/scandialog/scandialog.js
View file @
d44ca0af
Component
({
mixins
:
[],
// minxin 方便复用代码
data
:
{
show
:
1
,
loading
:
2
,
resultSuccess
:
3
,
resultFailed
:
4
,
dialogDisplay
:
0
,
},
// 组件内部数据
props
:
{
remindText
:
""
,
warningText
:
""
,
//
warningText:"",
loadingText
:
""
,
resultSuccessRemind
:
""
,
resultSuccessText
:
""
,
resultFailureRemind
:
""
,
resultFailureText
:
""
,
resultText
:
""
,
statusIdle
:
1
,
//初始状态
statusProgress
:
2
,
//loading状态
statusSuccessResult
:
3
,
//成功状态
statusFailedResult
:
4
,
//失败状态
currentStatus
:
1
//当前状态
displayDialog
:
0
,
},
// 可给外部传入的属性添加默认值
didMount
()
{
},
// 生命周期函数,加载成功
didUpdate
()
{},
//刷新
didUnmount
()
{},
//生命周期
deriveDataFromProps
(
nextProps
)
{
// 组件创建时触发或更新时触发
this
.
setData
({
dialogDisplay
:
nextProps
.
displayDialog
}
)
console
.
log
(
" deriveDataFromProps"
,
nextProps
,
this
.
props
,
this
.
data
);
},
methods
:
{
// 自定义方法
dialogClose
(){
//隐藏
this
.
props
.
dialogDisplay
=
0
;
},
},
});
\ No newline at end of file
pages/home/home.axml
View file @
d44ca0af
<view class="page" >
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;background:url(/images/bg_home.png) no-repeat fixed top;background-size:100% 100%;" onTap="homeTap"/>
<scandialog/>
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;background:url(/images/bg_home.png) no-repeat fixed top;background-size:100% 100%;"/>
<scandialog displayDialog="{{scanDialogDisplay}}"
remindText="请扫描订单编码"
loadingText="识别中"
resultSuccessRemind="退款成功"
resultSuccessRemind="退款完成!会在1~2个工作日 返还到您的付款账户"
resultFailureRemind="退款失败"
resultFailureText="核销失败!无效的订单码"
onTap="onTapScanDialog"
/>
</view>
\ No newline at end of file
pages/home/home.js
View file @
d44ca0af
Page
({
data
:
{
dialogDisplay
:
0
,
show
:
1
,
loading
:
2
,
resultSuccess
:
3
,
resultFailed
:
4
scanDialogDisplay
:
0
},
onLoad
()
{
...
...
@@ -32,6 +28,13 @@ Page({
});
},
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
showDialog
(){
this
.
setData
(
this
.
data
.
scanDialogDisplay
=
this
.
data
.
scanDialogDisplay
+
1
)
}
});
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