self_info.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. <template>
  2. <view class="content-box">
  3. <!-- <view class="header-box">
  4. <image src="/static/tips.png" mode="aspectFill"></image>
  5. <text>温馨提示:请填写以下信息,填写后信息不可修改</text>
  6. </view> -->
  7. <form @submit="formSubmit" style="width: 100%">
  8. <!-- <view class="self-title-box">
  9. <image src="/static/rect-icon.png" mode="aspectFill"></image>
  10. <text>登记信息</text>
  11. </view> -->
  12. <view class="info-box">
  13. <view class="info-title-box">
  14. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  15. <text>姓名</text>
  16. </view>
  17. <view class="info-value-box">
  18. <input type="text" placeholder="请输入姓名" name="selfName" :value="userName" >
  19. </view>
  20. </view>
  21. <view class="info-box">
  22. <view class="info-title-box">
  23. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  24. <text>手机号</text>
  25. </view>
  26. <view class="info-value-box">
  27. <input type="tel" placeholder="请输入手机号" name="selfTel" :value="userPhone" disabled="true">
  28. </view>
  29. </view>
  30. <!-- <view class="info-box">
  31. <view class="info-title-box">
  32. <image src="/static/require-icon.png" mode="aspectFill"></image>
  33. <text>个人照片</text>
  34. </view>
  35. <view class="info-value-box">
  36. <image :src="userHeadImg" mode="aspectFit" style="width: 120rpx;height: 120rpx;border-radius: 10rpx;" @click="showLarge(userHeadImg)"></image>
  37. <view class="update_button display-flex">
  38. <view class="upload-box" @click="getImage('album')">
  39. <view class="img">
  40. <image src="/static/photo.png" class="photo"></image>
  41. </view>
  42. </view>
  43. <view class="display-flex upload-box-photo" v-for="(item, index) in uploadList" :key="index">
  44. <image :src="item" mode="aspectFit" style="width: 100%; height: 100%" @click="showLarge(item)"/>
  45. <image src="/static/del.png" class="del-icon"mode="aspectFit"
  46. style="width: 30rpx; height: 30rpx" @click="delPhoto(index)"></image>
  47. </view>
  48. </view>
  49. </view>
  50. </view> -->
  51. <view class="img-container">
  52. <label for="img">个人照片</label>
  53. <view class="note-image-box">
  54. <view class="note-image-item" v-for="(item,index) in uploadList" :key="index">
  55. <view class="close-icon" @click="delPhoto(index)">
  56. <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
  57. </view>
  58. <view class="image-box" @click="showLarge(item)">
  59. <image :src="item" mode="aspectFill"></image>
  60. </view>
  61. </view>
  62. <view v-if="uploadList.length < 1" class="note-image-item" @click="getImage('album')">
  63. <view class="image-box">
  64. <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="info-box">
  70. <view class="info-title-box">
  71. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  72. <text>入党年月</text>
  73. </view>
  74. <view class="info-value-box">
  75. <view class="uni-list title-date-box">
  76. <view class="uni-list-cell">
  77. <view class="uni-list-cell-db display-flex-start">
  78. <picker mode="date" fields="year" @change="bindDateChange" class="picker-class">
  79. <view class="uni-input display-between items-center">{{dateYear}}年<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  80. </picker>
  81. <picker :range="arrayMonth" :value="dateMonth" @change="bindDateMonthChange" class="picker-class" style="margin-left: 2%;">
  82. <view class="uni-input display-between items-center" style="color: #707070;">{{dateMonth}}月<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  83. </picker>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="info-box">
  90. <view class="info-title-box">
  91. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  92. <text>性别</text>
  93. </view>
  94. <view class="info-gender-box">
  95. <radio-group @change="radioCheck" class="padding-left-2">
  96. <label class="radio margin-right-10"><radio value="1" :checked="userSex==='1'" color="#00A1B4" class="form-radio"/>男</label>
  97. <label class="radio"><radio value="2" :checked="userSex==='2'" color="#00A1B4" class="form-radio"/>女</label>
  98. </radio-group>
  99. </view>
  100. </view>
  101. <view class="info-box">
  102. <view class="info-title-box">
  103. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  104. <text>民族</text>
  105. </view>
  106. <view class="info-value-box">
  107. <input type="text" placeholder="请输入民族" name="selfNation" :value="userNation" >
  108. </view>
  109. </view>
  110. <view class="info-box">
  111. <view class="info-title-box">
  112. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  113. <text>籍贯</text>
  114. </view>
  115. <view class="info-value-box">
  116. <input type="text" placeholder="请输入籍贯" name="selfNative" :value="userNative" >
  117. </view>
  118. </view>
  119. <view class="info-box">
  120. <view class="info-title-box">
  121. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  122. <text>出生日期</text>
  123. </view>
  124. <view class="info-value-box">
  125. <uni-datetime-picker
  126. class="time-select-box"
  127. type="date"
  128. :value="userBorn"
  129. @change="change"
  130. :clear-icon="false"
  131. @maskClick="dateMask"
  132. />
  133. </view>
  134. </view>
  135. <view class="info-box">
  136. <view class="info-title-box">
  137. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  138. <text>学历</text>
  139. </view>
  140. <view class="info-value-box">
  141. <picker @change="bindPickerChange($event,'education')" :range="educationArray" class="select-box" >
  142. <view class="uni-input">{{educationValue}}</view>
  143. <image src="/static/arrow_down.svg" mode="aspectFill"></image>
  144. </picker>
  145. </view>
  146. </view>
  147. <view class="info-box">
  148. <view class="info-title-box">
  149. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  150. <text>工作单位</text>
  151. </view>
  152. <view class="info-value-box">
  153. <input type="text" name="selfOffice" :value="userOffice" >
  154. </view>
  155. </view>
  156. <view class="info-box">
  157. <view class="info-title-box">
  158. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  159. <text>职务</text>
  160. </view>
  161. <view class="info-value-box">
  162. <input type="text" name="selfPosition" :value="userPosition">
  163. </view>
  164. </view>
  165. <view class="info-box">
  166. <view class="info-title-box">
  167. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  168. <text>职称</text>
  169. </view>
  170. <view class="info-value-box">
  171. <input type="text" :value="userTitle" name="selfTitle">
  172. </view>
  173. </view>
  174. <view style="display: flex;justify-content: space-evenly;">
  175. <!-- <button type="default" class="submit-bth" style="background-color: #aaaaaa;">清空</button> -->
  176. <button type="primary" class="submit-bth" style="background-color: #169bd5;" formType="submit">提交</button>
  177. </view>
  178. </form>
  179. </view>
  180. </template>
  181. <script>
  182. import md5 from "@/common/md5.js";
  183. // import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
  184. // var graceChecker = require("../../../common/graceChecker.js");
  185. export default {
  186. components: {
  187. },
  188. data() {
  189. return {
  190. dateYear:new Date().getFullYear(),
  191. dateMonth:new Date().getMonth() + 1,
  192. arrayMonth:["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"],
  193. title: 'Hello',
  194. userName:'',
  195. userPhone:getApp().globalData.user_phone,
  196. userHeadImg:getApp().globalData.user_headUrl,
  197. detailObj:{},
  198. shareContent:'',
  199. shareCode:'',
  200. storeImg:'',
  201. isAuthPhone:getApp().globalData.user_phone,
  202. userSex:'1',
  203. userNation:'',
  204. userNative:'',
  205. userBorn:'',
  206. userOffice:'',
  207. userPosition:'',
  208. userTitle:'',
  209. txt: '请选择',
  210. educationValue:'请选择',
  211. educationArray: ['博士研究生','硕士研究生','本科','大专','中专'],
  212. professionValue:'请选择',
  213. professionArray:[],
  214. endsValue:'请选择',
  215. endsArray:[],
  216. provinceArray: [],
  217. addressShow: false,
  218. form: {
  219. province: '',
  220. city: '',
  221. },
  222. address: '',
  223. addressObj:{},
  224. userBrand:'',
  225. addressDetail:'',
  226. loginObj:{},
  227. uploadList: [],
  228. imgIdList: [],
  229. headImgId:'',
  230. educationObj:{
  231. '1':'中专',
  232. '2':'大专',
  233. '3':'本科',
  234. '4':'硕士研究生',
  235. '5':'博士研究生'
  236. },
  237. educationObjEdit:{
  238. '中专':'1',
  239. '大专':'2',
  240. '本科':'3',
  241. '硕士研究生':'4',
  242. '博士研究生':'5'
  243. }
  244. }
  245. },
  246. onLoad() {
  247. this.getMemberInfo();
  248. },
  249. onShow() {
  250. },
  251. // onShareAppMessage() {
  252. // return {
  253. // title: '分销小助手',
  254. // path:'/pages/index/index?scene=' + getApp().globalData.user_id
  255. // }
  256. // },
  257. methods: {
  258. getMemberInfo() {
  259. let md5Sign = md5(
  260. "method=" +"member" + "&timestamp=" + getApp().globalData.globalTimestamp +
  261. "&secret=" + getApp().globalData.secret
  262. );
  263. let url = getApp().globalData.shareUrl +"api/api.php" +
  264. "?method=member&action=info&timestamp=" +
  265. getApp().globalData.globalTimestamp +
  266. "&sign=" +
  267. md5Sign;
  268. uni.request({
  269. url: url,
  270. method: "POST",
  271. header: {
  272. "content-type": "application/x-www-form-urlencoded",
  273. },
  274. data: {
  275. openid: getApp().globalData.open_id,
  276. },
  277. success: (res) => {
  278. if (res.data.code === 200) {
  279. let userInfoObj = res.data.data;
  280. this.userName = userInfoObj.name;
  281. this.dateYear = userInfoObj.jion_year;
  282. this.dateMonth = userInfoObj.jion_month;
  283. this.userNation = userInfoObj.nation;
  284. this.userNative = userInfoObj.native;
  285. this.userSex = userInfoObj.sex;
  286. if (this.userSex == '0')
  287. {
  288. this.userSex = '2';
  289. }
  290. if(userInfoObj.birth_day && userInfoObj.birth_day!='0'){
  291. this.userBorn = (userInfoObj.birth_day).substr(0,4) + '-' + (userInfoObj.birth_day).substr(4,2) + '-' + (userInfoObj.birth_day).substr(6);
  292. }
  293. this.educationValue = this.educationObj[userInfoObj.education_level];
  294. this.userOffice = userInfoObj.office;
  295. this.userPosition = userInfoObj.position;
  296. this.userTitle = userInfoObj.technical_title;
  297. if(userInfoObj.pic_url){
  298. userInfoObj.pic_url = getApp().globalData.shareUrl + userInfoObj.pic_url
  299. this.uploadList.push(userInfoObj.pic_url);
  300. }
  301. }
  302. },
  303. fail: () => {
  304. console.log("连接失败");
  305. },
  306. });
  307. },
  308. bindDateChange(e){
  309. this.dateYear = e.target.value
  310. },
  311. bindDateMonthChange(e){
  312. this.dateMonth = this.arrayMonth[e.target.value]
  313. },
  314. change(e) {
  315. console.log('show')
  316. this.userBorn = e;
  317. },
  318. dateMask(param){
  319. console.log(param)
  320. },
  321. showDateModal(){
  322. console.log('show')
  323. },
  324. getImage(type) {
  325. let that = this;
  326. if (that.uploadList.length === 1) {
  327. uni.showToast({
  328. title: "最多上传1张图片",
  329. icon: "none",
  330. duration: 2500,
  331. });
  332. return;
  333. }
  334. uni.chooseImage({
  335. sourceType: [type],
  336. count: 1,
  337. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  338. success: (res) => {
  339. for (let i = 0; i < res.tempFilePaths.length; i++) {
  340. console.log(res.tempFilePaths[i])
  341. that.uploadList.push(res.tempFilePaths[i]);
  342. that.uploadFileRequest(res.tempFilePaths[i]);
  343. }
  344. },
  345. });
  346. },
  347. uploadFileRequest(fileVal) {
  348. uni.showLoading({
  349. title: "上传中",
  350. mask: true,
  351. });
  352. let that = this;
  353. let md5Sign = md5(
  354. "method=" +"member_upload" +"&timestamp=" +
  355. getApp().globalData.globalTimestamp +
  356. "&secret=" + getApp().globalData.secret
  357. );
  358. let url =
  359. getApp().globalData.shareUrl +
  360. "api/api.php" +
  361. "?method=member_upload&timestamp=" +
  362. getApp().globalData.globalTimestamp +
  363. "&sign=" +
  364. md5Sign;
  365. uni.uploadFile({
  366. url: url, //需要设置为全局
  367. filePath: fileVal,
  368. name: "file",
  369. formData: {
  370. file: fileVal,
  371. openid:getApp().globalData.open_id,
  372. },
  373. success: (res) => {
  374. let tmpres = JSON.parse(res.data);
  375. uni.hideLoading();
  376. that.imgIdList.push(tmpres.data.id);
  377. that.headImgId = tmpres.data.id;
  378. },
  379. fail: (res) => {
  380. console.log("上传请求失败");
  381. console.log(res);
  382. },
  383. });
  384. },
  385. delPhoto(idx) {
  386. this.uploadList.splice(idx, 1);
  387. this.imgIdList.splice(idx, 1);
  388. },
  389. showLarge(src) {
  390. uni.previewImage({
  391. urls: [src],
  392. longPressActions: {
  393. itemList: ["发送给朋友", "保存图片"],
  394. success: function (data) {},
  395. fail: function (err) {
  396. console.log(err.errMsg);
  397. },
  398. },
  399. });
  400. },
  401. radioCheck(e){
  402. console.log(e.target.value)
  403. this.userSex = e.target.value;
  404. //this.gender = e.target.value == '0' ? '男' : '女';
  405. },
  406. changeCity(data) {
  407. this.txt = data.data.join('')
  408. console.log(data.data.join(''))
  409. },
  410. bindPickerChange(e,type) {
  411. this.educationValue = this.educationArray[e.target.value]
  412. console.log(this.educationValue)
  413. console.log(this.educationObjEdit[this.educationValue])
  414. },
  415. formSubmit(e) {
  416. //进行表单检查
  417. var formData = e.detail.value;
  418. console.log(formData)
  419. if(!formData.selfName){
  420. uni.showToast({
  421. title:'请填写姓名',
  422. duration:2500,
  423. icon:'none'
  424. })
  425. }else {
  426. this.submitRequest(formData)
  427. }
  428. },
  429. submitRequest(params){
  430. console.log(this.userTitle,this.headImgId)
  431. let md5Sign = md5(
  432. "method=" +"member" + "&timestamp=" + getApp().globalData.globalTimestamp +
  433. "&secret=" + getApp().globalData.secret
  434. );
  435. let url = getApp().globalData.shareUrl +"api/api.php" +
  436. "?method=member&action=info_update&timestamp=" +
  437. getApp().globalData.globalTimestamp +
  438. "&sign=" +
  439. md5Sign;
  440. uni.request({
  441. url: url,
  442. method: "POST",
  443. header: {
  444. "content-type": "application/x-www-form-urlencoded",
  445. },
  446. data: {
  447. openid: getApp().globalData.open_id,
  448. name:params.selfName,
  449. jion_year :this.dateYear,
  450. jion_month :this.dateMonth,
  451. sex : this.userSex,
  452. birth_day: this.userBorn,
  453. office :params.selfOffice,
  454. position:params.selfPosition,
  455. nation:params.selfNation,
  456. native:params.selfNative,
  457. technical_title:params.selfTitle,
  458. education_level:this.educationObjEdit[this.educationValue],
  459. photo_attach_id:this.headImgId,
  460. },
  461. success: (res) => {
  462. if (res.data.code === 200) {
  463. uni.showToast({
  464. title:'修改成功',
  465. duration:2500,
  466. icon:'none',
  467. })
  468. setTimeout(()=>{uni.navigateBack({delta:1})},500)
  469. }
  470. },
  471. fail: () => {
  472. console.log("连接失败");
  473. },
  474. });
  475. },
  476. }
  477. }
  478. </script>
  479. <style lang="scss" scoped>
  480. .content {
  481. &_list{
  482. display: flex;
  483. flex-direction: row;
  484. align-items: center;
  485. justify-content:space-around;
  486. &_lable{
  487. }
  488. &_content{
  489. flex: 1;
  490. width: auto;
  491. text-align: right;
  492. }
  493. }
  494. }
  495. .content-box {
  496. width: 100%;
  497. /* height: 100%; */
  498. display: flex;
  499. flex-direction: column;
  500. align-items: center;
  501. /* justify-content: center; */
  502. }
  503. .header-box {
  504. width: 85%;
  505. height:80rpx;
  506. border: .5px dotted #00A1B4;
  507. border-radius: 50rpx;
  508. display: flex;
  509. justify-content: center;
  510. align-items: center;
  511. font-size: 24rpx;
  512. color:#00A1B4 ;
  513. /* font-family: PingFangSC-Regular; */
  514. margin-top: 2%;
  515. }
  516. .header-box image {
  517. width: 36rpx;
  518. height: 36rpx;
  519. margin-right: 1%;
  520. }
  521. .self-title-box {
  522. width: 90%;
  523. display: flex;
  524. align-items: center;
  525. font-size: 32rpx;
  526. letter-spacing: 2rpx;
  527. color:#3C3C3C ;
  528. /* font-family: SimHei; */
  529. margin: 4% auto;
  530. font-weight: bold;
  531. height: 50rpx;
  532. line-height: 50rpx;
  533. }
  534. .self-title-box image {
  535. width: 6rpx;
  536. height: 32rpx;
  537. margin-right: 2%;
  538. }
  539. .info-box {
  540. width: 90%;
  541. margin: 3% auto;
  542. display: flex;
  543. align-items: center;
  544. // height: 180rpx;
  545. }
  546. .info-title-box {
  547. width: 20%;
  548. display: flex;
  549. align-items: center;
  550. font-size: 26rpx;
  551. }
  552. .info-title-box image{
  553. width: 15rpx;
  554. height: 15rpx;
  555. margin-right: 2%;
  556. }
  557. .info-value-box {
  558. width: 75%;
  559. }
  560. .info-value-box input {
  561. height: 88rpx;
  562. background: #f7f7f7;
  563. font-size: 28rpx;
  564. padding-left: 4%;
  565. margin: 2% auto;
  566. }
  567. .info-value-box picker {
  568. position: relative;
  569. }
  570. .info-value-box picker image {
  571. position: absolute;
  572. width: 25rpx;
  573. height: 25rpx;
  574. right: 10px;
  575. top: 30rpx;
  576. }
  577. .select-box {
  578. height: 80rpx;
  579. background: #f7f7f7;
  580. font-size: 28rpx;
  581. padding-left: 4%;
  582. margin: 2% auto;
  583. color: #888;
  584. line-height: 88rpx;
  585. }
  586. .info-gender-box {
  587. width: 75%;
  588. font-size: 28rpx;
  589. }
  590. .form-radio {
  591. transform: scale(0.6);
  592. }
  593. .padding-left-2 {
  594. // padding-left: 2%;
  595. }
  596. .margin-right-10 {
  597. margin-right: 10%;
  598. }
  599. .border-line-box {
  600. width: 100%;
  601. height: 20rpx;
  602. background: #f7f7f7;
  603. }
  604. .picker-box{
  605. display: flex;
  606. align-items: center;
  607. justify-content: space-between;
  608. height: 60rpx;
  609. line-height: 60rpx;
  610. background: #f7f7f7;
  611. height: 88rpx;
  612. line-height: 88rpx;
  613. background: #f7f7f7;
  614. font-size: 28rpx;
  615. padding-left: 4%;
  616. }
  617. .uni-input image {
  618. width: 40rpx;
  619. height: 40rpx;
  620. margin-right: 2%;
  621. float: right;
  622. }
  623. .textarea-box {
  624. background: #f7f7f7;
  625. min-height: 120rpx;
  626. font-size: 28rpx;
  627. margin: 5% auto;
  628. padding: 4%;
  629. margin-bottom: 8%;
  630. }
  631. .upload-box {
  632. display: flex;
  633. flex-flow: column;
  634. width: 25%;
  635. background-color: #e0e0e0;
  636. height: 100rpx;
  637. border-radius: 10rpx;
  638. padding-top: 15rpx;
  639. image {
  640. margin-top: 10rpx;
  641. width: 60rpx !important;
  642. height: 60rpx !important;
  643. }
  644. }
  645. .upload-box-photo {
  646. width: 25%;
  647. height: 100rpx;
  648. border-radius: 10rpx;
  649. padding-top: 15rpx;
  650. position: relative;
  651. margin-left: 10rpx;
  652. }
  653. .del-icon {
  654. position: absolute;
  655. right: 0;
  656. width: 30rpx;
  657. height: 30rpx;
  658. }
  659. .update_button {
  660. text-align: center;
  661. display: flex;
  662. flex-wrap: wrap;
  663. }
  664. .picker-class {
  665. border-radius: 10rpx;
  666. padding: 10rpx;
  667. width: 73%;
  668. font-size: 28rpx;
  669. background: #f5f5f5;
  670. }
  671. .picker-class image {
  672. width: 26rpx;
  673. height: 26rpx;
  674. }
  675. .submit-bth {
  676. width: 25%;
  677. font-size: 26rpx;
  678. margin: 0 0 5% 0;
  679. color: #fff;
  680. }
  681. .img-container{
  682. display: flex;
  683. width: 90%;
  684. margin: 3% auto;
  685. font-size: 26rpx;
  686. label {
  687. width: 20%;
  688. }
  689. .note-image-box{
  690. width: 75%;
  691. display: flex;
  692. flex-wrap: wrap;
  693. .note-image-item{
  694. position: relative;
  695. //这两个百分比很关键
  696. width: 33.33%;
  697. height: 0;
  698. padding-top: 33.33%;
  699. box-sizing: border-box;
  700. .close-icon{
  701. display: flex;
  702. justify-content: center;
  703. align-items: center;
  704. position: absolute;
  705. right: 0;
  706. top: 0;
  707. width: 22px;
  708. height: 22px;
  709. border-radius: 50%;
  710. background-color: #d5d5d5;
  711. z-index: 2;
  712. }
  713. .image-box{
  714. display: flex;
  715. justify-content: center;
  716. align-items: center;
  717. position: absolute;
  718. top: 5px;
  719. right: 5px;
  720. bottom: 5px;
  721. left: 5px;
  722. border: 1px #eee solid;
  723. border-radius: 5px;
  724. overflow: hidden;
  725. image{
  726. width: 100%;
  727. height: 100%;
  728. }
  729. }
  730. }
  731. }
  732. }
  733. </style>