123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <template>
- <view class="content">
- <view class="content1">
- <view class="left">
- <image src="../../static/c3.png" mode="widthFix" class="img"></image>
- </view>
- <view class="right">
- <view class="row1">
- 姓名|职务
- </view>
- <view class="">
- 公司名称
- </view>
- <view class="">
- 地址
- </view>
- <view class="">
- 联系电话
- </view>
- <view class="">
- 备注
- </view>
- </view>
- </view>
- <view class="change-template">
- 切换模板
- </view>
- <view class="content2">
- <view class="">
- 名片信息
- </view>
- <u--form labelPosition="left" :model="cardInfo" ref="uForm">
- <u-form-item label="名片标识" prop="userInfo.cardBusiness" borderBottom>
- <text>名片-{{cardInfo.cardBusiness}}</text>
- </u-form-item>
- <u-form-item label="姓名" prop="userInfo.name" borderBottom>
- <u--input v-model="cardInfo.name" border="none" placeholder="输入姓名"></u--input>
- </u-form-item>
- <u-form-item label="职务" prop="userInfo.post" borderBottom>
- <u--input v-model="cardInfo.post" border="none" placeholder="输入职务,不超过8个字符"></u--input>
- </u-form-item>
- <u-form-item label="公司/机构名称" prop="userInfo.companyName" borderBottom>
- <u--input v-model="cardInfo.companyName" border="none" placholder="输入公司/机构名称"></u--input>
- </u-form-item>
- <u-form-item label="定位" prop="userInfo.name" borderBottom @click="placeSelect();hideKeyboard()">
- <text>选择定位> </text>
- </u-form-item>
- <u-form-item label="详细地址" prop="userInfo.name" borderBottom>
- <u--input v-model="cardInfo.name" border="none" placeholder="输入地址,不超过15个字"></u--input>
- </u-form-item>
- <u-form-item label="联系电话" prop="userInfo.name" borderBottom>
- <u--input v-model="cardInfo.name" border="none" placeholder="输入联系电话"></u--input>
- </u-form-item>
- </u--form>
- </view>
- <view class="content3">
- <view class="left">
- 上传企业logo或个人头像
- </view>
- <view class="right">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
- :maxCount="10"></u-upload>
- </view>
- </view>
- <view class="bottom">
- <button>提交</button>
- </view>
- </view>
- </template>
- <script>
- import uploadImage from '@/components/ossutil/uploadFile.js';
- export default {
- data() {
- return {
- fileList1: [],
- cardInfo: {
- commonId:'',
- cardBusiness:'',
- name:'',
- post:'',
- companyName:'',
- location:'',
- detailedAddress:'',
- phone:'',
- headSculpture:''
-
-
-
- }
- };
- },
- methods: {
- placeSelect() {
- uni.chooseLocation({
- success: function(res) {
- console.log(res);
- 11111
- // console.log('位置名称:' + res.name);
- // console.log('详细地址:' + res.address);
- // console.log('纬度:' + res.latitude);
- // console.log('经度:' + res.longitude);
- this.cardInfo.location = res.latitude+','+res.longitude
- this.
- console.log('----------------------------')
- // that.addressInfo.latitude = res.latitude
- // that.addressInfo.longitude = res.longitude
- // that.addressInfo.detailedAddress = _address.Village
- // that.addressInfo.province = _address.Province
- // that.addressInfo.city = _address.City
- // that.addressInfo.area = _address.Country
- // that.addressInfo.commonId = that.userInfo.id
- // that.$forceUpdate()
- }
- });
- },
- hideKeyboard() {
- uni.hideKeyboard()
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- // uploadImage(res.tempFilePaths[0], 'cardImages/',
- // result => {
- // // this.trainImg = result
- // uni.hideLoading();
- // }
- // )
- // let a = uni.uploadFile({
- // url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
- // filePath: url,
- // name: 'file',
- // formData: {
- // user: 'test'
- // },
- // success: (res) => {
- // setTimeout(() => {
- // resolve(res.data.data)
- // }, 1000)
- // }
- // });
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .img {
- width: 100rpx;
- }
- </style>
|