schoolCard.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="card" style="margin-bottom: 20px">
  3. <van-row >
  4. <van-col span="16">
  5. <h3><strong>校卡审核</strong></h3>
  6. </van-col>
  7. <van-col span="8">
  8. <p :style="{ color: statusColor[2] }">{{statusString[2]}}</p>
  9. </van-col>
  10. </van-row>
  11. <add-photo @uploadPhoto="onReadPhoto"/>
  12. <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
  13. </div>
  14. </template>
  15. <script>
  16. import { Row, Col, } from 'vant';
  17. import AddPhoto from "../components/addPhoto";
  18. import {BasicFunction} from "../connector/basic-service";
  19. export default {
  20. name: "schoolCard",
  21. components: {
  22. AddPhoto,
  23. [Row.name]: Row, [Col.name]: Col,
  24. },
  25. data() {
  26. return {
  27. statusString: ['审核中', '未上传校卡', '审核通过', '审核失败'],
  28. statusColor: ['#f43736', '#00ff00', '#00fa9a', '#ff0000'],
  29. photo: null,
  30. }
  31. },
  32. methods: {
  33. publishPresent() {
  34. // 检验输入
  35. if (this.photo === null) {
  36. Toast.fail('请上传礼物照片');
  37. return;
  38. }
  39. // post_present()
  40. let present = {
  41. photo: this.photo
  42. };
  43. console.log(present);
  44. //FIXME : wrong address given !
  45. BasicFunction.get_data("ajaxpostpresent", function (response) {
  46. console.log("------ Data Rcvd in School Card --------");
  47. console.log(response);
  48. if(response.ret === "10000"){
  49. // 不需要 设置 SessionID, 已经自动保存在jSessionID中
  50. this.$router.push('index');
  51. } else {
  52. // 注册失败的处理
  53. Toast.fail("上传失败,请检查网络");
  54. }
  55. }, {});
  56. // this.$router.push('index');
  57. },
  58. onReadPhoto(file) {
  59. this.photo = file;
  60. }
  61. },
  62. created: function () {
  63. if (!localStorage.getItem('frontend-userid')) {
  64. this.$router.push('login');
  65. return;
  66. }
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. p, h3 {
  72. color: #fd6740;
  73. }
  74. h3 {
  75. padding: 5px;
  76. border-bottom: solid 1px #e4e4e4;
  77. }
  78. p {
  79. padding-top: 3px ;
  80. }
  81. .card {
  82. background-color: white;
  83. margin: 20px 20px;
  84. border: solid 1px #e4e4e4;
  85. padding: 15px;
  86. text-align: left;
  87. }
  88. </style>