addConnect.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="userAddConnect">
  3. <div class="contentArea">
  4. <div class="cellBox" v-for="item in userData">
  5. <div class="stitle">{{item.title}}</div>
  6. <input
  7. type="text"
  8. v-model="item.value"
  9. :placeholder="item.placeholder"
  10. v-if="item.type === 'text'" />
  11. <el-select v-model="item.value" :placeholder="item.placeholder" v-else-if="item.type==='select'">
  12. <el-option
  13. v-for="option in item.options"
  14. :key="option.value"
  15. :label="option.label"
  16. :value="option.value">
  17. </el-option>
  18. </el-select>
  19. </div>
  20. <div class="submitBtn" @click="submitHandler">
  21. <p>保存</p>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. /**
  28. * 名片夹
  29. */
  30. import Vue from 'vue'
  31. import { InfiniteScroll, Loadmore, CellSwipe, MessageBox } from 'mint-ui';
  32. import MintUI from 'mint-ui';
  33. import "mint-ui/lib/style.css";
  34. const mix = {
  35. data() {
  36. return {
  37. // 详情id
  38. detailID: this.$route.params.detail,
  39. }
  40. },
  41. methods: {
  42. }
  43. }
  44. //联系方式展示 0 不展示 1 电话 2网址 3 微信
  45. export default {
  46. name: 'UserAddConnect',
  47. mixins: [mix],
  48. data() {
  49. return {
  50. userData: [
  51. { title: '联系电话', type:"text", name: 'contact', value: '', placeholder: "请输入您的联系电话(选填)" },
  52. { title: '微信号', type:"text",name: 'wechat', value: '', placeholder: "请输入您的微信号(选填)" },
  53. { title: '企业官网', type:"text", name: 'website', value: '', placeholder: "请输入您的企业官网链接,需以http://开头(选填)"},
  54. {
  55. title: '展示信息设置', type:"select", name: 'contactDisplay', value: '', placeholder: "选择您需要展示的联系方式",
  56. options: [{label: "不展示", value: 0},{label: "联系电话", value: 1},{label: "微信号", value: 3},{label: "企业官网",
  57. value: 2},]
  58. },
  59. ],
  60. loading: true,
  61. }
  62. },
  63. async created() {
  64. },
  65. async mounted() {
  66. await this.needLogin()
  67. this.getConnectInfo()
  68. },
  69. methods: {
  70. /** 获取 */
  71. getConnectInfo() {
  72. this.loading = true
  73. this.$axios.post('/api/company_info/get_home_page_info', {}).then(res => {
  74. if (res.data.status === 1) {
  75. const { contactDisplay, website, wechat, contact} = res.data.data && res.data.data.base
  76. this.userData[0].value = contact || ""
  77. this.userData[1].value = wechat || ""
  78. this.userData[2].value = website || ""
  79. this.userData[3].value = Number(contactDisplay) || 0
  80. } else {
  81. this.$message.error('查询失败:' + res.info)
  82. }
  83. }).finally(() => {
  84. this.loading = false
  85. })
  86. },
  87. jumpUserPage() {
  88. const { id } = this.selectedItem
  89. let url = `/wo/${id}`
  90. if (this.$deviceType.app) {
  91. location.href = `proginn://jump?path=${url}`
  92. } else {
  93. location.href = url
  94. }
  95. },
  96. calcUserVip(item) {
  97. const { isVip, vipTypeID } = item
  98. return { [ 'vip' + vipTypeID ]: isVip }
  99. },
  100. submitHandler() {
  101. if (!this.checkSubmit()) {
  102. return
  103. }
  104. //todo 存入
  105. },
  106. checkSubmit() {
  107. let p = {}
  108. this.userData.forEach(v=>{
  109. const {name, value} = v
  110. p[name] = value
  111. })
  112. this.$axios.post('/api/companyInfo/updateContactInfo', p).then(res => {
  113. if (res.data.status === 1) {
  114. this.$message.success('保存成功')
  115. } else {
  116. this.$message.error('保存失败:' + res.info)
  117. }
  118. }).finally(() => {
  119. this.loading = false
  120. })
  121. return true
  122. }
  123. },
  124. }
  125. </script>
  126. <style lang="scss">
  127. @import "../../../assets/css/scssCommon";
  128. .el-select {
  129. width: 100%;
  130. .el-input__inner {
  131. margin-top: pxtovw(2);
  132. width: pxtovw(355);
  133. height: pxtovw(44);
  134. background: rgba(255, 255, 255, 1);
  135. border-radius: pxtovw(3);
  136. border:pxtovw(1) solid rgba(146,154,164,0.2);
  137. padding: pxtovw(15) pxtovw(10);
  138. }
  139. }
  140. input::placeholder {
  141. color: #AFB9C4;
  142. height:pxtovw(14);
  143. font-size:pxtovw(14);
  144. font-weight:400;
  145. line-height:pxtovw(14);
  146. }
  147. </style>
  148. <style lang="scss" scoped>
  149. @import '../../../assets/css/otherpage/user/addConnect.scss';
  150. </style>