driverIdentityThree.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="center">
  3. <view class="picture">
  4. <view style="margin: 0 auto;" v-if="travels != ''" @click="travel">
  5. <image v-bind:src = "travels" class="picture"></image>
  6. </view>
  7. <view style="margin: 0 auto;" v-if="drives != ''" @click="drive">
  8. <image v-bind:src = "drives" class="picture"></image>
  9. </view>
  10. <view style="margin: 0 auto;" v-if="practices != ''" @click="practice">
  11. <image v-bind:src = "practices" class="picture"></image>
  12. </view>
  13. <view style="margin: 0 auto;" v-if="operates != ''" class="fujian" @click="operate">
  14. <image v-bind:src = "operates" class="picture"></image>
  15. </view>
  16. <button class="btns btn" @click="commit">提交</button>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. mapState
  23. } from 'vuex';
  24. export default {
  25. data() {
  26. return {
  27. travels: "../../static/img/authentication/travel(3).png",
  28. drives: "../../static/img/authentication/drive(3).png",
  29. practices: "../../static/img/authentication/travel(3).png",
  30. operates: "../../static/img/authentication/drive(3).png",
  31. DriverViewInfo: {
  32. },
  33. addressUrl:[],
  34. }
  35. },
  36. computed: {
  37. ...mapState(['hasLogin', 'userInfo'])
  38. },
  39. onLoad(options){
  40. this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
  41. },
  42. methods:{
  43. commit() {
  44. if (this.addressUrl[0] == "" || this.addressUrl[0] == null) {
  45. console.log(this.addressUrl)
  46. this.$api.msg('请上传行驶证!')
  47. return
  48. }
  49. if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
  50. console.log(this.addressUrl)
  51. this.$api.msg('请上传驾驶证!')
  52. return
  53. }
  54. if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
  55. console.log(this.addressUrl)
  56. this.$api.msg('请上传道路运营证!')
  57. return
  58. }
  59. if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
  60. console.log(this.addressUrl)
  61. this.$api.msg('请上传从业资格证')
  62. return
  63. }
  64. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  65. this.DriverViewInfo.commonId = this.userInfo.id
  66. this.DriverViewInfo.pcFlag = 0
  67. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  68. console.log(this.DriverViewInfo,"司机对象")
  69. return
  70. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {
  71. }).catch(res => {
  72. uni.showToast({
  73. title: res.data.message,
  74. icon: 'none',
  75. duration: 2000
  76. })
  77. })
  78. },
  79. travel(){
  80. var that = this
  81. wx.chooseImage({
  82. success: function(res) {
  83. wx.uploadFile({
  84. url: 'https://www.zthymaoyi.com/upload/admin',
  85. filePath: res.tempFilePaths[0],
  86. name: 'file',
  87. success(res) {
  88. var data = res.data
  89. var strToObj = JSON.parse(data)
  90. that.travels = strToObj.url
  91. that.addressUrl[0] = strToObj.url
  92. console.log(that.addressUrl)
  93. }
  94. })
  95. }
  96. })
  97. },
  98. drive(){
  99. var that = this
  100. wx.chooseImage({
  101. success: function(res) {
  102. wx.uploadFile({
  103. url: 'https://www.zthymaoyi.com/upload/admin',
  104. filePath: res.tempFilePaths[0],
  105. name: 'file',
  106. success(res) {
  107. var data = res.data
  108. var strToObj = JSON.parse(data)
  109. that.drives = strToObj.url
  110. that.addressUrl[1] = strToObj.url
  111. console.log(that.addressUrl)
  112. }
  113. })
  114. }
  115. })
  116. },
  117. operate(){
  118. var that = this
  119. wx.chooseImage({
  120. success: function(res) {
  121. wx.uploadFile({
  122. url: 'https://www.zthymaoyi.com/upload/admin',
  123. filePath: res.tempFilePaths[0],
  124. name: 'file',
  125. success(res) {
  126. var data = res.data
  127. var strToObj = JSON.parse(data)
  128. that.operates = strToObj.url
  129. that.addressUrl[2] = strToObj.url
  130. console.log(that.addressUrl)
  131. }
  132. })
  133. }
  134. })
  135. },
  136. practice(){
  137. var that = this
  138. wx.chooseImage({
  139. success: function(res) {
  140. wx.uploadFile({
  141. url: 'https://www.zthymaoyi.com/upload/admin',
  142. filePath: res.tempFilePaths[0],
  143. name: 'file',
  144. success(res) {
  145. var data = res.data
  146. var strToObj = JSON.parse(data)
  147. that.practices = strToObj.url
  148. that.addressUrl[3] = strToObj.url
  149. console.log(that.addressUrl)
  150. }
  151. })
  152. }
  153. })
  154. },
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .center {
  160. padding: 10px 20px;
  161. background-color: #F5F6FA;
  162. }
  163. .picture{
  164. width: 100%;
  165. height: 220px;
  166. text-align: center;
  167. margin-top: 10px;
  168. }
  169. .btn {
  170. margin-top: 10px;
  171. background-color: #FFFFFF;
  172. border-radius: 25px;
  173. border: none;
  174. }
  175. .btns{
  176. background-color: #22C572;
  177. }
  178. </style>