123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578 |
- <template>
- <view class="content">
- <view class="content1 relative">
- <view class="relative">
- <image :src="imgList[cardInfo.cuttentTemplate-1].dictLabel" mode="widthFix" style="width: 100%;height: auto;"></image>
- </view>
- <view class="absolute card-content style1" v-if="cardInfo.cuttentTemplate==1">
- <view class="left">
- <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px" shape="circle" v-if="cardInfo.headSculpture"></u--image>
- <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
- </view>
- <view class="right">
- <view class="row1">
- <text class="name">{{cardInfo.name}}</text>
- <text class="post">{{cardInfo.post}}</text>
- </view>
- <view class="row2">
- {{cardInfo.companyName}}
- </view>
- <view class="row3 flex">
- <u--image :showLoading="true" src="/static/imgs/card/address1.png" width="13px"
- height="16px"></u--image>
- <view class='icon-text'>{{ cardInfo.province?cardInfo.province:'-' }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/remark1.png" width="10px"
- height="12px"></u--image>
- <view class='icon-text'>{{cardInfo.remark?cardInfo.remark:'-'}}</view>
- </view>
- </view>
- </view>
- <view class="absolute card-content style1 flex-between" v-if="cardInfo.cuttentTemplate==2">
- <view class="right">
- <view class="row1">
- <text class="name">{{cardInfo.name}}</text>
- <text class="post">{{cardInfo.post}}</text>
- </view>
- <view class="row2">
- {{cardInfo.companyName}}
- </view>
- <view class="row3 flex">
- <u--image :showLoading="true" src="/static/imgs/card/address3.png" width="13px"
- height="16px"></u--image>
- <view class='icon-text'>{{ cardInfo.province?cardInfo.province:'-' }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/phone3.png" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/remark3.png" width="10px"
- height="12px"></u--image>
- <view class='icon-text'>{{cardInfo.remark?cardInfo.remark:'-'}}</view>
- </view>
- </view>
- <view class="left">
- <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px" shape="circle" v-if="cardInfo.headSculpture"></u--image>
- <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
- </view>
- </view>
- <view class="absolute card-content style2" v-if="cardInfo.cuttentTemplate==3">
- <view class="top">
- <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px" shape="circle" v-if="cardInfo.headSculpture"></u--image>
- <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
- </view>
- <view class="bottom flex">
- <view class="left">
- <view class="row1">
- <text class="name">{{cardInfo.name}}</text>
- <text class="post">{{cardInfo.post}}</text>
- </view>
- <view class="row2">
- {{cardInfo.companyName}}
- </view>
- </view>
- <view class="right">
- <view class="row1 flex">
- <u--image :showLoading="true" src="/static/imgs/card/address1.png" width="13px"
- height="16px"></u--image>
- <view class='icon-text'>{{ cardInfo.province?cardInfo.province:'-' }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
- </view>
- <view class="row2 flex">
- <u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/remark1.png" width="10px"
- height="12px"></u--image>
- <view class='icon-text'>{{cardInfo.remark?cardInfo.remark:'-'}}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="absolute card-content style2" v-if="cardInfo.cuttentTemplate==4">
- <view class="top">
- <view class="row1">
- <text class="name">{{cardInfo.name}}</text>
- <text class="post">{{cardInfo.post}}</text>
- </view>
- <view class="row2">
- {{cardInfo.companyName}}
- </view>
-
- </view>
- <view class="bottom flex">
- <view class="left">
- <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px" shape="circle" v-if="cardInfo.headSculpture"></u--image>
- <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
- </view>
- <view class="right">
- <view class="row1 flex">
- <u--image :showLoading="true" src="/static/imgs/card/address2.png" width="13px"
- height="16px"></u--image>
- <view class='icon-text'>{{ cardInfo.province?cardInfo.province:'-' }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
- </view>
- <view class="row2 flex">
- <u--image :showLoading="true" src="/static/imgs/card/phone2.png" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image :showLoading="true" src="/static/imgs/card/remark2.png" width="10px"
- height="12px"></u--image>
- <view class='icon-text'>{{cardInfo.remark?cardInfo.remark:'-'}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="change-template">
- 切换模板
- </view>
- <view class="img-list">
- <view class="img-item" v-for="(item,index) in imgList" @click="changeTemplate(index)">
- <image :src="item.dictValue" class="img-item" :key="index"></image>
- <image src="../../static/imgs/card/dh.png" class="dh" v-if="cardInfo.cuttentTemplate==(index+1)"></image>
- </view>
- </view>
- <view class="change-template">
- 名片信息
- </view>
- <view class="content2">
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 名片标识
- </view>
- <u--input v-model="cardInfo.cardBusiness" border="none" placeholder="输入名片标识" inputAlign='right'></u--input>
- </view>
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 姓名
- </view>
- <u--input v-model="cardInfo.name" border="none" placeholder="输入姓名" inputAlign='right'></u--input>
- </view>
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 职务
- </view>
- <u--input v-model="cardInfo.post" border="none" placeholder="输入职务,不超过8个字符" inputAlign='right'></u--input>
- </view>
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 公司/机构名称
- </view>
- <u--input v-model="cardInfo.companyName" border="none" placeholder="输入公司/机构名称" inputAlign='right'></u--input>
- </view>
- <view class="flex flex-between align-item-center row" @click="placeSelect();hideKeyboard()">
- <view class="left">
- 地址
- </view>
- <view v-if="cardInfo.province">{{ cardInfo.province }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
- <view class="" v-else>
- <text>选择地址 </text>
- <image src="../../static/imgs/card/yjt.png" mode="" style="margin-left:10rpx;width:12rpx;height: 21rpx;"></image>
- </view>
-
- </view>
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 详细地址
- </view>
- <u--input v-model="cardInfo.detailedAddress" border="none" placeholder="输入详细地址,不超过15个字" inputAlign='right'></u--input>
- </view>
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 联系电话
- </view>
- <u--input v-model="cardInfo.phone" maxlength='15' border="none" placeholder="输入联系电话" inputAlign='right'></u--input>
- </view>
- <!-- <u-form-item label="地址" prop="userInfo.name" borderBottom>
- <view @click="showPicker">选择地址</view>
- <view>{{ province }}{{ city }}{{ area }}</view>
- </u-form-item> -->
- <view class="flex flex-between align-item-center row">
- <view class="left">
- 上传企业logo或个人头像
- </view>
- <view class="right">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
- :maxCount="1"></u-upload>
- </view>
- </view>
- </view>
- <view class="bottom">
- <button @click='$u.debounce(submit, 500)' class='button' type="default">提交</button>
- </view>
- <city-picker ref="picker" mode="multiSelector" :list="areaData" :level="3" @confirm="finishSelectAddress">
- </city-picker>
- <u-modal :show="isSubmit" :content='content' @confirm="$u.debounce(confirmSubmit, 500)" showCancelButton
- @cancel="isSubmit=false" @close="isSubmit=false" closeOnClickOverlay></u-modal>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- var that;
- import uploadImage from '@/components/ossutil/uploadFile.js';
- export default {
- onLoad(options) {
- this.cardInfo = JSON.parse(options.itemVal)
- console.log(this.cardInfo)
- this.fileList1 = [
- {
- url:this.cardInfo.headSculpture
- }
- ]
- that = this
- this.userInfo = uni.getStorageSync("userInfo")
- this.getList()
- },
- data() {
- return {
- selectIndex: 1,
- imgList:[],
- isSubmit: false,
- content: '确定提交名片信息?',
- userInfo: {},
- fileList1: [],
- cardInfo: {
- city:'',
- area:'',
- province:'',
- commonId: '',
- cardBusiness: '名片标识',
- name: '',
- post: '',
- companyName: '',
- location: '',
- detailedAddress: '',
- phone: '',
- headSculpture: '',
- currentBackground:'',
- cuttentTemplate:''
- }
- };
- },
- methods: {
- changeTemplate(index) {
- this.selectIndex = (index+1)
- this.cardInfo.currentBackground = this.imgList[index].dictLabel
- this.cardInfo.cuttentTemplate = this.imgList[index].dictSort
- },
- getList() {
- this.$request.baseRequest('admin.dictData', 'list', {
- dictType: "card_template"
- }, failres => {
- console.log('res+++++', failres.errmsg)
- uni.hideLoading()
- uni.showToast({
- icon:"none",
- title: failres.errmsg,
- duration: 3000
- });
- }).then(res => {
- console.log("img", res)
- this.imgList = res.data.items
- if(!this.cardInfo.currentBackground&&!this.cardInfo.cuttentTemplate){
- this.cardInfo.currentBackground = this.imgList[0].dictLabel
- this.cardInfo.cuttentTemplate = this.imgList[0].dictSort
- }
- })
- },
- placeSelect() {
- uni.chooseLocation({
- success: function(res) {
- console.log(res);
- that.cardInfo.location = res.latitude + ',' + res.longitude
- let _address = that.$helper.formatLocation(res.address)
- that.cardInfo.province = _address.Province
- that.cardInfo.city = _address.City
- that.cardInfo.area = _address.Country
- that.cardInfo.detailedAddress = _address.Village
- }
- });
- },
- 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(res) {
- return new Promise((resolve, reject) => {
- uploadImage(res, 'cardImages/',
- result => {
- that.cardInfo.headSculpture = result
- resolve(res)
- }
- )
- })
- },
- confirmSubmit() {
- this.$request.baseRequest('admin.unimall.cardManagementInfo', 'update', {
- cardManagementInfo: JSON.stringify(this.cardInfo)
- }, failres => {
- uni.hideLoading()
- uni.showToast({
- icon:"none",
- title: failres.errmsg,
- duration: 3000
- });
- }).then(res => {
- this.isSubmit = false
- uni.showToast({
- icon:"success",
- title: '编辑成功!',
- duration: 2000
- });
- uni.navigateBack()
- })
- },
- submit() {
- this.isSubmit = true
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- padding: 20rpx;
- }
- .bgc0 {
- background: url('https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/bgc1.png') no-repeat center;
- height: 380rpx;
- border-radius: 20rpx;
- }
- .bgc1 {
- background: url('https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/bgc2.png') no-repeat center;
- height: 380rpx;
- border-radius: 20rpx;
- }
- .bgc2 {
- background: url('https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/bgc3.png') no-repeat center;
- height: 380rpx;
- border-radius: 20rpx;
- }
- .bgc3 {
- background: url('https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/bgc4.png') no-repeat center;
- height: 380rpx;
- border-radius: 20rpx;
- }
- .bgc4 {
- background: url('https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/bgc5.png') no-repeat center;
- height: 380rpx;
- border-radius: 20rpx;
- }
- .img {
- width: 100rpx;
- }
- .change-template {
- margin: 46rpx 0 30rpx 0;
- font-size: 32rpx;
- font-weight: bold;
- color: #19191A;
- }
- .img-list {
- display: block;
- white-space: nowrap;
- overflow-x: auto;
- .dh {
- width: 32rpx;
- height: 32rpx;
- position: absolute;
- right: 8rpx;
- bottom: 8rpx;
- }
- .img-item {
- position: relative;
- width: 186rpx;
- height: 120rpx;
- display: inline-block;
- margin-right: 2 0rpx;
- border-radius: 20rpx;
- margin-right: 20rpx;
- }
- }
- .content2 {
- background-color: #fff;
- border-radius: 20rpx;
- padding:0 20rpx 0 20rpx;
- .row{
- padding: 20rpx;
- border-bottom: 1px solid #E6E5E5;
- }
- }
- .button{
- color: #fff;
- background-color: #112253;
- border-radius: 20rpx;
- margin: 40rpx 0;
- }
- .card-content{
- top: 20rpx;
- left: 20rpx;
- }
- .content1{
- .icon-text{
- margin-left:10rpx;
- }
- .style1{
- display: flex;
- padding: 20rpx 30rpx;
- width: 85%;
- .left{
- width: 132rpx;
- height: 132rpx;
- border-radius: 50%;
- }
- .right{
- margin-left: 40rpx;
- .row1{
- .name{
- font-size: 38rpx;
- font-weight: bold;
- color: #040000;
- margin-right: 20rpx;
- }
- .post{
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- .row2{
- margin-top: 20rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #323333;
- }
- .row3{
- margin-top: 30rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #323333;
- }
- .row2,.row3,.row4{
- margin-top: 20rpx;
- }
- }
- }
- .style2{
- padding:30rpx;
- .top{
- .row1{
- .name{
- font-size: 38rpx;
- font-weight: bold;
- color: #040000;
- margin-right: 20rpx;
- }
- .post{
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- .row2{
- margin-top: 20rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #323333;
- }
- }
- .bottom{
- margin-top: 48rpx;
- .left{
- margin-right: 40rpx;
- .row1{
- .name{
- font-size: 38rpx;
- font-weight: bold;
- color: #040000;
- margin-right: 20rpx;
- }
- .post{
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- .row2{
- margin-top: 20rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #323333;
- }
- }
- .right{
- .row1,.row2{
- font-size: 24rpx;
- font-weight: 500;
- color: #323333;
- }
- .row2,.row3,.row4{
- margin-top: 20rpx;
- }
- }
- }
-
- }
- }
- .content2{
- .left{
- margin-right:10rpx;
- }
- }
- </style>
|