add.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view >
  3. <uni-forms ref="form" :model="datainfo">
  4. <view class="address">
  5. <view class="adrbox flex1 flexdc">
  6. <view class="flex1">
  7. <view class="chtop flexc">
  8. <view class="line"></view>
  9. <view>基本信息</view>
  10. </view>
  11. <view class="plr15">
  12. </uni-forms-item>
  13. <uni-forms-item label="标题" required name="title">
  14. <view class="flexc">
  15. <uni-easyinput v-model="datainfo.title" :inputBorder='false' placeholder="请输入标题信息" />
  16. <view class="rimg"></view>
  17. </view>
  18. </uni-forms-item>
  19. <uni-easyinput type="textarea" autoHeight v-model="datainfo.content" :inputBorder='false' placeholder="请详细描述您的投诉建议内容(最多可输入200字哦)" />
  20. <view class="voice mb28">
  21. <view class="flexc">
  22. <image :src="voice"></image>
  23. 语音输入
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 图片 -->
  28. <view class="imgs">
  29. <!-- <view class="img" @click="getPreview">
  30. <image :src="photo" class="pico"></image>
  31. <image :src="del" class="del" @click="getDelFn"></image>
  32. </view> -->
  33. <block v-if="phofile&&phofile.length">
  34. <view class="img" v-for="(ite,idx) in phofile" :key="idx" @click="getPreview(idx,phofile)">
  35. <image :src="baseUrl+ite" class="pico"></image>
  36. <image :src="del" class="del" @click.stop="getDelFn(idx)"></image>
  37. </view>
  38. </block>
  39. <view class="addbox" @click="getaddImage">
  40. <image :src="photo" class="pico"></image>
  41. <view>添加图片</view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="plr15 flex0 mt30">
  46. <view class="rhbtn " @click="getSubmit">提交信息</view>
  47. </view>
  48. </view>
  49. </view>
  50. </uni-forms>
  51. <loading></loading>
  52. </view>
  53. </template>
  54. <script>
  55. import config from '@/config.js'
  56. import { addressPermi, addressRole } from "@/utils/permission"; // 权限判断函数
  57. import {uploadIdentify,uploadmore} from '@/utils/common.js'
  58. import {suggestionAdd,suggestionlPut} from "@/api/work/news.js"
  59. export default{
  60. components:{},
  61. data(){
  62. return{
  63. rimg:require('@/static/images/rimg.png'),
  64. check: require('@/mine/static/check.png'),
  65. ncheck: require('@/mine/static/ncheck.png'),
  66. voice: require('@/work/static/voice.png'),
  67. photo:require("@/work/static/service/photo.png"),
  68. del:require('@/work/static/service/rdel.png'),
  69. datainfo:{
  70. // "suggestionId":"投诉建议ID",
  71. "title":"",//投诉建议标题
  72. "content":"",//投诉建议内容
  73. "images":"",//投诉照片
  74. // "status":"投诉建议状态:pending(待回复)、replied(已回复)",
  75. "replyContent":"",//投诉建议的回复内容
  76. // "type":"投诉建议类型",
  77. // "isPublic":"投诉建议是否公开:Y(公开)、N(不公开)",
  78. // "isDel":"是否删除:Y(删除)、N(不删除)"
  79. },
  80. phofile:[],
  81. baseUrl:config.baseUrl,
  82. }
  83. },
  84. onLoad: function() {
  85. },
  86. methods:{
  87. addressPermi, addressRole,
  88. getAddFn(){
  89. // this.$tab.navigateTo("/mine/pages/house/addaddress")
  90. },
  91. getTabFn(val){
  92. this.tabval=val
  93. },
  94. getDataFn(){
  95. return
  96. var params={
  97. pageSize:this.pageSize,
  98. pageNum: this.pageNum,
  99. }
  100. params.noticeType=this.tabidx
  101. getNoticeList(params).then(res=>{
  102. if(res.code==200){
  103. }else{
  104. this.$toast(res.msg)
  105. }
  106. })
  107. },
  108. getSubmit(){
  109. var that=this;
  110. var params=JSON.parse(JSON.stringify(this.datainfo))
  111. var phofile=JSON.parse(JSON.stringify(this.phofile))
  112. if(phofile&&phofile.length){
  113. params.images=this.phofile.join(',');
  114. }
  115. if(!params.title){
  116. this.$toast("请输入标题")
  117. return
  118. }
  119. suggestionAdd(params).then(res=>{
  120. if(res.code==200){
  121. this.$toast("新增成功")
  122. setTimeout(function(){
  123. uni.$emit("refSuggestion")
  124. uni.navigateBack({
  125. delta:1
  126. })
  127. },1500)
  128. }
  129. })
  130. },
  131. getPreview(idx,arr) {
  132. var newArr=[];
  133. arr.forEach(ite=>{
  134. var ds=this.baseUrl+ite
  135. newArr.push(ds)
  136. })
  137. uni.previewImage({
  138. urls: newArr,
  139. current:idx,
  140. success: function(data) {},
  141. fail: function(err) {}
  142. });
  143. },
  144. getDelFn(idx){
  145. var that=this;
  146. uni.showModal({
  147. title: '确认删除',
  148. content: "是否确认删除",
  149. cancelText: '取消',
  150. confirmText: '确认',
  151. success: function(res) {
  152. if (res.confirm) {
  153. that.phofile.splice(idx,1)
  154. } else if (res.cancel) {
  155. }
  156. }
  157. });
  158. },
  159. getaddImage(e){
  160. let that = this;
  161. let file =[],count=9
  162. uni.chooseImage({
  163. // count: 1,
  164. success:function(res){
  165. let img= res.tempFilePaths;
  166. if(img.length + file.length > count){
  167. uni.showToast({
  168. title: '最多上传'+count+'张图片',
  169. icon: 'none',
  170. duration: 2000
  171. })
  172. }else{
  173. let imglen = res.tempFilePaths.length;
  174. var fuwufile = [];
  175. uploadmore('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  176. that.phofile = that.phofile.concat(rs);
  177. })
  178. }
  179. }
  180. });
  181. },
  182. }
  183. }
  184. </script>
  185. <style>
  186. page{background: #F3F3F0;}
  187. </style>
  188. <style lang="scss" scoped>
  189. .address /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  190. .address /deep/ .uni-forms-item:last-child{border-bottom: none;}
  191. .address /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;padding-left: 12rpx;}
  192. .address /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  193. .address /deep/ .uni-easyinput__content-textarea{min-height: 140rpx;font-size: 26rpx;
  194. border-radius: 10rpx;padding: 20rpx 14rpx;text-align: left;}
  195. .address /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  196. .address /deep/ .uni-input-input{font-size: 26rpx;}
  197. .address /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  198. .address /deep/ .is-required{font-size: 26rpx;color: #F40027;margin-right: 4rpx;}
  199. .address /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  200. .address{min-height: 100vh;padding: 20rpx 18rpx 30rpx;display: flex;flex-direction: column;}
  201. .adrbox{background: #FFFFFF;border-radius: 20rpx;padding-bottom: 100rpx;
  202. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  203. image{width: 100%;height: 100%;}
  204. }
  205. &.mjbox{
  206. padding: 36rpx 24rpx 18rpx;
  207. .tit{font-weight: bold;font-size: 26rpx;color: #272727;padding-left: 18rpx;}
  208. .adrlist{
  209. view{font-weight: bold;font-size: 26rpx;color: #666666;min-width: 198rpx;padding: 0 10rpx;box-sizing: border-box;margin: 0 12rpx 24rpx;height: 64rpx;display: flex;align-items: center;justify-content: center;border-radius: 10rpx;border: 2rpx solid #C1C1C1;
  210. &.act{background: #DFEAFF;border: 2rpx solid #0256FD;color: #0256FD;}
  211. }
  212. }
  213. }
  214. .chtop{margin-bottom: 8rpx;padding-top: 32rpx;
  215. view{font-weight: bold;font-size: 28rpx;color: #272727;}
  216. .line{width: 14rpx;height: 48rpx;background: #0256FD;border-radius:0 12rpx 12rpx 0;margin-right: 18rpx;}
  217. }
  218. .voice{font-weight: 500;display: flex;justify-content:flex-end;align-items: center;margin-top: 40rpx;font-size: 24rpx;color: #45CB99;
  219. image{width: 24rpx;height: 24rpx;margin-right: 8rpx;}
  220. }
  221. .imgs{display: flex;align-items: center;flex-wrap: wrap;padding: 0 24rpx;
  222. .img{width: 142rpx;height:142rpx;border-radius: 20rpx;margin: 0 12rpx 20rpx 12rpx;position: relative;
  223. // &:nth-of-type(2n){margin-right: 0;}
  224. }
  225. .pico{width: 100%;height: 100%;border-radius: 20rpx;}
  226. .del{width: 24rpx;height: 24rpx;position: absolute;right: 0;top: 0;}
  227. .addbox{background: #F0F0F0;border-radius: 20rpx;display: flex;align-items: center;flex-direction: column;width: 142rpx;height:142rpx;justify-content: center;margin:0 12rpx 20rpx 12rpx;
  228. image{width: 48rpx;height: 42rpx;margin-bottom: 12rpx;}
  229. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  230. }
  231. }
  232. .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
  233. }
  234. </style>