123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view>
-
- <form action="" >
-
- <view class="form-item margin-top">
- <view class="title">
- <text class="necessary">*</text>
- 上报名称:
- </view>
- <input type="text">
- </view>
-
- <view class="form-item margin-top">
- <view class="title">
- <text class="necessary">*</text>
- 巡检状态:
- </view>
- <radio-group name="gender" @change="radioChange">
- <label class="margin-right-xs">
- <radio value="2" checked /><text>正常</text>
- </label>
- <label class="margin-right-xs">
- <radio value="3" /><text>异常</text>
- </label>
- <label class="margin-right-xs">
- <radio value="2" /><text>供电</text>
- </label>
- <label>
- <radio value="3" /><text>其他</text>
- </label>
- </radio-group>
-
- </view>
-
- <view class="form-item margin-top">
- <view class="title">
- <text class="necessary">*</text>
- 上传图片:
- </view>
-
- <view style="width:500rpx">
- <view class="cu-form-group">
- <view class="grid col-4 grid-square flex-sub">
- <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
- <image :src="imgList[index]" mode="aspectFill"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
- <text class='cuIcon-cameraadd'></text>
- </view>
- </view>
- </view>
- </view>
- </view>
-
- <view class="form-item margin-top">
- <view class="title">
- <text class="necessary">*</text>
- 巡检描述:
- </view>
- <textarea maxlength="-1" @input="textareaAInput" placeholder="" width="250"></textarea>
- </view>
-
- <view class="btn-area submitBottomBtn padding-lr-sm">
- <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
- </view>
-
- </form>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
-
- imgList: [],
- }
- },
- methods: {
- radioChange(e) {
- console.log('type:' + e.detail.value);
- this.radioOne = e.detail.value;
- },
-
- ChooseImage() {
- uni.chooseImage({
- count: 4, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album'], //从相册选择
- success: (res) => {
- if (this.imgList.length != 0) {
- this.imgList = this.imgList.concat(res.tempFilePaths)
- } else {
- this.imgList = res.tempFilePaths
- }
- }
- });
- },
-
- ViewImage(e) {
- uni.previewImage({
- urls: this.imgList,
- current: e.currentTarget.dataset.url
- });
- },
- DelImg(e) {
- uni.showModal({
- title: '删除',
- content: '确定要删除此图片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- this.imgList.splice(e.currentTarget.dataset.index, 1)
- }
- }
- })
- },
-
- }
- }
- </script>
- <style lang="scss">
-
-
- </style>
|