You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
4.2 KiB
195 lines
4.2 KiB
2 years ago
|
<template>
|
||
|
<view class="maboxbg" v-if="isshow" @click="checkbox(0)">
|
||
|
<view class="modtips" @click.stop="" v-if="tipstate==1">
|
||
|
<view class="title">
|
||
|
{{title||'提示'}}
|
||
|
</view>
|
||
|
<!-- <view class="contents">
|
||
|
{{content||'提示内容模板'}}
|
||
|
</view> -->
|
||
|
<view class="inputbx">
|
||
|
<input v-model="inputtext" :placeholder="placeholder" />
|
||
|
</view>
|
||
|
<view class="buts">
|
||
|
<view @click="checkbox(1)" v-if="isshowcancel" class="cancel">{{cancelTxt||'取消'}}</view>
|
||
|
<view @click="checkbox(2)" class="confirm">{{confirmTxt||'确认'}}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="modtips" @click.stop="" v-if="tipstate==2">
|
||
|
<view class="title">
|
||
|
{{title||'提示'}}
|
||
|
</view>
|
||
|
<!-- <view class="contents">
|
||
|
{{content||'提示内容模板'}}
|
||
|
</view> -->
|
||
|
<view class="listcheck">
|
||
|
<view @click="checkitem(index)" v-for="(item,index) in list">
|
||
|
<image :src="checklist.indexOf(index)==-1?'/static/nocheck.png':'/static/check.png'"></image>
|
||
|
<view>{{item}}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="buts">
|
||
|
<view @click="checkbox(1)" v-if="isshowcancel" class="cancel">{{cancelTxt||'取消'}}</view>
|
||
|
<view @click="checkbox(2)" class="confirm">{{confirmTxt||'确认'}}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts" setup>
|
||
|
import { tiplistType } from '@/interfaces/compoment/tiplist'
|
||
|
import { reactive,ref,toRefs } from "vue";
|
||
|
let details=reactive<tiplistType>({
|
||
|
tipstate:2,
|
||
|
title:'',
|
||
|
placeholder:'',
|
||
|
isshowcancel:true,
|
||
|
confirmTxt:'',
|
||
|
cancelTxt:'',
|
||
|
success:null,
|
||
|
cancel:null,
|
||
|
close:null,
|
||
|
isshow:false,
|
||
|
list:['12341131212'],
|
||
|
checklist:[],
|
||
|
inputtext:'',
|
||
|
isonecheck:false
|
||
|
})
|
||
|
function setdetails(objs:any){
|
||
|
for(let key in objs){
|
||
|
details[key]=objs[key]
|
||
|
}
|
||
|
}
|
||
|
function checkitem(index:number){
|
||
|
if(details.isonecheck){
|
||
|
if(details.checklist.indexOf(index)==-1){
|
||
|
details.checklist=[index]
|
||
|
}else{
|
||
|
details.checklist.splice(details.checklist.indexOf(index),1)
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
if(details.checklist.indexOf(index)==-1){
|
||
|
details.checklist.push(index)
|
||
|
}else{
|
||
|
details.checklist.splice(details.checklist.indexOf(index),1)
|
||
|
}
|
||
|
}
|
||
|
function checkbox(type:number){
|
||
|
switch (type){
|
||
|
case 0:
|
||
|
if(details.close){
|
||
|
details.close(details)
|
||
|
}
|
||
|
break;
|
||
|
case 1:
|
||
|
if(details.cancel){
|
||
|
details.cancel(details)
|
||
|
}
|
||
|
break;
|
||
|
case 2:
|
||
|
if(details.success){
|
||
|
details.success(details)
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
defineExpose({setdetails})
|
||
|
const { inputtext,checklist,list,isshow,tipstate,title,isshowcancel,placeholder,confirmTxt,cancelTxt }=toRefs(details)
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
.maboxbg{
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
position: fixed;
|
||
|
left: 0;
|
||
|
top: 0;
|
||
|
background-color: #00000050;
|
||
|
}
|
||
|
.modtips{
|
||
|
width: 630upx;
|
||
|
// height: 63upx;
|
||
|
background: #FFFFFF;
|
||
|
border-radius: 7upx;
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
align-items: center;
|
||
|
padding:40upx 20upx;
|
||
|
position: absolute;
|
||
|
left: 50%;
|
||
|
top: 50%;
|
||
|
transform: translateX(-50%) translateY(-50%);
|
||
|
box-sizing: border-box;
|
||
|
.title{
|
||
|
font-size: 34upx;
|
||
|
color: #092C4D;
|
||
|
}
|
||
|
.contents{
|
||
|
max-width: 480upx;
|
||
|
font-size: 29upx;
|
||
|
color:#90A0AF;
|
||
|
margin-top: 30upx;
|
||
|
}
|
||
|
.buts{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
margin-top: 40upx;
|
||
|
>view{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
width: 260upx;
|
||
|
height: 76upx;
|
||
|
border-radius: 7upx;
|
||
|
font-size: 28upx;
|
||
|
}
|
||
|
>.cancel{
|
||
|
background-color: #F5F5F6;
|
||
|
color: #5A6875;
|
||
|
margin-right: 20upx;
|
||
|
}
|
||
|
>.confirm{
|
||
|
background-color: #D3832A;
|
||
|
color: #FFFFFF;
|
||
|
}
|
||
|
}
|
||
|
.inputbx{
|
||
|
margin-top: 30upx;
|
||
|
margin-bottom: 10upx;
|
||
|
border: 1upx solid #092C4D20;
|
||
|
padding: 15upx 30upx;
|
||
|
padding-left: 20upx;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
box-sizing: border-box;
|
||
|
border-radius: 10upx;
|
||
|
font-size: 27upx;
|
||
|
color: #092C4D;
|
||
|
>input{
|
||
|
width: 390upx;
|
||
|
flex: 1;
|
||
|
}
|
||
|
}
|
||
|
.listcheck{
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
margin-top: 30upx;
|
||
|
>view{
|
||
|
width: 420upx;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: flex-start;
|
||
|
font-size: 28upx;
|
||
|
padding: 10upx 0;
|
||
|
>image{
|
||
|
width: 30upx;
|
||
|
height: 30upx;
|
||
|
margin-right: 15upx;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|