qiyexiangxi.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div>
  3. <span class="Tips" ref="Tips"></span>
  4. <!-- 企业详细信息 -->
  5. <div v-if="xiugai">
  6. <div class="gs-worp qy-worp" style="width:100%">
  7. <div class="qy-title">
  8. <span><img @click= "gobick" style="float: left;padding: 20px; cursor:pointer" src="../../../static/img/fanhui.png" alt=""></span>
  9. <span>企业基本信息</span>
  10. <span v-if="isxiugaiId" @click="xiugaiqiye" class="qy-xiugai dianji">修改</span>
  11. </div>
  12. <div class="qy-conent">
  13. <ul>
  14. <li><span class="qy-biaoti">公司名称</span><span>{{content.name}}</span></li>
  15. <li><span class="qy-biaoti">所属行业</span><span>{{content.type}}</span></li>
  16. <li><span class="qy-biaoti">公司地址</span><span>{{content.address}}</span></li>
  17. </ul>
  18. </div>
  19. </div>
  20. <div class="gs-worp qy-worp" style="width:100%">
  21. <div class="qy-title">
  22. <span>管理员信息</span>
  23. </div>
  24. <div class="qy-conent">
  25. <ul>
  26. <li><span class="qy-biaoti">姓名</span><span>{{content.admin}}</span></li>
  27. <li><span class="qy-biaoti">手机号</span><span>{{mytoken.account.mobile}}</span></li>
  28. <li><span class="qy-biaoti">邮箱</span><span>{{content.adminEmail}}</span></li>
  29. </ul>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- 修改企业信息 ------------------------------------------ -->
  34. <div v-else>
  35. <div class="gs-worp qy-worp" style="width: 100%">
  36. <div class="qy-title" style="position: relative;">
  37. <span>企业基本信息</span>
  38. <div class="qy-anniu">
  39. <span @click= "baocunxiugai" class="qy-xiugai dianji" style="left: 0">保存</span>
  40. <span @click= "quxiaoxiugai" class="qy-quxiao xs">取消</span>
  41. </div>
  42. </div>
  43. <div class="qy-conent">
  44. <ul>
  45. <li>
  46. <span class="qy-biaoti"><span class="xingxing">*</span>公司名称</span>
  47. <span>{{content.name}}</span>
  48. </li>
  49. <li>
  50. <span class="qy-biaoti">所属行业</span>
  51. <select ref="qyindustry" style="width:59%;height: 30px" name="selectAge" id="selectAge">
  52. <option value="">请选择所属行业</option>
  53. <option value="贸易零售">贸易零售</option>
  54. <option value="制造加工">制造加工</option>
  55. <option value="服务业">服务业</option>
  56. <option value="教育">教育</option>
  57. <option value="信息传媒">信息传媒</option>
  58. <option value="金融">金融</option>
  59. <option value="高新科技">高新科技</option>
  60. <option value="电子商务">电子商务</option>
  61. <option value="互联网">互联网</option>
  62. <option value="医疗服务">医疗服务</option>
  63. <option value="艺术娱乐">艺术娱乐</option>
  64. <option value="地产建筑">地产建筑</option>
  65. <option value="公共服务">公共服务</option>
  66. <option value="开采冶金">开采冶金</option>
  67. <option value="交通仓储">交通仓储</option>
  68. <option value="农林牧渔">农林牧渔</option>
  69. <option value="其他">其他</option>
  70. </select>
  71. </li>
  72. <li>
  73. <span class="qy-biaoti">公司地址</span>
  74. <span>{{content.address}}</span>
  75. </li>
  76. </ul>
  77. </div>
  78. </div>
  79. <div class="gs-worp qy-worp" style="width: 100%">
  80. <div class="qy-title">
  81. <span>管理员信息</span>
  82. </div>
  83. <div class="qy-conent">
  84. <ul>
  85. <li><span class="qy-biaoti">姓名</span><span>{{content.admin}}</span></li>
  86. <li><span class="qy-biaoti">手机号</span><span>{{mytoken.account.mobile}}</span></li>
  87. <li>
  88. <span class="qy-biaoti">邮箱</span>
  89. <input @change="email" ref="email" type="text" value="">
  90. <dir class="qy-Tips"><span style="color:red">{{Email}}</span></dir>
  91. </li>
  92. </ul>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. export default {
  100. data(){
  101. return {
  102. xiugai:true,
  103. content: JSON.parse(window.sessionStorage.getItem("content")),
  104. Email: '',
  105. mytoken: JSON.parse(localStorage.getItem('app-state-session')),//本地储存的用户信息
  106. isId: false,
  107. isemail: true,//正则邮箱
  108. isxiugaiId: false
  109. }
  110. },
  111. mounted(){
  112. //不是管理员隐藏修改按钮
  113. if (this.content.adminId == this.mytoken.account.id) {
  114. this.isxiugaiId = true;
  115. } else {
  116. this.isxiugaiId = false
  117. }
  118. },
  119. methods: {
  120. selects(){
  121. let selects = this.$refs.qyindustry;
  122. let options = selects.options;
  123. for (let i = 0; i < options.length; i++) {
  124. if (options[i].innerHTML == this.content.type) {
  125. options[i].selected = true
  126. }
  127. };
  128. let email = this.$refs.email;
  129. email.value = this.content.adminEmail;
  130. },
  131. //修改企业信息
  132. xiugaiqiye(){
  133. document.documentElement.scrollTop = 0;
  134. this.xiugai = false;
  135. setTimeout(()=>{
  136. this.selects()
  137. },10)
  138. },
  139. email(){ //验证邮箱
  140. let reg = new RegExp("^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-z]{2,}$");
  141. let email = this.$refs.email.value;//邮箱
  142. if (email == '') {
  143. this.Email = ''
  144. this.isemail = true
  145. } else {
  146. if (!reg.test(email)) {
  147. this.Email = '请填写正确的邮箱'
  148. this.isemail = false
  149. } else {
  150. this.Email = ''
  151. this.isemail = true
  152. }
  153. }
  154. },
  155. // 取消修改
  156. quxiaoxiugai(){
  157. document.documentElement.scrollTop = 0;
  158. this.xiugai = true;
  159. },
  160. // 保存修改
  161. baocunxiugai(){
  162. let qyindustry = this.$refs.qyindustry.value;//所属行业
  163. if (this.isemail && qyindustry!='') {
  164. let email = this.$refs.email.value;
  165. let qyname = this.content.name;//公司名字
  166. // let qyindustry = this.$refs.qyindustry.value;//所属行业
  167. let address = this.content.address;//公司详细地址
  168. let companyId = this.content.id;
  169. let name = this.content.realname;//名字
  170. let mobile = this.mytoken.account.mobile;//手机号
  171. let uu = this.content.uu;
  172. let company = {'name':qyname,'address':address, 'id':companyId, 'type':qyindustry};
  173. let account = {'realname':name,'email':email,'mobile':mobile, 'uu':uu};
  174. this.$ajax({
  175. url: this.$url.api+"/api/account/accountCenter/companyAccount/update",//http://192.168.253.31:8560
  176. method: 'post',
  177. data: {
  178. companyRegDTO:company,
  179. accountRegDTO:account,
  180. },
  181. headers: {
  182. "Authorization":this.mytoken.token,
  183. }
  184. })
  185. .then(res=>{
  186. // console.log("请求成功",res)
  187. if (res.data.success) {
  188. document.documentElement.scrollTop = 0;
  189. this.xiugai = true;
  190. this.content.type = qyindustry;
  191. this.content.adminEmail = email
  192. };
  193. })
  194. .catch(err=>{
  195. // console.log("请求失败",err)
  196. })
  197. } else {
  198. this.$refs.Tips.innerHTML= "请填写正确的邮箱或选择行业"
  199. // this.isTipsmail = true;
  200. setTimeout(()=>{
  201. this.$refs.Tips.innerHTML= ""
  202. },3000)
  203. }
  204. },
  205. //返回
  206. gobick(){
  207. // this.$router.go(-1)
  208. this.$router.push({name:'company'});
  209. }
  210. }
  211. }
  212. </script>
  213. <style scoped>
  214. .xg-biaoqian {
  215. padding: 6px 20px;
  216. border-radius: 2px;
  217. margin-right: 8px;
  218. background: #F1F7FC;
  219. color: #243A52;
  220. }
  221. .qcbiaoqian {
  222. position: relative;
  223. top: -17px;
  224. right: -21px;
  225. }
  226. .Tips {
  227. display: block;
  228. text-align: center;
  229. color: red;
  230. height: 20px;
  231. }
  232. .qy-Tips {
  233. margin: 0;
  234. text-align: left;
  235. height: 26px;
  236. margin-left: 16%;
  237. }
  238. </style>