addVehicle.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!-- 管理车辆 -->
  2. <template>
  3. <view class="content">
  4. <view class="flex flex-space-between">
  5. <view>车牌号</view>
  6. <u--input placeholder="输入车牌号" inputAlign='right' border="none" v-model="carNumber"></u--input>
  7. </view>
  8. <view>上传人车合影(车头车牌号可见)</view>
  9. <u-button type="primary" @click="unloadGroupPhoto()">上传人车合影</u-button>
  10. <u-button type="primary" @click="submit">提交</u-button>
  11. <u-toast ref="uToast"></u-toast>
  12. </view>
  13. </template>
  14. <script>
  15. import uploadImage from '@/components/ossutil/uploadFile.js';
  16. var _this;
  17. export default {
  18. data() {
  19. return {
  20. carNumber: '',
  21. };
  22. },
  23. onLoad(options) {
  24. _this = this;
  25. console.log(options)
  26. },
  27. methods: {
  28. unloadGroupPhoto() {
  29. uni.chooseImage({
  30. count: 1,
  31. sizeType: ['compressed'],
  32. success: function(res) {
  33. console.log(JSON.stringify(res.tempFilePaths));
  34. uploadImage('image', res.tempFilePaths[0], 'appData/',
  35. result => {
  36. // 上传成功
  37. console.log('图片地址', result)
  38. }
  39. )
  40. }
  41. });
  42. },
  43. submit() {
  44. let params = {
  45. type: 'success',
  46. message: "提交成功",
  47. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  48. }
  49. this.$refs.uToast.show({
  50. ...params
  51. })
  52. },
  53. },
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. </style>