invitation.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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 param = this.getUrlParam('param');
  88. var sUserAgent = navigator.userAgent.toLowerCase();
  89. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  90. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  91. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  92. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  93. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  94. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  95. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  96. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  97. if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
  98. // 移动端访问跳转到移动端页面
  99. window.location.href = 'invitation_mobile_join.html?param='+param
  100. } else {
  101. this.param();//获取pc端页面参数
  102. }
  103. },
  104. //验证手机
  105. phone(){
  106. let phone = this.$refs.phone.value;//手机
  107. 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}$');
  108. if (phone == '') {
  109. this.$message.error('手机号码不能为空');
  110. this.isphone = false;
  111. } else {
  112. this.isphone = true;
  113. if (!reg.test(phone)) {
  114. this.$message.error('请输入正确的手机号码');
  115. this.isregphone = false;
  116. } else {
  117. this.isregphone = true;
  118. }
  119. }
  120. },
  121. //验证姓名
  122. name(){
  123. let name = this.$refs.name.value;
  124. if (name == '') {
  125. this.$message.error('姓名不能为空')
  126. this.isname = false;
  127. } else {
  128. this.isname = true;
  129. if (this.regname.test(name)) {
  130. this.$message.error('姓名不能包含符号、数字等非法字符');
  131. this.isregname = false
  132. } else {
  133. this.isregname = true
  134. }
  135. }
  136. },
  137. //验证码
  138. validCode(){
  139. let Verification = this.$refs.Verification.value;//验证码
  140. if (Verification == '') {
  141. this.$message.error('请输入验证码')
  142. this.isvalidCode = false;
  143. } else {
  144. this.isvalidCode = true;
  145. }
  146. },
  147. // 验证角色
  148. roles(){
  149. let roleid = this.$refs.role.value;//角色
  150. if (roleid == '') {
  151. this.$message.error('请选择岗位角色');
  152. this.isrole = false;
  153. } else {
  154. this.isrole = true;
  155. }
  156. },
  157. // 获取验证码
  158. Obtaincode(){
  159. this.$refs.Verification.value = '';
  160. if (!this.isphone) {
  161. this.$message.error('手机号码不能为空');
  162. } else if (!this.isregphone){
  163. this.$message.error('请输入正确的手机号码');
  164. } else {
  165. let phone = this.$refs.phone.value;//手机
  166. this.$ajax({
  167. url: this.$url.api+'/api/commons/share/getSmsCode'+`?mobile=${phone}`,//http://192.168.253.31:8560
  168. method:'POST'
  169. })
  170. .then(res=>{
  171. if (res.data.success) {
  172. this.isobtaincode = false;
  173. this.settime();
  174. } else {
  175. this.$message.error(res.data.message)
  176. }
  177. })
  178. }
  179. },
  180. // 提交
  181. login(){
  182. let phone = this.$refs.phone.value;//手机
  183. let Verification = this.$refs.Verification.value;//验证码
  184. let name = this.$refs.name.value;//姓名
  185. let roleid = this.$refs.role.value;//角色
  186. if (!this.isphone) {
  187. this.$message.error({
  188. message: '手机号码不能为空'
  189. });
  190. } else if (!this.isregphone){
  191. this.$message.error('请输入正确的手机号码');
  192. } else if (!this.isname) {
  193. this.$message.error('姓名不能为空');
  194. } else if (!this.isregname) {
  195. this.$message.error("姓名不能包含符号、数字等非法字符");
  196. } else if(!this.isvalidCode){
  197. this.$message.error("请输入验证码");
  198. } else if(!this.isrole){
  199. this.$message.error('请选择岗位角色');
  200. } else {
  201. this.$ajax({
  202. url: this.$url.api+'/api/commons/share/submit',
  203. method:'POST',
  204. data:{
  205. username:name,
  206. mobile:phone,
  207. companyId:this.enterprise.companyId,
  208. roleId:roleid,
  209. validCode:Verification,
  210. },
  211. })
  212. .then(res=>{
  213. if (res.data.success) {
  214. this.istanchaung = true;
  215. } else {
  216. this.$message.error(res.data.message);
  217. }
  218. })
  219. }
  220. },
  221. // 跳转首页
  222. gohome(){
  223. this.$router.push({path: '/home'});
  224. },
  225. //倒计时
  226. settime(){
  227. this.times = setTimeout(()=>{
  228. if (this.time == 0) {
  229. this.isobtaincode = true;
  230. this.time = 60;
  231. clearTimeout(this.times);
  232. } else {
  233. this.time--;
  234. this.settime();
  235. }
  236. },1000)
  237. },
  238. //获取角色
  239. role(){
  240. let companyId = this.enterprise.companyId;
  241. this.$ajax({
  242. url: this.$url.api+'/api/account/role/list/'+companyId,
  243. })
  244. .then(res=>{
  245. if (res.data.success) {
  246. this.arr = res.data.data
  247. }
  248. })
  249. },
  250. getUrlParam(name){
  251. var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)");
  252. var index = window.location.href.indexOf('?');
  253. var r=window.location.href.substr(index+1).match(reg);
  254. if (r!=null) return decodeURI(r[2]);
  255. return null;
  256. },
  257. //同步获取页面参数
  258. param: async function () {
  259. let param = this.getUrlParam('param');
  260. let data = await this.$ajax({
  261. url: this.$url.api+"/api/commons/share/valid/param?param="+param,
  262. method:'POST',
  263. headers:{
  264. "Content-Type":"application/x-www-form-urlencoded",
  265. }
  266. });
  267. if (data.data.success) {
  268. this.enterprise = data.data.data;
  269. this.role();//获取角色
  270. } else {
  271. this.$router.push({path:'/failure'})
  272. }
  273. },
  274. //关闭弹窗
  275. hidden(){
  276. this.istanchaung = false;
  277. },
  278. }
  279. }
  280. </script>
  281. <style scoped>
  282. .invitation > img{
  283. width: 100%;
  284. }
  285. .centent {
  286. width: 27rem;
  287. position: absolute;
  288. top: 50%;
  289. left: 50%;
  290. transform: translate(-50%, -50%);
  291. text-align: center
  292. }
  293. .inv-logo {
  294. font-family: PingFangSC-Medium;
  295. font-size: 26px;
  296. color: #FFFFFF;
  297. letter-spacing: 3.25px;
  298. display: inline-block;
  299. position: relative;
  300. bottom: -20px;
  301. }
  302. .padding-left {
  303. padding-left: 15px;
  304. }
  305. .centent > input {
  306. width: 100%;
  307. margin-bottom: 11px;
  308. opacity: 0.87;
  309. background: #FFFFFF;
  310. box-shadow: 0 2px 4px 0 #3C8EFF;
  311. font-size: 14px;
  312. border: 0;
  313. height: 40px;
  314. border-radius: 4px;
  315. }
  316. .inv-title {
  317. text-align: left;
  318. margin-top: 37px;
  319. margin-bottom: 20px;
  320. }
  321. .inv-title > p{
  322. font-family: PingFangSC-Medium;
  323. font-size: 18px;
  324. color: #FFFFFF;
  325. letter-spacing: 2.25px;
  326. text-shadow: 0 2px 4px #1B5099;
  327. line-height: 30px;
  328. }
  329. .inv-title >p:nth-child(1) {
  330. /* margin-bottom: 16px; */
  331. }
  332. .inv-text {
  333. font-family: PingFangSC-Regular;
  334. }
  335. .login {
  336. background: #004CE0;
  337. width: 100%;
  338. border: 0;
  339. height: 40px;
  340. border-radius: 4px;
  341. color: #FFFFFF;
  342. letter-spacing: 1.75px;
  343. }
  344. .role {
  345. width: 100%;
  346. margin-bottom: 39px;
  347. opacity: 0.87;
  348. box-shadow: 0 2px 4px 0 #3C8EFF;
  349. font-size: 14px;
  350. border: 0;
  351. height: 40px;
  352. border-radius: 4px;
  353. appearance:none;
  354. -moz-appearance:none;
  355. -webkit-appearance:none;
  356. /*设置箭头*/
  357. background: url(/static/img/TriangleCopy.png) no-repeat scroll right center transparent;
  358. padding-right: 14px;
  359. background-position-x: 95%;
  360. }
  361. .Verification {
  362. border: 0;
  363. opacity: 0.87;
  364. background: #FFFFFF;
  365. box-shadow: 0 2px 4px 0 #3C8EFF;
  366. margin-bottom: 11px;
  367. height: 40px;
  368. line-height: 38px;
  369. border-radius: 4px;
  370. }
  371. .Verification > input {
  372. width: 68%;
  373. border: 0;
  374. font-size: 14px;
  375. outline:none;
  376. }
  377. .Verification > span {
  378. width: 30%;
  379. display: inline-block;
  380. font-family: PingFangSC-Regular;
  381. font-size: 12px;
  382. color: #2F86FE;
  383. letter-spacing: 1.5px;
  384. }
  385. .bottom {
  386. height: 100px;
  387. background: #FAFCFF;
  388. text-align: center;
  389. padding: 27px 0px;
  390. }
  391. .bottom > p{
  392. font-family: PingFangSC-Regular;
  393. font-size: 16px;
  394. color: #666666;
  395. letter-spacing: 2px;
  396. }
  397. /* 弹窗 */
  398. .Popup {
  399. width: 428px;
  400. height: 235px;
  401. background: #FFFFFF;
  402. border-radius: 2px;
  403. position: fixed;
  404. top: 50%;
  405. left: 50%;
  406. transform: translate(-50%, -50%);
  407. z-index: 10001;
  408. text-align: center;
  409. padding: 24px;
  410. }
  411. .shang {
  412. height: 30%;
  413. position: relative;
  414. }
  415. .shang > img:nth-child(1){
  416. width: 124px;
  417. margin-top: 15px;
  418. }
  419. .shang > img:nth-child(2){
  420. position: absolute;
  421. top: 0px;
  422. right: 0px;
  423. }
  424. .zhong {
  425. height: 50%;
  426. line-height: 36px;
  427. }
  428. .zhong > p:nth-child(1) {
  429. font-family: PingFangSC-Regular;
  430. font-size: 14px;
  431. color: #333333;
  432. letter-spacing: 1.75px;
  433. }
  434. .zhong > p:nth-child(2) {
  435. font-family: PingFangSC-Regular;
  436. font-size: 12px;
  437. color: #666666;
  438. letter-spacing: 1.5px;
  439. }
  440. .xia {
  441. height: 20%;
  442. }
  443. .xia > button {
  444. background: #207CFF;
  445. border-radius: 2px;
  446. font-family: PingFangSC-Regular;
  447. font-size: 14px;
  448. color: #FFFFFF;
  449. letter-spacing: 1.75px;
  450. padding: 6px 16px;
  451. border: 0;
  452. }
  453. </style>