invitation.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <div class="invitation">
  3. <img src="/static/img/beijing.png" alt="">
  4. <div class="centent">
  5. <img src="/static/img/assets/logo@2x.png" alt="">
  6. <p class="inv-logo">U企云服</p>
  7. <div class="inv-title">
  8. <p>{{enterprise.username}}</p>
  9. <p>
  10. <span class="inv-text">邀请您加入</span>
  11. <span>{{enterprise.companyName}}</span>
  12. <span class="inv-text">SAAS服务</span>
  13. </p>
  14. </div>
  15. <input type="text" ref="phone" @blur="phone" placeholder="请输入手机号">
  16. <div class="Verification">
  17. <input type="text" ref="Verification" @change="validCode" placeholder="请输入验证码">
  18. <span v-if="isobtaincode" class="xs" @click="Obtaincode">获取验证码</span>
  19. <span v-if="!isobtaincode" ref="obtaincode">{{time}}</span>
  20. </div>
  21. <input type="text" ref="name" @blur="name" placeholder="请输入姓名">
  22. <select class="role" ref="role" @blur="roles">
  23. <option value="">岗位角色</option>
  24. <option v-for="(d,i) in arr" :key="i" :value=d.id>{{d.name}}</option>
  25. </select>
  26. <button class="login" @click="login">提交</button>
  27. </div>
  28. <div class="bottom">
  29. <p>U企云服|电子行业企业管理云端解决方案</p>
  30. <p>版权所有:深圳市优软科技有限公司 Copyright @ 2017 All Rights Reserved</p>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import Session from '@/utils/session'
  36. import { setTimeout } from 'timers';
  37. export default {
  38. data(){
  39. return {
  40. isobtaincode:true,
  41. time:60,
  42. isphone:false,
  43. isregphone:false,
  44. isname:false,
  45. isregname:false,
  46. regname:new RegExp(/[\@\#\$\%\&\*!!\¥0-9a-zA-Z]/),//非法字符加数字加中文
  47. isvalidCode:false,
  48. isrole:false,
  49. enterprise:[],
  50. arr:[],
  51. roleId:''
  52. }
  53. },
  54. created(){
  55. this.$store.state.isinvitation = false;
  56. this.param();//获取页面参数
  57. },
  58. mounted(){
  59. //获取角色
  60. setTimeout(()=>{
  61. this.role()
  62. },800)
  63. },
  64. destroyed(){
  65. this.$store.state.isinvitation = true
  66. },
  67. methods:{
  68. //验证手机
  69. phone(){
  70. let phone = this.$refs.phone.value;//手机
  71. 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}$');
  72. if (phone == '') {
  73. this.$message.error('手机号码不能为空');
  74. this.isphone = false;
  75. } else {
  76. this.isphone = true;
  77. if (!reg.test(phone)) {
  78. this.$message.error('请输入正确的手机号码');
  79. this.isregphone = false;
  80. } else {
  81. this.isregphone = true;
  82. }
  83. }
  84. },
  85. //验证姓名
  86. name(){
  87. let name = this.$refs.name.value;
  88. if (name == '') {
  89. this.$message.error('姓名不能为空')
  90. this.isname = false;
  91. } else {
  92. this.isname = true;
  93. if (this.regname.test(name)) {
  94. this.$message.error('姓名不能包含符号、数字、英文等非法字符');
  95. this.isregname = false
  96. } else {
  97. this.isregname = true
  98. }
  99. }
  100. },
  101. //验证码
  102. validCode(){
  103. let Verification = this.$refs.Verification.value;//验证码
  104. if (Verification == '') {
  105. this.$message.error('请输入验证码')
  106. this.isvalidCode = false;
  107. } else {
  108. this.isvalidCode = true;
  109. }
  110. },
  111. // 验证角色
  112. roles(){
  113. let roleid = this.$refs.role.value;//角色
  114. if (roleid == '') {
  115. this.$message.error('请选择岗位角色');
  116. this.isrole = false;
  117. } else {
  118. this.isrole = true;
  119. }
  120. },
  121. // 获取验证码
  122. Obtaincode(){
  123. if (!this.isphone) {
  124. this.$message.error('手机号码不能为空');
  125. } else if (!this.isregphone){
  126. this.$message.error('请输入正确的手机号码');
  127. } else {
  128. let phone = this.$refs.phone.value;//手机
  129. this.$ajax({
  130. url:'http://192.168.253.31:8560/api/commons/share/getSmsCode',
  131. method:'POST',
  132. data:{
  133. mobile:phone
  134. },
  135. headers:{
  136. "Authorization":Session.getToken(),
  137. }
  138. })
  139. .then(res=>{
  140. console.log(res)
  141. if (res.data.success) {
  142. this.isobtaincode = false;
  143. this.settime()
  144. }
  145. })
  146. }
  147. },
  148. // 提交
  149. login(){
  150. let phone = this.$refs.phone.value;//手机
  151. let Verification = this.$refs.Verification.value;//验证码
  152. let name = this.$refs.name.value;//姓名
  153. let roleid = this.$refs.role.value;//角色
  154. if (!this.isphone) {
  155. this.$message.error('手机号码不能为空');
  156. } else if (!this.isregphone){
  157. this.$message.error('请输入正确的手机号码');
  158. } else if (!this.isname) {
  159. this.$message.error('姓名不能为空')
  160. } else if (!this.isregname) {
  161. this.$message.error("姓名不能包含符号、数字、英文等非法字符")
  162. } else if(!this.isvalidCode){
  163. this.$message.error("请输入验证码")
  164. } else if(!this.isrole){
  165. this.$message.error('请选择岗位角色');
  166. } else {
  167. this.$ajax({
  168. url:'http://192.168.253.31:8560/api/commons/share/submit',
  169. method:'POST',
  170. data:{
  171. username:name,
  172. mobile:phone,
  173. companyId:this.enterprise.companyId,
  174. roleId:roleid,
  175. validCode:Verification,
  176. }
  177. })
  178. }
  179. },
  180. //倒计时
  181. settime(){
  182. if (this.time == 0) {
  183. this.isobtaincode = true;
  184. clearTimeout(times)
  185. } else {
  186. this.time--
  187. }
  188. let times = setTimeout(()=>{
  189. this.settime(this.time)
  190. },1000)
  191. },
  192. //获取角色
  193. role(){
  194. let companyId = this.enterprise.companyId;
  195. this.$ajax({
  196. url:'http://192.168.253.31:8560/api/account/role/list'+`?id=${companyId}`,
  197. headers:{
  198. "Authorization":Session.getToken(),
  199. }
  200. })
  201. .then(res=>{
  202. if (res.data.success) {
  203. this.arr = res.data.data
  204. }
  205. })
  206. },
  207. //获取页面参数
  208. param(){
  209. let param = "dXNlcm5hbWU96ZmI54KcJmNvbXBhbnlJZD0yNjImdGltZXN0bWFwPTE1NDUyODAyODU1MjQmZGVsYXk9MSZjb21wYW55TmFtZT3pmYjngpw."
  210. this.$ajax({
  211. url:"http://192.168.253.31:8560/api/commons/share/valid/param"+`?param=${param}`,
  212. method:'POST',
  213. headers:{
  214. "Authorization":Session.getToken(),
  215. }
  216. })
  217. .then(res=>{
  218. if (res.data.success) {
  219. this.enterprise = res.data.data;
  220. }
  221. })
  222. },
  223. }
  224. }
  225. </script>
  226. <style scoped>
  227. .invitation > img{
  228. width: 100%;
  229. }
  230. .centent {
  231. width: 352px;
  232. position: absolute;
  233. top: 50%;
  234. left: 50%;
  235. transform: translate(-50%, -50%);
  236. text-align: center
  237. }
  238. .inv-logo {
  239. font-family: PingFangSC-Medium;
  240. font-size: 26px;
  241. color: #FFFFFF;
  242. letter-spacing: 3.25px;
  243. }
  244. .centent > input {
  245. width: 100%;
  246. margin-bottom: 16px;
  247. opacity: 0.95;
  248. background: #FFFFFF;
  249. box-shadow: 0 2px 4px 0 #3C8EFF;
  250. font-size: 15px;
  251. padding: 3px 0px 3px 5px;
  252. border: 0;
  253. }
  254. .inv-title {
  255. text-align: left;
  256. margin-top: 37px;
  257. margin-bottom: 40px;
  258. }
  259. .inv-title > p{
  260. font-family: PingFangSC-Medium;
  261. font-size: 18px;
  262. color: #FFFFFF;
  263. letter-spacing: 2.25px;
  264. text-shadow: 0 2px 4px #1B5099;
  265. }
  266. .inv-title >p:nth-child(1) {
  267. margin-bottom: 16px;
  268. }
  269. .inv-text {
  270. font-family: PingFangSC-Regular;
  271. }
  272. .login {
  273. background: #004CE0;
  274. width: 100%;
  275. border: 0;
  276. height: 36px;
  277. }
  278. .role {
  279. width: 100%;
  280. margin-bottom: 32px;
  281. padding: 3px 0px;
  282. }
  283. .Verification {
  284. border: 0;
  285. opacity: 0.95;
  286. background: #FFFFFF;
  287. box-shadow: 0 2px 4px 0 #3C8EFF;
  288. margin-bottom: 16px;
  289. }
  290. .Verification > input {
  291. width: 68%;
  292. border: 0;
  293. font-size: 15px;
  294. padding: 3px 0px 3px 5px;
  295. }
  296. .Verification > span {
  297. width: 30%;
  298. display: inline-block;
  299. border-left: 1px solid #2F86FE;
  300. font-family: PingFangSC-Regular;
  301. font-size: 12px;
  302. color: #2F86FE;
  303. letter-spacing: 1.5px;
  304. }
  305. .bottom {
  306. height: 100px;
  307. background: #FAFCFF;
  308. text-align: center;
  309. padding: 27px 0px;
  310. }
  311. .bottom > p{
  312. font-family: PingFangSC-Regular;
  313. font-size: 16px;
  314. color: #666666;
  315. letter-spacing: 2px;
  316. }
  317. </style>