create2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view class="content-box">
  3. <view class="step-box">
  4. <view class="step-1">1</view>
  5. <view style="color: #d7d7d7;font-size: 54rpx;">------</view>
  6. <view class="step-1" style="background-color:#02a7f0">2</view>
  7. </view>
  8. <view class="info-box">
  9. <view class="info-value-box">
  10. <input type="text" placeholder="请输入活动标题" name="selfName">
  11. </view>
  12. </view>
  13. <view class="info-box">
  14. <view class="info-title-box">
  15. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  16. <text>选择活动类型</text>
  17. </view>
  18. <view class="info-value-box">
  19. <picker @change="bindPickerChange($event,'education')" :range="activeType" class="select-box" name="education" disabled="true">
  20. <view class="uni-input">{{activeValue}}</view>
  21. <image src="/static/arrow_down.svg" mode="aspectFill"></image>
  22. </picker>
  23. </view>
  24. </view>
  25. <view class="info-box">
  26. <view class="info-title-box">
  27. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  28. <text>选择活动时间</text>
  29. </view>
  30. <view class="info-value-box" style=" width: 50%; margin-top: 2%;">
  31. <uni-datetime-picker
  32. class="time-select-box"
  33. type="date"
  34. :value="single"
  35. @change="change"
  36. :clear-icon="false"
  37. />
  38. </view>
  39. </view>
  40. <view class="info-box">
  41. <view class="info-title-box">
  42. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  43. <text>设置可见范围</text>
  44. </view>
  45. <view style="margin-top: 2%;">
  46. <checkbox-group @change="checkboxChange" class="display-wrap">
  47. <label class="display-flex-start check-class" v-for="(item,index) in memberList" :key="item.value">
  48. <view>
  49. <checkbox :value="item.value" :checked="item.checked"/>
  50. </view>
  51. <view>{{item.name}}</view>
  52. </label>
  53. </checkbox-group>
  54. </view>
  55. </view>
  56. <view class="info-box">
  57. <view class="info-title-box">
  58. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  59. <text>上传活动通知图片(非必填)</text>
  60. </view>
  61. <view class="info-value-box">
  62. <view class="update_button display-flex">
  63. <view class="upload-box" @click="getImage('album')">
  64. <view class="img" style="margin-top: 2%;">
  65. <image src="/static/upload-photo.png" class="photo"></image>
  66. </view>
  67. </view>
  68. <view
  69. class="display-flex upload-box-photo"
  70. v-for="(item, index) in uploadList"
  71. :key="index"
  72. >
  73. <image :src="item" mode="aspectFit" style="width: 100%; height: 100%" @click="showLarge(item)"/>
  74. <image src="/static/del.png" class="del-icon"mode="aspectFit"
  75. style="width: 30rpx; height: 30rpx" @click="delPhoto(index)"></image>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="footer-box">
  81. <button type="primary" class="submit-bth" style="background-color: #aaaaaa;" @click="goStep()">上一步</button>
  82. <button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="goStep()">提交</button>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import md5 from "@/common/md5.js";
  88. // import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
  89. // var graceChecker = require("../../../common/graceChecker.js");
  90. export default {
  91. components: {
  92. },
  93. data() {
  94. return {
  95. isAuthPhone:getApp().globalData.user_phone,
  96. activeValue:'请选择',
  97. activeType:['组织建设','参政议政','学习培训','社会活动','其他'],
  98. memberList: [
  99. {
  100. value: 'CHN',
  101. name: '全部人员'
  102. },
  103. {
  104. value: 'CHN',
  105. name: '管理团队',
  106. checked: 'true'
  107. },
  108. {
  109. value: 'CHN',
  110. name: '下级支部管理团队'
  111. },
  112. {
  113. value: 'CHN',
  114. name: '下级支部成员'
  115. },
  116. ],
  117. }
  118. },
  119. onLoad() {
  120. //this.getTradeRequest();
  121. },
  122. onShow() {
  123. },
  124. // onShareAppMessage() {
  125. // return {
  126. // title: '分销小助手',
  127. // path:'/pages/index/index?scene=' + getApp().globalData.user_id
  128. // }
  129. // },
  130. methods: {
  131. bindDateChange(e){
  132. this.dateYear = e.target.value
  133. },
  134. bindDateMonthChange(e){
  135. this.dateMonth = this.arrayMonth[e.target.value]
  136. },
  137. change(e) {
  138. this.single = e;
  139. console.log("-change事件:", e);
  140. },
  141. goStep(){
  142. uni.navigateTo({
  143. url:'./create2'
  144. })
  145. },
  146. bindPickerChange(e,type) {
  147. let that = this;
  148. switch (type){
  149. case 'education':
  150. that.educationValue = that.educationArray[e.target.value]
  151. console.log(that.educationValue)
  152. break;
  153. case 'profession':
  154. that.professionValue = that.professionArray[e.target.value]
  155. break;
  156. case 'ends':
  157. that.endsValue = that.endsArray[e.target.value]
  158. break;
  159. }
  160. },
  161. submitRequest(params){
  162. console.log(params)
  163. let that = this;
  164. },
  165. getImage(type) {
  166. let that = this;
  167. // if (that.uploadList.length >= 9) {
  168. // uni.showToast({
  169. // title: "最多上传9张图片",
  170. // icon: "none",
  171. // duration: 2500,
  172. // });
  173. // return;
  174. // }
  175. uni.chooseImage({
  176. sourceType: [type],
  177. count: 1,
  178. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  179. success: (res) => {
  180. for (let i = 0; i < res.tempFilePaths.length; i++) {
  181. console.log(res.tempFilePaths[i])
  182. that.uploadList.push(res.tempFilePaths[i]);
  183. that.uploadFileRequest(res.tempFilePaths[i]);
  184. }
  185. },
  186. });
  187. },
  188. uploadFileRequest(fileVal) {
  189. uni.showLoading({
  190. title: "上传中",
  191. mask: true,
  192. });
  193. let that = this;
  194. let md5Sign = md5(
  195. "method=" +
  196. "upload" +
  197. "&timestamp=" +
  198. getApp().globalData.globalTimestamp +
  199. "&secret=" +
  200. getApp().globalData.secret
  201. );
  202. let url =
  203. getApp().globalData.shareUrl +
  204. "api/api.php" +
  205. "?method=upload&source=activity&id=1&timestamp=" +
  206. getApp().globalData.globalTimestamp +
  207. "&sign=" +
  208. md5Sign;
  209. uni.uploadFile({
  210. url: url, //需要设置为全局
  211. filePath: fileVal,
  212. name: "file",
  213. formData: {
  214. file: fileVal,
  215. },
  216. success: (res) => {
  217. let tmpres = JSON.parse(res.data);
  218. console.log(tmpres);
  219. uni.hideLoading();
  220. that.imgIdList.push(tmpres.data.id);
  221. },
  222. fail: (res) => {
  223. console.log("上传请求失败");
  224. console.log(res);
  225. },
  226. });
  227. },
  228. delPhoto(idx) {
  229. this.uploadList.splice(idx, 1);
  230. this.imgIdList.splice(idx, 1);
  231. },
  232. showLarge(src) {
  233. uni.previewImage({
  234. urls: [src],
  235. longPressActions: {
  236. itemList: ["发送给朋友", "保存图片"],
  237. success: function (data) {},
  238. fail: function (err) {
  239. console.log(err.errMsg);
  240. },
  241. },
  242. });
  243. },
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .content {
  249. &_list{
  250. display: flex;
  251. flex-direction: row;
  252. align-items: center;
  253. justify-content:space-around;
  254. &_lable{
  255. }
  256. &_content{
  257. flex: 1;
  258. width: auto;
  259. text-align: right;
  260. }
  261. }
  262. }
  263. .content-box {
  264. width: 100%;
  265. /* height: 100%; */
  266. display: flex;
  267. flex-direction: column;
  268. align-items: center;
  269. /* justify-content: center; */
  270. }
  271. .header-box {
  272. width: 85%;
  273. height:80rpx;
  274. border: .5px dotted #00A1B4;
  275. border-radius: 50rpx;
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. font-size: 24rpx;
  280. color:#00A1B4 ;
  281. /* font-family: PingFangSC-Regular; */
  282. margin-top: 2%;
  283. }
  284. .header-box image {
  285. width: 36rpx;
  286. height: 36rpx;
  287. margin-right: 1%;
  288. }
  289. .self-title-box {
  290. width: 90%;
  291. display: flex;
  292. align-items: center;
  293. font-size: 32rpx;
  294. letter-spacing: 2rpx;
  295. color:#3C3C3C ;
  296. /* font-family: SimHei; */
  297. margin: 4% auto;
  298. font-weight: bold;
  299. height: 50rpx;
  300. line-height: 50rpx;
  301. }
  302. .self-title-box image {
  303. width: 6rpx;
  304. height: 32rpx;
  305. margin-right: 2%;
  306. }
  307. .info-box {
  308. width: 90%;
  309. margin: 2% auto;
  310. display: flex;
  311. flex-direction: column;
  312. // align-items: center;
  313. // height: 180rpx;
  314. }
  315. .info-title-box {
  316. display: flex;
  317. align-items: center;
  318. font-size: 28rpx;
  319. }
  320. .info-title-box image{
  321. width: 15rpx;
  322. height: 15rpx;
  323. margin-right: 2%;
  324. }
  325. .info-value-box {
  326. width: 100%;
  327. }
  328. .info-value-box input {
  329. height: 88rpx;
  330. background: #f7f7f7;
  331. font-size: 26rpx;
  332. padding-left: 4%;
  333. margin: 2% auto;
  334. }
  335. .info-value-box picker {
  336. position: relative;
  337. }
  338. .info-value-box picker image {
  339. position: absolute;
  340. width: 25rpx;
  341. height: 25rpx;
  342. right: 10px;
  343. top: 30rpx;
  344. }
  345. .select-box {
  346. height: 80rpx;
  347. background: #f7f7f7;
  348. font-size: 26rpx;
  349. padding-left: 4%;
  350. margin: 2% auto;
  351. color: #888;
  352. line-height: 88rpx;
  353. }
  354. .info-gender-box {
  355. width: 75%;
  356. font-size: 28rpx;
  357. }
  358. .form-radio {
  359. transform: scale(0.6);
  360. }
  361. .padding-left-2 {
  362. // padding-left: 2%;
  363. }
  364. .margin-right-10 {
  365. margin-right: 10%;
  366. }
  367. .border-line-box {
  368. width: 100%;
  369. height: 20rpx;
  370. background: #f7f7f7;
  371. }
  372. .picker-box{
  373. display: flex;
  374. align-items: center;
  375. justify-content: space-between;
  376. height: 60rpx;
  377. line-height: 60rpx;
  378. background: #f7f7f7;
  379. height: 88rpx;
  380. line-height: 88rpx;
  381. background: #f7f7f7;
  382. font-size: 28rpx;
  383. padding-left: 4%;
  384. }
  385. .uni-input image {
  386. width: 40rpx;
  387. height: 40rpx;
  388. margin-right: 2%;
  389. float: right;
  390. }
  391. .textarea-box {
  392. background: #f7f7f7;
  393. min-height: 120rpx;
  394. font-size: 28rpx;
  395. margin: 5% auto;
  396. padding: 4%;
  397. margin-bottom: 8%;
  398. }
  399. .upload-box {
  400. display: flex;
  401. flex-flow: column;
  402. width: 25%;
  403. height: 100rpx;
  404. border-radius: 10rpx;
  405. padding-top: 15rpx;
  406. image {
  407. width: 100rpx;
  408. height:100rpx;
  409. }
  410. }
  411. .upload-box-photo {
  412. width: 25%;
  413. height: 100rpx;
  414. border-radius: 10rpx;
  415. padding-top: 15rpx;
  416. position: relative;
  417. margin-left: 10rpx;
  418. }
  419. .del-icon {
  420. position: absolute;
  421. right: 0;
  422. width: 30rpx;
  423. height: 30rpx;
  424. }
  425. .update_button {
  426. text-align: center;
  427. display: flex;
  428. flex-wrap: wrap;
  429. }
  430. .picker-class {
  431. border-radius: 10rpx;
  432. padding: 10rpx;
  433. width: 73%;
  434. font-size: 28rpx;
  435. background: #f5f5f5;
  436. }
  437. .picker-class image {
  438. width: 26rpx;
  439. height: 26rpx;
  440. }
  441. .submit-bth {
  442. width: 25%;
  443. font-size: 26rpx;
  444. margin: 0 0 5% 0;
  445. color: #fff;
  446. }
  447. .select-member {
  448. input {
  449. margin: 2% 2% 2% 0;
  450. height: 80rpx;
  451. line-height: 80rpx;
  452. }
  453. button {
  454. background-color: #169bd5;
  455. margin: 0;
  456. height: 60rpx;
  457. line-height: 60rpx;
  458. width: 20%;
  459. }
  460. }
  461. .check-class {
  462. margin-right:10rpx;
  463. transform:scale(.8);
  464. width: 48%;
  465. margin-top: 2%;
  466. }
  467. .step-box {
  468. display: flex;
  469. justify-content: space-evenly;
  470. align-items: center;
  471. width: 90%;
  472. margin: 5% 0 5% 0;
  473. }
  474. .step-1 {
  475. width: 60rpx;
  476. height: 60rpx;
  477. border-radius: 50%;
  478. background-color:#aaaaaa;
  479. text-align: center;
  480. line-height: 60rpx;
  481. color: #fff;
  482. }
  483. .footer-box {
  484. margin-top: 15%;
  485. width: 90%;
  486. display: flex;
  487. justify-content: space-evenly;
  488. }
  489. </style>