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 @@ ...@@ -1280,3 +1280,35 @@
line-height: 21rpx; line-height: 21rpx;
margin-right: 6rpx; 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 @@ ...@@ -549,4 +549,10 @@
</view> </view>
</view> </view>
</view> </view>
<!--全局吐司-->
<view class="toastLayout" hidden="{{!isShowToast}}">
<view class="toast">
<text>{{toastText}}</text>
</view>
</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 ...@@ -16,6 +16,9 @@ import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND, FLOW_DIRECT_PAYMENT, FLOW_VER
Page({ Page({
data: { data: {
//页面控制相关参数 //页面控制相关参数
//吐司显示
isShowToast: false,
toastText:"------",
pageShow: { pageShow: {
"home": true, "home": true,
"landscan": false, "landscan": false,
...@@ -113,6 +116,30 @@ Page({ ...@@ -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) { goPage(pageName) {
var pageShowTemp = { ...this.data.pageShow }; var pageShowTemp = { ...this.data.pageShow };
...@@ -301,7 +328,7 @@ Page({ ...@@ -301,7 +328,7 @@ Page({
//拿到当前显示的图片url //拿到当前显示的图片url
var curAdUrl = res.data; var curAdUrl = res.data;
//重置广告选中数据 //重置广告选中数据
var tempPosterList = { ...context.data.posterList }; var tempPosterList = context.data.posterList.slice();
for (var i = 0; i < tempPosterList.length; i++) { for (var i = 0; i < tempPosterList.length; i++) {
if (tempPosterList[i].url == curAdUrl) { if (tempPosterList[i].url == curAdUrl) {
tempPosterList[i].selected = true; tempPosterList[i].selected = true;
...@@ -558,7 +585,7 @@ Page({ ...@@ -558,7 +585,7 @@ Page({
}, },
success: (res) => { success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
my.showToast({ content: "正在打印中" });
}, },
fail: (res) => { fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
...@@ -1223,7 +1250,7 @@ Page({ ...@@ -1223,7 +1250,7 @@ Page({
console.log("event==>" + JSON.stringify(event)); console.log("event==>" + JSON.stringify(event));
//获取点击的index //获取点击的index
var index = event.target.dataset.index; var index = event.target.dataset.index;
var tempList = { ...this.data.posterList }; var tempList = this.data.posterList.slice();
//遍历改变posterList状态 //遍历改变posterList状态
for (var i = 0; i < tempList.length; i++) { for (var i = 0; i < tempList.length; i++) {
if (i == index) { if (i == index) {
...@@ -1243,19 +1270,15 @@ Page({ ...@@ -1243,19 +1270,15 @@ Page({
data: selAdUrl data: selAdUrl
}, },
success: (res) => { success: (res) => {
my.showToast({ console.log("sendBuddyMessage success:" + JSON.stringify(res));
content: "设置成功"
});
context.setData({ context.setData({
posterList: tempList posterList: tempList
}); });
console.log("sendBuddyMessage success:" + JSON.stringify(res)); context.showToast("设置成功");
}, },
fail: (res) => { fail: (res) => {
my.showToast({
content: "设置失败"
});
console.log("sendBuddyMessage fail:" + JSON.stringify(res)); 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