add.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div class="addActivity">
  3. <div class="reportBody">
  4. <ul class="detailUl">
  5. <li class="detailLi2">
  6. <span class="liName" style="margin-bottom: 16rpx"><span style="color: red">*</span> &nbsp;活动主题</span>
  7. <van-field
  8. :value="form.contant"
  9. autosize
  10. type="textarea"
  11. placeholder="请填写活动名称"
  12. class="myField"
  13. maxlength="50"
  14. show-word-limit
  15. />
  16. </li>
  17. <li class="detailLi2">
  18. <span class="liName">
  19. 选择类别
  20. </span>
  21. <div class="detailLi2Box">
  22. <div class="detailLi2BoxTop">
  23. <div class="checkItem" :class="item.isCheck?'checked':''" v-for="item in checkList" @click="clickCheck(item)">{{item.name}}</div>
  24. </div>
  25. </div>
  26. </li>
  27. <li class="detailLi2">
  28. <span class="liName">
  29. 主题图
  30. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片/视频上传限20M内,最多1张)</span>
  31. </span>
  32. <div class="detailLi2Box" style="margin: 24rpx 0 0 0">
  33. <van-uploader
  34. :max-count="6"
  35. @delete="deleteRYXXZP"
  36. :file-list="fileList"
  37. @after-read="uploadRYXXZP"
  38. :show-upload="true"
  39. />
  40. </div>
  41. </li>
  42. <li class="detailLi" style="border-bottom: none">
  43. <span class="liName">
  44. <span style="color: red">*</span>&nbsp; 联系电话
  45. </span>
  46. <input placeholder="请填写" v-model="phone" class="liIpt">
  47. </li>
  48. </ul>
  49. </div>
  50. <div class="reportBody">
  51. <ul class="detailUl">
  52. <li class="detailLi2">
  53. <span class="liName" style="margin-bottom: 16rpx"><span style="color: red">*</span>&nbsp; 活动举办</span>
  54. <van-field
  55. :value="form.contant"
  56. autosize
  57. type="textarea"
  58. placeholder="请填写活动举办相关信息"
  59. class="myField"
  60. maxlength="2000"
  61. show-word-limit
  62. />
  63. </li>
  64. <li class="detailLi2">
  65. <span class="liName" style="margin-bottom: 16rpx">
  66. <span style="color: red">*</span>&nbsp; 活动内容
  67. </span>
  68. <van-field
  69. :value="form.contant"
  70. autosize
  71. type="textarea"
  72. placeholder="请填写活动举办相关信息"
  73. class="myField"
  74. maxlength="2000"
  75. show-word-limit
  76. />
  77. <span class="liName" style="margin: 24rpx 0">
  78. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片上传限20M内,最多6张)</span>
  79. </span>
  80. <div class="detailLi2Box">
  81. <van-uploader
  82. :max-count="6"
  83. @delete="deleteRYXXZP"
  84. :file-list="fileList"
  85. @after-read="uploadRYXXZP"
  86. :show-upload="true"
  87. />
  88. </div>
  89. </li>
  90. <li class="detailLi2">
  91. <span class="liName" style="margin-bottom: 16rpx">
  92. <span style="color: red">*</span>&nbsp; 活动时间
  93. </span>
  94. <div class="choosTimeBox">
  95. <input placeholder="请选择年月日时分" class="timeIpt" disabled v-model="time1" @click="showTime('actStartTime')">
  96. <span class="midZ">至</span>
  97. <input placeholder="请选择年月日时分" class="timeIpt" disabled v-model="time2" @click="showTime('actEndTime')">
  98. </div>
  99. </li>
  100. <li class="detailLi2" style="border-bottom: none">
  101. <span class="liName" style="margin-bottom: 16rpx">
  102. <span style="color: red">*</span>&nbsp; 活动地址
  103. </span>
  104. <div class="placeBox">
  105. <input placeholder="详细地点" class="timeIpt" v-model="place">
  106. <van-icon name="location" style="color: rgba(51, 51, 51, 0.90);font-size: 30rpx"/>
  107. </div>
  108. </li>
  109. </ul>
  110. </div>
  111. <div class="reportBody">
  112. <ul class="detailUl">
  113. <li class="detailLi2">
  114. <span class="liName" style="margin-bottom: 16rpx"><span style="color: red">*</span>&nbsp; 报名条件</span>
  115. <van-field
  116. :value="form.contant"
  117. autosize
  118. type="textarea"
  119. placeholder="请填写活动举办相关信息"
  120. class="myField"
  121. maxlength="2000"
  122. show-word-limit
  123. />
  124. </li>
  125. <li class="detailLi2">
  126. <span class="liName" style="margin-bottom: 16rpx">
  127. <span style="color: red">*</span>&nbsp; 报名时间
  128. </span>
  129. <div class="choosTimeBox">
  130. <input placeholder="请选择年月日时分" class="timeIpt" disabled v-model="regTime1" @click="showTime('regStartTime')">
  131. <span class="midZ">至</span>
  132. <input placeholder="活动开始时间" class="timeIpt" disabled v-model="time1" style="background: white">
  133. <!-- <span>活动开始时间</span>-->
  134. </div>
  135. </li>
  136. <li class="detailLi2" style="border-bottom: none">
  137. <span class="liName" style="margin-bottom: 16rpx">活动参与</span>
  138. <van-field
  139. :value="form.contant"
  140. autosize
  141. type="textarea"
  142. placeholder="请填写限制人数等"
  143. class="myField"
  144. maxlength="2000"
  145. show-word-limit
  146. />
  147. </li>
  148. </ul>
  149. </div>
  150. <div class="buttonBox">
  151. <button class="btn zcBtn">暂存</button>
  152. <button class="btn fbBtn">发布</button>
  153. </div>
  154. <van-popup
  155. :show="timeShow"
  156. position="bottom"
  157. custom-style="height: 50%;"
  158. >
  159. <van-datetime-picker
  160. type="datetime"
  161. :value="currentDate"
  162. :formatter="formatter"
  163. @cancel="timeShow=false"
  164. @confirm="selectTime"
  165. />
  166. </van-popup>
  167. </div>
  168. </template>
  169. <script>
  170. export default {
  171. data(){
  172. return{
  173. timeShow:false,
  174. isCheck:false,
  175. isCheck2:false,
  176. time1:'',
  177. time1Str:'',
  178. time2Str:'',
  179. time2:'',
  180. regTime1:'',
  181. regTime1Str:'',
  182. place:'',
  183. currentDate: new Date().getTime(),
  184. form:{
  185. contant:''
  186. },
  187. phone:'',
  188. checkList:[
  189. {name:'培训',isCheck:true},
  190. {name:'法务',isCheck:false},
  191. {name:'财税',isCheck:false},
  192. {name:'私募',isCheck:false},
  193. ],
  194. fileList:[],
  195. optionsType:'',
  196. timePickerType:''
  197. }
  198. },
  199. onLoad(options) {
  200. console.log(options);
  201. this.optionsType = options.type
  202. if (options.type==='待处理'){
  203. uni.setNavigationBarTitle({
  204. title: '报修处理',
  205. });
  206. }else if(options.type==='已处理'){
  207. uni.setNavigationBarTitle({
  208. title: '报修详情',
  209. });
  210. }else {
  211. uni.setNavigationBarTitle({
  212. title: '报修派单',
  213. });
  214. }
  215. },
  216. methods:{
  217. clickCheck(item){
  218. item.isCheck = !item.isCheck
  219. },
  220. selectTime(e){
  221. const dateString = this.timestampToDate(e.detail);
  222. if(this.timePickerType === 'actStartTime'){
  223. this.time1Str = e.detail
  224. if (this.time2Str){
  225. if (this.time1Str >= this.time2Str){
  226. this.$showToast("请选择合理时间");
  227. return
  228. }else{
  229. this.time1 = dateString
  230. }
  231. }else{
  232. this.time1 = dateString
  233. }
  234. }else if(this.timePickerType === 'actEndTime'){
  235. this.time2Str = e.detail
  236. if (this.time1Str){
  237. if (this.time1Str >= this.time2Str){
  238. this.$showToast("请选择合理时间");
  239. return
  240. }else{
  241. this.time2 = dateString
  242. }
  243. }else{
  244. this.time2 = dateString
  245. }
  246. }else if(this.timePickerType === 'regStartTime'){
  247. this.regTime1Str = e.detail
  248. if (this.time1Str){
  249. if (this.time1Str <= this.regTime1Str){
  250. this.$showToast("请选择合理时间");
  251. return
  252. }else{
  253. this.regTime1 = dateString
  254. }
  255. }else{
  256. this.regTime1 = dateString
  257. }
  258. }
  259. this.timeShow = false
  260. // console.log(dateString)
  261. },
  262. showTime(e){
  263. this.timePickerType = e
  264. this.timeShow = true
  265. },
  266. deleteRYXXZP(event) {
  267. this.fileList.splice(event.detail.index, 1);
  268. this.$forceUpdate();
  269. },
  270. uploadRYXXZP(event) {
  271. console.log(event)
  272. let that = this;
  273. const { file } = event.detail;
  274. uni.uploadFile({
  275. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  276. filePath: file.url,
  277. name: "file",
  278. formData: { user: "test" },
  279. success(res) {
  280. // 上传完成需要更新 fileList
  281. let data = JSON.parse(res.data);
  282. that.fileList.push({
  283. imgUrl: "/FileController/download/" + data.data[0],
  284. id: data.data[0],
  285. url:
  286. that.$constant.BASE_URI +
  287. "/FileController/download/" +
  288. data.data[0],
  289. isImage: true,
  290. });
  291. },
  292. fail(res) {},
  293. });
  294. },
  295. // 时间选择单位
  296. formatter(type, val) {
  297. if (type === 'year') {
  298. return `${val}年`;
  299. } else if (type === 'month') {
  300. return `${val}月`;
  301. }else if (type === 'day') {
  302. return `${val}日`;
  303. }else if (type === 'hour') {
  304. return `${val}时`;
  305. }else if (type === 'minute') {
  306. return `${val}分`;
  307. }
  308. return val;
  309. },
  310. // 时间戳转换方法
  311. timestampToDate(timestamp) {
  312. const date = new Date(timestamp); // 如果timestamp是字符串,确保它是整数:parseInt(timestamp)
  313. const year = date.getFullYear();
  314. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  315. const day = date.getDate().toString().padStart(2, '0');
  316. const hours = date.getHours().toString().padStart(2, '0');
  317. const minutes = date.getMinutes().toString().padStart(2, '0');
  318. const seconds = date.getSeconds().toString().padStart(2, '0');
  319. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  320. },
  321. }
  322. }
  323. </script>
  324. <style lang="scss">
  325. .addActivity{
  326. .reportBody{
  327. margin-top: 24rpx;
  328. padding: 0rpx 36rpx;
  329. background: white;
  330. //height: 1416rpx;
  331. box-sizing: border-box;
  332. .record {
  333. display: flex;
  334. align-items: center;
  335. justify-content: flex-end;
  336. color: #0365F9;
  337. font-size: 32rpx;
  338. .recordImg{
  339. width: 36rpx;
  340. height: 36rpx;
  341. padding: 5rpx 0 0 10rpx;
  342. }
  343. }
  344. .detailUl{
  345. margin-top: 20rpx;
  346. .liName{
  347. font-size: 32rpx;
  348. color: rgba(51, 51, 51, 1);
  349. white-space: nowrap;
  350. }
  351. .liIpt{
  352. text-align: right;
  353. }
  354. .detailLi{
  355. display: flex;
  356. justify-content: space-between;
  357. align-items: center;
  358. padding: 32rpx 0;
  359. border-bottom: 2rpx solid #E6E6E6;
  360. .liInfo{
  361. display: inline-block;
  362. text-align: right;
  363. max-width: 428rpx;
  364. color: rgba(102, 102, 102, 1);
  365. font-size: 32rpx;
  366. line-height: 38rpx;
  367. display: flex;
  368. align-items: center;
  369. .radio{
  370. margin-left: 64rpx;
  371. }
  372. .phoneIcon{
  373. width: 64rpx;
  374. height: 64rpx;
  375. margin-left: 24rpx;
  376. }
  377. }
  378. }
  379. .detailLi2{
  380. display: flex;
  381. flex-direction: column;
  382. padding: 32rpx 0;
  383. border-bottom: 2rpx solid #E6E6E6;
  384. .detailLi2BoxTop{
  385. display: flex;
  386. flex-wrap: wrap;
  387. justify-content: space-between;
  388. margin: 12rpx 0;
  389. .checkItem{
  390. width: 160rpx;
  391. height: 64rpx;
  392. font-size: 28rpx;
  393. color: #666666;
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. background: #F5F7FA;
  398. border-radius: 8rpx;
  399. margin: 12rpx 0;
  400. }
  401. .checked{
  402. background: #0365F9;
  403. color: white;
  404. }
  405. }
  406. .choosTimeBox{
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. .timeIpt{
  411. width: 300rpx;
  412. height: 96rpx;
  413. background: rgba(245, 247, 250, 1);
  414. font-size: 32rpx;
  415. border-radius: 8rpx;
  416. padding: 0 20rpx;
  417. box-sizing: border-box;
  418. }
  419. .midZ{
  420. color: rgba(51, 51, 51, 1);
  421. font-size: 32rpx;
  422. }
  423. }
  424. .placeBox{
  425. display: flex;
  426. justify-content: space-between;
  427. align-items: center;
  428. margin-top: 8rpx;
  429. }
  430. }
  431. }
  432. }
  433. .van-cell {
  434. background: #F5F7FA !important;
  435. border-radius: 8rpx;
  436. font-size: 28rpx;
  437. }
  438. .buttonBox{
  439. display: flex;
  440. justify-content: center;
  441. .btn{
  442. width: 240rpx;
  443. height: 80rpx;
  444. display: flex;
  445. border-radius: 8rpx;
  446. align-items: center;
  447. justify-content: center;
  448. margin: 48rpx 16rpx 150rpx 16rpx;
  449. color: white;
  450. letter-spacing: 2rpx;
  451. text-indent: 2rpx;
  452. &::after{
  453. border: none;
  454. }
  455. }
  456. .zcBtn{
  457. background: rgba(254, 134, 67, 1);
  458. }
  459. .fbBtn{
  460. background: #0365F9;
  461. }
  462. }
  463. }
  464. </style>