123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <view class="publish">
- <textarea class="content" :value="content" placeholder="请输入内容" />
- <view class="img-list">
- <view class="img-box" v-for="(item,index) in imgList" @click="handleImage(index)" :key="index">
- <image class="img" :src="item" mode=""></image>
- <view class="del-btn" @click.stop="del(index)">
- <u-icon name="close" color="#fff" size="28"></u-icon>
- </view>
- </view>
- <view class="add-image" @click="chooseImage">
- <u-icon name="plus" color="#999" size="58"></u-icon>
- </view>
- </view>
- <button class="publish-btn" type="default" @click="publish">发布</button>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- content: '',
- imgList:[]
- }
- },
- methods: {
- handleImage(current){
- uni.previewImage({
- current,
- urls:this.imgList,
- indicator:'number'
- })
- },
- del(index){
- this.imgList.splice(index,1)
- },
- publish() {
- uni.navigateTo({
- url:'./community'
- })
- },
- chooseImage(){
- let that = this
- uni.chooseImage({
- success(res){
- that.imgList = that.imgList.concat(res.tempFilePaths).slice(0,9)
- console.log(that.imgList);
- }
- })
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .publish{
- padding: 30rpx;
- .content{
- width: 100%;
- padding: 30rpx;
- height: 308rpx;
- box-sizing: border-box;
- background: #F9F9F9;
- border-radius: 16rpx;
- }
- .img-list{
- display: flex;
- flex-wrap: wrap;
- margin-top: 20rpx;
-
- .img-box{
- width: 212rpx;
- height: 212rpx;
- border-radius: 16rpx;
- margin: 0 16rpx 20rpx 0;
- position: relative;
- .img{
- width: 212rpx;
- height: 212rpx;
- border-radius: 16rpx;
- }
- .del-btn{
- position: absolute;
- top: 0%;
- right: 0;
- transform: translate(50%,-50%);
- background: rgba(0,0,0,0.6);
- border-radius: 50%;
- }
- }
- .add-image{
- width: 212rpx;
- height: 212rpx;
- background: #F9F9F9;
- border-radius: 16rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- .publish-btn{
- width: 560rpx;
- height: 96rpx;
- line-height: 96rpx;
- border-radius: 48rpx;
- background: linear-gradient(270deg, #3074F8 0%, #568FFF 100%);
- box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
- color: #fff;
- font-size: 32rpx;
- margin-top: 300rpx;
- }
- }
- </style>
|