Commit 417f9ac4 authored by jiangjiantao's avatar jiangjiantao

Merge branch 'dev-1.0' of…

Merge branch 'dev-1.0' of https://gitlab.infra.miyatech.com/pengguangpu/doublescreen-back into dev-1.0
parents ea520410 bbc82c5e
......@@ -1280,3 +1280,35 @@
line-height: 21rpx;
margin-right: 6rpx;
}
/* 吐司样式 */
.toastLayout {
text-align: center;
width: 100%;
height: 100%;
position: absolute;
top: 0rpx;
/* border: 2px solid red; */
align-items: center;
align-content: center;
box-sizing: border-box;
white-space: nowrap;
display: flex;
}
.toast {
box-sizing: border-box;
/* border: 2px solid red; */
float: left;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 14rpx;
padding-bottom: 14rpx;
background: rgba(0, 0, 0, 0.85);
border-radius: 5rpx;
margin: 0 auto;
font-size: 19rpx;
color: white;
}
\ No newline at end of file
......@@ -549,4 +549,10 @@
</view>
</view>
</view>
<!--全局吐司-->
<view class="toastLayout" hidden="{{!isShowToast}}">
<view class="toast">
<text>{{toastText}}</text>
</view>
</view>
</view>
\ No newline at end of file
......@@ -16,6 +16,9 @@ import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT, FLOW_VER
Page({
data: {
//页面控制相关参数
//吐司显示
isShowToast: false,
toastText:"------",
pageShow: {
"home": true,
"landscan": false,
......@@ -113,6 +116,30 @@ Page({
],
},
/**
* 显示吐司方法
* @param text 吐司内容
* @param timeoutMs 倒计时,单位ms
*/
showToast(text, timeoutMs) {
if (timeoutMs == null || timeoutMs == 0) {
timeoutMs = 1500;
}
let context = this;
context.setData({
isShowToast: true,
toastText:text
});
setTimeout(
function () {
context.setData({
isShowToast: false
});
},
timeoutMs
);
},
/**跳转页面方法 */
goPage(pageName) {
var pageShowTemp = { ...this.data.pageShow };
......@@ -301,7 +328,7 @@ Page({
//拿到当前显示的图片url
var curAdUrl = res.data;
//重置广告选中数据
var tempPosterList = { ...context.data.posterList };
var tempPosterList = context.data.posterList.slice();
for (var i = 0; i < tempPosterList.length; i++) {
if (tempPosterList[i].url == curAdUrl) {
tempPosterList[i].selected = true;
......@@ -558,7 +585,7 @@ Page({
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
my.showToast({ content: "正在打印中" });
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
......@@ -1223,7 +1250,7 @@ Page({
console.log("event==>" + JSON.stringify(event));
//获取点击的index
var index = event.target.dataset.index;
var tempList = { ...this.data.posterList };
var tempList = this.data.posterList.slice();
//遍历改变posterList状态
for (var i = 0; i < tempList.length; i++) {
if (i == index) {
......@@ -1243,19 +1270,15 @@ Page({
data: selAdUrl
},
success: (res) => {
my.showToast({
content: "设置成功"
});
console.log("sendBuddyMessage success:" + JSON.stringify(res));
context.setData({
posterList: tempList
});
console.log("sendBuddyMessage success:" + JSON.stringify(res));
context.showToast("设置成功");
},
fail: (res) => {
my.showToast({
content: "设置失败"
});
console.log("sendBuddyMessage fail:" + JSON.stringify(res));
context.showToast("设置失败");
},
});
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment