| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <div class="userAddConnect">
- <div class="contentArea">
- <div class="cellBox" v-for="item in userData">
- <div class="stitle">{{item.title}}</div>
- <input
- type="text"
- v-model="item.value"
- :placeholder="item.placeholder"
- v-if="item.type === 'text'" />
- <el-select v-model="item.value" :placeholder="item.placeholder" v-else-if="item.type==='select'">
- <el-option
- v-for="option in item.options"
- :key="option.value"
- :label="option.label"
- :value="option.value">
- </el-option>
- </el-select>
- </div>
- <div class="submitBtn" @click="submitHandler">
- <p>保存</p>
- </div>
- </div>
- </div>
- </template>
- <script>
- /**
- * 名片夹
- */
- import Vue from 'vue'
- import { InfiniteScroll, Loadmore, CellSwipe, MessageBox } from 'mint-ui';
- import MintUI from 'mint-ui';
- import "mint-ui/lib/style.css";
- const mix = {
- data() {
- return {
- // 详情id
- detailID: this.$route.params.detail,
- }
- },
- methods: {
- }
- }
- //联系方式展示 0 不展示 1 电话 2网址 3 微信
- export default {
- name: 'UserAddConnect',
- mixins: [mix],
- data() {
- return {
- userData: [
- { title: '联系电话', type:"text", name: 'contact', value: '', placeholder: "请输入您的联系电话(选填)" },
- { title: '微信号', type:"text",name: 'wechat', value: '', placeholder: "请输入您的微信号(选填)" },
- { title: '企业官网', type:"text", name: 'website', value: '', placeholder: "请输入您的企业官网链接,需以http://开头(选填)"},
- {
- title: '展示信息设置', type:"select", name: 'contactDisplay', value: '', placeholder: "选择您需要展示的联系方式",
- options: [{label: "不展示", value: 0},{label: "联系电话", value: 1},{label: "微信号", value: 3},{label: "企业官网",
- value: 2},]
- },
- ],
- loading: true,
- }
- },
- async created() {
- },
- async mounted() {
- await this.needLogin()
- this.getConnectInfo()
- },
- methods: {
- /** 获取 */
- getConnectInfo() {
- this.loading = true
- this.$axios.post('/api/company_info/get_home_page_info', {}).then(res => {
- if (res.data.status === 1) {
- const { contactDisplay, website, wechat, contact} = res.data.data && res.data.data.base
- this.userData[0].value = contact || ""
- this.userData[1].value = wechat || ""
- this.userData[2].value = website || ""
- this.userData[3].value = Number(contactDisplay) || 0
- } else {
- this.$message.error('查询失败:' + res.info)
- }
- }).finally(() => {
- this.loading = false
- })
- },
- jumpUserPage() {
- const { id } = this.selectedItem
- let url = `/wo/${id}`
- if (this.$deviceType.app) {
- location.href = `proginn://jump?path=${url}`
- } else {
- location.href = url
- }
- },
- calcUserVip(item) {
- const { isVip, vipTypeID } = item
- return { [ 'vip' + vipTypeID ]: isVip }
- },
- submitHandler() {
- if (!this.checkSubmit()) {
- return
- }
- //todo 存入
- },
- checkSubmit() {
- let p = {}
- this.userData.forEach(v=>{
- const {name, value} = v
- p[name] = value
- })
- this.$axios.post('/api/companyInfo/updateContactInfo', p).then(res => {
- if (res.data.status === 1) {
- this.$message.success('保存成功')
- } else {
- this.$message.error('保存失败:' + res.info)
- }
- }).finally(() => {
- this.loading = false
- })
- return true
- }
- },
- }
- </script>
- <style lang="scss">
- @import "../../../assets/css/scssCommon";
- .el-select {
- width: 100%;
- .el-input__inner {
- margin-top: pxtovw(2);
- width: pxtovw(355);
- height: pxtovw(44);
- background: rgba(255, 255, 255, 1);
- border-radius: pxtovw(3);
- border:pxtovw(1) solid rgba(146,154,164,0.2);
- padding: pxtovw(15) pxtovw(10);
- }
- }
- input::placeholder {
- color: #AFB9C4;
- height:pxtovw(14);
- font-size:pxtovw(14);
- font-weight:400;
- line-height:pxtovw(14);
- }
- </style>
- <style lang="scss" scoped>
- @import '../../../assets/css/otherpage/user/addConnect.scss';
- </style>
|