feat: “我的”页面添加按钮点击事件

This commit is contained in:
chenwj 2023-06-07 11:06:10 +08:00
parent da14783edc
commit aa4e18e267
6 changed files with 42 additions and 12 deletions

View File

@ -1,4 +1,6 @@
// components/payroll-manage/index.js // components/payroll-manage/index.js
import Dialog from 'tdesign-miniprogram/dialog/index';
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
@ -18,16 +20,39 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
list: [
{ value: 'label_1', label: '首页', icon: 'home' },
{ value: 'label_2', label: '应用', icon: 'app' }
]
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
showDialog(e) {
const {value} = e.target.dataset;
let content;
if (value == "oa-shenpi" || value == "zhanghuyue") {
content = "您当前没有操作权限"
}else if(value == "baoxian" || value == "baoxianzhanghu") {
content = "未开通保险账号,请联系您的客户经理"
} else {
content = "功能升级中, 敬请期待"
}
const dialogConfig = {
context: this,
title: '提示',
content: content,
closeBtn: true,
cancelBtn: null,
closeOnOverlayClick: true,
confirmBtn:'确定'
};
Dialog.confirm(dialogConfig)
.then(() => {
console.log('点击确定');
})
.catch(() => {
console.log('点击取消');
});
},
} }
}) })

View File

@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"iconfont": "/iconfont/iconfont" "iconfont": "/iconfont/iconfont",
"t-dialog": "tdesign-miniprogram/dialog/dialog"
} }
} }

View File

@ -4,9 +4,10 @@
<view class="icon" > <view class="icon" >
<view wx:for="{{icons}}" wx:key="index" > <view wx:for="{{icons}}" wx:key="index" >
<view class="card-icon" style="background-color: {{item.color}}" > <view class="card-icon" style="background-color: {{item.color}}" >
<iconfont name="{{item.value}}" size="48" color="white" /> <iconfont name="{{item.value}}" size="48" color="white" bindtap="showDialog" data-value="{{item.value}}"/>
</view> </view>
<view class="card-name">{{item.name}}</view> <view class="card-name">{{item.name}}</view>
</view> </view>
<t-dialog id="t-dialog" />
</view> </view>
</view> </view>

View File

@ -8,7 +8,7 @@ Page({
iconsList1: [{ iconsList1: [{
value: 'oa-shenpi', value: 'oa-shenpi',
color: 'orange', color: 'orange',
name: 'OA审批' name: 'OA审批',
}, { }, {
value: 'zhifushezhi', value: 'zhifushezhi',
color: 'deepskyblue', color: 'deepskyblue',
@ -45,6 +45,7 @@ Page({
name: '保险账户' name: '保险账户'
}] }]
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载

View File

@ -1,5 +1,5 @@
<!--pages/my/my.wxml--> <!--pages/my/my.wxml-->
<view class="my"> <view class="my" style="padding-bottom: 25%;">
<view class="userinfo"> <view class="userinfo">
<view class="userinfo-avatar" bindtap="bindViewTap"> <view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data> <open-data type="userAvatarUrl"></open-data>
@ -14,5 +14,4 @@
<card cardName="风险管控" icons="{{iconsList3}}" /> <card cardName="风险管控" icons="{{iconsList3}}" />
<t-cell title="回到首页" hover arrow leftIcon="home" bordered="{{false}}" /> <t-cell title="回到首页" hover arrow leftIcon="home" bordered="{{false}}" />
<t-cell title="关于我们" hover arrow leftIcon="error-circle" bordered="{{false}}" /> <t-cell title="关于我们" hover arrow leftIcon="error-circle" bordered="{{false}}" />
</view> </view>

View File

@ -1,7 +1,10 @@
/* pages/my/my.wxss */ /* pages/my/my.wxss */
.my {
width: 100%
}
.userinfo { .userinfo {
display: flex; display: flex;
width: 100%;
flex-direction: row; flex-direction: row;
background-color: white; background-color: white;
} }