123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <view class="center">
- <view class="picture">
- <view style="margin: 0 auto;" v-if="travels != ''" @click="travel">
- <image v-bind:src = "travels" class="picture"></image>
- </view>
- <view style="margin: 0 auto;" v-if="drives != ''" @click="drive">
- <image v-bind:src = "drives" class="picture"></image>
- </view>
- <view style="margin: 0 auto;" v-if="practices != ''" @click="practice">
- <image v-bind:src = "practices" class="picture"></image>
- </view>
- <view style="margin: 0 auto;" v-if="operates != ''" class="fujian" @click="operate">
- <image v-bind:src = "operates" class="picture"></image>
- </view>
- <button class="btns btn" @click="commit">提交</button>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- travels: "../../static/img/authentication/travel(3).png",
- drives: "../../static/img/authentication/drive(3).png",
- practices: "../../static/img/authentication/travel(3).png",
- operates: "../../static/img/authentication/drive(3).png",
- DriverViewInfo: {
- },
- addressUrl:[],
- }
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- onLoad(options){
- this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
- },
- methods:{
- commit() {
- if (this.addressUrl[0] == "" || this.addressUrl[0] == null) {
- console.log(this.addressUrl)
- this.$api.msg('请上传行驶证!')
- return
- }
- if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
- console.log(this.addressUrl)
- this.$api.msg('请上传驾驶证!')
- return
- }
- if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
- console.log(this.addressUrl)
- this.$api.msg('请上传道路运营证!')
- return
- }
- if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
- console.log(this.addressUrl)
- this.$api.msg('请上传从业资格证')
- return
- }
- this.DriverViewInfo.addressUrl = this.addressUrl.toString()
- this.DriverViewInfo.commonId = this.userInfo.id
- this.DriverViewInfo.pcFlag = 0
- this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
- console.log(this.DriverViewInfo,"司机对象")
- return
- this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {
- }).catch(res => {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- })
- },
- travel(){
- var that = this
- wx.chooseImage({
- success: function(res) {
- wx.uploadFile({
- url: 'https://www.zthymaoyi.com/upload/admin',
- filePath: res.tempFilePaths[0],
- name: 'file',
- success(res) {
- var data = res.data
- var strToObj = JSON.parse(data)
- that.travels = strToObj.url
- that.addressUrl[0] = strToObj.url
- console.log(that.addressUrl)
- }
- })
- }
- })
- },
- drive(){
- var that = this
- wx.chooseImage({
- success: function(res) {
- wx.uploadFile({
- url: 'https://www.zthymaoyi.com/upload/admin',
- filePath: res.tempFilePaths[0],
- name: 'file',
- success(res) {
- var data = res.data
- var strToObj = JSON.parse(data)
- that.drives = strToObj.url
- that.addressUrl[1] = strToObj.url
- console.log(that.addressUrl)
- }
- })
- }
- })
- },
- operate(){
- var that = this
- wx.chooseImage({
- success: function(res) {
- wx.uploadFile({
- url: 'https://www.zthymaoyi.com/upload/admin',
- filePath: res.tempFilePaths[0],
- name: 'file',
- success(res) {
- var data = res.data
- var strToObj = JSON.parse(data)
- that.operates = strToObj.url
- that.addressUrl[2] = strToObj.url
- console.log(that.addressUrl)
- }
- })
- }
- })
- },
- practice(){
- var that = this
- wx.chooseImage({
- success: function(res) {
- wx.uploadFile({
- url: 'https://www.zthymaoyi.com/upload/admin',
- filePath: res.tempFilePaths[0],
- name: 'file',
- success(res) {
- var data = res.data
- var strToObj = JSON.parse(data)
- that.practices = strToObj.url
- that.addressUrl[3] = strToObj.url
- console.log(that.addressUrl)
- }
- })
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .center {
- padding: 10px 20px;
- background-color: #F5F6FA;
- }
- .picture{
- width: 100%;
- height: 220px;
- text-align: center;
- margin-top: 10px;
- }
-
-
- .btn {
- margin-top: 10px;
- background-color: #FFFFFF;
- border-radius: 25px;
- border: none;
- }
- .btns{
- background-color: #22C572;
- }
- </style>
|