planDetail.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <form action="" >
  4. <view class="form-item margin-top">
  5. <view class="title">
  6. <text class="necessary">*</text>
  7. 上报名称:
  8. </view>
  9. <input type="text">
  10. </view>
  11. <view class="form-item margin-top">
  12. <view class="title">
  13. <text class="necessary">*</text>
  14. 巡检状态:
  15. </view>
  16. <radio-group name="gender" @change="radioChange">
  17. <label class="margin-right-xs">
  18. <radio value="2" checked /><text>正常</text>
  19. </label>
  20. <label class="margin-right-xs">
  21. <radio value="3" /><text>异常</text>
  22. </label>
  23. <label class="margin-right-xs">
  24. <radio value="2" /><text>供电</text>
  25. </label>
  26. <label>
  27. <radio value="3" /><text>其他</text>
  28. </label>
  29. </radio-group>
  30. </view>
  31. <view class="form-item margin-top">
  32. <view class="title">
  33. <text class="necessary">*</text>
  34. 上传图片:
  35. </view>
  36. <view style="width:500rpx">
  37. <view class="cu-form-group">
  38. <view class="grid col-4 grid-square flex-sub">
  39. <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
  40. <image :src="imgList[index]" mode="aspectFill"></image>
  41. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
  42. <text class='cuIcon-close'></text>
  43. </view>
  44. </view>
  45. <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
  46. <text class='cuIcon-cameraadd'></text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="form-item margin-top">
  53. <view class="title">
  54. <text class="necessary">*</text>
  55. 巡检描述:
  56. </view>
  57. <textarea maxlength="-1" @input="textareaAInput" placeholder="" width="250"></textarea>
  58. </view>
  59. <view class="btn-area submitBottomBtn padding-lr-sm">
  60. <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
  61. </view>
  62. </form>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. imgList: [],
  70. }
  71. },
  72. methods: {
  73. radioChange(e) {
  74. console.log('type:' + e.detail.value);
  75. this.radioOne = e.detail.value;
  76. },
  77. ChooseImage() {
  78. uni.chooseImage({
  79. count: 4, //默认9
  80. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  81. sourceType: ['album'], //从相册选择
  82. success: (res) => {
  83. if (this.imgList.length != 0) {
  84. this.imgList = this.imgList.concat(res.tempFilePaths)
  85. } else {
  86. this.imgList = res.tempFilePaths
  87. }
  88. }
  89. });
  90. },
  91. ViewImage(e) {
  92. uni.previewImage({
  93. urls: this.imgList,
  94. current: e.currentTarget.dataset.url
  95. });
  96. },
  97. DelImg(e) {
  98. uni.showModal({
  99. title: '删除',
  100. content: '确定要删除此图片吗?',
  101. cancelText: '取消',
  102. confirmText: '确定',
  103. success: res => {
  104. if (res.confirm) {
  105. this.imgList.splice(e.currentTarget.dataset.index, 1)
  106. }
  107. }
  108. })
  109. },
  110. }
  111. }
  112. </script>
  113. <style lang="scss">
  114. </style>