setinfo.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="content">
  3. <view class="row1">
  4. <text class="tit">企业头像</text>
  5. <view class="background-img" @click.stop="imgsub">
  6. <image class="background-img" v-model="qyList.headimg" :src="qyList.headimg" mode="aspectFill">
  7. </image>
  8. </view>
  9. </view>
  10. <view class="row">
  11. <text class="tit">企业名称</text>
  12. <input class="input" type="text" v-model="qyList.name" placeholder-class="placeholder" />
  13. </view>
  14. <view class="row">
  15. <text class="tit">企业简介</text>
  16. <input class="input" type="text" placeholder-class="placeholder" disabled value="修改" style="color: #3075ff;"
  17. @click="navto('/pages/set/bjq')" />
  18. </view>
  19. <view class="" v-html="content" style="padding: 20rpx;background-color: #fff;text-align: justify;">
  20. </view>
  21. <view class="add-btn" @click="confirm">提交</view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. changeInformation,
  27. enterprise
  28. } from '@/api/user.js'
  29. import {
  30. mapState,
  31. mapMutations
  32. } from 'vuex';
  33. import {
  34. upload
  35. } from '@/api/order.js';
  36. import {
  37. userEdit,
  38. logout
  39. } from '@/api/set.js';
  40. export default {
  41. data() {
  42. return {
  43. userInfo1: '',
  44. show: false,
  45. password: '',
  46. qyList: {},
  47. maxText: 225, //最大字数
  48. currentWordNumber: 0, //当前字数
  49. content: '', //企业简介
  50. }
  51. },
  52. computed: {
  53. ...mapState('user', ['userInfo'])
  54. },
  55. onLoad() {
  56. enterprise().then(res => {
  57. console.log(res, '信息');
  58. this.qyList = res.data
  59. // res.data.introduce = JSON.parse(JSON.stringify(res.data.introduce))
  60. this.content = res.data.introduce.replace(/<img/g,"<img style='max-width:100%;height:auto;'");
  61. })
  62. },
  63. methods: {
  64. ...mapMutations('user', ['logout']),
  65. navto(url) {
  66. uni.navigateTo({
  67. url
  68. })
  69. },
  70. imgsub() {
  71. console.log('上传头像')
  72. upload({
  73. filename: ''
  74. }).then(data => {
  75. console.log("data", data);
  76. this.qyList.headimg = data[0].url;
  77. console.log(this.qyList.headimg, '22312');
  78. })
  79. },
  80. confirm() {
  81. let obj = this
  82. changeInformation({
  83. headimg: obj.qyList.headimg,
  84. name: obj.qyList.name,
  85. introduce: obj.content,
  86. })
  87. .then(e => {
  88. // console.log(e, '返回');
  89. obj.$api.msg('修改成功');
  90. setTimeout(() => {
  91. uni.switchTab({
  92. url: '/pages/user/user'
  93. });
  94. }, 1000);
  95. console.log(e, '1');
  96. })
  97. .catch(e => {
  98. console.log(e, '2');
  99. });
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .row1 {
  106. display: flex;
  107. align-items: center;
  108. justify-content: space-between;
  109. position: relative;
  110. padding: 0 30upx;
  111. height: 110upx;
  112. background: #fff;
  113. margin-bottom: 20upx;
  114. .tit {
  115. flex-shrink: 0;
  116. width: 200rpx;
  117. font-size: $font-lg;
  118. color: $font-color-dark;
  119. }
  120. .background-img {
  121. width: 80rpx;
  122. height: 80rpx;
  123. border-radius: 50%;
  124. background: #f2f2f2;
  125. }
  126. }
  127. .row {
  128. position: relative;
  129. display: flex;
  130. align-items: center;
  131. padding: 0 30upx;
  132. min-height: 110upx;
  133. background: #fff;
  134. align-items: flex-start;
  135. line-height: 110rpx;
  136. .tit {
  137. flex-shrink: 0;
  138. width: 200upx;
  139. font-size: $font-lg;
  140. color: $font-color-dark;
  141. }
  142. .input {
  143. flex: 1;
  144. text-align: right;
  145. font-size: $font-base;
  146. color: $color-gray;
  147. height: 110rpx;
  148. }
  149. .currentWordNumber {
  150. color: #999999;
  151. font-size: 24rpx;
  152. position: absolute;
  153. right: 0;
  154. bottom: 0;
  155. margin: -100rpx 30rpx;
  156. }
  157. }
  158. .add-btn {
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. margin: 158rpx auto 30rpx;
  163. width: 560rpx;
  164. height: 80rpx;
  165. background: linear-gradient(0deg, #2E58FF, #32C6FF);
  166. border-radius: 40px;
  167. color: #FFFFFF;
  168. }
  169. .out {
  170. display: flex;
  171. align-items: center;
  172. justify-content: center;
  173. margin: 0 auto 30rpx;
  174. width: 560rpx;
  175. height: 80rpx;
  176. border: 1px solid #32C6FF;
  177. background: #FFFFFF;
  178. border-radius: 40px;
  179. color: #32C6FF;
  180. }
  181. .psw-wrapper {
  182. width: 548rpx;
  183. height: 344rpx;
  184. background-color: #ffffff;
  185. .psw-title {
  186. width: 100%;
  187. font-size: 35rpx;
  188. padding: 43rpx 0 49rpx;
  189. text-align: center;
  190. font-weight: 800;
  191. }
  192. .psw-ipt {
  193. display: block;
  194. background-color: #dce3ed;
  195. height: 90rpx;
  196. width: 464rpx;
  197. padding-left: 30rpx;
  198. margin: 0 auto;
  199. font-size: 80rpx;
  200. }
  201. .psw-btn text {
  202. display: inline-block;
  203. text-align: center;
  204. width: 50%;
  205. padding-top: 29rpx;
  206. font-size: 35rpx;
  207. }
  208. .psw-qd {
  209. color: #32C6FF;
  210. }
  211. }
  212. </style>