company_info.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div>
  3. <van-nav-bar :title="title" left-text="返回" @click-left="$route_back" left-arrow></van-nav-bar>
  4. <van-cell-group>
  5. <van-cell title="公司LOGO" is-link class="company_info">
  6. <template solt="default">
  7. <vue-img-cropper v-if="isUploader" ref="cropper" :height="400" :width="400" :maxScale="6" :compressionRatio="0.5" @cutImg="showCutImg" @showLoading="showLoading" @hideLoading="hideLoading">
  8. <img :src="site_info.logo_url?site_info.logo_url : 'static/images/default_company_logo.png'" class="needsclick company_img" />
  9. </vue-img-cropper>
  10. <div v-else @click="openText()">
  11. <img :src="site_info.logo_url?site_info.logo_url : 'static/images/default_company_logo.png'" class="needsclick company_img" />
  12. </div>
  13. </template>
  14. </van-cell>
  15. </van-cell-group>
  16. <van-cell-group class="company_name">
  17. <van-cell title="公司名称" is-link :value="site_info.name" @click="showPopup" />
  18. </van-cell-group>
  19. <!-- <vue-img-cropper
  20. ref="cropper"
  21. :height="400"
  22. :width="400"
  23. :maxScale="6"
  24. :compressionRatio="0.5"
  25. @cutImg="showCutImg"
  26. @showLoading="showLoading"
  27. @hideLoading="hideLoading"
  28. @showError="showError">
  29. </vue-img-cropper> -->
  30. <van-dialog v-model="show" title="修改公司名称" class="edit_com_popup" show-cancel-button @confirm="save_btn">
  31. <van-cell-group>
  32. <input type="text" class="edit_com_input" ref="input" v-model="edit_com_name" name="公司名称" v-validate="'required'" placeholder="请填写公司名称" style=" box-sizing: border-box; width: 100%;">
  33. </van-cell-group>
  34. </van-dialog>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import Vue from 'vue'
  40. import { mapGetters, mapState } from 'vuex';
  41. import VueImgCropper from '@/components/vue-img-cropper'
  42. import { Notify, Image } from 'vant'
  43. Vue.use(Notify).use(Image)
  44. export default {
  45. // 状态
  46. data () {
  47. return {
  48. title: '企业信息',
  49. show: false,
  50. action_sheet_show: false,
  51. actions: [
  52. { name: '选项', color: '#07c160' },
  53. { name: '禁用选项', disabled: true }
  54. ],
  55. user_info: this.$userInfo(),
  56. click_count: 0,
  57. edit_com_name: '',
  58. company_info:{},
  59. isUploader: this.$getCache('isUploader'),
  60. }
  61. },
  62. // 组件
  63. components: {VueImgCropper},
  64. computed: {
  65. ...mapGetters(['site_info'])
  66. },
  67. // 方法
  68. methods: {
  69. // select_img () {
  70. // if (this.click_count == 0) {
  71. // // if(self.$getCache("isUploader")) {
  72. // // self.$refs.cropper.getImg()
  73. // // // setTimeout(() => {
  74. // // // self.click_count = 0
  75. // // // }, 20)
  76. // // }else {
  77. // // }
  78. // this.$dialog.confirm({
  79. // title: '权限获取',
  80. // message: '当您在我们的产品中使用拍照、拍摄、扫描二维码、图片上传等功能时,我们需要获取您设备的相机权限,以便您正常使用图片上传、图片下载、附件上传、头像设置等服务',
  81. // }).then(() => {
  82. // this.$refs.cropper.getImg()
  83. // // setTimeout(() => {
  84. // // this.click_count = 0
  85. // // }, 20)
  86. // })
  87. // }
  88. // },
  89. openText(){
  90. // 功道云需要使用媒体、相册、文件等权限,以便您正常使用图片上传、图片分享、图片下载等服务。
  91. this.$dialog.confirm({
  92. title: '权限获取',
  93. message: '当您在我们的产品中使用拍照、拍摄、扫描二维码、图片上传等功能时,我们需要获取您设备的相机权限,以便您正常使用图片上传、图片下载、附件上传、头像设置等服务',
  94. }).then(() => {
  95. this.$setCache('isUploader',true)
  96. this.isUploader = true
  97. })
  98. },
  99. showCutImg (d) {
  100. this.$toast.loading({
  101. mask: true,
  102. message: '正在处理'
  103. })
  104. this.$axiosUser('post','/api/pro/site/update',{logo_url:d.url}).then((res) => {
  105. this.$store.dispatch('get_site_info',true).then((res) => {})//公司信息
  106. })
  107. },
  108. showLoading () {
  109. this.$toast.loading({
  110. mask: true,
  111. message: '正在处理'
  112. })
  113. },
  114. hideLoading () {
  115. this.$toast.clear()
  116. },
  117. showError (d) {},
  118. // 保存
  119. save_btn () {
  120. this.$validator.validate().then(result => {
  121. if (!result) {
  122. Notify({ type: 'danger', message: this.$validator.errors.items[0].msg })
  123. } else {
  124. this.showLoading()
  125. this.$axiosUser('post','/api/pro/site/update',{name:this.edit_com_name}).then((res) => {
  126. this.company_info = res.data.data
  127. this.$store.dispatch('get_site_info',true).then((res) => {})//公司信息
  128. this.$toast.clear()
  129. this.$toast('修改成功')
  130. })
  131. }
  132. })
  133. },
  134. // 弹窗
  135. showPopup () {
  136. this.edit_com_name = this.site_info.name
  137. this.show = true
  138. this.$nextTick(() => {
  139. this.$refs.input.focus()
  140. })
  141. }
  142. },
  143. }
  144. </script>
  145. <style scoped>
  146. .body_com {
  147. height: calc(100% - 1rem);
  148. position: relative;
  149. }
  150. .company_img{
  151. width: 1.28rem;
  152. height: 1.28rem;
  153. border-radius: 0.1rem;
  154. }
  155. .company_info .van-cell__title,.company_info .van-icon {line-height: 1.42rem;}
  156. .com_name_popup{
  157. width: 50vw;
  158. height: auto;
  159. }
  160. .edit_com_popup{
  161. top: 3rem
  162. }
  163. /deep/.edit_com_popup .van-dialog__content{
  164. padding: 0.2rem;
  165. }
  166. .edit_com_input{
  167. border: 0.02rem solid #efefef;
  168. border-radius: 0.1rem;
  169. padding: 0.2rem 0.14rem;
  170. margin-bottom: 0.2rem;
  171. width: 100%;
  172. -webkit-appearance: none;
  173. -moz-appearance: none;
  174. appearance: none;
  175. outline: none;
  176. }
  177. .company_name .van-cell{
  178. padding: 0.24rem 0.32rem;
  179. }
  180. .company_name .van-cell__value{
  181. width: 50%;
  182. overflow: hidden;
  183. white-space: nowrap;
  184. text-overflow: ellipsis;
  185. }
  186. /deep/ .van-hairline--top-bottom:after, .van-hairline-unset--top-bottom:after{
  187. border:none;
  188. }
  189. /deep/ .van-cell{
  190. padding: 0.15rem 0.32rem;
  191. }
  192. /deep/ .van-cell .van-cell__value{
  193. font-size:0.28rem;
  194. }
  195. </style>