checkpoint: 冻结资金开工前龙先生小程序本地备份(不推远程)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
58
components/tousu-float/tousu-float.js
Normal file
58
components/tousu-float/tousu-float.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const STORAGE_KEY = 'tousuFloatHidden';
|
||||
|
||||
Component({
|
||||
data: {
|
||||
hidden: false,
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this._syncHidden();
|
||||
},
|
||||
},
|
||||
|
||||
pageLifetimes: {
|
||||
show() {
|
||||
this._syncHidden();
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
_syncHidden() {
|
||||
let hidden = false;
|
||||
try {
|
||||
hidden = wx.getStorageSync(STORAGE_KEY) === 1 || wx.getStorageSync(STORAGE_KEY) === '1';
|
||||
} catch (e) {}
|
||||
if (hidden !== this.data.hidden) {
|
||||
this.setData({ hidden });
|
||||
}
|
||||
},
|
||||
|
||||
go() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/gongdan/create/create',
|
||||
fail: (err) => {
|
||||
console.error('打开投诉页失败', err);
|
||||
wx.showToast({ title: '打开失败,请重试', icon: 'none' });
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
onDismiss(e) {
|
||||
if (e && e.stopPropagation) e.stopPropagation();
|
||||
wx.showModal({
|
||||
title: '隐藏投诉入口',
|
||||
content: '隐藏后可在「我的 / 工单」中继续投诉。需要恢复时可清除小程序缓存。',
|
||||
confirmText: '不再显示',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
try {
|
||||
wx.setStorageSync(STORAGE_KEY, 1);
|
||||
} catch (err) {}
|
||||
this.setData({ hidden: true });
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
1
components/tousu-float/tousu-float.json
Normal file
1
components/tousu-float/tousu-float.json
Normal file
@@ -0,0 +1 @@
|
||||
{"component":true}
|
||||
6
components/tousu-float/tousu-float.wxml
Normal file
6
components/tousu-float/tousu-float.wxml
Normal file
@@ -0,0 +1,6 @@
|
||||
<view class="tousu-wrap" wx:if="{{!hidden}}">
|
||||
<view class="float" catchtap="go">投诉</view>
|
||||
<view class="dismiss-row" catchtap="onDismiss">
|
||||
<text class="dismiss-label">不再显示</text>
|
||||
</view>
|
||||
</view>
|
||||
37
components/tousu-float/tousu-float.wxss
Normal file
37
components/tousu-float/tousu-float.wxss
Normal file
@@ -0,0 +1,37 @@
|
||||
.tousu-wrap {
|
||||
position: fixed;
|
||||
right: 24rpx;
|
||||
bottom: 280rpx;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.float {
|
||||
min-width: 96rpx;
|
||||
height: 72rpx;
|
||||
padding: 0 22rpx;
|
||||
border-radius: 36rpx;
|
||||
background: rgba(55, 55, 55, 0.72);
|
||||
color: #f5f5f5;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
letter-spacing: 1rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.dismiss-row {
|
||||
padding: 4rpx 8rpx;
|
||||
}
|
||||
|
||||
.dismiss-label {
|
||||
font-size: 20rpx;
|
||||
color: rgba(120, 120, 120, 0.9);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 4rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user