|                                                                                                                                                                                                                                     |  | <template>  <view>    <uv-popup ref="popup" mode="bottom" bgColor="none" >      <view class="popup__view">        <view class="flex header">          <view class="title">标记有我</view>          <button class="btn" @click="close">关闭</button>        </view>        <view class="form">          <uv-form             ref="form"            :model="form"            :rules="rules"            errorType="toast"          >            <view class="form-item">              <uv-form-item prop="imagePath" :customStyle="formItemStyle">                <view class="form-item-label">                  <image class="icon" src="@/pages_order/static/icon-require.png" mode="widthFix"></image>                  上传本人照片                </view>                <view class="form-item-content">                  <button class="flex btn btn-avatar" @click="onUpload">                    <view v-if="form.imagePath" class="avatar">											<image class="img" :src="form.imagePath" mode="aspectFill"></image>											<view class="flex mask">	        							<image class="icon" src="@/pages_order/static/icon-change.png" mode="widthFix" />											</view>										</view>										<view v-else class="flex avatar is-empty">        							<image class="icon" src="@/static/image/icon-plus.png" mode="widthFix" />										</view>                  </button>                </view>              </uv-form-item>            </view>          </uv-form>        </view>        <view class="flex footer">          <button class="flex btn btn-palin" @click="jumpToGrowing">成长档案</button>          <button class="flex btn btn-primary" @click="onSubmit">开始标记</button>        </view>      </view>    </uv-popup>  </view></template>
<script>  export default {    data() {      return {        activityId: null,        form: {          imagePath: null,        },        rules: {          'imagePath': {            type: 'string',            required: true,            message: '请上传图片',          },        },        formItemStyle: { padding: 0 },      }    },    methods: {      open(activityId) {        this.activityId = activityId        this.$refs.popup.open();      },      close() {        this.$refs.popup.close();      },      onUpload() {        uni.chooseImage({          count: 1,          sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
          success: res => {            let image = res.tempFilePaths[0] // 将选择的图片赋值给我们定义的cover
                this.$Oss.ossUpload(image)            .then(url => {              this.form.imagePath = url            })          }        });      },      async onSubmit() {        try {          await this.$refs.form.validate()
          const {            imagePath,          } = this.form
          const params = {            activityId: this.activityId,            imagePath,          }
          const result = await this.$fetch('queryMarkmeList', params)
          uni.showToast({            icon: 'success',            title: '标记成功',          });
          this.$emit('submitted', result)
          this.$store.commit('setMarkmeList', result)
          uni.navigateTo({            url: '/pages_order/growing/activity/markList',            success: () => {              this.close()            }          })
        } catch (err) {          console.log('onSave err', err)        }      },      jumpToGrowing(id) {        // todo
  			this.$utils.navigateTo(`/pages/index/growing`)      },    },  }</script>
<style lang="scss" scoped>
  .popup__view {    width: 100vw;    display: flex;    flex-direction: column;    box-sizing: border-box;    background: #FFFFFF;    border-top-left-radius: 32rpx;    border-top-right-radius: 32rpx;  }
  .header {    position: relative;    width: 100%;    padding: 24rpx 0;    box-sizing: border-box;    border-bottom: 2rpx solid #EEEEEE;
    .title {      font-family: PingFang SC;      font-weight: 500;      font-size: 34rpx;      line-height: 1.4;      color: #181818;    }
    .btn {      font-family: PingFang SC;      font-weight: 500;      font-size: 32rpx;      line-height: 1.4;      color: #8B8B8B;      position: absolute;      top: 26rpx;      left: 40rpx;    }
  }    .form {    max-height: 75vh;    padding: 32rpx 40rpx;    box-sizing: border-box;    overflow-y: auto;
    &-item {      padding: 8rpx 0 6rpx 0;            & + & {        padding-top: 24rpx;        border-top: 2rpx solid #EEEEEE;      }
      &-label {        margin-bottom: 14rpx;        display: flex;        align-items: center;        font-family: PingFang SC;        font-weight: 400;        font-size: 26rpx;        line-height: 1.4;        color: #181818;
        .icon {          margin-right: 8rpx;          width: 16rpx;          height: auto;        }      }
      &-content {            .text {          padding: 2rpx 0;          font-family: PingFang SC;          font-weight: 400;          font-size: 32rpx;          line-height: 1.4;
          &.placeholder {            color: #C6C6C6;          }        }
      }    }  }
  .footer {    column-gap: 32rpx;    width: 100%;    padding: 32rpx 40rpx;    box-sizing: border-box;    border-top: 2rpx solid #F1F1F1;
    .btn {      flex: 1;      padding: 14rpx 0;      box-sizing: border-box;      font-family: PingFang SC;      font-weight: 500;      font-size: 36rpx;      line-height: 1.4;      border-radius: 41rpx;
      &-palin {        color: #252545;        border: 2rpx solid #252545;      }
      &-primary {        color: #FFFFFF;        background: linear-gradient(to right, #21FEEC, #019AF9);        border: 2rpx solid #00A9FF;      }    }  }
  .btn-avatar {		display: inline-flex;	}
	.avatar {		position: relative;		width: 200rpx;		height: 200rpx;		border-radius: 24rpx;		overflow: hidden;
		.img {			width: 100%;			height: 100%;		}				.mask {			position: absolute;			top: 0;			left: 0;			width: 100%;			height: 100%;			background: #00000080;			border-radius: 24rpx;
			.icon {				width: 64rpx;				height: 64rpx;			}		}
		&.is-empty {			background: #F7F8FA;						.icon {				width: 61rpx;				height: auto;			}
		}	}</style>
 |