移动端
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

suishoupai.vue 11 KiB

2 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div class="home_wrapper">
  3. <img src="../../assets/images/sunVillage_info/complaint_add_icon_01.jpg" width="100%" alt="">
  4. <van-form @submit="onSubmit">
  5. <div class="list_main">
  6. <van-field readonly required label="上报内容" :border="false" />
  7. <div class="input_field">
  8. <van-field
  9. v-model="form.adviceContent"
  10. :rules="[{ required: true , message:'具体说明上报内容' }]"
  11. rows="4"
  12. autosize
  13. type="textarea"
  14. maxlength="1000"
  15. placeholder="具体说明上报内容"
  16. show-word-limit
  17. :border="false"
  18. style="padding: 5PX 0;"
  19. />
  20. </div>
  21. <van-field readonly required label="图片线索" :border="false" />
  22. <van-uploader
  23. v-model="fileList"
  24. style="margin-top: 10PX;"
  25. :upload-icon="uploadIcon1"
  26. :after-read="afterRead"
  27. @delete="deleteFile1"
  28. />
  29. <van-field readonly label="视频线索" :border="false" />
  30. <van-uploader
  31. v-model="videoList"
  32. style="margin-top: 10PX;"
  33. :upload-icon="uploadIcon2"
  34. accept="video/*"
  35. :after-read="afterReadVideo"
  36. @delete="deleteFileVideo"
  37. @click-preview="handleclicksc"
  38. />
  39. <van-popup v-model="showvideoplay" style="background: transparent;width: 70%;">
  40. <video
  41. controls
  42. preload="auto"
  43. style="width:100%;object-fit: contain;"
  44. :src="videourl"
  45. v-if="videourl"
  46. ></video>
  47. </van-popup>
  48. <van-field readonly required label="所在区域" :border="false" />
  49. <div class="input_field">
  50. <van-field
  51. readonly
  52. clickable
  53. placeholder="请选择所在区域"
  54. v-model="form.deptName"
  55. label-width="auto"
  56. :border="false"
  57. :rules="[{ required: true , message:'请选择所在区域' }]"
  58. right-icon="arrow-down"
  59. @click="showDept = true"
  60. />
  61. <van-popup v-model="showDept" position="bottom">
  62. <van-cascader
  63. v-model="villageValue"
  64. title="请选择"
  65. :options="deptOptions"
  66. @close="showDept = false"
  67. @change="onConfirmDept"
  68. active-color="#1989fa"
  69. :field-names="hcAreaInfoFieldName"
  70. />
  71. </van-popup>
  72. </div>
  73. <van-field readonly required label="线索地址(具体)" :border="false" />
  74. <div class="input_field">
  75. <van-field placeholder="请输入地址" v-model="form.adviceAddress" :border="false" />
  76. </div>
  77. <van-field readonly label="上报人(非必填)" :border="false" />
  78. <div class="input_field">
  79. <van-field placeholder="请输入姓名" v-model="form.adviceName" :border="false" />
  80. </div>
  81. <van-field readonly label="联系电话(非必填,我们将对号码保密)" :border="false" />
  82. <div class="input_field">
  83. <van-field placeholder="请输入电话" v-model="form.advicePhone" :border="false" />
  84. </div>
  85. <van-button size="small" round block type="primary" native-type="submit">
  86. 保存
  87. </van-button>
  88. </div>
  89. </van-form>
  90. <div style="height: 50px;"></div>
  91. </div>
  92. </template>
  93. <script>
  94. import {publicUpload, addAdvice, treeselect} from "@/api/sunVillage_info/fixedAssets";
  95. import Cookies from "js-cookie";
  96. import uploadIcon1 from '@/assets/images/sunVillage_info/complaint_add_icon_03.png'
  97. import uploadIcon2 from '@/assets/images/sunVillage_info/complaint_add_icon_04.png'
  98. import request from '@/utils/request'
  99. export default {
  100. name: "certificateList",
  101. data() {
  102. return {
  103. showvideoplay:false,
  104. videourl:'',
  105. form:{},
  106. //选中的值
  107. villageValue: "",
  108. hcAreaInfoFieldName: {
  109. text: "label",
  110. value: "value",
  111. children: "children",
  112. },
  113. uploadIcon1:uploadIcon1,
  114. uploadIcon2:uploadIcon2,
  115. openPic:[],
  116. queryParams:{
  117. bookId:'',
  118. deptId:'',
  119. },
  120. openPic2:[],
  121. deptOptions:[],
  122. fileList:[],
  123. videoList:[],
  124. videoUrl:[],
  125. adviceTypeOptions:[],
  126. showDept:false,
  127. showAdviceType:false,
  128. adviceType:''
  129. };
  130. },
  131. created() {
  132. this.queryParams.bookId = Cookies.get('bookId');
  133. this.queryParams.deptId = Cookies.get('deptId');
  134. this.houseGetDicts("communicate_type").then((response) => {
  135. this.adviceTypeOptions = response.data;
  136. // this.form.otherTypeText = this.selectDictLabel(response.data, this.$route.query.type);
  137. // this.form.otherName = Cookies.get('deptName')+this.selectDictLabel(response.data, this.$route.query.type);
  138. });
  139. treeselect().then((res) => {
  140. if (res.code == 200) {
  141. this.deptOptions = res.data;
  142. }
  143. });
  144. },
  145. methods: {
  146. handleclicksc(file) {
  147. console.log(file)
  148. this.videourl = file.content
  149. this.showvideoplay = true;
  150. },
  151. onConfirmDept({ selectedOptions }){
  152. this.form.deptId = selectedOptions[selectedOptions.length-1].id;
  153. this.form.deptName = selectedOptions.map((option) => option.label).join('/');
  154. },
  155. onConfirmAdviceType(e){
  156. this.form.adviceType = e.dictValue;
  157. this.adviceType = e.dictLabel;
  158. this.showAdviceType = false;
  159. console.log(e)
  160. },
  161. onSubmit(){
  162. var that = this;
  163. console.log(that.openPic2)
  164. if (that.openPic2.length<1){
  165. that.$notify({ type: 'warning', message: '图片线索不能为空' });
  166. return;
  167. }
  168. that.form.fileUrl = that.openPic2.join(',')
  169. that.form.videoUrl = that.videoUrl.join(',')
  170. that.form.adviceTime = that.format(new Date(),'yyyy-MM-dd HH:mm:ss')
  171. this.form.title="投诉建议"
  172. this.form.adviceType="1"
  173. addAdvice(that.form).then((r1) => {
  174. if (r1.code == 200){
  175. that.$notify({ type: 'success', message: '提交成功' });
  176. if(this.$route.query.type != 'code'){
  177. location.reload();
  178. }else{
  179. setTimeout(function(){
  180. history.back(-1);
  181. },2000)
  182. }
  183. }
  184. })
  185. },
  186. afterRead(file) {
  187. console.log(file instanceof Array)
  188. if (file instanceof Array){//判断是否为数组,单张图片为array,多张为数组,数组返回true否则为false
  189. file.map(res=>{
  190. this.openPic.push(res.file);
  191. let params1 = new FormData();
  192. params1.append("file", res.file);
  193. publicUpload(params1).then((r1) => {
  194. this.openPic2.push(r1.fileName);
  195. })
  196. })
  197. }else{
  198. this.openPic.push(file);
  199. let params1 = new FormData();
  200. params1.append("file", file.file);
  201. publicUpload(params1).then((r1) => {
  202. this.openPic2.push(r1.fileName);
  203. })
  204. }
  205. },
  206. deleteFile1(detail){
  207. this.openPic2.splice(detail.index,1)
  208. // this.form.openPic.splice(index,1);
  209. },
  210. deleteFileVideo(detail){
  211. this.videoUrl.splice(detail.index,1)
  212. // this.form.openPic.splice(index,1);
  213. },
  214. afterReadVideo(file){
  215. const that = this;
  216. let formData = new FormData(); // 为上传文件定义一个formData对象
  217. formData.append("file", file.file);
  218. publicUpload(formData).then((r1) => {
  219. this.videoUrl.push(r1.fileName);
  220. })
  221. },
  222. },
  223. }
  224. </script>
  225. <style scoped lang="scss">
  226. /deep/ .van-button--primary{
  227. background: #2ec6a9;
  228. border: none;
  229. width: 40%;
  230. margin:5vh auto 2vh;
  231. }
  232. .van-radio:last-child{
  233. margin-right: 0;
  234. }
  235. .input_field{
  236. border: 1px solid #d8d8d8;
  237. padding: 8PX 15PX;
  238. border-radius: 8PX;
  239. margin: 10PX 0;
  240. }
  241. .home_wrapper{
  242. background: #f1f2f2;
  243. min-height: 100vh;
  244. width: 100vw;
  245. .header_main {
  246. height: 116px;
  247. background: url('../../assets/images/sunVillage_info/list_head_green.png') no-repeat;
  248. background-size: 100% 100%;
  249. position: fixed;
  250. top: 0;
  251. left: 0;
  252. width: 100%;
  253. font-size: 36px;
  254. line-height: 116px;
  255. text-align: center;
  256. color: #fff;
  257. position: relative;
  258. .return_btn {
  259. width: 24px;
  260. height: 43.2px;
  261. background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  262. background-size: 20px 36px;
  263. position: absolute;
  264. left: 38px;
  265. top: 36px;
  266. }
  267. }
  268. .release_head{
  269. height: 90px;
  270. padding:0 23px;
  271. display: flex;
  272. align-items: center;
  273. font-size: 26px;
  274. color: #929292;
  275. .people{
  276. flex: 1;
  277. display: flex;
  278. align-items: center;
  279. .icon{
  280. width: 24px;
  281. height: 21px;
  282. background: url('../../assets/images/sunVillage_info/details_icon_1.png') no-repeat;
  283. background-size: 100% 100%;
  284. display: block;
  285. margin-right: 8px;
  286. }
  287. }
  288. .time{
  289. flex: 1;
  290. display: flex;
  291. align-items: center;
  292. justify-content:flex-end;
  293. .icon{
  294. width: 25px;
  295. height: 25px;
  296. background: url('../../assets/images/sunVillage_info/details_icon_2.png') no-repeat;
  297. background-size: 100% 100%;
  298. display: block;
  299. margin-right: 8px;
  300. }
  301. }
  302. }
  303. .release_conetnt{
  304. padding:0 22px;
  305. font-size: 32px;
  306. color: #252525;
  307. line-height: 44px;
  308. img{
  309. max-width: 100%;
  310. margin-bottom: 16px;
  311. }
  312. p{
  313. margin-bottom: 16px;
  314. }
  315. }
  316. .list_main{
  317. padding: 75px 25px 25px;
  318. background: #ffffff url("../../assets/images/sunVillage_info/complaint_add_icon_02.jpg") no-repeat center top;
  319. background-size: auto 60px;
  320. width: 94%;
  321. margin: 25px auto 0;
  322. border-radius: 15PX;
  323. box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
  324. }
  325. .tit{
  326. font-size: 16PX;
  327. padding: 15PX 10PX;
  328. }
  329. /deep/ .van-cell{
  330. padding-left: 0!important;
  331. padding-right: 0!important;
  332. padding-bottom: 0!important;
  333. line-height: 1;
  334. &:nth-child(1){
  335. padding-top: 0;
  336. }
  337. }
  338. /deep/ .van-field__label{
  339. padding-left: 10PX;
  340. width: auto;
  341. display: flex;
  342. align-items: center;
  343. border-left: 4PX solid #2ec6a9;
  344. }
  345. /deep/ .van-cell--required::before{
  346. left: 22%;
  347. }
  348. /deep/ .van-field__error-message{
  349. display: none;
  350. }
  351. }
  352. </style>