c9670daaac019705104ac648c7e3e8f40c00c6ed.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <div class="reg">
  3. <yd-popup v-model="rgShow" position="center">
  4. <div class="reg-box">
  5. <div class="reg-top row allAlignment item-center">
  6. <span>注册-用户信息</span>
  7. <img :src="url1" alt @click="closeRg()">
  8. </div>
  9. <div class="reg-mian">
  10. <div>
  11. <span>会员账号</span>
  12. <br>
  13. <input
  14. type="text"
  15. v-model="account"
  16. maxlength="15"
  17. onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"
  18. @blur="vipID()"
  19. placeholder="请输入你的账号"
  20. >
  21. <br>
  22. <i :class="idInfo?'infoRed':''">*使用4-15位数字、字母和汉字,不能使用特殊字符</i>
  23. </div>
  24. <div>
  25. <span>会员密码</span>
  26. <br>
  27. <input
  28. type="password"
  29. maxlength="15"
  30. v-model="password"
  31. onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"
  32. @blur="pwd()"
  33. placeholder="请输入你的密码"
  34. >
  35. <br>
  36. <i :class="pwdInfo?'infoRed':''">*使用6-15位数字或字母,不能使用特殊字符</i>
  37. </div>
  38. <div>
  39. <span>密码确认</span>
  40. <br>
  41. <input
  42. type="password"
  43. v-model="again_password"
  44. @blur="monitor()"
  45. maxlength="15"
  46. onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"
  47. placeholder="请输入确认密码"
  48. >
  49. <br>
  50. <i :class="suerPwdInfo?'infoRed':''">*请输入确认密码</i>
  51. </div>
  52. <div>
  53. <span>真实姓名</span>
  54. <br>
  55. <input
  56. type="text"
  57. v-model="userName"
  58. @blur="username()"
  59. placeholder="请输入真实姓名"
  60. >
  61. <br>
  62. <i :class="userInfo?'infoRed':''">*请输入真实姓名</i>
  63. </div>
  64. <div>
  65. <span>手机号</span>
  66. <br>
  67. <input
  68. type="number"
  69. v-model="iPhone"
  70. @blur="iphone()"
  71. onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"
  72. placeholder="请输入手机号"
  73. >
  74. <br>
  75. <i :class="phoneInfo?'infoRed':''">*请输入正确的手机号码</i>
  76. </div>
  77. </div>
  78. <div class="row vertical-center">
  79. <yd-button :class="access?'btnCor':''" @click.native="reg()">完成注册</yd-button>
  80. </div>
  81. </div>
  82. </yd-popup>
  83. </div>
  84. </template>
  85. <script>
  86. import "@/css/index.css";
  87. export default {
  88. name: "register",
  89. data() {
  90. return {
  91. idInfo: false, // ID字段提醒输入错误
  92. pwdInfo: false, //密码提醒
  93. suerPwdInfo: false, //确认密码
  94. userInfo: false, //用户信息提醒
  95. phoneInfo: false, //手机号提醒
  96. access: false, //btn样式修改
  97. account: "",
  98. password: "",
  99. again_password: "",
  100. userName: "",
  101. iPhone: "",
  102. rgShow:this.$store.state.rgShow,
  103. url1: require("@/assets/st-imges/guanbi.png"),
  104. docmHeight: '0', //默认屏幕高度
  105. showHeight: '0', //实时屏幕高度
  106. hidshow:true, //显示或者隐藏footer,
  107. isResize:false, //默认屏幕高度是否已获取
  108. };
  109. },
  110. methods: {
  111. closeRg(){
  112. // 关闭投注框改变背景滚动
  113. this.$store.dispatch('SET_NOROLL',false)
  114. this.$store.dispatch('GETRGSHOW', false);
  115. },
  116. monitor() {
  117. if (this.again_password != this.password) {
  118. this.suerPwdInfo = true;
  119. this.again_password = "";
  120. } else {
  121. this.suerPwdInfo = false;
  122. }
  123. },
  124. reg() {
  125. if (
  126. this.account != "" &&
  127. this.password != "" &&
  128. this.again_password != "" &&
  129. this.userName != "" &&
  130. this.iPhone != ""
  131. ) {
  132. this.$http.post(this.$ports.login.reg,{account:this.account,name:this.userName,password:this.password,again_password:this.again_password,phone:this.iPhone}).then(res =>{
  133. if(res.data.status == 1){
  134. sessionStorage.setItem('token',res.data.data[0].token)
  135. localStorage.setItem('name',res.data.data[0].name)
  136. this.$dialog.alert({mes: res.data.msg });
  137. this.$store.dispatch('GETRGSHOW', false);
  138. }else{
  139. this.$dialog.alert({mes: res.data.msg });
  140. }
  141. })
  142. }else{
  143. this.$dialog.alert({mes: '请完善您的信息!' });
  144. }
  145. },
  146. vipID() {
  147. if (/^[0-9a-zA-Z\u4e00-\u9fa5]{4,15}$/.test(this.account) && this.password != this.account) {
  148. this.idInfo = false;
  149. } else {
  150. this.account = "";
  151. this.idInfo = true;
  152. }
  153. },
  154. pwd() {
  155. if (/^[a-zA-Z0-9]{6,15}$/.test(this.password) && this.password != this.account) {
  156. this.pwdInfo = false;
  157. }
  158. else {
  159. this.password = "";
  160. this.pwdInfo = true;
  161. }
  162. },
  163. username() {
  164. if (/^[a-zA-Z\u4e00-\u9fa5]{2,32}$/.test(this.userName)) {
  165. this.userInfo = false;
  166. } else {
  167. this.userInfo = true;
  168. this.userName = "";
  169. }
  170. },
  171. iphone() {
  172. if (/^1[34578]\d{9}$/.test(this.iPhone)) {
  173. this.phoneInfo = false;
  174. } else {
  175. this.phoneInfo = true;
  176. this.iPhone = "";
  177. }
  178. }
  179. },
  180. computed:{
  181. Isshow:function(){
  182. //根据注册框改变滚动状态
  183. this.$store.dispatch('SET_NOROLL',this.rgShow)
  184. this.$store.dispatch('GETRGSHOW',this.rgShow)
  185. return {
  186. isshow_code:this.$store.state.rgShow
  187. }
  188. },
  189. noNull(){
  190. if (
  191. this.account != "" &&
  192. this.password != "" &&
  193. this.again_password != "" &&
  194. this.userName != "" &&
  195. this.iPhone != ""
  196. ) {
  197. this.access = true;
  198. }
  199. return this.access
  200. }
  201. },
  202. watch:{
  203. noNull(val){
  204. },
  205. Isshow(obj){
  206. this.rgShow=obj.isshow_code
  207. },
  208. isshow:{
  209. istrue(val){
  210. }
  211. }
  212. },
  213. mounted(){
  214. }
  215. };
  216. </script>
  217. <style scoped>
  218. .reg{
  219. z-index: 1000;
  220. position: fixed;
  221. left: 0;
  222. top: 0;
  223. right: 0;
  224. bottom: 0;
  225. }
  226. .reg-box {
  227. width: 6.75rem;
  228. background: #f8f8f8;
  229. border-radius: 0.52rem;
  230. padding: 0 0.54rem;
  231. }
  232. .reg-top {
  233. font-size: 0.32rem;
  234. padding-top: 0.58rem;
  235. padding-bottom: 0.6rem;
  236. color: #f76649;
  237. }
  238. .reg-top img {
  239. width: 0.26rem;
  240. height: 0.26rem;
  241. }
  242. .reg-mian {
  243. /* height: 5.46rem; */
  244. }
  245. .reg-mian div {
  246. padding-bottom: 0.27rem;
  247. }
  248. .reg-mian span {
  249. font-size: 0.28rem;
  250. }
  251. .reg-mian i {
  252. font-size: 0.22rem;
  253. color: #aaaaaa;
  254. }
  255. .reg-mian input {
  256. width: 90%;
  257. height: 0.46rem;
  258. border: none;
  259. outline: none;
  260. border-bottom: 1px solid #aaaaaa;
  261. margin: 0.14rem auto 0.1rem ;
  262. font-size: 0.24rem;
  263. }
  264. button {
  265. width: 1.9rem;
  266. height: 0.7rem;
  267. border-radius: 0.35rem;
  268. border: none;
  269. background: #aaaaaa;
  270. color: #f8f8f8;
  271. margin-bottom: 0.5rem;
  272. }
  273. input {
  274. font-size: 0.2rem;
  275. }
  276. .reg-mian .infoRed {
  277. color: #f76649;
  278. }
  279. div.row .btnCor {
  280. background: #f76649;
  281. }
  282. .yd-btn-primary:not(.yd-btn-loading){
  283. background: #aaaaaa;
  284. }
  285. div /deep/ .yd-popup-center{
  286. margin: 0;
  287. overflow-y: scroll;
  288. -webkit-overflow-scrolling: touch;
  289. position: absolute;
  290. }
  291. </style>