schoolCard.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="card" style="margin-bottom: 20px">
  3. <van-row style="border-bottom: solid 1px #e4e4e4;">
  4. <van-col span="16">
  5. <h3><strong>校卡审核</strong></h3>
  6. </van-col>
  7. <van-col span="8">
  8. <p :style="{ color: statusColor }">{{statusString}}</p>
  9. </van-col>
  10. </van-row>
  11. <div v-if="status===30 || status === 500">
  12. <add-photo :photoURL="imgUrl" @onRead="onRead"/>
  13. <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
  14. <van-button
  15. type="primary"
  16. class="submit_button"
  17. @click="schoolPresent"
  18. :loading="loading"
  19. >保存
  20. </van-button>
  21. </div>
  22. <div v-else>
  23. <img :src="schoolpic" style="max-width: 100%"/>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { Row, Col, } from 'vant';
  29. import AddPhoto from "../components/addPhoto";
  30. import {BasicFunction} from "../connector/basic-service";
  31. export default {
  32. name: "schoolCard",
  33. components: {
  34. AddPhoto,
  35. [Row.name]: Row, [Col.name]: Col,
  36. },
  37. data() {
  38. return {
  39. statusColor: '',
  40. statusString: '-----',
  41. photo: null,
  42. loading: false,
  43. status: 0,
  44. imgage: null,
  45. imgDo: {},
  46. schoolpic: "",
  47. IMGPREFIX: "http://gift.fogice.com"
  48. }
  49. },
  50. methods: {
  51. schoolPresent() {
  52. // 检验输入
  53. this.loading = true;
  54. if (this.photo === null) {
  55. Toast.fail('请上传礼物照片');
  56. this.loading = false;
  57. return;
  58. }
  59. this.imgDo.userSchoolCardPic = this.imgUrl;
  60. let that = this;
  61. BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
  62. console.log("------ Data Rcvd in uploadphotoChange --------");
  63. console.log(response);
  64. if (response.ret === "10000") {
  65. Toast.success("上传成功")
  66. } else {
  67. Toast.fail("上传失败,请检查网络");
  68. }
  69. }, [this.imgDo]);
  70. },
  71. onRead: function (e) {
  72. this.photo = e;
  73. }
  74. },
  75. created: function () {
  76. if (!localStorage.getItem('frontend-userid')) {
  77. this.$router.push('login');
  78. return;
  79. }
  80. let userid = localStorage.getItem('frontend-userid');
  81. let that = this;
  82. BasicFunction.get_data('smartIdentity/list?userId=' + userid, function (res) {
  83. console.log(res);
  84. if (res.ret === '10000') {
  85. var t = res.model.list;
  86. that.status = t[0].userReviewStatus;
  87. that.imgDo = t[0];
  88. console.log(that);
  89. if (that.status === 30) {
  90. that.statusColor = '#c5c5c5';
  91. that.statusString = '未上传校卡';
  92. that.$router.push('verify');
  93. return;
  94. } else if (that.status === 0 || that.status === 1000) {
  95. that.schoolpic = that.IMGPREFIX + t[0].userSchoolCardPic;
  96. if (that.status === 0) {
  97. that.statusColor = '#c5c530';
  98. that.statusString = '审核中'
  99. }
  100. if (that.status === 1000) {
  101. that.statusColor = '#00ff00';
  102. that.statusString = '审核通过'
  103. }
  104. } else {
  105. that.statusColor = '#ff0000';
  106. that.statusString = '审核未通过'
  107. }
  108. }
  109. }, {});
  110. }
  111. }
  112. </script>
  113. <style scoped>
  114. p, h3 {
  115. color: #fd6740;
  116. }
  117. p, h3 {
  118. padding: 5px;
  119. }
  120. p {
  121. padding-top: 3px ;
  122. }
  123. .card {
  124. background-color: white;
  125. margin: 20px 20px;
  126. border: solid 1px #e4e4e4;
  127. padding: 15px;
  128. text-align: left;
  129. }
  130. .submit_button {
  131. margin-bottom: 10px;
  132. margin-left: auto;
  133. margin-right: auto;
  134. position: fixed;
  135. bottom: 0;
  136. left: 0;
  137. right: 0;
  138. background-color: #fd6740;
  139. border-color: #fd6740;
  140. width: 85%;
  141. }
  142. </style>