record.vue 9.9 KB

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