8277ece6465f0c207eeeb4890d4b15c92e31f6f4.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div>
  3. <yd-popup v-model="rgShow" position="center" width="90%margin:0;">
  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. this.$store.dispatch('GETRGSHOW', false);
  113. },
  114. monitor() {
  115. if (this.again_password != this.password) {
  116. this.suerPwdInfo = true;
  117. this.again_password = "";
  118. } else {
  119. this.suerPwdInfo = false;
  120. }
  121. },
  122. reg() {
  123. if (
  124. this.account != "" &&
  125. this.password != "" &&
  126. this.again_password != "" &&
  127. this.userName != "" &&
  128. this.iPhone != ""
  129. ) {
  130. 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 =>{
  131. if(res.data.status == 1){
  132. localStorage.setItem('token',res.data.data[0].token)
  133. localStorage.setItem('name',res.data.data[0].name)
  134. this.$dialog.alert({mes: res.data.msg });
  135. this.$store.dispatch('GETRGSHOW', false);
  136. }else{
  137. this.$dialog.alert({mes: res.data.msg });
  138. }
  139. })
  140. }else{
  141. this.$dialog.alert({mes: '请完善您的信息!' });
  142. }
  143. },
  144. vipID() {
  145. if (/^[0-9a-zA-Z\u4e00-\u9fa5]{4,15}$/.test(this.account) && this.password != this.account) {
  146. this.idInfo = false;
  147. } else {
  148. this.account = "";
  149. this.idInfo = true;
  150. }
  151. },
  152. pwd() {
  153. if (/^[a-zA-Z0-9]{6,15}$/.test(this.password) && this.password != this.account) {
  154. this.pwdInfo = false;
  155. }
  156. else {
  157. this.password = "";
  158. this.pwdInfo = true;
  159. }
  160. },
  161. username() {
  162. if (/^[a-zA-Z\u4e00-\u9fa5]{2,32}$/.test(this.userName)) {
  163. this.userInfo = false;
  164. } else {
  165. this.userInfo = true;
  166. this.userName = "";
  167. }
  168. },
  169. iphone() {
  170. if (/^1[34578]\d{9}$/.test(this.iPhone)) {
  171. this.phoneInfo = false;
  172. } else {
  173. this.phoneInfo = true;
  174. this.iPhone = "";
  175. }
  176. }
  177. },
  178. computed:{
  179. Isshow:function(){
  180. this.$store.dispatch('GETRGSHOW',this.rgShow)
  181. return {
  182. isshow_code:this.$store.state.rgShow
  183. }
  184. },
  185. noNull(){
  186. if (
  187. this.account != "" &&
  188. this.password != "" &&
  189. this.again_password != "" &&
  190. this.userName != "" &&
  191. this.iPhone != ""
  192. ) {
  193. this.access = true;
  194. }
  195. return this.access
  196. }
  197. },
  198. watch:{
  199. noNull(val){
  200. },
  201. Isshow(obj){
  202. this.rgShow=obj.isshow_code
  203. },
  204. isshow:{
  205. istrue(val){
  206. }
  207. }
  208. },
  209. mounted(){
  210. }
  211. };
  212. </script>
  213. <style scoped>
  214. .reg-box {
  215. width: 6.75rem;
  216. /* height: 8.26rem; */
  217. background: #f8f8f8;
  218. border-radius: 0.52rem;
  219. padding: 0 0.54rem;
  220. }
  221. .reg-top {
  222. font-size: 0.32rem;
  223. padding-top: 0.58rem;
  224. padding-bottom: 0.6rem;
  225. color: #f76649;
  226. }
  227. .reg-top img {
  228. width: 0.26rem;
  229. height: 0.26rem;
  230. }
  231. .reg-mian {
  232. /* height: 5.46rem; */
  233. }
  234. .reg-mian div {
  235. padding-bottom: 0.27rem;
  236. }
  237. .reg-mian span {
  238. font-size: 0.28rem;
  239. }
  240. .reg-mian i {
  241. font-size: 0.22rem;
  242. color: #aaaaaa;
  243. }
  244. .reg-mian input {
  245. width: 90%;
  246. height: 0.46rem;
  247. border: none;
  248. outline: none;
  249. border-bottom: 1px solid #aaaaaa;
  250. margin: 0.14rem auto 0.1rem ;
  251. font-size: 0.24rem;
  252. }
  253. button {
  254. width: 1.9rem;
  255. height: 0.7rem;
  256. border-radius: 0.35rem;
  257. border: none;
  258. background: #aaaaaa;
  259. color: #f8f8f8;
  260. margin-bottom: 0.5rem;
  261. }
  262. input {
  263. font-size: 0.2rem;
  264. }
  265. .reg-mian .infoRed {
  266. color: #f76649;
  267. }
  268. div.row .btnCor {
  269. background: #f76649;
  270. }
  271. .yd-btn-primary:not(.yd-btn-loading){
  272. background: #aaaaaa;
  273. }
  274. div /deep/ .yd-popup-center{
  275. margin: 0;
  276. overflow-y: scroll;
  277. -webkit-overflow-scrolling: touch;
  278. position: absolute;
  279. }
  280. </style>