class_edit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <view class="real-name">
  3. <view class="item name_item">
  4. <view class="label">
  5. 班级
  6. </view>
  7. <view class="right" @click="goEdit('班级',1,type=0)">
  8. {{form.truename ? form.truename : '去填写'}}
  9. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  10. </view>
  11. </view>
  12. <view class="item">
  13. <view class="label">
  14. 入学时间
  15. </view>
  16. <view class="right" @click="goDay">
  17. <text>
  18. {{form.class ? form.class : '去填写'}}
  19. </text>
  20. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  21. </view>
  22. </view>
  23. <view class="item">
  24. <view class="label">
  25. 专业
  26. </view>
  27. <view class="right" @click="goEdit('专业',5,type=0)">
  28. <text>
  29. {{form.account ? form.account : '去填写'}}
  30. </text>
  31. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  32. </view>
  33. </view>
  34. <!-- <view class="item">
  35. <view class="label">
  36. 性别
  37. </view>
  38. <view class="right">
  39. <u-radio-group v-model="form.sex" @change="radioGroupChange">
  40. <u-radio v-for="(item, index) in list_sex" :key="index" :name="item.label">
  41. {{item.name}}
  42. </u-radio>
  43. </u-radio-group>
  44. </view>
  45. </view> -->
  46. <!-- <view class="item">
  47. <view class="label">
  48. 个人照片
  49. </view>
  50. <view class="right" @click="goEdit('上传个人照片',2,type=2)">
  51. {{form.headimg ? '已上传' : '点击上传'}}
  52. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  53. </view>
  54. </view>-->
  55. <!-- <view class="item">
  56. <view class="label">
  57. 邮箱
  58. </view>
  59. <view class="right" @click="goEdit('填写邮箱',4,type=0)">
  60. {{form.email ? form.email : '去填写'}}
  61. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  62. </view>
  63. </view> -->
  64. <view class="item">
  65. <view class="label">
  66. 籍贯
  67. </view>
  68. <view class="right" @click="goEdit('籍贯',3,type=0)">
  69. <text>
  70. {{form.class ? form.class : '去填写'}}
  71. </text>
  72. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  73. </view>
  74. </view>
  75. <view class="item">
  76. <view class="label">
  77. 政治面貌
  78. </view>
  79. <view class="right" @click="goEdit('政治面貌',6,type=0)">
  80. {{form.mobile ? form.mobile : '去填写'}}
  81. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  82. </view>
  83. </view>
  84. <!-- <view class="item">
  85. <view class="label">
  86. 邮箱
  87. </view>
  88. <view class="right" @click="goEdit('填写邮箱',4,type=0)">
  89. {{form.email ? form.email : '去填写'}}
  90. <u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  91. </view>
  92. </view> -->
  93. <view class="item" v-if="!form.demand">
  94. <view class="label">
  95. 学习经历
  96. </view>
  97. <view class="right" @click="goEdit('学习经历',9,type=1)">
  98. 去填写<u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  99. </view>
  100. </view>
  101. <view class="item1" v-if="form.demand">
  102. <view class="item">
  103. <view class="label">
  104. 学习经历
  105. </view>
  106. <view class="right" @click="goEdit('学习经历',9,type=1)">
  107. 修改<u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  108. </view>
  109. </view>
  110. <view class="dec">
  111. {{form.demand}}
  112. </view>
  113. </view>
  114. <view class="item" v-if="!form.demand">
  115. <view class="label">
  116. 工作经历
  117. </view>
  118. <view class="right" @click="goEdit('工作经历',9,type=1)">
  119. 去填写<u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  120. </view>
  121. </view>
  122. <view class="item1" v-if="form.demand">
  123. <view class="item">
  124. <view class="label">
  125. 工作经历
  126. </view>
  127. <view class="right" @click="goEdit('工作经历',9,type=1)">
  128. 修改<u-icon name="arrow-right" size="20" margin-left="20"></u-icon>
  129. </view>
  130. </view>
  131. <view class="dec">
  132. {{form.demand}}
  133. </view>
  134. </view>
  135. <u-calendar v-model="calendar_show" :mode="mode" @change="change_date"></u-calendar>
  136. <u-popup v-model="show" mode="bottom" height="100%">
  137. <view class="form">
  138. <view class="back" @click="show=false">
  139. <u-icon name="arrow-left" size="30"></u-icon>
  140. </view>
  141. <u-navbar :is-back="false" title="填写信息"></u-navbar>
  142. <view class="title">
  143. {{input_name}}
  144. </view>
  145. <view class="input" v-if="type==0">
  146. <u-input v-model="value" :placeholder=' "请输入" + input_name' />
  147. </view>
  148. <!-- 上传图片 -->
  149. <view class="upload_image" v-if="item==2&&image_edit==0">
  150. <u-upload ref="uUpload" :action="action" :auto-upload="true" :form-data='imageDate'
  151. :file-list="fileList" @on-success='uploadSuccess'></u-upload>
  152. </view>
  153. <view class="upload_image" v-if="item==2 && image_edit==1">
  154. <u-image width="100%" height="300rpx" :src="uploadImage"></u-image>
  155. </view>
  156. <view class="complate" v-if="item==2 && image_edit==1" @click="reload">
  157. 重新上传
  158. </view>
  159. <view class="complate1" v-if="item==2 " @click="complate">
  160. 完成
  161. </view>
  162. <!-- textear编辑 -->
  163. <view class="upload_image" v-if="type==1">
  164. <u-input v-model="textarea" type="textarea" :border="true" />
  165. </view>
  166. <view class="complate" v-if="item!=2" @click="complate">
  167. 完成
  168. </view>
  169. <!-- 性别 -->
  170. <!-- <view class="upload_image" v-if="type==3">
  171. <u-radio-group v-model="value_sex" @change="radioGroupChange">
  172. <u-radio v-for="(item, index) in list_sex" :key="index" :name="item.name"
  173. :disabled="item.disabled">
  174. {{item.name}}
  175. </u-radio>
  176. </u-radio-group>
  177. </view>
  178. <view class="complate" v-if="item!=2" @click="complate">
  179. 完成
  180. </view> -->
  181. </view>
  182. </u-popup>
  183. <!-- <view class="buttom" @click="mentor">
  184. 保存
  185. </view> -->
  186. </view>
  187. </template>
  188. <script>
  189. export default {
  190. data() {
  191. return {
  192. show: false,
  193. input_name: '',
  194. item: '',
  195. image_edit: 0,
  196. value: '', //输入框的内容
  197. action: '', //封面图上传地址
  198. imageDate: {
  199. file_type: 'img',
  200. type: 'tearcher_headimg'
  201. }, //上传图片携带参数
  202. fileList: [],
  203. uploadImage: '',
  204. type: 0, //0input输入框,1textare输入框
  205. textarea: '',
  206. form: {
  207. status: 1,
  208. sex: 0
  209. },
  210. list_sex: [{
  211. name: '男',
  212. label: 0
  213. },
  214. {
  215. name: '女',
  216. label: 1
  217. },
  218. ],
  219. rules: {
  220. name: [{
  221. required: true,
  222. message: '请输入姓名',
  223. // 可以单个或者同时写两个触发验证方式
  224. trigger: 'blur,change'
  225. }],
  226. intro: [{
  227. min: 5,
  228. message: '简介不能少于5个字',
  229. trigger: 'change'
  230. }]
  231. },
  232. calendar_show: false,
  233. mode: 'date'
  234. }
  235. },
  236. onLoad(options) {
  237. if (options.type == 0) {
  238. this.getMe()
  239. }
  240. },
  241. onShow() {
  242. this.action = '/api/base/common/upload'
  243. },
  244. methods: {
  245. radioGroupChange(e) {
  246. console.log(e);
  247. this.form.sex = e
  248. },
  249. getMe() {
  250. this.$u.get('/base/auth/me').then(res => {
  251. console.log(res, 'ppp')
  252. this.form = res.data.type_model
  253. this.uploadImage = res.data.headimg
  254. this.image_edit = 1
  255. })
  256. },
  257. //保存修改
  258. mentor() {
  259. let id = this.$store.state.vuex_user.type_id
  260. this.$u.put('/mentor/student/' + id, this.form).then(res => {
  261. if (res.code == 200) {
  262. console.log(res, 'pppp')
  263. uni.showToast({
  264. title: res.message,
  265. icon: 'none'
  266. })
  267. setTimeout(function() {
  268. uni.switchTab({
  269. url: './tea_index'
  270. })
  271. }, 1500)
  272. }
  273. })
  274. },
  275. //上传图片成功
  276. uploadSuccess(data) {
  277. console.log(data, 'ppp')
  278. // this.form.headimg = data.data[0].id
  279. this.form.headimg = data.data[0].url
  280. this.uploadImage = data.data[0].url
  281. this.image_edit = 1
  282. },
  283. //重新上传
  284. reload() {
  285. this.image_edit = 0
  286. console.log('---------')
  287. this.fileList = [],
  288. this.uploadImage = ''
  289. },
  290. //修改出生日期
  291. goDay(){
  292. this.calendar_show=true
  293. },
  294. change_date(e){
  295. console.log(e,11111)
  296. this.form.date = e.result
  297. },
  298. goEdit(name, item) {
  299. if (this.uploadImage) {
  300. this.fileList.push({
  301. url: this.uploadImage
  302. })
  303. }
  304. this.show = true
  305. this.item = item
  306. this.input_name = name
  307. this.textarea = ''
  308. this.value = ''
  309. switch (item) {
  310. case 1:
  311. this.value = this.form.truename
  312. break
  313. case 2:
  314. break
  315. case 3:
  316. this.value = this.form.class
  317. break
  318. case 4:
  319. this.value = this.form.email
  320. break
  321. case 5:
  322. this.value = this.form.account
  323. break
  324. case 6:
  325. this.value = this.form.mobile
  326. break
  327. case 9:
  328. this.textarea = this.form.demand
  329. break
  330. case 10:
  331. this.sex = this.form.sex
  332. break
  333. }
  334. },
  335. complate() {
  336. let item = this.item
  337. switch (item) {
  338. case 1:
  339. this.form.truename = this.value
  340. break
  341. case 2:
  342. break
  343. case 3:
  344. this.form.class = this.value
  345. break
  346. case 4:
  347. this.form.email = this.value
  348. break
  349. case 5:
  350. this.form.account = this.value
  351. break
  352. case 6:
  353. this.form.mobile = this.value
  354. break
  355. case 9:
  356. this.form.demand = this.textarea
  357. break
  358. case 10:
  359. this.form.sex = this.value
  360. break
  361. }
  362. this.show = !this.show
  363. },
  364. //保存编辑
  365. save() {
  366. this.$u.post('/mentor/student', this.form).then(res => {
  367. console.log(res, 'oopp')
  368. })
  369. }
  370. }
  371. }
  372. </script>
  373. <style lang="scss" scoped>
  374. .upload_image {
  375. width: 90%;
  376. margin: 0 auto;
  377. }
  378. .complate,
  379. .complate1 {
  380. width: 50%;
  381. margin: 0 auto;
  382. margin-top: 20%;
  383. line-height: 44px;
  384. text-align: center;
  385. height: 44px;
  386. background: #3B7653;
  387. opacity: 1;
  388. border-radius: 24px;
  389. font-size: 18px;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #FFFFFF;
  393. opacity: 1;
  394. }
  395. .complate1 {
  396. margin-top: 30px;
  397. }
  398. .real-name {
  399. padding: 0 16px;
  400. padding-bottom: 40px;
  401. .name_item{
  402. margin-top: 20px !important;
  403. }
  404. .item {
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-between;
  408. height: 46px;
  409. line-height: 46px;
  410. // margin-top: 10px;
  411. .label {
  412. flex: 0 0 30%;
  413. font-size: 16px;
  414. font-family: PingFang SC;
  415. font-weight: bold;
  416. line-height: 20px;
  417. color: #282828;
  418. opacity: 1;
  419. }
  420. .right {
  421. // flex: 1;
  422. font-size: 13px;
  423. font-family: PingFang SC;
  424. font-weight: 400;
  425. line-height: 20px;
  426. color: #282828;
  427. opacity: 0.42;
  428. text-align: right;
  429. height: 20px;
  430. // overflow: hidden;
  431. display: flex;
  432. align-items: center;
  433. text {
  434. display: inline-block;
  435. width: 200px;
  436. height: 20px;
  437. line-height: 20px;
  438. overflow: hidden;
  439. white-space: nowrap;
  440. text-overflow: ellipsis;
  441. }
  442. }
  443. }
  444. .form {
  445. position: relative;
  446. .back {
  447. position: absolute;
  448. left: 10px;
  449. top: 0px;
  450. width: 30px;
  451. height: 44px;
  452. line-height: 44px;
  453. text-align: center;
  454. z-index: 9999;
  455. // background: #18B566;
  456. }
  457. .title {
  458. padding: 0 20px;
  459. height: 40px;
  460. line-height: 40px;
  461. }
  462. .input {
  463. margin: 0 20px;
  464. height: 40px;
  465. line-height: 40px;
  466. border-bottom: solid 1px rgba(175, 175, 175, .2);
  467. }
  468. }
  469. .item1 {
  470. .dec {
  471. font-size: 13px;
  472. font-family: PingFang SC;
  473. font-weight: 400;
  474. line-height: 20px;
  475. color: #AFAFAF;
  476. opacity: 1;
  477. padding-bottom: 10px;
  478. border-bottom: solid 1px rgba(175, 175, 175, .2);
  479. }
  480. }
  481. .buttom {
  482. width: 229px;
  483. height: 56px;
  484. line-height: 56px;
  485. background: #3B7653;
  486. text-align: center;
  487. border-radius: 28px;
  488. margin: 0 auto;
  489. margin-top: 50px;
  490. font-size: 18px;
  491. font-family: PingFang SC;
  492. font-weight: bold;
  493. color: #fff;
  494. opacity: 1;
  495. }
  496. }
  497. </style>