invitation.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div class="invitation">
  3. <div class="zhezhao" v-if="istanchaung"></div>
  4. <div class="Popup" v-if="istanchaung">
  5. <div class="shang">
  6. <img src="/static/img/tijiao.png" alt="">
  7. <img class="xs" @click="hidden" src="/static/img/assets/chahao.png" alt="">
  8. </div>
  9. <div class="zhong">
  10. <p>欢迎你加入U企云服,立即畅享轻松工作!</p>
  11. <p>新用户登录密码随后将发送短信通知请注意查收</p>
  12. </div>
  13. <div class="xia">
  14. <button @click="gohome">立即访问</button>
  15. </div>
  16. </div>
  17. <img src="/static/img/beijing.png" alt="">
  18. <div class="centent">
  19. <div>
  20. <img style="width:80px" src="/static/img/assets/logo@2x.png" alt="">
  21. <span class="inv-logo">U企云服</span>
  22. </div>
  23. <div class="inv-title">
  24. <p>{{enterprise.username}}</p>
  25. <p>
  26. <span class="inv-text">邀请您加入</span>
  27. <span class="inv-text">{{enterprise.companyName}}</span>
  28. <!-- <span class="inv-text">SAAS服务</span> -->
  29. </p>
  30. </div>
  31. <input class="padding-left" type="text" ref="phone" @blur="phone" placeholder="请输入手机号">
  32. <div class="Verification">
  33. <input class="padding-left" type="text" ref="Verification" @change="validCode" placeholder="请输入验证码">
  34. <span v-if="isobtaincode" class="xs" @click="Obtaincode">获取验证码</span>
  35. <span v-if="!isobtaincode" ref="obtaincode">{{time}}</span>
  36. </div>
  37. <input class="padding-left" type="text" ref="name" @blur="name" placeholder="请输入姓名">
  38. <select style="background-color: white;" class="role padding-left" ref="role" @blur="roles">
  39. <option value="" disabled selected hidden>岗位角色</option>
  40. <option v-for="(d,i) in arr" :key="i" :value=d.id>{{d.name}}</option>
  41. </select>
  42. <button class="login" @click="login">提交</button>
  43. </div>
  44. <div class="bottom">
  45. <p>U企云服|电子行业企业管理云端解决方案</p>
  46. <p>深圳市优软科技有限公司</p>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import Session from '@/utils/session'
  52. import { setTimeout } from 'timers';
  53. import { log } from 'util';
  54. export default {
  55. data(){
  56. return {
  57. isobtaincode:true,
  58. time:60,
  59. isphone:false,
  60. isregphone:false,
  61. isname:false,
  62. isregname:false,
  63. regname:new RegExp(/[\@\#\$\%\&\*!!\¥0-9]/),//非法字符加数字
  64. isvalidCode:false,
  65. isrole:false,
  66. enterprise:[],
  67. arr:[],
  68. roleId:'',
  69. times:'',
  70. istanchaung:false,
  71. }
  72. },
  73. computed: {
  74. },
  75. created(){
  76. this.$store.state.isinvitation = false;
  77. this.browserRedirect();
  78. },
  79. mounted(){
  80. this.$store.state.isinvitation = false;
  81. },
  82. destroyed(){
  83. this.$store.state.isinvitation = true
  84. },
  85. methods:{
  86. browserRedirect() {
  87. let url1 = window.location.href;
  88. let param = url1.substring(url1.lastIndexOf('=')+1, url1.length);
  89. var sUserAgent = navigator.userAgent.toLowerCase();
  90. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  91. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  92. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  93. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  94. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  95. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  96. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  97. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  98. if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
  99. // 移动端访问跳转到移动端页面
  100. window.location.href = 'invitation_mobile_join.html?param='+param
  101. } else {
  102. this.param();//获取pc端页面参数
  103. }
  104. },
  105. //验证手机
  106. phone(){
  107. let phone = this.$refs.phone.value;//手机
  108. let reg = new RegExp('^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$');
  109. if (phone == '') {
  110. this.$message.error('手机号码不能为空');
  111. this.isphone = false;
  112. } else {
  113. this.isphone = true;
  114. if (!reg.test(phone)) {
  115. this.$message.error('请输入正确的手机号码');
  116. this.isregphone = false;
  117. } else {
  118. this.isregphone = true;
  119. }
  120. }
  121. },
  122. //验证姓名
  123. name(){
  124. let name = this.$refs.name.value;
  125. if (name == '') {
  126. this.$message.error('姓名不能为空')
  127. this.isname = false;
  128. } else {
  129. this.isname = true;
  130. if (this.regname.test(name)) {
  131. this.$message.error('姓名不能包含符号、数字等非法字符');
  132. this.isregname = false
  133. } else {
  134. this.isregname = true
  135. }
  136. }
  137. },
  138. //验证码
  139. validCode(){
  140. let Verification = this.$refs.Verification.value;//验证码
  141. if (Verification == '') {
  142. this.$message.error('请输入验证码')
  143. this.isvalidCode = false;
  144. } else {
  145. this.isvalidCode = true;
  146. }
  147. },
  148. // 验证角色
  149. roles(){
  150. let roleid = this.$refs.role.value;//角色
  151. if (roleid == '') {
  152. this.$message.error('请选择岗位角色');
  153. this.isrole = false;
  154. } else {
  155. this.isrole = true;
  156. }
  157. },
  158. // 获取验证码
  159. Obtaincode(){
  160. this.$refs.Verification.value = '';
  161. if (!this.isphone) {
  162. this.$message.error('手机号码不能为空');
  163. } else if (!this.isregphone){
  164. this.$message.error('请输入正确的手机号码');
  165. } else {
  166. let phone = this.$refs.phone.value;//手机
  167. this.$ajax({
  168. url: this.$url.api+'/api/commons/share/getSmsCode'+`?mobile=${phone}`,//http://192.168.253.31:8560
  169. method:'POST'
  170. })
  171. .then(res=>{
  172. if (res.data.success) {
  173. this.isobtaincode = false;
  174. this.settime();
  175. } else {
  176. this.$message.error(res.data.message)
  177. }
  178. })
  179. }
  180. },
  181. // 提交
  182. login(){
  183. let phone = this.$refs.phone.value;//手机
  184. let Verification = this.$refs.Verification.value;//验证码
  185. let name = this.$refs.name.value;//姓名
  186. let roleid = this.$refs.role.value;//角色
  187. if (!this.isphone) {
  188. this.$message.error({
  189. message: '手机号码不能为空'
  190. });
  191. } else if (!this.isregphone){
  192. this.$message.error('请输入正确的手机号码');
  193. } else if (!this.isname) {
  194. this.$message.error('姓名不能为空');
  195. } else if (!this.isregname) {
  196. this.$message.error("姓名不能包含符号、数字等非法字符");
  197. } else if(!this.isvalidCode){
  198. this.$message.error("请输入验证码");
  199. } else if(!this.isrole){
  200. this.$message.error('请选择岗位角色');
  201. } else {
  202. this.$ajax({
  203. url: this.$url.api+'/api/commons/share/submit',
  204. method:'POST',
  205. data:{
  206. username:name,
  207. mobile:phone,
  208. companyId:this.enterprise.companyId,
  209. roleId:roleid,
  210. validCode:Verification,
  211. },
  212. })
  213. .then(res=>{
  214. if (res.data.success) {
  215. this.istanchaung = true;
  216. } else {
  217. this.$message.error(res.data.message);
  218. }
  219. })
  220. }
  221. },
  222. // 跳转首页
  223. gohome(){
  224. this.$router.push({path: '/home'});
  225. },
  226. //倒计时
  227. settime(){
  228. this.times = setTimeout(()=>{
  229. if (this.time == 0) {
  230. this.isobtaincode = true;
  231. this.time = 60;
  232. clearTimeout(this.times);
  233. } else {
  234. this.time--;
  235. this.settime();
  236. }
  237. },1000)
  238. },
  239. //获取角色
  240. role(){
  241. let companyId = this.enterprise.companyId;
  242. this.$ajax({
  243. url: this.$url.api+'/api/account/role/list/'+companyId,
  244. })
  245. .then(res=>{
  246. if (res.data.success) {
  247. this.arr = res.data.data
  248. }
  249. })
  250. },
  251. //同步获取页面参数
  252. param: async function () {
  253. let url1 = window.location.href;
  254. let param = url1.substring(url1.lastIndexOf('=')+1, url1.length);
  255. let data = await this.$ajax({
  256. url: this.$url.api+"/api/commons/share/valid/param?param="+param,
  257. method:'POST',
  258. headers:{
  259. "Content-Type":"application/x-www-form-urlencoded",
  260. }
  261. });
  262. if (data.data.success) {
  263. this.enterprise = data.data.data;
  264. this.role();//获取角色
  265. } else {
  266. this.$router.push({path:'/failure'})
  267. }
  268. },
  269. //关闭弹窗
  270. hidden(){
  271. this.istanchaung = false;
  272. },
  273. }
  274. }
  275. </script>
  276. <style scoped>
  277. .invitation > img{
  278. width: 100%;
  279. }
  280. .centent {
  281. width: 27rem;
  282. position: absolute;
  283. top: 50%;
  284. left: 50%;
  285. transform: translate(-50%, -50%);
  286. text-align: center
  287. }
  288. .inv-logo {
  289. font-family: PingFangSC-Medium;
  290. font-size: 26px;
  291. color: #FFFFFF;
  292. letter-spacing: 3.25px;
  293. display: inline-block;
  294. position: relative;
  295. bottom: -20px;
  296. }
  297. .padding-left {
  298. padding-left: 15px;
  299. }
  300. .centent > input {
  301. width: 100%;
  302. margin-bottom: 11px;
  303. opacity: 0.87;
  304. background: #FFFFFF;
  305. box-shadow: 0 2px 4px 0 #3C8EFF;
  306. font-size: 14px;
  307. border: 0;
  308. height: 40px;
  309. border-radius: 4px;
  310. }
  311. .inv-title {
  312. text-align: left;
  313. margin-top: 37px;
  314. margin-bottom: 20px;
  315. }
  316. .inv-title > p{
  317. font-family: PingFangSC-Medium;
  318. font-size: 18px;
  319. color: #FFFFFF;
  320. letter-spacing: 2.25px;
  321. text-shadow: 0 2px 4px #1B5099;
  322. line-height: 30px;
  323. }
  324. .inv-title >p:nth-child(1) {
  325. /* margin-bottom: 16px; */
  326. }
  327. .inv-text {
  328. font-family: PingFangSC-Regular;
  329. }
  330. .login {
  331. background: #004CE0;
  332. width: 100%;
  333. border: 0;
  334. height: 40px;
  335. border-radius: 4px;
  336. color: #FFFFFF;
  337. letter-spacing: 1.75px;
  338. }
  339. .role {
  340. width: 100%;
  341. margin-bottom: 39px;
  342. opacity: 0.87;
  343. box-shadow: 0 2px 4px 0 #3C8EFF;
  344. font-size: 14px;
  345. border: 0;
  346. height: 40px;
  347. border-radius: 4px;
  348. appearance:none;
  349. -moz-appearance:none;
  350. -webkit-appearance:none;
  351. /*设置箭头*/
  352. background: url(/static/img/TriangleCopy.png) no-repeat scroll right center transparent;
  353. padding-right: 14px;
  354. background-position-x: 95%;
  355. }
  356. .Verification {
  357. border: 0;
  358. opacity: 0.87;
  359. background: #FFFFFF;
  360. box-shadow: 0 2px 4px 0 #3C8EFF;
  361. margin-bottom: 11px;
  362. height: 40px;
  363. line-height: 38px;
  364. border-radius: 4px;
  365. }
  366. .Verification > input {
  367. width: 68%;
  368. border: 0;
  369. font-size: 14px;
  370. outline:none;
  371. }
  372. .Verification > span {
  373. width: 30%;
  374. display: inline-block;
  375. font-family: PingFangSC-Regular;
  376. font-size: 12px;
  377. color: #2F86FE;
  378. letter-spacing: 1.5px;
  379. }
  380. .bottom {
  381. height: 100px;
  382. background: #FAFCFF;
  383. text-align: center;
  384. padding: 27px 0px;
  385. }
  386. .bottom > p{
  387. font-family: PingFangSC-Regular;
  388. font-size: 16px;
  389. color: #666666;
  390. letter-spacing: 2px;
  391. }
  392. /* 弹窗 */
  393. .Popup {
  394. width: 428px;
  395. height: 235px;
  396. background: #FFFFFF;
  397. border-radius: 2px;
  398. position: fixed;
  399. top: 50%;
  400. left: 50%;
  401. transform: translate(-50%, -50%);
  402. z-index: 10001;
  403. text-align: center;
  404. padding: 24px;
  405. }
  406. .shang {
  407. height: 30%;
  408. position: relative;
  409. }
  410. .shang > img:nth-child(1){
  411. width: 124px;
  412. margin-top: 15px;
  413. }
  414. .shang > img:nth-child(2){
  415. position: absolute;
  416. top: 0px;
  417. right: 0px;
  418. }
  419. .zhong {
  420. height: 50%;
  421. line-height: 36px;
  422. }
  423. .zhong > p:nth-child(1) {
  424. font-family: PingFangSC-Regular;
  425. font-size: 14px;
  426. color: #333333;
  427. letter-spacing: 1.75px;
  428. }
  429. .zhong > p:nth-child(2) {
  430. font-family: PingFangSC-Regular;
  431. font-size: 12px;
  432. color: #666666;
  433. letter-spacing: 1.5px;
  434. }
  435. .xia {
  436. height: 20%;
  437. }
  438. .xia > button {
  439. background: #207CFF;
  440. border-radius: 2px;
  441. font-family: PingFangSC-Regular;
  442. font-size: 14px;
  443. color: #FFFFFF;
  444. letter-spacing: 1.75px;
  445. padding: 6px 16px;
  446. border: 0;
  447. }
  448. </style>