project init
This commit is contained in:
60
pages/settings/edit/index.js
Normal file
60
pages/settings/edit/index.js
Normal file
@@ -0,0 +1,60 @@
|
||||
import ActionSheet, { ActionSheetTheme } from '../../../miniprogram_npm/tdesign-miniprogram/action-sheet/index';
|
||||
let handler = null;
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
isAccount: 0,
|
||||
isIncome: 0,
|
||||
isAdd: 0,
|
||||
showDeleteConfirm: false,
|
||||
icon : null
|
||||
},
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
isAccount : options.isAccount,
|
||||
isIncome : options.isIncome,
|
||||
isAdd : options.isAdd
|
||||
})
|
||||
},
|
||||
handleMultiAction(e) {
|
||||
if (this.data.isAccount == 1) {
|
||||
handler = ActionSheet.show({
|
||||
theme: ActionSheetTheme.Grid,
|
||||
selector: '#t-action-sheet',
|
||||
context: this,
|
||||
items: app.globalData.accountIcon
|
||||
});
|
||||
}else {
|
||||
handler = ActionSheet.show({
|
||||
theme: ActionSheetTheme.Grid,
|
||||
selector: '#t-action-sheet',
|
||||
context: this,
|
||||
items: app.globalData.billIcon
|
||||
});
|
||||
}
|
||||
},
|
||||
onCancel(){
|
||||
handler.close();
|
||||
},
|
||||
handleSelected(e) {
|
||||
let {icon} = e.detail.selected
|
||||
this.setData({icon})
|
||||
},
|
||||
saveSetting () {
|
||||
wx.navigateBack();
|
||||
},
|
||||
deleteSetting() {
|
||||
this.setData({
|
||||
showDeleteConfirm: true
|
||||
})
|
||||
},
|
||||
onConfirm (e) {
|
||||
wx.navigateBack();
|
||||
this.closeDialog()
|
||||
},
|
||||
closeDialog() {
|
||||
this.setData({
|
||||
showDeleteConfirm: false
|
||||
})
|
||||
}
|
||||
});
|
||||
4
pages/settings/edit/index.json
Normal file
4
pages/settings/edit/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
||||
33
pages/settings/edit/index.wxml
Normal file
33
pages/settings/edit/index.wxml
Normal file
@@ -0,0 +1,33 @@
|
||||
<t-input
|
||||
label="名称"
|
||||
placeholder="请输入名称"
|
||||
align="right"
|
||||
bindchange="onPriceInput"
|
||||
value="{{ '假的名称' }}"
|
||||
/>
|
||||
<t-input wx:if="{{ isAccount == 1 }}" label="分类" disabled>
|
||||
<t-radio-group slot="suffix" default-value="0" borderless t-class="box">
|
||||
<t-radio block="{{ false }}" label="资产账户" value="0" />
|
||||
<t-radio block="{{ false }}" label="负债账户" value="1" />
|
||||
</t-radio-group>
|
||||
</t-input>
|
||||
<t-input label="图标" disabled >
|
||||
<t-icon wx:if="{{icon}}" name="{{icon}}" slot="suffix" size="32" bind:tap="handleMultiAction" />
|
||||
<text wx:else slot="suffix" class="t-color-input" bind:tap="handleMultiAction">{{'请选择图标'}}</text>
|
||||
</t-input>
|
||||
<view class="bottom_box">
|
||||
<view class="space_box">
|
||||
<t-button wx:if="{{ isAdd == 0 }}" bind:tap="deleteSetting" theme="danger" variant="outline" block >删除</t-button>
|
||||
<t-button bind:tap="saveSetting" theme="primary" variant="outline" block >保存</t-button>
|
||||
</view>
|
||||
</view>
|
||||
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" bind:cancel="onCancel"/>
|
||||
<t-dialog
|
||||
visible="{{showDeleteConfirm}}"
|
||||
title="确认删除?"
|
||||
confirm-btn="{{ { content: '确定', variant: 'base'} }}"
|
||||
cancel-btn="取消"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="closeDialog"
|
||||
>
|
||||
</t-dialog>
|
||||
16
pages/settings/edit/index.wxss
Normal file
16
pages/settings/edit/index.wxss
Normal file
@@ -0,0 +1,16 @@
|
||||
.bottom_box {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom:50rpx;
|
||||
}
|
||||
.space_box {
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
t-button {
|
||||
width: 100%;
|
||||
}
|
||||
.t-color-input {
|
||||
color: orange;
|
||||
}
|
||||
Reference in New Issue
Block a user