Browse Source

/deep/替换为::v-deep

master
1747191978@qq.com 2 months ago
parent
commit
f3d7fb909e
  1. 343
      大唐会议前台1/App.vue
  2. 365
      大唐会议前台1/pages/components/MeetingList.vue
  3. 263
      大唐会议前台1/pages/index/details.vue
  4. 261
      大唐会议前台1/pages/index/index.vue
  5. 519
      大唐会议前台1/pages/index/pdf.vue
  6. 503
      大唐会议前台1/pages/index/pdf平铺.vue
  7. 696
      大唐会议前台1/pages/user/login.vue
  8. 78
      大唐会议前台1/uni_modules/uview-ui/components/u-input/props.js
  9. 550
      大唐会议前台1/uni_modules/uview-ui/components/u-input/u-input.vue
  10. 54
      大唐会议前台1/uni_modules/uview-ui/components/u-textarea/props.js
  11. 318
      大唐会议前台1/uni_modules/uview-ui/components/u-textarea/u-textarea.vue

343
大唐会议前台1/App.vue

@ -1,213 +1,210 @@
<script> <script>
import { import { mapState, mapMutations } from 'vuex';
mapState, export default {
mapMutations data() {
} from 'vuex'; return {
export default { isAudio: true,
data() { };
return { },
isAudio: true, methods: {
}; ...mapMutations(['setTrainPath']),
}, },
methods: { mounted() {},
...mapMutations(['setTrainPath']), //
}, onLoad() {},
mounted() {}, onLaunch() {},
// };
onLoad() {},
onLaunch() {},
};
</script> </script>
<style lang="scss"> <style lang="scss">
/*每个页面公共css */ /*每个页面公共css */
@import '@/uni_modules/uview-ui/index.scss'; @import '@/uni_modules/uview-ui/index.scss';
@import 'common/demo.scss'; @import 'common/demo.scss';
uni-view, uni-view,
p, p,
span { span {
font-size: 16px; font-size: 16px;
}
::v-deep.u-modal {
background: #ffffff;
}
::v-deep.u-modal__content__text span {
font-size: 20px;
}
.avatarobx {
top: 16px;
right: 16px;
position: fixed;
display: flex;
align-items: center;
color: #fff;
.name {
font-size: 18px;
} }
/deep/.u-modal{ .view-out {
background: #ffffff; margin-right: 10px;
// border-bottom:1px solid #fff;
} }
/deep/.u-modal__content__text span{
font-size: 20px; .avatar {
border-radius: 6px;
width: 30px;
height: 30px;
margin-left: 18px;
} }
.avatarobx {
top: 16px; .out {
right: 16px; width: 30px;
position: fixed; height: 30px;
display: flex;
align-items: center;
color: #fff;
.name{
font-size: 18px;
}
.view-out {
margin-right: 10px;
// border-bottom:1px solid #fff;
}
.avatar {
border-radius: 6px;
width: 30px;
height: 30px;
margin-left: 18px;
}
.out {
width: 30px;
height: 30px
}
} }
}
.view-backimg {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
.view-backimg { .view-backimg-top {
position: fixed; height: 50vh;
top: 0; background-image: url('./imgs/bg-top.png');
bottom: 0; background-size: 100% 100%;
left: 0;
right: 0;
z-index: -1;
.view-backimg-top {
height: 50vh;
background-image: url('./imgs/bg-top.png');
background-size: 100% 100%;
}
.view-backimg-bottom {
height: 50vh;
background-image: url('./imgs/left.png');
background-size: 100% 100%;
}
} }
/deep/.u-toast__content__text--error, .view-backimg-bottom {
/deep/.u-toast__content__text--success { height: 50vh;
max-width: 500px !important; background-image: url('./imgs/left.png');
background-size: 100% 100%;
} }
.back{ }
width:40px;
::v-deep.u-toast__content__text--error,
::v-deep.u-toast__content__text--success {
max-width: 500px !important;
}
.back {
width: 40px;
position: fixed !important;
top: 16px;
left: 16px;
}
.logo {
width: 500px;
position: fixed !important; position: fixed !important;
top: 16px; top: 16px;
left: 16px; left: 16px;
} }
.logo {
width: 500px;
position: fixed !important;
top:16px;
left: 16px;
}
// //
.statusGray { .statusGray {
color: #c0c4cc; color: #c0c4cc;
} }
.statusGreen { .statusGreen {
color: #10b884; color: #10b884;
} }
.statusRed { .statusRed {
color: red; color: red;
} }
.view-none { .view-none {
width: 100%; width: 100%;
font-size: 16px !important; font-size: 16px !important;
line-height: 50px; line-height: 50px;
color: #909399; color: #909399;
text-align: center; text-align: center;
} }
/deep/.uni-pagination__num-tag { ::v-deep.uni-pagination__num-tag {
width: 30px !important; width: 30px !important;
min-width: 30px !important; min-width: 30px !important;
height: 30px !important; height: 30px !important;
font-size: 16px !important; font-size: 16px !important;
} }
.width-60 { .width-60 {
min-width: 60px !important; min-width: 60px !important;
} }
.width-100 { .width-100 {
min-width: 100px !important; min-width: 100px !important;
} }
.width-160 { .width-160 {
min-width: 160px !important; min-width: 160px !important;
} }
.width-250 { .width-250 {
min-width: 250px !important; min-width: 250px !important;
} }
.uni-select__input-box, .uni-select__input-box,
.uni-select { .uni-select {
height: 40px !important; height: 40px !important;
} }
.uni-select { .uni-select {
font-size: 16px !important; font-size: 16px !important;
} }
.uni-select__input-placeholder { .uni-select__input-placeholder {
font-size: 16px !important; font-size: 16px !important;
} }
.uni-input-input, .uni-input-input,
uni-input { uni-input {
border-radius: 5px; border-radius: 5px;
height: 38px !important; height: 38px !important;
font-size: 16px !important; font-size: 16px !important;
} }
uni-input { uni-input {
padding: 0 10px; padding: 0 10px;
} }
.uni-icons { .uni-icons {
font-size: 24px !important; font-size: 24px !important;
} }
.u-popup__content { .u-popup__content {
background-color: rgba(0, 0, 0, 0) !important; background-color: rgba(0, 0, 0, 0) !important;
} }
.uni-input-placeholder { .uni-input-placeholder {
font-size: 16px; font-size: 16px;
line-height: 40px; line-height: 40px;
} }
.u-input--square { .u-input--square {
height: 28px !important; height: 28px !important;
padding: 6px 9px !important; padding: 6px 9px !important;
} }
.u-input__content__field-wrapper__field { .u-input__content__field-wrapper__field {
font-size: 16px !important; font-size: 16px !important;
} }
uni-video { uni-video {
width: 100% !important; width: 100% !important;
height: 100% !important; height: 100% !important;
} }
.u-toast { .u-toast {
font-size: 30px !important; font-size: 30px !important;
} }
// //
.u-picker { .u-picker {
background: #fff; background: #fff;
} }
.u-toolbar__wrapper__cancel, .u-toolbar__wrapper__cancel,
.u-toolbar__wrapper__confirm, .u-toolbar__wrapper__confirm,
.u-toolbar__title { .u-toolbar__title {
font-size: 26px !important; font-size: 26px !important;
} }
</style> </style>

365
大唐会议前台1/pages/components/MeetingList.vue

@ -2,235 +2,258 @@
<view> <view>
<view class="view-li" v-for="(item, index) in infos" :key="index"> <view class="view-li" v-for="(item, index) in infos" :key="index">
<view class="li-item" v-if="item.type == 'title'"> <view class="li-item" v-if="item.type == 'title'">
<view class="li-title">{{item.title}}</view> <view class="li-title">{{ item.title }}</view>
</view> </view>
<view class="li-item " v-if="item.type == 'file-pdf'"> <view class="li-item" v-if="item.type == 'file-pdf'">
<view class="li-pdf" @click="handlePdf(item)"> {{item.filePdfName}} <view class="li-pdf" @click="handlePdf(item)">
<span style="color:blue"> 预览</span> {{ item.filePdfName }}
<span style="color: blue"> 预览</span>
</view> </view>
</view> </view>
<view class="li-item" v-if="item.type == 'richtext'"> <view class="li-item" v-if="item.type == 'richtext'">
<view class="li-text">{{item.richtext}}</view> <view class="li-text">{{ item.richtext }}</view>
</view> </view>
<view class="view-ul" v-if="item.infos && item.infos.length"> <view class="view-ul" v-if="item.infos && item.infos.length">
<MeetingList :detailsId='detailsId' :infos='item.infos'></MeetingList> <MeetingList
:detailsId="detailsId"
:infos="item.infos"
></MeetingList>
</view> </view>
</view> </view>
<u-popup :show="show" @close="handleClose" mode="center"> <u-popup :show="show" @close="handleClose" mode="center">
<view class="popup-close" @click='handleClose'> <view class="popup-close" @click="handleClose">
<uni-icons class="popup-icons" type="closeempty" size="30"></uni-icons> <uni-icons
class="popup-icons"
type="closeempty"
size="30"
></uni-icons>
</view> </view>
<view class="popup-box"> <view class="popup-box">
<view class="view-pdf"> <view class="view-pdf">
<pdf v-if='show' ref="pdf" :page="pageNum" @progress="loadedRatio = $event" <pdf
@page-loaded="pageLoaded($event)" @num-pages="pageTotalNum=$event" @error="pdfError($event)" v-if="show"
@link-clicked="page = $event" :src="filePdfUrl"> ref="pdf"
:page="pageNum"
@progress="loadedRatio = $event"
@page-loaded="pageLoaded($event)"
@num-pages="pageTotalNum = $event"
@error="pdfError($event)"
@link-clicked="page = $event"
:src="filePdfUrl"
>
</pdf> </pdf>
<div class="tools"> <div class="tools">
<button :theme="'default'" type="submit" @click.stop="prePage" class="mr10"> <button
:theme="'default'"
type="submit"
@click.stop="prePage"
class="mr10"
>
上一页 上一页
</button> </button>
<div class="page">{{pageNum}}/{{pageTotalNum}}</div> <div class="page">{{ pageNum }}/{{ pageTotalNum }}</div>
<button :theme="'default'" type="submit" @click.stop="nextPage" class="mr10"> <button
:theme="'default'"
type="submit"
@click.stop="nextPage"
class="mr10"
>
下一页 下一页
</button> </button>
</div> </div>
</view> </view>
</view> </view>
</u-popup> </u-popup>
</view> </view>
</template> </template>
<script> <script>
import pdf from 'vue-pdf' import pdf from 'vue-pdf';
export default { export default {
name: 'MeetingList', name: 'MeetingList',
props: ['infos','detailsId'], props: ['infos', 'detailsId'],
components: { components: {
pdf pdf,
},
data() {
return {
show: false,
filePdfUrl: '',
pageNum: 1,
pageTotalNum: 1,
//
loadedRatio: 0,
curPageNum: 0,
pdfId: '',
};
},
onShow() {
console.log('infos', infos);
},
methods: {
//
handleClose() {
this.pdfId = '';
this.show = false;
},
//
prePage() {
var page = this.pageNum;
page = page > 1 ? page - 1 : this.pageTotalNum;
this.pageNum = page;
},
//
nextPage() {
var page = this.pageNum;
page = page < this.pageTotalNum ? page + 1 : 1;
this.pageNum = page;
}, },
data() { // e
return { pageLoaded(e) {
show: false, this.curPageNum = e;
filePdfUrl: "",
pageNum: 1,
pageTotalNum: 1,
//
loadedRatio: 0,
curPageNum: 0,
pdfId: '',
};
}, },
onShow() { //
console.log('infos', infos) pdfError(error) {
console.error(error);
}, },
methods: { // pdf
handlePdf(_item) {
// // this.filePdfUrl = _item.filePdfUrl
handleClose() { // this.show = true
this.pdfId = '' uni.navigateTo({
this.show = false url: `/pages/index/pdf?filePdfUrl=${_item.filePdfUrl}&detailsId=${this.detailsId}`,
}, });
//
prePage() {
var page = this.pageNum
page = page > 1 ? page - 1 : this.pageTotalNum
this.pageNum = page
},
//
nextPage() {
var page = this.pageNum
page = page < this.pageTotalNum ? page + 1 : 1
this.pageNum = page
},
// e
pageLoaded(e) {
this.curPageNum = e
},
//
pdfError(error) {
console.error(error)
},
// pdf
handlePdf(_item) {
// this.filePdfUrl = _item.filePdfUrl
// this.show = true
uni.navigateTo({
url: `/pages/index/pdf?filePdfUrl=${_item.filePdfUrl}&detailsId=${this.detailsId}`,
});
},
}, },
// },
onLoad() {}, //
}; onLoad() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.popup-close { .popup-close {
position: fixed; position: fixed;
right: 20px; right: 20px;
top: 20px; top: 20px;
z-index: 9999; z-index: 9999;
/deep/.uni-icons { ::v-deep.uni-icons {
font-size: 40px !important; font-size: 40px !important;
color: #fff !important; color: #fff !important;
}
} }
}
/deep/.u-popup__content{ ::v-deep.u-popup__content {
position: relative; position: relative;
.tools { .tools {
position: absolute; position: absolute;
left:10px; left: 10px;
right:10px; right: 10px;
bottom:0px; bottom: 0px;
background:#fff; background: #fff;
padding-top:10px; padding-top: 10px;
padding-bottom:10px; padding-bottom: 10px;
} }
} }
.popup-box { .popup-box {
max-height: 80vh; max-height: 80vh;
overflow: auto; overflow: auto;
} }
.view-gb { .view-gb {
max-width: 100px; max-width: 100px;
margin-left: 16px; margin-left: 16px;
} }
.view-li { .view-li {
// padding-left: 10px; // padding-left: 10px;
} }
.view-pdf { .view-pdf {
width: 50vw; width: 50vw;
padding: 16px 16px 50px 16px; padding: 16px 16px 50px 16px;
border: 1px solid #ededed; border: 1px solid #ededed;
background: #fff; background: #fff;
.tools { .tools {
display: flex; display: flex;
uni-button {
font-size: 18px;
line-height: 44px;
height: 44px;
flex: 1
}
.page {
line-height: 44px;
height: 44px;
width: 100px;
text-align: center;
}
}
}
.pathsName { uni-button {
color: #fff; font-size: 18px;
font-size: 12px; line-height: 44px;
} height: 44px;
flex: 1;
}
.pdfBox .el-button { .page {
background: rgba(255, 255, 255, 0); line-height: 44px;
border: none; height: 44px;
/* width: 30px; */ width: 100px;
text-align: center;
}
} }
}
.pdfBox>>>.el-icon-arrow-left, .pathsName {
.pdfBox>>>.el-icon-arrow-right { color: #fff;
font-size: 18px; font-size: 12px;
color: #000; }
}
.pdfBox .page { .pdfBox .el-button {
margin: 0 10px; background: rgba(255, 255, 255, 0);
} border: none;
/* width: 30px; */
}
.pdfBox .el-button-group { .pdfBox >>> .el-icon-arrow-left,
width: 100%; .pdfBox >>> .el-icon-arrow-right {
justify-content: center; font-size: 18px;
display: flex; color: #000;
align-items: center; }
padding-top: 20px;
}
.pdfBox { .pdfBox .page {
padding-bottom: 20px; margin: 0 10px;
margin-top: 20px; }
background: #fff;
min-height: 300px;
}
.contLeft-pane>>>.el-form-item__label { .pdfBox .el-button-group {
text-align: right; width: 100%;
margin-right: 10px !important; justify-content: center;
padding: 0 !important; display: flex;
} align-items: center;
padding-top: 20px;
}
.contLeft-pane>>>.el-form-item--medium .el-form-item__content { .pdfBox {
flex: 1; padding-bottom: 20px;
} margin-top: 20px;
background: #fff;
min-height: 300px;
}
.li-item { .contLeft-pane >>> .el-form-item__label {
uni-view { text-align: right;
font-size: 20px; margin-right: 10px !important;
line-height: 40px; padding: 0 !important;
span{ }
font-size: 20px;
}
}
.contLeft-pane >>> .el-form-item--medium .el-form-item__content {
flex: 1;
}
.li-title { .li-item {
uni-view {
font-size: 20px;
line-height: 40px;
span {
font-size: 20px; font-size: 20px;
font-weight: bold;
line-height: 30px;
} }
} }
.li-title {
font-size: 20px;
font-weight: bold;
line-height: 30px;
}
}
</style> </style>
<style></style> <style></style>

263
大唐会议前台1/pages/index/details.vue

@ -1,19 +1,34 @@
<template> <template>
<view class="box"> <view class="box">
<!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> --> <!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> -->
<image class="logo" src='../../imgs/logo.png' alt="" mode="widthFix" ></image> <image
class="logo"
src="../../imgs/logo.png"
alt=""
mode="widthFix"
></image>
<view class="box-cent"> <view class="box-cent">
<view class="box-cent1"> <view class="box-cent1">
<view class="view-box"> <view class="view-box">
<view style="text-align: center;"> <view style="text-align: center">
<span class="view-title"> {{listData.title}}</span> <span class="view-title"> {{ listData.title }}</span>
</view> </view>
<view class="view-ul"> <view class="view-ul">
<MeetingList :detailsId='detailsId' :infos='listData.infos'></MeetingList> <MeetingList
:detailsId="detailsId"
:infos="listData.infos"
></MeetingList>
</view> </view>
</view> </view>
</view> </view>
<u-modal v-if="show" :show="show" @cancel="show = false" :showCancelButton="true" content='是否确认退出登录?' @confirm="handleOut"></u-modal> <u-modal
v-if="show"
:show="show"
@cancel="show = false"
:showCancelButton="true"
content="是否确认退出登录?"
@confirm="handleOut"
></u-modal>
</view> </view>
<!-- 底部背景图 --> <!-- 底部背景图 -->
<view class="view-backimg"> <view class="view-backimg">
@ -22,145 +37,145 @@
</view> </view>
<!-- 头像 - 头像 --> <!-- 头像 - 头像 -->
<view class="avatarobx"> <view class="avatarobx">
<view class="name">{{userName}}</view> <view class="name">{{ userName }}</view>
<image @click='handleBack' class="avatar" src='../../imgs/arrow-left.png' mode="widthFix"></image> <image
<image @click="show = true" class="avatar" src='../../imgs/out.png' mode="widthFix"></image> @click="handleBack"
class="avatar"
src="../../imgs/arrow-left.png"
mode="widthFix"
></image>
<image
@click="show = true"
class="avatar"
src="../../imgs/out.png"
mode="widthFix"
></image>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { import { queryMeeting, meetingDetails } from '@/common/api';
queryMeeting, import { mapMutations } from 'vuex';
meetingDetails import MeetingList from '../components/MeetingList.vue';
} from "@/common/api";
import {
mapMutations
} from 'vuex';
import MeetingList from "../components/MeetingList.vue"
export default { export default {
components: { components: {
MeetingList MeetingList,
},
data() {
return {
listData: [],
data: [],
userName: uni.getStorageSync('userName'),
show: false,
detailsId: '',
};
},
created() {
let routes = getCurrentPages(); //
let curParam = routes[routes.length - 1].options; //
this.detailsId = curParam.id;
console.log('curParam', this.detailsId);
this.getMeetingDetails(curParam.id); //
},
methods: {
// 退
handleOut() {
uni.clearStorage();
uni.reLaunch({
url: '/pages/user/login',
});
}, },
data() { // logo
return { handleBack() {
listData: [], uni.navigateTo({
data: [], url: `/pages/index/index`,
userName: uni.getStorageSync("userName"), });
show: false, // uni.navigateBack({
detailsId:'', // delta: 1
}; // });
}, },
//
created() { handleItemClaick(_item) {
let routes = getCurrentPages(); // // enable false
let curParam = routes[routes.length - 1].options; // if (!_item.enable) return;
this.detailsId = curParam.id uni.navigateTo({
console.log('curParam', this.detailsId) url: `/pages/index/details?id=${_item.id}`,
this.getMeetingDetails(curParam.id) // });
}, },
methods: { //
// 退 async getMeetingDetails(meetingId) {
handleOut(){ const res = await meetingDetails({
uni.clearStorage(); param: {
uni.reLaunch({ meetingId,
url: '/pages/user/login', },
}); });
}, const { code, data, msg } = res;
// logo if (code === 200) {
handleBack() { this.listData = data;
uni.navigateTo({ console.log(this.listData);
url: `/pages/index/index`, }
});
// uni.navigateBack({
// delta: 1
// });
},
//
handleItemClaick(_item) {
// enable false
if (!_item.enable) return
uni.navigateTo({
url: `/pages/index/details?id=${_item.id}`,
});
},
//
async getMeetingDetails(meetingId) {
const res = await meetingDetails({
param: {
meetingId,
}
});
const {
code,
data,
msg
} = res;
if (code === 200) {
this.listData = data
console.log(this.listData)
}
},
}, },
// },
onLoad() {}, //
}; onLoad() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .u-modal__content{ ::v-deep .u-modal__content {
text-align: center; text-align: center;
} }
.avatar{ .avatar {
} }
.view-box { .view-box {
margin-top: 50px; margin-top: 50px;
} }
.view-ul {
text-align: left;
margin-bottom: 16px;
.view-li { .view-ul {
font-size: 18px; text-align: left;
line-height: 26px; margin-bottom: 16px;
} .view-li {
font-size: 18px;
line-height: 26px;
} }
}
.view-title { .view-title {
display: inline-block; display: inline-block;
border: 1px solid #000; border: 1px solid #000;
padding: 0 14px; padding: 0 14px;
margin-bottom: 30px; margin-bottom: 30px;
line-height: 50px; line-height: 50px;
border-radius: 6px; border-radius: 6px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
} }
.box { .box {
height: 100vh; height: 100vh;
box-sizing: border-box; box-sizing: border-box;
padding: 20px 100px; padding: 20px 100px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.box-cent { .box-cent {
flex: 1; flex: 1;
margin-top: 70px; margin-top: 70px;
position: relative; position: relative;
} }
.box-cent1 { .box-cent1 {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
overflow: auto; overflow: auto;
}
} }
}
</style> </style>
<style></style> <style></style>

261
大唐会议前台1/pages/index/index.vue

@ -1,23 +1,41 @@
<template> <template>
<view class="box"> <view class="box">
<!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click='handleBack'></image> --> <!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click='handleBack'></image> -->
<image class="logo" src='../../imgs/logo.png' mode="widthFix" ></image> <image class="logo" src="../../imgs/logo.png" mode="widthFix"></image>
<view class="box-cent"> <view class="box-cent">
<view class="box-cent1"> <view class="box-cent1">
<view class="view-box" v-for="(item, index) in listData" :key="index"> <view
<view style="text-align: center;"> class="view-box"
<span class="view-title"> {{item.dateTitle}}</span> v-for="(item, index) in listData"
:key="index"
>
<view style="text-align: center">
<span class="view-title"> {{ item.dateTitle }}</span>
</view> </view>
<view class="view-ul"> <view class="view-ul">
<view class="view-li" v-for="(row, rind) in item.meetingList" :key="rind" <view
class="view-li"
v-for="(row, rind) in item.meetingList"
:key="rind"
>
<span @click="handleItemClaick(item, row)"
>{{ rind + 1 }}. {{ row.title }}</span
> >
<span @click="handleItemClaick(item,row)">{{rind + 1}}. {{row.title}}</span>
</view> </view>
</view> </view>
</view> </view>
<view v-if="!listData.length" class="view-none"> 暂无会议 </view> <view v-if="!listData.length" class="view-none">
暂无会议
</view>
</view> </view>
<u-modal v-if="show" :show="show" @cancel="show = false" :showCancelButton="true" content='是否确认退出登录?' @confirm="handleOut"></u-modal> <u-modal
v-if="show"
:show="show"
@cancel="show = false"
:showCancelButton="true"
content="是否确认退出登录?"
@confirm="handleOut"
></u-modal>
</view> </view>
<!-- 底部背景图 --> <!-- 底部背景图 -->
<view class="view-backimg"> <view class="view-backimg">
@ -26,144 +44,137 @@
</view> </view>
<!-- 头像 - 头像 --> <!-- 头像 - 头像 -->
<view class="avatarobx"> <view class="avatarobx">
<view class="name">{{userName}}</view> <view class="name">{{ userName }}</view>
<!-- <image @click='handleBack' class="avatar" src='../../imgs/arrow-left.png' mode="widthFix"></image> --> <!-- <image @click='handleBack' class="avatar" src='../../imgs/arrow-left.png' mode="widthFix"></image> -->
<image @click="show = true" class="avatar" src='../../imgs/out.png' mode="widthFix"></image> <image
@click="show = true"
class="avatar"
src="../../imgs/out.png"
mode="widthFix"
></image>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { import { queryMeeting, meetingDetails } from '@/common/api';
queryMeeting, import { mapMutations } from 'vuex';
meetingDetails export default {
} from "@/common/api"; data() {
import { return {
mapMutations listData: [],
} from 'vuex'; userName: uni.getStorageSync('userName'),
export default { show: false,
data() { };
return { },
listData: [], created() {
userName: uni.getStorageSync("userName"), this.getQueryMeeting(); //
show: false },
}; onShow() {
this.userName = uni.getStorageSync('userName');
console.log('this.userName', this.userName);
},
methods: {
// logo
handleBack() {
uni.navigateTo({
url: `/pages/user/login`,
});
// uni.navigateBack({
// delta: 1
// });
}, },
created() { // 退
this.getQueryMeeting() // handleOut() {
uni.clearStorage();
uni.reLaunch({
url: '/pages/user/login',
});
}, },
onShow(){ //
this.userName = uni.getStorageSync("userName") handleItemClaick(_item, _row) {
console.log('this.userName',this.userName) // enable false
if (!_item.enable) return;
uni.navigateTo({
url: `/pages/index/details?id=${_row.id}`,
});
}, },
methods: { //
// logo async getQueryMeeting() {
handleBack() { const res = await queryMeeting({
uni.navigateTo({ param: {},
url: `/pages/user/login`, });
}); const { code, data, msg } = res;
// uni.navigateBack({ if (code === 200) {
// delta: 1 this.listData = data;
// }); }
},
// 退
handleOut(){
uni.clearStorage();
uni.reLaunch({
url: '/pages/user/login',
});
},
//
handleItemClaick(_item, _row) {
// enable false
if (!_item.enable) return
uni.navigateTo({
url: `/pages/index/details?id=${_row.id}`,
});
},
//
async getQueryMeeting() {
const res = await queryMeeting({
param: {}
});
const {
code,
data,
msg
} = res;
if (code === 200) {
this.listData = data
}
},
}, },
// },
onLoad() {}, //
}; onLoad() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .u-modal__content {
text-align: center;
}
.view-box {
margin-top: 50px;
}
/deep/ .u-modal__content{ .view-none {
text-align: center; height: 100%;
} display: flex;
.view-box{ justify-content: center;
margin-top:50px ; align-items: center;
} font-size: 40px !important;
}
.view-none{ .view-ul {
height: 100%; text-align: left;
display: flex; margin-bottom: 16px;
justify-content: center;
align-items: center;
font-size: 40px !important;
}
.view-ul {
text-align: left;
margin-bottom: 16px;
.view-li {
span{
font-size: 20px;
line-height: 40px;
}
.view-li {
span {
font-size: 20px;
line-height: 40px;
} }
} }
}
.view-title { .view-title {
display: inline-block; display: inline-block;
border: 1px solid #000; border: 1px solid #000;
padding: 0 14px; padding: 0 14px;
margin-bottom: 30px; margin-bottom: 30px;
line-height: 50px; line-height: 50px;
border-radius: 6px; border-radius: 6px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
} }
.box { .box {
height: 100vh; height: 100vh;
background-size: cover; background-size: cover;
box-sizing: border-box; box-sizing: border-box;
padding: 20px 100px; padding: 20px 100px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.box-cent { .box-cent {
flex: 1; flex: 1;
margin-top: 70px; margin-top: 70px;
position: relative; position: relative;
} }
.box-cent1 { .box-cent1 {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
overflow: auto; overflow: auto;
}
} }
}
</style> </style>
<style></style> <style></style>

519
大唐会议前台1/pages/index/pdf.vue

@ -1,17 +1,31 @@
<template> <template>
<view class="box" style="position: relative;"> <view class="box" style="position: relative">
<!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> --> <!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> -->
<image class="logo" src='../../imgs/logo.png' mode="widthFix" ></image> <image class="logo" src="../../imgs/logo.png" mode="widthFix"></image>
<view class="box-cent"> <view class="box-cent">
<view class="box-cent1"> <view class="box-cent1">
<view class="view-pdf"> <view class="view-pdf">
<pdf ref="pdf" :page="pageNum" @progress="loadedRatio = $event" @page-loaded="pageLoaded($event)" <pdf
@num-pages="pageTotalNum=$event" @error="pdfError($event)" @link-clicked="page = $event" ref="pdf"
:src="filePdfUrl"> :page="pageNum"
@progress="loadedRatio = $event"
@page-loaded="pageLoaded($event)"
@num-pages="pageTotalNum = $event"
@error="pdfError($event)"
@link-clicked="page = $event"
:src="filePdfUrl"
>
</pdf> </pdf>
</view> </view>
</view> </view>
<u-modal v-if="show" :show="show" @cancel="show = false" :showCancelButton="true" content='是否确认退出登录?' @confirm="handleOut"></u-modal> <u-modal
v-if="show"
:show="show"
@cancel="show = false"
:showCancelButton="true"
content="是否确认退出登录?"
@confirm="handleOut"
></u-modal>
</view> </view>
<!-- 底部背景图 --> <!-- 底部背景图 -->
<view class="view-backimg"> <view class="view-backimg">
@ -19,284 +33,301 @@
<!-- <view class="view-backimg-bottom"></view> --> <!-- <view class="view-backimg-bottom"></view> -->
</view> </view>
<div class="tools"> <div class="tools">
<view style="width:50vw;display: flex;margin: auto;"> <view style="width: 50vw; display: flex; margin: auto">
<button :theme="'default'" type="submit" @click.stop="prePage" class="mr10"> <button
:theme="'default'"
type="submit"
@click.stop="prePage"
class="mr10"
>
上一页 上一页
</button> </button>
<div class="page">{{pageNum}}/{{pageTotalNum}}</div> <div class="page">{{ pageNum }}/{{ pageTotalNum }}</div>
<button :theme="'default'" type="submit" @click.stop="nextPage" class="mr10"> <button
:theme="'default'"
type="submit"
@click.stop="nextPage"
class="mr10"
>
下一页 下一页
</button> </button>
</view> </view>
</div> </div>
<!-- 头像 - 头像 --> <!-- 头像 - 头像 -->
<view class="avatarobx"> <view class="avatarobx">
<view class="name">{{userName}}</view> <view class="name">{{ userName }}</view>
<image @click='handleBack' class="avatar" src='../../imgs/arrow-left.png' mode="widthFix"></image> <image
<image @click="show = true" class="avatar" src='../../imgs/out.png' mode="widthFix"></image> @click="handleBack"
class="avatar"
src="../../imgs/arrow-left.png"
mode="widthFix"
></image>
<image
@click="show = true"
class="avatar"
src="../../imgs/out.png"
mode="widthFix"
></image>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import pdf from 'vue-pdf' import pdf from 'vue-pdf';
export default { export default {
name: 'MeetingList', name: 'MeetingList',
props: ['infos'], props: ['infos'],
components: { components: {
pdf pdf,
},
data() {
return {
pageNum: 1,
pageTotalNum: 1,
//
loadedRatio: 0,
curPageNum: 0,
filePdfUrl: '',
userName: uni.getStorageSync('userName'),
show: false,
detailsId: '',
};
},
created() {
let routes = getCurrentPages(); //
let curParam = routes[routes.length - 1].options; //
this.detailsId = curParam.detailsId;
console.log('this.detailsId ', this.detailsId);
this.filePdfUrl = curParam.filePdfUrl;
},
methods: {
// logo
handleBack() {
uni.navigateTo({
url: `/pages/index/details?id=${this.detailsId}`,
});
// uni.navigateBack({
// delta: 1
// });
}, },
data() { // 退
return { handleOut() {
pageNum: 1, uni.clearStorage();
pageTotalNum: 1, uni.reLaunch({
// url: '/pages/user/login',
loadedRatio: 0, });
curPageNum: 0,
filePdfUrl: '',
userName: uni.getStorageSync("userName"),
show: false,
detailsId:'',
};
}, },
created() { // logo
let routes = getCurrentPages(); // handleLogo() {
let curParam = routes[routes.length - 1].options; // uni.navigateTo({
this.detailsId = curParam.detailsId url: `/pages/index/index`,
console.log('this.detailsId ',this.detailsId) });
this.filePdfUrl = curParam.filePdfUrl
}, },
methods: {
// logo
handleBack() {
uni.navigateTo({
url: `/pages/index/details?id=${this.detailsId}`,
});
// uni.navigateBack({
// delta: 1
// });
},
// 退
handleOut() {
uni.clearStorage();
uni.reLaunch({
url: '/pages/user/login',
});
},
// logo
handleLogo() {
uni.navigateTo({
url: `/pages/index/index`,
});
},
// //
handleClose() { handleClose() {
this.pdfId = '' this.pdfId = '';
this.show = false this.show = false;
},
//
prePage() {
var page = this.pageNum
page = page > 1 ? page - 1 : this.pageTotalNum
this.pageNum = page
},
//
nextPage() {
var page = this.pageNum
page = page < this.pageTotalNum ? page + 1 : 1
this.pageNum = page
},
// e
pageLoaded(e) {
this.curPageNum = e
},
//
pdfError(error) {
console.error(error)
},
}, },
// //
onLoad() {}, prePage() {
}; var page = this.pageNum;
page = page > 1 ? page - 1 : this.pageTotalNum;
this.pageNum = page;
},
//
nextPage() {
var page = this.pageNum;
page = page < this.pageTotalNum ? page + 1 : 1;
this.pageNum = page;
},
// e
pageLoaded(e) {
this.curPageNum = e;
},
//
pdfError(error) {
console.error(error);
},
},
//
onLoad() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .u-modal__content{ ::v-deep .u-modal__content {
text-align: center; text-align: center;
} }
.popup-close { .popup-close {
position: fixed; position: fixed;
right: 20px; right: 20px;
top: 20px; top: 20px;
z-index: 9999; z-index: 9999;
/deep/.uni-icons { ::v-deep.uni-icons {
font-size: 40px !important; font-size: 40px !important;
color: #fff !important; color: #fff !important;
}
}
.view-gb {
max-width: 100px;
margin-left: 16px;
}
.view-li {
// padding-left: 10px;
}
.view-pdf {
width: 60vw;
margin: auto;
}
.tools {
display: flex;
align-items: center;
position: absolute;
bottom: 26px;
left:16px;
right:16px;
uni-button {
font-size: 18px;
line-height: 44px;
height: 44px;
flex: 1
}
.page {
line-height: 44px;
height: 44px;
width: 100px;
text-align: center;
}
}
.pathsName {
color: #fff;
font-size: 12px;
}
.pdfBox .el-button {
background: rgba(255, 255, 255, 0);
border: none;
/* width: 30px; */
} }
}
.pdfBox>>>.el-icon-arrow-left,
.pdfBox>>>.el-icon-arrow-right { .view-gb {
max-width: 100px;
margin-left: 16px;
}
.view-li {
// padding-left: 10px;
}
.view-pdf {
width: 60vw;
margin: auto;
}
.tools {
display: flex;
align-items: center;
position: absolute;
bottom: 26px;
left: 16px;
right: 16px;
uni-button {
font-size: 18px; font-size: 18px;
color: #000; line-height: 44px;
} height: 44px;
.pdfBox .page {
margin: 0 10px;
}
.pdfBox .el-button-group {
width: 100%;
justify-content: center;
display: flex;
align-items: center;
padding-top: 20px;
}
.pdfBox {
padding-bottom: 20px;
margin-top: 20px;
background: #fff;
min-height: 300px;
}
.contLeft-pane>>>.el-form-item__label {
text-align: right;
margin-right: 10px !important;
padding: 0 !important;
}
.contLeft-pane>>>.el-form-item--medium .el-form-item__content {
flex: 1; flex: 1;
} }
.li-item { .page {
uni-view { line-height: 44px;
font-size: 20px; height: 44px;
line-height: 40px; width: 100px;
text-align: center;
span { }
font-size: 20px; }
}
} .pathsName {
color: #fff;
font-size: 12px;
}
.pdfBox .el-button {
background: rgba(255, 255, 255, 0);
border: none;
/* width: 30px; */
}
.pdfBox >>> .el-icon-arrow-left,
.pdfBox >>> .el-icon-arrow-right {
font-size: 18px;
color: #000;
}
.pdfBox .page {
margin: 0 10px;
}
.pdfBox .el-button-group {
width: 100%;
justify-content: center;
display: flex;
align-items: center;
padding-top: 20px;
}
.pdfBox {
padding-bottom: 20px;
margin-top: 20px;
background: #fff;
min-height: 300px;
}
.contLeft-pane >>> .el-form-item__label {
text-align: right;
margin-right: 10px !important;
padding: 0 !important;
}
.contLeft-pane >>> .el-form-item--medium .el-form-item__content {
flex: 1;
}
.li-item {
uni-view {
font-size: 20px;
line-height: 40px;
.li-title { span {
font-size: 20px; font-size: 20px;
font-weight: bold;
line-height: 30px;
} }
} }
.view-box { .li-title {
margin-top: 50px; font-size: 20px;
font-weight: bold;
line-height: 30px;
} }
}
.view-none { .view-box {
height: 100%; margin-top: 50px;
display: flex; }
justify-content: center;
align-items: center;
font-size: 40px !important;
}
.view-ul { .view-none {
text-align: left; height: 100%;
margin-bottom: 16px; display: flex;
justify-content: center;
align-items: center;
font-size: 40px !important;
}
.view-li { .view-ul {
span { text-align: left;
font-size: 20px; margin-bottom: 16px;
line-height: 40px;
}
.view-li {
span {
font-size: 20px;
line-height: 40px;
} }
} }
}
.view-title {
display: inline-block; .view-title {
border: 1px solid #000; display: inline-block;
padding: 0 14px; border: 1px solid #000;
margin-bottom: 30px; padding: 0 14px;
line-height: 50px; margin-bottom: 30px;
border-radius: 6px; line-height: 50px;
font-size: 20px; border-radius: 6px;
font-weight: bold; font-size: 20px;
font-weight: bold;
}
.box {
height: 100vh;
background-size: cover;
box-sizing: border-box;
padding: 20px 100px;
display: flex;
flex-direction: column;
.box-cent {
flex: 1;
margin-top: 70px;
position: relative;
} }
.box { .box-cent1 {
height: 100vh; position: absolute;
background-size: cover; top: 0;
box-sizing: border-box; bottom: 0;
padding: 20px 100px; left: 0;
display: flex; right: 0;
flex-direction: column; overflow: auto;
.box-cent {
flex: 1;
margin-top: 70px;
position: relative;
}
.box-cent1 {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
}
} }
}
</style> </style>
<style></style> <style></style>

503
大唐会议前台1/pages/index/pdf平铺.vue

@ -1,14 +1,26 @@
<template> <template>
<view class="box" style="position: relative;"> <view class="box" style="position: relative">
<!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> --> <!-- <image class="back" src='../../imgs/back.png' mode="widthFix" @click="handleBack"></image> -->
<image class="logo" src='../../imgs/logo.png' mode="widthFix" ></image> <image class="logo" src="../../imgs/logo.png" mode="widthFix"></image>
<view class="box-cent"> <view class="box-cent">
<view class="box-cent1"> <view class="box-cent1">
<view class="view-pdf"> <view class="view-pdf">
<pdf v-for="i in numPages" :key="i" :src="filePdfUrl" :page="i"></pdf> <pdf
v-for="i in numPages"
:key="i"
:src="filePdfUrl"
:page="i"
></pdf>
</view> </view>
</view> </view>
<u-modal v-if="show" :show="show" @cancel="show = false" :showCancelButton="true" content='是否确认退出登录?' @confirm="handleOut"></u-modal> <u-modal
v-if="show"
:show="show"
@cancel="show = false"
:showCancelButton="true"
content="是否确认退出登录?"
@confirm="handleOut"
></u-modal>
</view> </view>
<!-- 底部背景图 --> <!-- 底部背景图 -->
<view class="view-backimg"> <view class="view-backimg">
@ -28,276 +40,283 @@
</div> --> </div> -->
<!-- 头像 - 头像 --> <!-- 头像 - 头像 -->
<view class="avatarobx"> <view class="avatarobx">
<view class="name">{{userName}}</view> <view class="name">{{ userName }}</view>
<image @click='handleBack' class="avatar" src='../../imgs/arrow-left.png' mode="widthFix"></image> <image
<image @click="show = true" class="avatar" src='../../imgs/out.png' mode="widthFix"></image> @click="handleBack"
class="avatar"
src="../../imgs/arrow-left.png"
mode="widthFix"
></image>
<image
@click="show = true"
class="avatar"
src="../../imgs/out.png"
mode="widthFix"
></image>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import pdf from 'vue-pdf' import pdf from 'vue-pdf';
export default { export default {
name: 'MeetingList', name: 'MeetingList',
props: ['infos'], props: ['infos'],
components: { components: {
pdf pdf,
},
data() {
return {
filePdfUrl: '',
userName: uni.getStorageSync('userName'),
detailsId: '',
numPages: '',
show: false,
};
},
created() {
let routes = getCurrentPages(); //
let curParam = routes[routes.length - 1].options; //
this.detailsId = curParam.detailsId;
this.filePdfUrl = curParam.filePdfUrl;
this.getNumPages(this.filePdfUrl);
},
methods: {
getNumPages(url) {
this.pdfSrc = url;
this.pdfSrc = pdf.createLoadingTask(this.pdfSrc);
this.pdfSrc.promise.then((pdf) => {
this.numPages = pdf.numPages;
console.log('this.numPages', this.numPages);
});
}, },
data() { // logo
return { handleBack() {
filePdfUrl: '', uni.navigateTo({
userName: uni.getStorageSync("userName"), url: `/pages/index/details?id=${this.detailsId}`,
detailsId:'', });
numPages:'', // uni.navigateBack({
show:false // delta: 1
}; // });
}, },
created() { // 退
let routes = getCurrentPages(); // handleOut() {
let curParam = routes[routes.length - 1].options; // uni.clearStorage();
this.detailsId = curParam.detailsId uni.reLaunch({
this.filePdfUrl = curParam.filePdfUrl url: '/pages/user/login',
this.getNumPages(this.filePdfUrl ) });
},
// logo
handleLogo() {
uni.navigateTo({
url: `/pages/index/index`,
});
}, },
methods: {
getNumPages(url) {
this.pdfSrc=url
this.pdfSrc = pdf.createLoadingTask(this.pdfSrc)
this.pdfSrc.promise.then(pdf => {
this.numPages = pdf.numPages
console.log('this.numPages',this.numPages)
})
},
// logo
handleBack() {
uni.navigateTo({
url: `/pages/index/details?id=${this.detailsId}`,
});
// uni.navigateBack({
// delta: 1
// });
},
// 退
handleOut() {
uni.clearStorage();
uni.reLaunch({
url: '/pages/user/login',
});
},
// logo
handleLogo() {
uni.navigateTo({
url: `/pages/index/index`,
});
},
// //
handleClose() { handleClose() {
this.pdfId = '' this.pdfId = '';
this.show = false this.show = false;
}, },
// //
prePage() { prePage() {
var page = this.pageNum var page = this.pageNum;
page = page > 1 ? page - 1 : this.pageTotalNum page = page > 1 ? page - 1 : this.pageTotalNum;
this.pageNum = page this.pageNum = page;
}, },
// //
nextPage() { nextPage() {
var page = this.pageNum var page = this.pageNum;
page = page < this.pageTotalNum ? page + 1 : 1 page = page < this.pageTotalNum ? page + 1 : 1;
this.pageNum = page this.pageNum = page;
}, },
// e // e
pageLoaded(e) { pageLoaded(e) {
this.curPageNum = e this.curPageNum = e;
},
//
pdfError(error) {
console.error(error)
},
}, },
// //
onLoad() {}, pdfError(error) {
}; console.error(error);
},
},
//
onLoad() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .u-modal__content{ ::v-deep .u-modal__content {
text-align: center; text-align: center;
} }
.popup-close { .popup-close {
position: fixed; position: fixed;
right: 20px; right: 20px;
top: 20px; top: 20px;
z-index: 9999; z-index: 9999;
/deep/.uni-icons { ::v-deep.uni-icons {
font-size: 40px !important; font-size: 40px !important;
color: #fff !important; color: #fff !important;
}
}
.view-gb {
max-width: 100px;
margin-left: 16px;
}
.view-li {
// padding-left: 10px;
}
.view-pdf {
width: 60vw;
margin: auto;
}
.tools {
display: flex;
align-items: center;
position: absolute;
bottom: 26px;
left:16px;
right:16px;
uni-button {
font-size: 18px;
line-height: 44px;
height: 44px;
flex: 1
}
.page {
line-height: 44px;
height: 44px;
width: 100px;
text-align: center;
}
}
.pathsName {
color: #fff;
font-size: 12px;
}
.pdfBox .el-button {
background: rgba(255, 255, 255, 0);
border: none;
/* width: 30px; */
} }
}
.pdfBox>>>.el-icon-arrow-left,
.pdfBox>>>.el-icon-arrow-right { .view-gb {
max-width: 100px;
margin-left: 16px;
}
.view-li {
// padding-left: 10px;
}
.view-pdf {
width: 60vw;
margin: auto;
}
.tools {
display: flex;
align-items: center;
position: absolute;
bottom: 26px;
left: 16px;
right: 16px;
uni-button {
font-size: 18px; font-size: 18px;
color: #000; line-height: 44px;
} height: 44px;
.pdfBox .page {
margin: 0 10px;
}
.pdfBox .el-button-group {
width: 100%;
justify-content: center;
display: flex;
align-items: center;
padding-top: 20px;
}
.pdfBox {
padding-bottom: 20px;
margin-top: 20px;
background: #fff;
min-height: 300px;
}
.contLeft-pane>>>.el-form-item__label {
text-align: right;
margin-right: 10px !important;
padding: 0 !important;
}
.contLeft-pane>>>.el-form-item--medium .el-form-item__content {
flex: 1; flex: 1;
} }
.li-item { .page {
uni-view { line-height: 44px;
font-size: 20px; height: 44px;
line-height: 40px; width: 100px;
text-align: center;
span { }
font-size: 20px; }
}
} .pathsName {
color: #fff;
font-size: 12px;
}
.pdfBox .el-button {
background: rgba(255, 255, 255, 0);
border: none;
/* width: 30px; */
}
.pdfBox >>> .el-icon-arrow-left,
.pdfBox >>> .el-icon-arrow-right {
font-size: 18px;
color: #000;
}
.pdfBox .page {
margin: 0 10px;
}
.pdfBox .el-button-group {
width: 100%;
justify-content: center;
display: flex;
align-items: center;
padding-top: 20px;
}
.pdfBox {
padding-bottom: 20px;
margin-top: 20px;
background: #fff;
min-height: 300px;
}
.contLeft-pane >>> .el-form-item__label {
text-align: right;
margin-right: 10px !important;
padding: 0 !important;
}
.contLeft-pane >>> .el-form-item--medium .el-form-item__content {
flex: 1;
}
.li-item {
uni-view {
font-size: 20px;
line-height: 40px;
.li-title { span {
font-size: 20px; font-size: 20px;
font-weight: bold;
line-height: 30px;
} }
} }
.view-box { .li-title {
margin-top: 50px; font-size: 20px;
font-weight: bold;
line-height: 30px;
} }
}
.view-none { .view-box {
height: 100%; margin-top: 50px;
display: flex; }
justify-content: center;
align-items: center;
font-size: 40px !important;
}
.view-ul { .view-none {
text-align: left; height: 100%;
margin-bottom: 16px; display: flex;
justify-content: center;
align-items: center;
font-size: 40px !important;
}
.view-li { .view-ul {
span { text-align: left;
font-size: 20px; margin-bottom: 16px;
line-height: 40px;
}
.view-li {
span {
font-size: 20px;
line-height: 40px;
} }
} }
}
.view-title {
display: inline-block; .view-title {
border: 1px solid #000; display: inline-block;
padding: 0 14px; border: 1px solid #000;
margin-bottom: 30px; padding: 0 14px;
line-height: 50px; margin-bottom: 30px;
border-radius: 6px; line-height: 50px;
font-size: 20px; border-radius: 6px;
font-weight: bold; font-size: 20px;
font-weight: bold;
}
.box {
height: 100vh;
background-size: cover;
box-sizing: border-box;
padding: 20px 100px;
display: flex;
flex-direction: column;
.box-cent {
flex: 1;
margin-top: 70px;
position: relative;
} }
.box { .box-cent1 {
height: 100vh; position: absolute;
background-size: cover; top: 0;
box-sizing: border-box; bottom: 0;
padding: 20px 100px; left: 0;
display: flex; right: 0;
flex-direction: column; overflow: auto;
.box-cent {
flex: 1;
margin-top: 70px;
position: relative;
}
.box-cent1 {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
}
} }
}
</style> </style>
<style></style> <style></style>

696
大唐会议前台1/pages/user/login.vue

@ -2,398 +2,436 @@
<div> <div>
<div class="divbox"> <div class="divbox">
<div class="div-left"> <div class="div-left">
<image class="logo" src='../../imgs/logo.png' mode="widthFix"></image> <image
class="logo"
src="../../imgs/logo.png"
mode="widthFix"
></image>
</div> </div>
<div class="div-right"> <div class="div-right">
<h1 class="h1-title">内部会议系统</h1> <h1 class="h1-title">内部会议系统</h1>
<u-form :model="form" :rules="rules" ref="uForm" label-position="top" label-width="100" <u-form
class="view-form"> :model="form"
:rules="rules"
ref="uForm"
label-position="top"
label-width="100"
class="view-form"
>
<u-form-item label="" prop="username"> <u-form-item label="" prop="username">
<view class="form-item-box"> <view class="form-item-box">
<u-input autocomplete="new-password" class="form-item-input" v-model="form.username" <u-input
placeholder="请输入用户名" /> autocomplete="new-password"
class="form-item-input"
v-model="form.username"
placeholder="请输入用户名"
/>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="" prop="password" class="form-item-pass" style="padding-bottom: 0"> <u-form-item
<view class="form-item-box" style="display: flex; align-items: center"> label=""
<u-input :type="!passShow ? 'password' : ''" class="form-item-input" prop="password"
autocomplete="new-password" v-model="form.password" placeholder="请输入密码" /> class="form-item-pass"
<image @click="passShow = !passShow" v-if="passShow" mode="aspectFit" class="form-item-img" style="padding-bottom: 0"
src="../../imgs/xyj.png" style="margin-right: 14px"></image> >
<image @click="passShow = !passShow" v-else mode="aspectFit" class="form-item-img" <view
src="../../imgs/xyj1.png" style="margin-right: 14px"></image> class="form-item-box"
style="display: flex; align-items: center"
>
<u-input
:type="!passShow ? 'password' : ''"
class="form-item-input"
autocomplete="new-password"
v-model="form.password"
placeholder="请输入密码"
/>
<image
@click="passShow = !passShow"
v-if="passShow"
mode="aspectFit"
class="form-item-img"
src="../../imgs/xyj.png"
style="margin-right: 14px"
></image>
<image
@click="passShow = !passShow"
v-else
mode="aspectFit"
class="form-item-img"
src="../../imgs/xyj1.png"
style="margin-right: 14px"
></image>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="" prop="code"> <u-form-item label="" prop="code">
<view style="width:100%; display: flex;"> <view style="width: 100%; display: flex">
<view class="form-item-box" style="flex:1"> <view class="form-item-box" style="flex: 1">
<u-input autocomplete="off" class="form-item-input" v-model="form.code" <u-input
placeholder="请输入验证码" /> autocomplete="off"
class="form-item-input"
v-model="form.code"
placeholder="请输入验证码"
/>
</view> </view>
<view class="code-imagebox" @click="getCaptchaImage()"> <view
<image class='code-image' :src="codeUrl" alt=""></image> class="code-imagebox"
@click="getCaptchaImage()"
>
<image
class="code-image"
:src="codeUrl"
alt=""
></image>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
<view @click="show = true" style="text-align: right;"> 忘记密码</view> <view @click="show = true" style="text-align: right">
忘记密码</view
>
</u-form> </u-form>
<view class="log-but" @click="handleLogin"> 登录 </view> <view class="log-but" @click="handleLogin"> 登录 </view>
</div> </div>
</div> </div>
<u-modal :show="show" :content='configData' @confirm="show = false"></u-modal> <u-modal
:show="show"
:content="configData"
@confirm="show = false"
></u-modal>
<u-toast ref="uToast"></u-toast> <u-toast ref="uToast"></u-toast>
</div> </div>
</template> </template>
<script> <script>
import { import { mapMutations, mapState } from 'vuex';
mapMutations, import { login, captchaImage, config } from '@/common/userApi';
mapState export default {
} from "vuex"; name: 'SignIn',
import { components: {},
login, data() {
captchaImage, return {
config show: false,
} from "@/common/userApi"; codeUrl: '', //
export default { passShow: false,
name: "SignIn", form: {
components: {}, username: '',
data() { password: '',
return { },
show:false, configData: '',
codeUrl: '', // rules: {
passShow: false, username: [
form: { {
username: "",
password: "",
},
configData:'',
rules: {
username: [{
required: true, required: true,
message: "请输入用户名", message: '请输入用户名',
trigger: ["blur"], trigger: ['blur'],
}], },
password: [{ ],
password: [
{
required: true, required: true,
message: "请输入密码", message: '请输入密码',
trigger: ["blur"], trigger: ['blur'],
}], },
code: [{ ],
code: [
{
required: true, required: true,
message: "请输入验证码", message: '请输入验证码',
trigger: ["blur"], trigger: ['blur'],
}], },
}, ],
},
};
},
computed: {
...mapState('ht', ['reportId']),
},
created() {
this.getCaptchaImage(); //
this.getConfig(); //
this.keyEnter();
},
methods: {
...mapMutations(['setTrainPath']),
//
keyEnter() {
document.onkeydown = (e) => {
if (e.keyCode == 13) {
this.handleLogin(); //
}
}; };
}, },
computed: { //
...mapState("ht", ["reportId"]), async getConfig() {
const res = await config('sys.password.forget');
const { code, rows, msg } = res;
if (code === 200) {
this.configData = rows[0]?.configValue || '';
}
}, },
created() { //
this.getCaptchaImage() // async getCaptchaImage() {
this.getConfig() // const res = await captchaImage();
this.keyEnter() const { code, data, msg } = res;
if (code === 200) {
this.codeUrl = 'data:image/gif;base64,' + res.img;
this.form.uuid = res.uuid;
}
}, },
methods: { //
...mapMutations(["setTrainPath"]), async handleLogin() {
// this.$refs.uForm.validate().then(async (formRes) => {
keyEnter(){ const param = {
document.onkeydown = e =>{ username: this.form.username,
if(e.keyCode == 13){ password: this.form.password,
this.handleLogin() // code: this.form.code, // 456
} uuid: this.form.uuid,
} };
}, const res = await login(param);
// const { code, data, msg } = res;
async getConfig() {
const res = await config('sys.password.forget');
const {
code,
rows,
msg
} = res;
if (code === 200) { if (code === 200) {
this.configData = rows[0]?.configValue || '' uni.setStorageSync('userToken', res.token);
} uni.setStorageSync('userName', this.form.username);
}, uni.navigateTo({
// url: '/pages/index/index',
async getCaptchaImage() { });
const res = await captchaImage(); //
const { var docElm = document.documentElement;
code, if (docElm.requestFullscreen) {
data, docElm.requestFullscreen();
msg } else if (docElm.mozRequestFullScreen) {
} = res; docElm.mozRequestFullScreen();
if (code === 200) { } else if (docElm.webkitRequestFullScreen) {
this.codeUrl = "data:image/gif;base64," + res.img; docElm.webkitRequestFullScreen();
this.form.uuid = res.uuid } else if (elem.msRequestFullscreen) {
} elem.msRequestFullscreen();
},
//
async handleLogin() {
this.$refs.uForm.validate().then(async (formRes) => {
const param = {
username: this.form.username,
password: this.form.password,
code: this.form.code, // 456
uuid: this.form.uuid,
};
const res = await login(param);
const {
code,
data,
msg
} = res;
if (code === 200) {
uni.setStorageSync("userToken", res.token);
uni.setStorageSync("userName", this.form.username);
uni.navigateTo({
url: "/pages/index/index",
});
//
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
this.handleSuccess("登录成功");
} else {
this.handleError(msg || "登录失败");
} }
}) this.handleSuccess('登录成功');
} else {
}, this.handleError(msg || '登录失败');
// }
handleError(_tips) { });
this.$refs.uToast.show({
type: "error",
icon: false,
message: _tips,
});
},
//
handleSuccess(_tips) {
this.$refs.uToast.show({
type: "success",
icon: false,
message: _tips,
});
},
}, },
}; //
handleError(_tips) {
this.$refs.uToast.show({
type: 'error',
icon: false,
message: _tips,
});
},
//
handleSuccess(_tips) {
this.$refs.uToast.show({
type: 'success',
icon: false,
message: _tips,
});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.view-form { .view-form {
width: 80% width: 80%;
} }
.code-imagebox { .code-imagebox {
width: 100px; width: 100px;
margin-left: 12px; margin-left: 12px;
.code-image { .code-image {
width: 100px; width: 100px;
height: 48px; height: 48px;
}
} }
}
.log-but {
width: 400px; .log-but {
line-height: 48px; width: 400px;
background: #3d78ff; line-height: 48px;
border-radius: 4px; background: #3d78ff;
font-size: 20px; border-radius: 4px;
color: #ffffff; font-size: 20px;
text-align: center; color: #ffffff;
margin-top: 36px; text-align: center;
margin-top: 36px;
}
.checkbox-box {
display: flex;
}
.view-yd {
width: 440px;
}
::v-deep.u-checkbox__icon-wrap--square {
width: 18px !important;
height: 18px !important;
}
.pawss {
display: flex;
justify-content: space-between;
color: #3d78ff;
.forget {
font-size: 14px !important;
} }
}
.checkbox-box { ::v-deep .u-checkbox-label--left span {
display: flex; font-size: 14px !important;
} }
.view-yd { .form-fg {
width: 440px; height: 30px;
} }
/deep/.u-checkbox__icon-wrap--square { .form-item-img {
width: 18px !important; width: 20px;
height: 18px !important; height: 30px;
} }
.pawss { .ipt-box {
display: flex; width: 380px;
justify-content: space-between; margin: 0 100px;
color: #3d78ff; }
.forget { .code-wrap {
font-size: 14px !important; display: flex;
}
}
/deep/ .u-checkbox-label--left span { .code-field {
font-size: 14px !important; flex: 1;
} }
.form-fg { .code-btn {
height: 30px; margin-left: 10px;
} }
.form-item-img { i {
width: 20px; position: absolute;
height: 30px; top: 30px;
right: 15px;
cursor: pointer;
} }
}
.ipt-box { .forgetPassword {
width: 380px; cursor: pointer;
margin: 0 100px; color: rgba(0, 0, 0, 0.54);
} }
.code-wrap { .forgetPassword:hover {
text-decoration: underline;
color: rgba(0, 0, 0, 0.87);
}
</style>
<style scoped lang="scss">
.form-item-box {
width: 100%;
border-radius: 4px 4px 4px 4px;
border: 1px solid #dcdfe6;
height: 46px;
}
.form-item-input {
height: 46px !important;
border-radius: 23px;
padding: 0 14px !important;
color: #333333;
box-sizing: border-box;
border: none;
}
::v-deep .uni-input-input {
//font-size: 50px;
}
.form-item-input:placeholder {
font-size: 16px;
color: #000;
}
.form-item-codebut {
font-size: 12px;
color: #888888;
width: 100px;
text-align: center;
border-left: 1px solid #d8d8d8;
}
::v-deep .u-form-item__body__left__content__label {
width: 100px;
font-size: 22px;
color: #000000;
margin-bottom: 16px;
}
::v-deep.u-input__content__field-wrapper__field {
height: 48px;
line-height: 48px;
font-size: 16px;
}
::v-deep.ant-input {
font-size: 22px;
}
::v-deep.ant-input-affix-wrapper .ant-input:not(:first-child) {
padding-left: 40px;
}
.h1-title {
text-align: center;
font-weight: bold;
font-size: 36px;
width: 100%;
margin-bottom: 20px;
}
.divbox {
display: flex;
background-image: url('../../imgs/left.png');
background-position: left bottom;
background-repeat: no-repeat;
background-size: 100%;
.div-left {
position: relative;
flex: 1;
display: flex; display: flex;
justify-content: center;
.code-field { align-items: center;
flex: 1; .equipment {
}
.code-btn {
margin-left: 10px;
}
i {
position: absolute; position: absolute;
top: 30px; bottom: 4px;
right: 15px; color: #6fcd9d;
cursor: pointer;
} }
} }
}
.forgetPassword { .divbox {
cursor: pointer; width: 100%;
color: rgba(0, 0, 0, 0.54); height: 100vh;
} display: flex;
.forgetPassword:hover { .div-left {
text-decoration: underline; flex: 2;
color: rgba(0, 0, 0, 0.87);
}
</style>
<style scoped lang="scss">
.form-item-box {
width: 100%;
border-radius: 4px 4px 4px 4px;
border: 1px solid #dcdfe6;
height: 46px;
}
.form-item-input {
height: 46px !important;
border-radius: 23px;
padding: 0 14px !important;
color: #333333;
box-sizing: border-box;
border: none;
}
/deep/ .uni-input-input {
//font-size: 50px;
}
.form-item-input:placeholder {
font-size: 16px;
color: #000;
}
.form-item-codebut {
font-size: 12px;
color: #888888;
width: 100px;
text-align: center;
border-left: 1px solid #d8d8d8;
}
/deep/ .u-form-item__body__left__content__label {
width: 100px;
font-size: 22px;
color: #000000;
margin-bottom: 16px;
}
/deep/.u-input__content__field-wrapper__field {
height: 48px;
line-height: 48px;
font-size: 16px;
} }
/deep/.ant-input { .div-right {
font-size: 22px; background: rgba(255, 255, 255, 0.6);
} width: 500px;
/deep/.ant-input-affix-wrapper .ant-input:not(:first-child) {
padding-left: 40px;
}
.h1-title {
text-align: center;
font-weight: bold;
font-size: 36px;
width: 100%;
margin-bottom: 20px;
}
.divbox { text-align: left;
display: flex; display: flex;
background-image: url('../../imgs/left.png'); flex-wrap: wrap;
background-position: left bottom; justify-content: center;
background-repeat: no-repeat; align-content: center;
background-size: 100% ;
.div-left {
position: relative;
flex: 1;
display: flex;
justify-content: center;
align-items: center;
.equipment {
position: absolute;
bottom: 4px;
color: #6fcd9d;
}
}
}
.divbox {
width: 100%;
height: 100vh;
display: flex;
.div-left {
flex: 2;
}
.div-right {
background:rgba(255, 255, 255, .6) ;
width: 500px;
text-align: left; .p-note {
display: flex; color: #10b884;
flex-wrap: wrap;
justify-content: center;
align-content: center;
.p-note {
color: #10b884;
}
} }
} }
}
</style> </style>

78
大唐会议前台1/uni_modules/uview-ui/components/u-input/props.js

@ -3,7 +3,7 @@ export default {
// 输入的值 // 输入的值
value: { value: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.value default: uni.$u.props.input.value,
}, },
// 输入框类型 // 输入框类型
// number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数 // number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数
@ -12,176 +12,176 @@ export default {
// text-文本输入键盘 // text-文本输入键盘
type: { type: {
type: String, type: String,
default: uni.$u.props.input.type default: uni.$u.props.input.type,
}, },
// 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true, // 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,
// 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序 // 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序
fixed: { fixed: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.fixed default: uni.$u.props.input.fixed,
}, },
// 是否禁用输入框 // 是否禁用输入框
disabled: { disabled: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.disabled default: uni.$u.props.input.disabled,
}, },
// 禁用状态时的背景色 // 禁用状态时的背景色
disabledColor: { disabledColor: {
type: String, type: String,
default: uni.$u.props.input.disabledColor default: uni.$u.props.input.disabledColor,
}, },
// 是否显示清除控件 // 是否显示清除控件
clearable: { clearable: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.clearable default: uni.$u.props.input.clearable,
}, },
// 是否密码类型 // 是否密码类型
password: { password: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.password default: uni.$u.props.input.password,
}, },
// 最大输入长度,设置为 -1 的时候不限制最大长度 // 最大输入长度,设置为 -1 的时候不限制最大长度
maxlength: { maxlength: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.maxlength default: uni.$u.props.input.maxlength,
}, },
// 输入框为空时的占位符 // 输入框为空时的占位符
placeholder: { placeholder: {
type: String, type: String,
default: uni.$u.props.input.placeholder default: uni.$u.props.input.placeholder,
}, },
// 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写::v-deep
placeholderClass: { placeholderClass: {
type: String, type: String,
default: uni.$u.props.input.placeholderClass default: uni.$u.props.input.placeholderClass,
}, },
// 指定placeholder的样式 // 指定placeholder的样式
placeholderStyle: { placeholderStyle: {
type: [String, Object], type: [String, Object],
default: uni.$u.props.input.placeholderStyle default: uni.$u.props.input.placeholderStyle,
}, },
// 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效 // 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效
showWordLimit: { showWordLimit: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.showWordLimit default: uni.$u.props.input.showWordLimit,
}, },
// 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档 // 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档
// https://uniapp.dcloud.io/component/input // https://uniapp.dcloud.io/component/input
// https://uniapp.dcloud.io/component/textarea // https://uniapp.dcloud.io/component/textarea
confirmType: { confirmType: {
type: String, type: String,
default: uni.$u.props.input.confirmType default: uni.$u.props.input.confirmType,
}, },
// 点击键盘右下角按钮时是否保持键盘不收起,H5无效 // 点击键盘右下角按钮时是否保持键盘不收起,H5无效
confirmHold: { confirmHold: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.confirmHold default: uni.$u.props.input.confirmHold,
}, },
// focus时,点击页面的时候不收起键盘,微信小程序有效 // focus时,点击页面的时候不收起键盘,微信小程序有效
holdKeyboard: { holdKeyboard: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.holdKeyboard default: uni.$u.props.input.holdKeyboard,
}, },
// 自动获取焦点 // 自动获取焦点
// 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 // 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点
focus: { focus: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.focus default: uni.$u.props.input.focus,
}, },
// 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 // 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效
autoBlur: { autoBlur: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.autoBlur default: uni.$u.props.input.autoBlur,
}, },
// 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 // 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效
disableDefaultPadding: { disableDefaultPadding: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.disableDefaultPadding default: uni.$u.props.input.disableDefaultPadding,
}, },
// 指定focus时光标的位置 // 指定focus时光标的位置
cursor: { cursor: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.cursor default: uni.$u.props.input.cursor,
}, },
// 输入框聚焦时底部与键盘的距离 // 输入框聚焦时底部与键盘的距离
cursorSpacing: { cursorSpacing: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.cursorSpacing default: uni.$u.props.input.cursorSpacing,
}, },
// 光标起始位置,自动聚集时有效,需与selection-end搭配使用 // 光标起始位置,自动聚集时有效,需与selection-end搭配使用
selectionStart: { selectionStart: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.selectionStart default: uni.$u.props.input.selectionStart,
}, },
// 光标结束位置,自动聚集时有效,需与selection-start搭配使用 // 光标结束位置,自动聚集时有效,需与selection-start搭配使用
selectionEnd: { selectionEnd: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.selectionEnd default: uni.$u.props.input.selectionEnd,
}, },
// 键盘弹起时,是否自动上推页面 // 键盘弹起时,是否自动上推页面
adjustPosition: { adjustPosition: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.adjustPosition default: uni.$u.props.input.adjustPosition,
}, },
// 输入框内容对齐方式,可选值为:left|center|right // 输入框内容对齐方式,可选值为:left|center|right
inputAlign: { inputAlign: {
type: String, type: String,
default: uni.$u.props.input.inputAlign default: uni.$u.props.input.inputAlign,
}, },
// 输入框字体的大小 // 输入框字体的大小
fontSize: { fontSize: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.input.fontSize default: uni.$u.props.input.fontSize,
}, },
// 输入框字体颜色 // 输入框字体颜色
color: { color: {
type: String, type: String,
default: uni.$u.props.input.color default: uni.$u.props.input.color,
}, },
// 输入框前置图标 // 输入框前置图标
prefixIcon: { prefixIcon: {
type: String, type: String,
default: uni.$u.props.input.prefixIcon default: uni.$u.props.input.prefixIcon,
}, },
// 前置图标样式,对象或字符串 // 前置图标样式,对象或字符串
prefixIconStyle: { prefixIconStyle: {
type: [String, Object], type: [String, Object],
default: uni.$u.props.input.prefixIconStyle default: uni.$u.props.input.prefixIconStyle,
}, },
// 输入框后置图标 // 输入框后置图标
suffixIcon: { suffixIcon: {
type: String, type: String,
default: uni.$u.props.input.suffixIcon default: uni.$u.props.input.suffixIcon,
}, },
// 后置图标样式,对象或字符串 // 后置图标样式,对象或字符串
suffixIconStyle: { suffixIconStyle: {
type: [String, Object], type: [String, Object],
default: uni.$u.props.input.suffixIconStyle default: uni.$u.props.input.suffixIconStyle,
}, },
// 边框类型,surround-四周边框,bottom-底部边框,none-无边框 // 边框类型,surround-四周边框,bottom-底部边框,none-无边框
border: { border: {
type: String, type: String,
default: uni.$u.props.input.border default: uni.$u.props.input.border,
}, },
// 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 // 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会
readonly: { readonly: {
type: Boolean, type: Boolean,
default: uni.$u.props.input.readonly default: uni.$u.props.input.readonly,
}, },
// 输入框形状,circle-圆形,square-方形 // 输入框形状,circle-圆形,square-方形
shape: { shape: {
type: String, type: String,
default: uni.$u.props.input.shape default: uni.$u.props.input.shape,
}, },
// 用于处理或者过滤输入框内容的方法 // 用于处理或者过滤输入框内容的方法
formatter: { formatter: {
type: [Function, null], type: [Function, null],
default: uni.$u.props.input.formatter default: uni.$u.props.input.formatter,
}, },
// 是否忽略组件内对文本合成系统事件的处理 // 是否忽略组件内对文本合成系统事件的处理
ignoreCompositionEvent: { ignoreCompositionEvent: {
type: Boolean, type: Boolean,
default: true default: true,
} },
} },
} };

550
大唐会议前台1/uni_modules/uview-ui/components/u-input/u-input.vue

@ -1,81 +1,81 @@
<template> <template>
<view class="u-input" :class="inputClass" :style="[wrapperStyle]"> <view class="u-input" :class="inputClass" :style="[wrapperStyle]">
<view class="u-input__content"> <view class="u-input__content">
<view <view
class="u-input__content__prefix-icon" class="u-input__content__prefix-icon"
v-if="prefixIcon || $slots.prefix" v-if="prefixIcon || $slots.prefix"
> >
<slot name="prefix"> <slot name="prefix">
<u-icon <u-icon
:name="prefixIcon" :name="prefixIcon"
size="18" size="18"
:customStyle="prefixIconStyle" :customStyle="prefixIconStyle"
></u-icon> ></u-icon>
</slot> </slot>
</view> </view>
<view class="u-input__content__field-wrapper" @tap="clickHandler"> <view class="u-input__content__field-wrapper" @tap="clickHandler">
<!-- 根据uni-app的input组件文档H5和APP中只要声明了password参数(无论true还是false)type均失效此时 <!-- 根据uni-app的input组件文档H5和APP中只要声明了password参数(无论true还是false)type均失效此时
为了防止type=number时又存在password属性type无效此时需要设置password为undefined 为了防止type=number时又存在password属性type无效此时需要设置password为undefined
--> -->
<input <input
class="u-input__content__field-wrapper__field" class="u-input__content__field-wrapper__field"
:style="[inputStyle]" :style="[inputStyle]"
:type="type" :type="type"
:focus="focus" :focus="focus"
:cursor="cursor" :cursor="cursor"
:value="innerValue" :value="innerValue"
:auto-blur="autoBlur" :auto-blur="autoBlur"
:disabled="disabled || readonly" :disabled="disabled || readonly"
:maxlength="maxlength" :maxlength="maxlength"
:placeholder="placeholder" :placeholder="placeholder"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
:placeholder-class="placeholderClass" :placeholder-class="placeholderClass"
:confirm-type="confirmType" :confirm-type="confirmType"
:confirm-hold="confirmHold" :confirm-hold="confirmHold"
:hold-keyboard="holdKeyboard" :hold-keyboard="holdKeyboard"
:cursor-spacing="cursorSpacing" :cursor-spacing="cursorSpacing"
:adjust-position="adjustPosition" :adjust-position="adjustPosition"
:selection-end="selectionEnd" :selection-end="selectionEnd"
:selection-start="selectionStart" :selection-start="selectionStart"
:password="password || type === 'password' || false" :password="password || type === 'password' || false"
:ignoreCompositionEvent="ignoreCompositionEvent" :ignoreCompositionEvent="ignoreCompositionEvent"
@input="onInput" @input="onInput"
@blur="onBlur" @blur="onBlur"
@focus="onFocus" @focus="onFocus"
@confirm="onConfirm" @confirm="onConfirm"
@keyboardheightchange="onkeyboardheightchange" @keyboardheightchange="onkeyboardheightchange"
/> />
</view> </view>
<view <view
class="u-input__content__clear" class="u-input__content__clear"
v-if="isShowClear" v-if="isShowClear"
@tap="onClear" @tap="onClear"
> >
<u-icon <u-icon
name="close" name="close"
size="11" size="11"
color="#ffffff" color="#ffffff"
customStyle="line-height: 12px" customStyle="line-height: 12px"
></u-icon> ></u-icon>
</view> </view>
<view <view
class="u-input__content__subfix-icon" class="u-input__content__subfix-icon"
v-if="suffixIcon || $slots.suffix" v-if="suffixIcon || $slots.suffix"
> >
<slot name="suffix"> <slot name="suffix">
<u-icon <u-icon
:name="suffixIcon" :name="suffixIcon"
size="18" size="18"
:customStyle="suffixIconStyle" :customStyle="suffixIconStyle"
></u-icon> ></u-icon>
</slot> </slot>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import props from "./props.js"; import props from './props.js';
/** /**
* Input 输入框 * Input 输入框
* @description 此组件为一个输入框默认没有边框和样式是专门为配合表单组件u-form而设计的利用它可以快速实现表单验证输入内容下拉选择等功能 * @description 此组件为一个输入框默认没有边框和样式是专门为配合表单组件u-form而设计的利用它可以快速实现表单验证输入内容下拉选择等功能
@ -89,7 +89,7 @@ import props from "./props.js";
* @property {Boolean} password 是否密码类型 默认 false * @property {Boolean} password 是否密码类型 默认 false
* @property {String | Number} maxlength 最大输入长度设置为 -1 的时候不限制最大长度 默认 -1 * @property {String | Number} maxlength 最大输入长度设置为 -1 的时候不限制最大长度 默认 -1
* @property {String} placeholder 输入框为空时的占位符 * @property {String} placeholder 输入框为空时的占位符
* @property {String} placeholderClass 指定placeholder的样式类注意页面或组件的style中写了scoped时需要在类名前写/deep/ 默认 'input-placeholder' * @property {String} placeholderClass 指定placeholder的样式类注意页面或组件的style中写了scoped时需要在类名前写::v-deep 默认 'input-placeholder'
* @property {String | Object} placeholderStyle 指定placeholder的样式字符串/对象形式"color: red;" * @property {String | Object} placeholderStyle 指定placeholder的样式字符串/对象形式"color: red;"
* @property {Boolean} showWordLimit 是否显示输入字数统计只在 type ="text"或type ="textarea"时有效 默认 false * @property {Boolean} showWordLimit 是否显示输入字数统计只在 type ="text"或type ="textarea"时有效 默认 false
* @property {String} confirmType 设置右下角按钮的文字兼容性详见uni-app文档 默认 'done' * @property {String} confirmType 设置右下角按钮的文字兼容性详见uni-app文档 默认 'done'
@ -119,206 +119,206 @@ import props from "./props.js";
* @example <u-input v-model="value" :password="true" suffix-icon="lock-fill" /> * @example <u-input v-model="value" :password="true" suffix-icon="lock-fill" />
*/ */
export default { export default {
name: "u-input", name: 'u-input',
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
data() { data() {
return { return {
// //
innerValue: "", innerValue: '',
// //
focused: false, focused: false,
// valuewatchimmediatevalue // valuewatchimmediatevalue
firstChange: true, firstChange: true,
// value // value
changeFromInner: false, changeFromInner: false,
// //
innerFormatter: value => value innerFormatter: (value) => value,
}; };
}, },
watch: { watch: {
value: { value: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.innerValue = newVal; this.innerValue = newVal;
/* #ifdef H5 */ /* #ifdef H5 */
// H5valueinput@input // H5valueinput@input
if ( if (
this.firstChange === false && this.firstChange === false &&
this.changeFromInner === false this.changeFromInner === false
) { ) {
this.valueChange(); this.valueChange();
} }
/* #endif */ /* #endif */
this.firstChange = false; this.firstChange = false;
// changeFromInnerfalse // changeFromInnerfalse
this.changeFromInner = false; this.changeFromInner = false;
}, },
}, },
}, },
computed: { computed: {
// //
isShowClear() { isShowClear() {
const { clearable, readonly, focused, innerValue } = this; const { clearable, readonly, focused, innerValue } = this;
return !!clearable && !readonly && !!focused && innerValue !== ""; return !!clearable && !readonly && !!focused && innerValue !== '';
}, },
// //
inputClass() { inputClass() {
let classes = [], let classes = [],
{ border, disabled, shape } = this; { border, disabled, shape } = this;
border === "surround" && border === 'surround' &&
(classes = classes.concat(["u-border", "u-input--radius"])); (classes = classes.concat(['u-border', 'u-input--radius']));
classes.push(`u-input--${shape}`); classes.push(`u-input--${shape}`);
border === "bottom" && border === 'bottom' &&
(classes = classes.concat([ (classes = classes.concat([
"u-border-bottom", 'u-border-bottom',
"u-input--no-radius", 'u-input--no-radius',
])); ]));
return classes.join(" "); return classes.join(' ');
}, },
// //
wrapperStyle() { wrapperStyle() {
const style = {}; const style = {};
// //
if (this.disabled) { if (this.disabled) {
style.backgroundColor = this.disabledColor; style.backgroundColor = this.disabledColor;
} }
// //
if (this.border === "none") { if (this.border === 'none') {
style.padding = "0"; style.padding = '0';
} else { } else {
// uni-appiOS // uni-appiOS
style.paddingTop = "6px"; style.paddingTop = '6px';
style.paddingBottom = "6px"; style.paddingBottom = '6px';
style.paddingLeft = "9px"; style.paddingLeft = '9px';
style.paddingRight = "9px"; style.paddingRight = '9px';
} }
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)); return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
}, },
// //
inputStyle() { inputStyle() {
const style = { const style = {
color: this.color, color: this.color,
fontSize: uni.$u.addUnit(this.fontSize), fontSize: uni.$u.addUnit(this.fontSize),
textAlign: this.inputAlign textAlign: this.inputAlign,
}; };
return style; return style;
}, },
}, },
methods: { methods: {
// propsref // propsref
setFormatter(e) { setFormatter(e) {
this.innerFormatter = e this.innerFormatter = e;
},
// input
onInput(e) {
let { value = '' } = e.detail || {};
//
const formatter = this.formatter || this.innerFormatter;
const formatValue = formatter(value);
// propsinnerValue$nextTick
this.innerValue = value;
this.$nextTick(() => {
this.innerValue = formatValue;
this.valueChange();
});
}, },
// input //
onInput(e) { onBlur(event) {
let { value = "" } = e.detail || {}; this.$emit('blur', event.detail.value);
// // H5blurclickfocused
const formatter = this.formatter || this.innerFormatter // false
const formatValue = formatter(value) uni.$u.sleep(50).then(() => {
// propsinnerValue$nextTick this.focused = false;
this.innerValue = value });
this.$nextTick(() => { // u-form
this.innerValue = formatValue; uni.$u.formValidate(this, 'blur');
this.valueChange(); },
}) //
}, onFocus(event) {
// this.focused = true;
onBlur(event) { this.$emit('focus');
this.$emit("blur", event.detail.value); },
// H5blurclickfocused //
// false onConfirm(event) {
uni.$u.sleep(50).then(() => { this.$emit('confirm', this.innerValue);
this.focused = false; },
}); //
// u-form // 2.7.0+App 3.1.0+
uni.$u.formValidate(this, "blur");
},
//
onFocus(event) {
this.focused = true;
this.$emit("focus");
},
//
onConfirm(event) {
this.$emit("confirm", this.innerValue);
},
//
// 2.7.0+App 3.1.0+
onkeyboardheightchange() { onkeyboardheightchange() {
this.$emit("keyboardheightchange"); this.$emit('keyboardheightchange');
}, },
// //
valueChange() { valueChange() {
const value = this.innerValue; const value = this.innerValue;
this.$nextTick(() => { this.$nextTick(() => {
this.$emit("input", value); this.$emit('input', value);
// value // value
this.changeFromInner = true; this.changeFromInner = true;
this.$emit("change", value); this.$emit('change', value);
// u-form // u-form
uni.$u.formValidate(this, "change"); uni.$u.formValidate(this, 'change');
}); });
}, },
// //
onClear() { onClear() {
this.innerValue = ""; this.innerValue = '';
this.$nextTick(() => { this.$nextTick(() => {
this.valueChange(); this.valueChange();
this.$emit("clear"); this.$emit('clear');
}); });
}, },
/** /**
* 在安卓nvue上事件无法冒泡 * 在安卓nvue上事件无法冒泡
* 在某些时间我们希望监听u-from-item的点击事件此时会导致点击u-form-item内的u-input后 * 在某些时间我们希望监听u-from-item的点击事件此时会导致点击u-form-item内的u-input后
* 无法触发u-form-item的点击事件这里通过手动调用u-form-item的方法进行触发 * 无法触发u-form-item的点击事件这里通过手动调用u-form-item的方法进行触发
*/ */
clickHandler() { clickHandler() {
// #ifdef APP-NVUE // #ifdef APP-NVUE
if (uni.$u.os() === "android") { if (uni.$u.os() === 'android') {
const formItem = uni.$u.$parent.call(this, "u-form-item"); const formItem = uni.$u.$parent.call(this, 'u-form-item');
if (formItem) { if (formItem) {
formItem.clickHandler(); formItem.clickHandler();
} }
} }
// #endif // #endif
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../libs/css/components.scss"; @import '../../libs/css/components.scss';
.u-input { .u-input {
@include flex(row); @include flex(row);
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
flex: 1; flex: 1;
&--radius, &--radius,
&--square { &--square {
border-radius: 4px; border-radius: 4px;
} }
&--no-radius { &--no-radius {
border-radius: 0; border-radius: 0;
} }
&--circle { &--circle {
border-radius: 100px; border-radius: 100px;
} }
&__content { &__content {
flex: 1; flex: 1;
@include flex(row); @include flex(row);
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
&__field-wrapper { &__field-wrapper {
position: relative; position: relative;
@include flex(row); @include flex(row);
margin: 0; margin: 0;
flex: 1; flex: 1;
&__field { &__field {
line-height: 26px; line-height: 26px;
@ -328,27 +328,27 @@ export default {
font-size: 15px; font-size: 15px;
flex: 1; flex: 1;
} }
} }
&__clear { &__clear {
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 100px; border-radius: 100px;
background-color: #c6c7cb; background-color: #c6c7cb;
@include flex(row); @include flex(row);
align-items: center; align-items: center;
justify-content: center; justify-content: center;
transform: scale(0.82); transform: scale(0.82);
margin-left: 4px; margin-left: 4px;
} }
&__subfix-icon { &__subfix-icon {
margin-left: 4px; margin-left: 4px;
} }
&__prefix-icon { &__prefix-icon {
margin-right: 4px; margin-right: 4px;
} }
} }
} }
</style> </style>

54
大唐会议前台1/uni_modules/uview-ui/components/u-textarea/props.js

@ -3,117 +3,117 @@ export default {
// 输入框的内容 // 输入框的内容
value: { value: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.textarea.value default: uni.$u.props.textarea.value,
}, },
// 输入框为空时占位符 // 输入框为空时占位符
placeholder: { placeholder: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.textarea.placeholder default: uni.$u.props.textarea.placeholder,
}, },
// 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写::v-deep
placeholderClass: { placeholderClass: {
type: String, type: String,
default: uni.$u.props.input.placeholderClass default: uni.$u.props.input.placeholderClass,
}, },
// 指定placeholder的样式 // 指定placeholder的样式
placeholderStyle: { placeholderStyle: {
type: [String, Object], type: [String, Object],
default: uni.$u.props.input.placeholderStyle default: uni.$u.props.input.placeholderStyle,
}, },
// 输入框高度 // 输入框高度
height: { height: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.textarea.height default: uni.$u.props.textarea.height,
}, },
// 设置键盘右下角按钮的文字,仅微信小程序,App-vue和H5有效 // 设置键盘右下角按钮的文字,仅微信小程序,App-vue和H5有效
confirmType: { confirmType: {
type: String, type: String,
default: uni.$u.props.textarea.confirmType default: uni.$u.props.textarea.confirmType,
}, },
// 是否禁用 // 是否禁用
disabled: { disabled: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.disabled default: uni.$u.props.textarea.disabled,
}, },
// 是否显示统计字数 // 是否显示统计字数
count: { count: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.count default: uni.$u.props.textarea.count,
}, },
// 是否自动获取焦点,nvue不支持,H5取决于浏览器的实现 // 是否自动获取焦点,nvue不支持,H5取决于浏览器的实现
focus: { focus: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.focus default: uni.$u.props.textarea.focus,
}, },
// 是否自动增加高度 // 是否自动增加高度
autoHeight: { autoHeight: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.autoHeight default: uni.$u.props.textarea.autoHeight,
}, },
// 如果textarea是在一个position:fixed的区域,需要显示指定属性fixed为true // 如果textarea是在一个position:fixed的区域,需要显示指定属性fixed为true
fixed: { fixed: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.fixed default: uni.$u.props.textarea.fixed,
}, },
// 指定光标与键盘的距离 // 指定光标与键盘的距离
cursorSpacing: { cursorSpacing: {
type: Number, type: Number,
default: uni.$u.props.textarea.cursorSpacing default: uni.$u.props.textarea.cursorSpacing,
}, },
// 指定focus时的光标位置 // 指定focus时的光标位置
cursor: { cursor: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.textarea.cursor default: uni.$u.props.textarea.cursor,
}, },
// 是否显示键盘上方带有”完成“按钮那一栏, // 是否显示键盘上方带有”完成“按钮那一栏,
showConfirmBar: { showConfirmBar: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.showConfirmBar default: uni.$u.props.textarea.showConfirmBar,
}, },
// 光标起始位置,自动聚焦时有效,需与selection-end搭配使用 // 光标起始位置,自动聚焦时有效,需与selection-end搭配使用
selectionStart: { selectionStart: {
type: Number, type: Number,
default: uni.$u.props.textarea.selectionStart default: uni.$u.props.textarea.selectionStart,
}, },
// 光标结束位置,自动聚焦时有效,需与selection-start搭配使用 // 光标结束位置,自动聚焦时有效,需与selection-start搭配使用
selectionEnd: { selectionEnd: {
type: Number, type: Number,
default: uni.$u.props.textarea.selectionEnd default: uni.$u.props.textarea.selectionEnd,
}, },
// 键盘弹起时,是否自动上推页面 // 键盘弹起时,是否自动上推页面
adjustPosition: { adjustPosition: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.adjustPosition default: uni.$u.props.textarea.adjustPosition,
}, },
// 是否去掉 iOS 下的默认内边距,只微信小程序有效 // 是否去掉 iOS 下的默认内边距,只微信小程序有效
disableDefaultPadding: { disableDefaultPadding: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.disableDefaultPadding default: uni.$u.props.textarea.disableDefaultPadding,
}, },
// focus时,点击页面的时候不收起键盘,只微信小程序有效 // focus时,点击页面的时候不收起键盘,只微信小程序有效
holdKeyboard: { holdKeyboard: {
type: Boolean, type: Boolean,
default: uni.$u.props.textarea.holdKeyboard default: uni.$u.props.textarea.holdKeyboard,
}, },
// 最大输入长度,设置为 -1 的时候不限制最大长度 // 最大输入长度,设置为 -1 的时候不限制最大长度
maxlength: { maxlength: {
type: [String, Number], type: [String, Number],
default: uni.$u.props.textarea.maxlength default: uni.$u.props.textarea.maxlength,
}, },
// 边框类型,surround-四周边框,bottom-底部边框 // 边框类型,surround-四周边框,bottom-底部边框
border: { border: {
type: String, type: String,
default: uni.$u.props.textarea.border default: uni.$u.props.textarea.border,
}, },
// 用于处理或者过滤输入框内容的方法 // 用于处理或者过滤输入框内容的方法
formatter: { formatter: {
type: [Function, null], type: [Function, null],
default: uni.$u.props.textarea.formatter default: uni.$u.props.textarea.formatter,
}, },
// 是否忽略组件内对文本合成系统事件的处理 // 是否忽略组件内对文本合成系统事件的处理
ignoreCompositionEvent: { ignoreCompositionEvent: {
type: Boolean, type: Boolean,
default: true default: true,
} },
} },
} };

318
大唐会议前台1/uni_modules/uview-ui/components/u-textarea/u-textarea.vue

@ -1,47 +1,47 @@
<template> <template>
<view class="u-textarea" :class="textareaClass" :style="[textareaStyle]"> <view class="u-textarea" :class="textareaClass" :style="[textareaStyle]">
<textarea <textarea
class="u-textarea__field" class="u-textarea__field"
:value="innerValue" :value="innerValue"
:style="{ height: $u.addUnit(height) }" :style="{ height: $u.addUnit(height) }"
:placeholder="placeholder" :placeholder="placeholder"
:placeholder-style="$u.addStyle(placeholderStyle, 'string')" :placeholder-style="$u.addStyle(placeholderStyle, 'string')"
:placeholder-class="placeholderClass" :placeholder-class="placeholderClass"
:disabled="disabled" :disabled="disabled"
:focus="focus" :focus="focus"
:autoHeight="autoHeight" :autoHeight="autoHeight"
:fixed="fixed" :fixed="fixed"
:cursorSpacing="cursorSpacing" :cursorSpacing="cursorSpacing"
:cursor="cursor" :cursor="cursor"
:showConfirmBar="showConfirmBar" :showConfirmBar="showConfirmBar"
:selectionStart="selectionStart" :selectionStart="selectionStart"
:selectionEnd="selectionEnd" :selectionEnd="selectionEnd"
:adjustPosition="adjustPosition" :adjustPosition="adjustPosition"
:disableDefaultPadding="disableDefaultPadding" :disableDefaultPadding="disableDefaultPadding"
:holdKeyboard="holdKeyboard" :holdKeyboard="holdKeyboard"
:maxlength="maxlength" :maxlength="maxlength"
:confirmType="confirmType" :confirmType="confirmType"
:ignoreCompositionEvent="ignoreCompositionEvent" :ignoreCompositionEvent="ignoreCompositionEvent"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@linechange="onLinechange" @linechange="onLinechange"
@input="onInput" @input="onInput"
@confirm="onConfirm" @confirm="onConfirm"
@keyboardheightchange="onKeyboardheightchange" @keyboardheightchange="onKeyboardheightchange"
></textarea> ></textarea>
<text <text
class="u-textarea__count" class="u-textarea__count"
:style="{ :style="{
'background-color': disabled ? 'transparent' : '#fff', 'background-color': disabled ? 'transparent' : '#fff',
}" }"
v-if="count" v-if="count"
>{{ innerValue.length }}/{{ maxlength }}</text >{{ innerValue.length }}/{{ maxlength }}</text
> >
</view> </view>
</template> </template>
<script> <script>
import props from "./props.js"; import props from './props.js';
/** /**
* Textarea 文本域 * Textarea 文本域
* @description 文本域此组件满足了可能出现的表单信息补充编辑等实际逻辑的功能内置了字数校验等 * @description 文本域此组件满足了可能出现的表单信息补充编辑等实际逻辑的功能内置了字数校验等
@ -49,7 +49,7 @@ import props from "./props.js";
* *
* @property {String | Number} value 输入框的内容 * @property {String | Number} value 输入框的内容
* @property {String | Number} placeholder 输入框为空时占位符 * @property {String | Number} placeholder 输入框为空时占位符
* @property {String} placeholderClass 指定placeholder的样式类注意页面或组件的style中写了scoped时需要在类名前写/deep/ 默认 'input-placeholder' * @property {String} placeholderClass 指定placeholder的样式类注意页面或组件的style中写了scoped时需要在类名前写::v-deep 默认 'input-placeholder'
* @property {String | Object} placeholderStyle 指定placeholder的样式字符串/对象形式"color: red;" * @property {String | Object} placeholderStyle 指定placeholder的样式字符串/对象形式"color: red;"
* @property {String | Number} height 输入框高度默认 70 * @property {String | Number} height 输入框高度默认 70
* @property {String} confirmType 设置键盘右下角按钮的文字仅微信小程序App-vue和H5有效默认 'done' * @property {String} confirmType 设置键盘右下角按钮的文字仅微信小程序App-vue和H5有效默认 'done'
@ -80,12 +80,12 @@ import props from "./props.js";
* @example <u--textarea v-model="value1" placeholder="请输入内容" ></u--textarea> * @example <u--textarea v-model="value1" placeholder="请输入内容" ></u--textarea>
*/ */
export default { export default {
name: "u-textarea", name: 'u-textarea',
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
data() { data() {
return { return {
// //
innerValue: "", innerValue: '',
// //
focused: false, focused: false,
// valuewatchimmediatevalue // valuewatchimmediatevalue
@ -93,147 +93,147 @@ export default {
// value // value
changeFromInner: false, changeFromInner: false,
// //
innerFormatter: value => value innerFormatter: (value) => value,
} };
}, },
watch: { watch: {
value: { value: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.innerValue = newVal; this.innerValue = newVal;
/* #ifdef H5 */ /* #ifdef H5 */
// H5valueinput@input // H5valueinput@input
if ( if (
this.firstChange === false && this.firstChange === false &&
this.changeFromInner === false this.changeFromInner === false
) { ) {
this.valueChange(); this.valueChange();
} }
/* #endif */ /* #endif */
this.firstChange = false; this.firstChange = false;
// changeFromInnerfalse // changeFromInnerfalse
this.changeFromInner = false; this.changeFromInner = false;
}, },
}, },
},
computed: {
//
textareaClass() {
let classes = [],
{ border, disabled, shape } = this;
border === 'surround' &&
(classes = classes.concat(['u-border', 'u-textarea--radius']));
border === 'bottom' &&
(classes = classes.concat([
'u-border-bottom',
'u-textarea--no-radius',
]));
disabled && classes.push('u-textarea--disabled');
return classes.join(' ');
},
//
textareaStyle() {
const style = {};
// #ifdef APP-NVUE
// textareanvue
if (uni.$u.os() === 'android') {
style.paddingTop = '6px';
style.paddingLeft = '9px';
style.paddingBottom = '3px';
style.paddingRight = '6px';
}
// #endif
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
},
}, },
computed: { methods: {
//
textareaClass() {
let classes = [],
{ border, disabled, shape } = this;
border === "surround" &&
(classes = classes.concat(["u-border", "u-textarea--radius"]));
border === "bottom" &&
(classes = classes.concat([
"u-border-bottom",
"u-textarea--no-radius",
]));
disabled && classes.push("u-textarea--disabled");
return classes.join(" ");
},
//
textareaStyle() {
const style = {};
// #ifdef APP-NVUE
// textareanvue
if (uni.$u.os() === "android") {
style.paddingTop = "6px";
style.paddingLeft = "9px";
style.paddingBottom = "3px";
style.paddingRight = "6px";
}
// #endif
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
},
},
methods: {
// propsref // propsref
setFormatter(e) { setFormatter(e) {
this.innerFormatter = e this.innerFormatter = e;
},
onFocus(e) {
this.$emit('focus', e);
},
onBlur(e) {
this.$emit('blur', e);
// u-form
uni.$u.formValidate(this, 'blur');
}, },
onFocus(e) { onLinechange(e) {
this.$emit("focus", e); this.$emit('linechange', e);
}, },
onBlur(e) { onInput(e) {
this.$emit("blur", e); let { value = '' } = e.detail || {};
// u-form
uni.$u.formValidate(this, "blur");
},
onLinechange(e) {
this.$emit("linechange", e);
},
onInput(e) {
let { value = "" } = e.detail || {};
// //
const formatter = this.formatter || this.innerFormatter const formatter = this.formatter || this.innerFormatter;
const formatValue = formatter(value) const formatValue = formatter(value);
// propsinnerValue$nextTick // propsinnerValue$nextTick
this.innerValue = value this.innerValue = value;
this.$nextTick(() => { this.$nextTick(() => {
this.innerValue = formatValue; this.innerValue = formatValue;
this.valueChange(); this.valueChange();
}) });
}, },
// //
valueChange() { valueChange() {
const value = this.innerValue; const value = this.innerValue;
this.$nextTick(() => { this.$nextTick(() => {
this.$emit("input", value); this.$emit('input', value);
// value // value
this.changeFromInner = true; this.changeFromInner = true;
this.$emit("change", value); this.$emit('change', value);
// u-form // u-form
uni.$u.formValidate(this, "change"); uni.$u.formValidate(this, 'change');
}); });
}, },
onConfirm(e) { onConfirm(e) {
this.$emit("confirm", e); this.$emit('confirm', e);
}, },
onKeyboardheightchange(e) { onKeyboardheightchange(e) {
this.$emit("keyboardheightchange", e); this.$emit('keyboardheightchange', e);
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../libs/css/components.scss"; @import '../../libs/css/components.scss';
.u-textarea { .u-textarea {
border-radius: 4px; border-radius: 4px;
background-color: #fff; background-color: #fff;
position: relative; position: relative;
@include flex; @include flex;
flex: 1; flex: 1;
padding: 9px; padding: 9px;
&--radius { &--radius {
border-radius: 4px; border-radius: 4px;
} }
&--no-radius { &--no-radius {
border-radius: 0; border-radius: 0;
} }
&--disabled { &--disabled {
background-color: #f5f7fa; background-color: #f5f7fa;
} }
&__field { &__field {
flex: 1; flex: 1;
font-size: 15px; font-size: 15px;
color: $u-content-color; color: $u-content-color;
width: 100%; width: 100%;
} }
&__count { &__count {
position: absolute; position: absolute;
right: 5px; right: 5px;
bottom: 2px; bottom: 2px;
font-size: 12px; font-size: 12px;
color: $u-tips-color; color: $u-tips-color;
background-color: #ffffff; background-color: #ffffff;
padding: 1px 4px; padding: 1px 4px;
} }
} }
</style> </style>

Loading…
Cancel
Save