index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="login">
  3. <header-logo></header-logo>
  4. <view class="login-main" v-if="step == 1">
  5. <div class="top flex">
  6. <div class="flex" @click="stepBack1">
  7. <u-icon name="arrow-left" color="#ffffff" size="16px" bold></u-icon>
  8. <!-- Log In -->
  9. {{ $t('login.login') }}
  10. </div>
  11. </div>
  12. <div class="section">
  13. <div class="title">
  14. <!-- Forget Password? -->
  15. {{ $t('login.forget') }}?
  16. </div>
  17. <div class="tip">
  18. <!-- We will send on otp to your Email ID / Mobile number -->
  19. {{ $t('login.lab') }}
  20. </div>
  21. <u--form class="form" labelPosition="left" :rules="rules" ref="uForm" :model="userInfo">
  22. <u-form-item prop="mobile" borderBottom ref="item1">
  23. <u--input placeholderStyle="color: #4E4E4E" color="#4E4E4E" fontSize="16px" v-model="userInfo.mobile" :placeholder="$t('login.lab1')" border="none">
  24. <template slot="prefix">
  25. <div class="code-box" @click="regionShow = true">
  26. <img class="thumbnail" :src="thumbnail" alt="">
  27. <div>+ {{ code }}</div>
  28. </div>
  29. </template>
  30. </u--input>
  31. </u-form-item>
  32. </u--form>
  33. <div class="fixed">
  34. <div class="btn" @click="stepTwo">
  35. <!-- Send -->
  36. {{ $t('login.lab2') }}
  37. </div>
  38. </div>
  39. </div>
  40. </view>
  41. <view class="login-main" v-if="step == 2">
  42. <div class="top flex">
  43. <div class="flex" @click="stepBack2">
  44. <u-icon name="arrow-left" color="#ffffff" size="16px" bold></u-icon>
  45. {{ $t('login.forget') }}?
  46. </div>
  47. </div>
  48. <div class="section">
  49. <div class="title">
  50. <!-- Enter the 6 digit OTP -->
  51. {{ $t('login.lab3') }}
  52. </div>
  53. <!-- OTP sent to -->
  54. <div class="tip">{{ $t('login.lab4') }} +{{ code }} {{ userInfo.mobile }}</div>
  55. <div class="lab">
  56. <!-- In Case You Don't Find It, Check Your Junk Information. -->
  57. {{ $t('login.lab5') }}
  58. </div>
  59. <u--form labelPosition="left" :rules="rules" ref="uForm" :model="userInfo">
  60. <u-form-item prop="code" ref="item1">
  61. <u-code-input size="84rpx" hairline borderColor="#959595" fontSize="16px" space="37rpx" v-model="userInfo.code" mode="line"></u-code-input>
  62. </u-form-item>
  63. </u--form>
  64. </div>
  65. <div class="fixed">
  66. <div class="box_btn_2">
  67. <div class="down-box" v-if="!timeFinish">
  68. <!-- Resend OTP IN -->
  69. {{ $t('login.lab6') }} <u-count-down @finish="timeFinishFun" :autoStart="autoStart" name="down" :time="2 * 60 * 1000" format="mm:ss"></u-count-down></div>
  70. <div class="down-box" v-if="timeFinish"><div class="Resend" @click="stepTwo">{{ $t('login.lab7') }}</div></div>
  71. <div class="btn" @click="stepThree">{{ $t('login.lab8') }}</div>
  72. </div>
  73. </div>
  74. </view>
  75. <view class="login-main" v-if="step == 3">
  76. <div class="top flex">
  77. <div class="flex" @click="stepBack">
  78. <u-icon name="arrow-left" color="#ffffff" size="16px" bold></u-icon>
  79. {{ $t('login.forget') }}?
  80. </div>
  81. </div>
  82. <div class="section">
  83. <div class="title">{{ $t('login.forget') }}?</div>
  84. <div class="tip">
  85. <!-- We will send on otp to your Email ID / Mobile number -->
  86. {{ $t('login.lab') }}
  87. </div>
  88. <u--form class="form" labelPosition="left" :rules="rules" ref="uForm" :model="userInfo">
  89. <u-form-item prop="password" borderBottom ref="item1">
  90. <u--input placeholderStyle="color: #4E4E4E" color="#4E4E4E" fontSize="16px" :type="!pwshow ? 'password' : 'text'" v-model="userInfo.password" :placeholder="$t('login.lab9')" border="none">
  91. <img class="pwd" slot="prefix" src="/static/image/login/pwd.svg" alt="">
  92. <template slot="suffix">
  93. <div>
  94. <img v-if="!pwshow" class="show" @click="pwshow = true" src="/static/image/login/show.svg" alt="">
  95. <img v-if="pwshow" class="show" @click="pwshow = false" src="/static/image/login/hide2.png" alt="">
  96. </div>
  97. </template>
  98. </u--input>
  99. </u-form-item>
  100. <u-form-item prop="password1" borderBottom ref="item1">
  101. <u--input placeholderStyle="color: #4E4E4E" color="#4E4E4E" fontSize="16px" :type="!pwshow1 ? 'password' : 'text'" v-model="userInfo.password1" :placeholder="$t('login.lab10')" border="none">
  102. <img class="pwd" slot="prefix" src="/static/image/login/pwd.svg" alt="">
  103. <template slot="suffix">
  104. <div>
  105. <img v-if="!pwshow1" class="show" @click="pwshow1 = true" src="/static/image/login/show.svg" alt="">
  106. <img v-if="pwshow1" class="show" @click="pwshow1 = false" src="/static/image/login/hide2.png" alt="">
  107. </div>
  108. </template>
  109. </u--input>
  110. </u-form-item>
  111. </u--form>
  112. </div>
  113. <div class="fixed">
  114. <div class="btn" @click="registered">
  115. <!-- Update -->
  116. {{ $t('login.lab11') }}
  117. </div>
  118. </div>
  119. </view>
  120. <u-overlay :show="regionShow" @close="close" @open="open" :closeable="regionShow">
  121. <selectRegion :tournamentList="tournamentList" @close="close" @checkboxChange="checkboxChange"></selectRegion>
  122. </u-overlay>
  123. </view>
  124. </template>
  125. <script>
  126. import selectRegion from '../components/selectRegion/index.vue'
  127. export default {
  128. components: {
  129. selectRegion
  130. },
  131. data() {
  132. return {
  133. userInfo: {
  134. mobile: "",
  135. password: "",
  136. password1: "",
  137. code: ''
  138. },
  139. pwshow: false,
  140. pwshow1: false,
  141. rules: {},
  142. checked: false,
  143. checked1: false,
  144. step: 1,
  145. tournamentList: [],
  146. code: '',
  147. searchname: '',
  148. thumbnail: "",
  149. country_code: "",
  150. regionShow: false,
  151. autoStart: true,
  152. timeFinish: true,
  153. }
  154. },
  155. created() {
  156. this.get_cricket_tournament("");
  157. },
  158. mounted() {
  159. },
  160. methods: {
  161. stepTwo() {
  162. if (!this.userInfo.mobile) {
  163. uni.$u.toast(this.$t('login.lab12'));
  164. return
  165. }
  166. uni.showLoading({
  167. title: this.$t('common.lab'),
  168. });
  169. let mobile = this.code + '-' + this.userInfo.mobile
  170. uni.$u.http.get('/api/v1/getcode', {
  171. params: {
  172. type: 2,
  173. mobile: mobile
  174. }
  175. }).then(res => {
  176. uni.$u.toast(this.$t('login.lab13'));
  177. this.timeFinish = false
  178. this.step = 2
  179. }).finally(() => {
  180. uni.hideLoading();
  181. });
  182. },
  183. stepThree() {
  184. if (!this.userInfo.code || this.userInfo.code.length < 6) {
  185. uni.$u.toast(this.$t('login.lab14'));
  186. return
  187. }
  188. uni.showLoading({
  189. title: this.$t('common.lab'),
  190. });
  191. let mobile = this.code + '-' + this.userInfo.mobile
  192. uni.$u.http.get('/api/v1/verify_code', {
  193. params: {
  194. code: this.userInfo.code,
  195. mobile: mobile,
  196. type: 2
  197. }
  198. }).then(res => {
  199. this.step = 3
  200. this.timeFinish = true
  201. }).finally(() => {
  202. uni.hideLoading();
  203. });
  204. },
  205. registered() {
  206. if (!this.userInfo.password) {
  207. uni.$u.toast(this.$t('login.lab15'));
  208. return
  209. }
  210. if (!this.userInfo.password1) {
  211. uni.$u.toast(this.$t('login.lab16'));
  212. return
  213. }
  214. if (this.userInfo.password != this.userInfo.password1) {
  215. uni.$u.toast(this.$t('login.lab17'));
  216. return
  217. }
  218. uni.showLoading({
  219. title: this.$t('login.lab18')
  220. })
  221. uni.$u.http.get('/api/v1/forgotPassword', {
  222. params: {
  223. ...this.userInfo,
  224. mobile: this.code + '-' + this.userInfo.mobile,
  225. }
  226. }).then(res => {
  227. uni.showToast({
  228. title: this.$t('login.lab13'),
  229. icon: "success"
  230. })
  231. this.step = 1
  232. this.userInfo.code = ''
  233. this.userInfo.password = ''
  234. this.userInfo.password1 = ''
  235. this.userInfo.mobile = ''
  236. this.$toUrl('/pages/login/login')
  237. }).finally(() => {
  238. uni.hideLoading();
  239. });
  240. },
  241. get_cricket_tournament(value) {
  242. uni.$u.http
  243. .post(`/api/universal/getHot?code=${value}`, {})
  244. .then((res) => {
  245. this.tournamentList = res.CountryCode || [];
  246. if (this.searchname) {
  247. return
  248. }
  249. this.searchname = res.CountryCode[0].name;
  250. this.country_code = res.CountryCode[0].country_code;
  251. this.thumbnail = res.CountryCode[0].thumbnail;
  252. this.code = res.CountryCode[0].code;
  253. })
  254. .catch((res) => {});
  255. },
  256. checkboxChange(item) {
  257. this.searchname = item.name;
  258. this.country_code = item.country_code;
  259. this.thumbnail = item.thumbnail;
  260. this.code = item.code;
  261. this.regionShow = false;
  262. },
  263. close() {
  264. this.regionShow = false;
  265. },
  266. open() {
  267. },
  268. timeFinishFun() {
  269. this.timeFinish = true
  270. },
  271. stepBack1() {
  272. this.$toUrl('/pages/login/login')
  273. },
  274. stepBack2() {
  275. this.step = 1
  276. this.timeFinish = true
  277. this.userInfo.code = ''
  278. this.userInfo.password = ''
  279. },
  280. stepBack() {
  281. this.step = 2
  282. this.userInfo.password = ''
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. .login-main {
  289. padding: 0 0 30rpx;
  290. .top {
  291. background-color: #262E4A;
  292. height: 40px;
  293. font-weight: 500;
  294. font-size: 16px;
  295. padding: 0 16px;
  296. color: #fff;
  297. .u-icon {
  298. margin-right: 10px;
  299. }
  300. }
  301. .section {
  302. padding: 32px 16px 0;
  303. }
  304. .title {
  305. font-weight: 600;
  306. font-size: 18px;
  307. color: #242424;
  308. margin-bottom: 16px;
  309. line-height: 1;
  310. }
  311. .tip {
  312. font-weight: 400;
  313. font-size: 14px;
  314. color: #4E4E4E;
  315. line-height: 1;
  316. }
  317. .u-form {
  318. padding-top: 5.5vh;
  319. &.form {
  320. padding-top: 8vh;
  321. }
  322. }
  323. .pwd {
  324. height: 16px;
  325. display: block;
  326. }
  327. .show {
  328. display: block;
  329. cursor: pointer;
  330. width: 20px;
  331. }
  332. /deep/ .u-input__content__prefix-icon {
  333. margin-right: 12px;
  334. }
  335. /deep/ .u-input__content__subfix-icon {
  336. padding-right: 5px;
  337. }
  338. .checkbox {
  339. position: relative;
  340. padding-left: 28px;
  341. font-weight: 400;
  342. font-size: 12px;
  343. color: #4E4E4E;
  344. margin-bottom: 26px;
  345. margin-top: 16px;
  346. .no {
  347. width: 14px;
  348. height: 14px;
  349. border: 1px solid #B1B1B1;
  350. border-radius: 3px;
  351. position: absolute;
  352. left: 0;
  353. top: 1px;
  354. }
  355. .line {
  356. text-decoration: underline;
  357. margin: 0 3px;
  358. }
  359. .img {
  360. width: 16px;
  361. position: absolute;
  362. left: 0;
  363. top: 1px;
  364. }
  365. }
  366. .code-box {
  367. display: flex;
  368. align-items: center;
  369. .thumbnail {
  370. width: 30px;
  371. margin-right: 11px;
  372. }
  373. }
  374. .lab {
  375. font-weight: 400;
  376. font-size: 12px;
  377. color: #4E4E4E;
  378. margin-top: 32px;
  379. line-height: 1;
  380. }
  381. }
  382. .box_btn_2 {
  383. .down-box {
  384. display: flex;
  385. align-items: center;
  386. justify-content: center;
  387. font-weight: 400;
  388. font-size: 14px;
  389. color: #4E4E4E;
  390. margin-bottom: 16px;
  391. }
  392. .u-count-down {
  393. margin-left: 3px;
  394. }
  395. .Resend {
  396. font-weight: 900;
  397. color: #DE2D01;
  398. }
  399. }
  400. .btn {
  401. cursor: pointer;
  402. background: linear-gradient(94.25deg, #FF3300 -3.08%, #D22A00 100%);
  403. border-radius: 4px;
  404. height: 52px;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. font-weight: 500;
  409. font-size: 16px;
  410. color: #fff;
  411. }
  412. .fixed {
  413. position: fixed;
  414. left: 0;
  415. right: 0;
  416. padding: 16px;
  417. bottom: 20px;
  418. background-color: #fff;
  419. }
  420. .u-form-item + .u-form-item {
  421. margin-top: 20px;
  422. }
  423. </style>