123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769 |
- <template>
- <view class="content">
- <view class="content1 relative">
- <view class="relative">
- <image :src="imgList[selectIndex].dictLabel" mode="widthFix" style="width: 100%;height: auto;"></image>
- </view>
- <view class="absolute card-content style1" v-if="imgList[layoutSelectIndex].dictSort==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
- :src="'/static/imgs/card/address'+colorList[colorSelectIndex].index+'.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
- :src="'/static/imgs/card/phone'+colorList[colorSelectIndex].index+'.png'" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image
- :src="'/static/imgs/card/remark'+colorList[colorSelectIndex].index+'.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="imgList[layoutSelectIndex].dictSort==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
- :src="'/static/imgs/card/address'+colorList[colorSelectIndex].index+'.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
- :src="'/static/imgs/card/phone'+colorList[colorSelectIndex].index+'.png'" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image
- :src="'/static/imgs/card/remark'+colorList[colorSelectIndex].index+'.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="imgList[layoutSelectIndex].dictSort==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
- :src="'/static/imgs/card/address'+colorList[colorSelectIndex].index+'.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
- :src="'/static/imgs/card/phone'+colorList[colorSelectIndex].index+'.png'" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image
- :src="'/static/imgs/card/remark'+colorList[colorSelectIndex].index+'.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="imgList[layoutSelectIndex].dictSort==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
- :src="'/static/imgs/card/address'+colorList[colorSelectIndex].index+'.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
- :src="'/static/imgs/card/phone'+colorList[colorSelectIndex].index+'.png'" width="12px"
- height="13px"></u--image>
- <view class='icon-text'>{{ cardInfo.phone?cardInfo.phone:'-' }}</view>
- </view>
- <view class="row4 flex">
- <u--image
- :src="'/static/imgs/card/remark'+colorList[colorSelectIndex].index+'.png'" width="10px"
- height="12px"></u--image>
- <view class='icon-text'>{{cardInfo.remark?cardInfo.remark:'-'}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="flex">
- <view class="change-template" :class="selectConfig==1?'active-style':''" @click="changeTab(1)">
- 背景配置
- </view>
- <view class="change-template" :class="selectConfig==2?'active-style':''" @click="changeTab(2)">
- 图标颜色
- </view>
- <view class="change-template" :class="selectConfig==3?'active-style':''" @click="changeTab(3)">
- 布局配置
- </view>
- </view>
- <view class="img-list" v-if="selectConfig==1">
- <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="selectIndex==index"></image>
- </view>
- </view>
- <view class="font-color flex" v-if="selectConfig==2">
- <view v-for="(item,index) in colorList"
- :style="'background:'+item.color+';width:100rpx;height:100rpx;border-radius:50%;margin-right:20rpx'"
- class="relative" @click="changeIconColor(index)">
- <image src="@/static/imgs/card/dh.png" class="icon-dh" v-if="colorSelectIndex==index"></image>
- </view>
- </view>
- <view class="font-color img-list" v-if="selectConfig==3">
- <view class="img-item" v-for="(item,index) in layoutImgList" @click="layoutChangeTemplate(index)">
- <image :src="item.dictValue" class="img-item" :key="index"></image>
- <image src="@/static/imgs/card/dh.png" class="dh" v-if="layoutSelectIndex==index"></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) {
- that = this
- this.userInfo = uni.getStorageSync("userInfo")
- this.cardInfo.commonId = this.userInfo.id
- this.cardInfo.cardBusiness ="名片标识"+ options.cardIndex
-
- this.getList()
- },
- data() {
- return {
- layoutSelectIndex: 0,
- layoutImgList: [{
- dictValue: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/muban3.png',
- dictSort: 1
- },
- {
- dictValue: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/muban2.png',
- dictSort: 2
- },
- // {
- // dictValue: '/static/imgs/card/3.png',
- // dictSort: 3
- // },
- {
- dictValue: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/muban1.png',
- dictSort: 4
- }
- ],
- colorSelectIndex: 0,
- colorList: [{
- "color": "rgba(196, 196, 196, 1)",
- index: 1
- },
- {
- "color": "rgba(96, 148, 196, 1)",
- index: 2
- },
- {
- "color": "rgba(168, 135, 98, 1)",
- index: 3
- }
- ],
- selectConfig: 1,
- selectIndex: 0,
- imgList: [],
- isSubmit: false,
- content: '确定提交名片信息?',
- userInfo: {},
- fileList1: [],
- cardInfo: {
- city: '',
- area: '',
- province: '',
- commonId: '',
- cardBusiness: '',
- name: '',
- post: '',
- companyName: '',
- location: '',
- detailedAddress: '',
- phone: '',
- headSculpture: '',
- currentBackground: '',
- cuttentTemplate: '',
- icon: '',
- }
- };
- },
- methods: {
- layoutChangeTemplate(index) {
- this.layoutSelectIndex = index
- this.cardInfo.cuttentTemplate = this.layoutImgList[index].dictSort
- },
- changeIconColor(index) {
- this.colorSelectIndex = index
- this.cardInfo.icon = this.colorList[index].index
- },
- changeTab(index) {
- this.selectConfig = index
- },
- changeTemplate(index) {
- this.selectIndex = index
- this.cardInfo.currentBackground = this.imgList[index].dictLabel
- },
- 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.currentBackground = this.imgList[0].dictLabel
- }
- if (!this.cardInfo.cuttentTemplate) {
- this.cardInfo.cuttentTemplate = this.layoutImgList[0].dictSort
- }
- if (!this.cardInfo.icon) {
- this.cardInfo.icon = this.colorList[0].index
- }
- })
- },
- 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() {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- this.$request.baseRequest('admin.unimall.cardManagementInfo', 'add', {
- cardManagementInfo: JSON.stringify(this.cardInfo)
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- this.isSubmit = false
- uni.showToast({
- icon: "success",
- title: '保存成功!',
- duration: 2000
- });
- this.$request.baseRequest('admin.unimall.personalHomepageInfo', 'list', {
- page: 1,
- limit: 10,
- commonId: uni.getStorageSync("userInfo").id
- }, failres => {
- console.log('res+++++', failres.errmsg)
- uni.hideLoading()
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- }).then(res => {
- if (res.data.items.length > 0) {
- uni.navigateBack()
- } else {
- uni.navigateTo({
- url: '/pageA/mySet/myHome'
- })
- }
- })
- })
- },
- 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: 30rpx 0 50rpx 0;
- font-size: 32rpx;
- font-weight: bold;
- color: #19191A;
- margin-right: 20rpx;
- }
- .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;
- }
- }
- .active-style {
- color: '#112253';
- font-size: 36rpx;
- font-weight: bold;
- position: relative;
- }
- .active-style::after {
- position: absolute;
- bottom: -20rpx;
- content: "";
- width: 70rpx;
- height: 8rpx;
- border-radius: 4rpx;
- background: #112253;
- left: 0;
- right: 0;
- margin: auto;
- }
- .font-color {
- position: relative;
- }
- .icon-dh {
- width: 32rpx;
- height: 32rpx;
- position: absolute;
- right: 20rpx;
- bottom: 20rpx;
- }
- </style>
|