invite-passive-user.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div>
  3. <!-- 微信环境提示浏览器打开 -->
  4. <WxPopTpis v-if="isWeChatBrowser" />
  5. <div class="padssive" v-else>
  6. <div class="bg-top-img-wrap" align="right">
  7. <img class="bg-top-img" src="~assets/image/activity/invite-user/invite-passive-user/bg.png" />
  8. </div>
  9. <div class="bright-wrap">
  10. <div class="bright-item mb-6">
  11. <div class="img-wrap">
  12. <img class="label-img" src="~assets/image/activity/invite-user/invite-passive-user/hosting.png" />
  13. </div>
  14. <div class="text-wrap">
  15. <p class="title-text">游戏托管</p>
  16. <p class="tips-text">自动刷资源</p>
  17. <p class="tips-text">秒升角色战力</p>
  18. </div>
  19. </div>
  20. <div class="bright-item mb-6">
  21. <div class="img-wrap">
  22. <img class="label-img" src="~assets/image/activity/invite-user/invite-passive-user/clone.png" />
  23. </div>
  24. <div class="text-wrap">
  25. <p class="title-text">应用分身</p>
  26. <p class="tips-text">无限多开群控</p>
  27. <p class="tips-text">小号多不用愁</p>
  28. </div>
  29. </div>
  30. <div class="bright-item">
  31. <div class="img-wrap">
  32. <img class="label-img" src="~assets/image/activity/invite-user/invite-passive-user/location.png" />
  33. </div>
  34. <div class="text-wrap">
  35. <p class="title-text">位置服务</p>
  36. <p class="tips-text">想去哪</p>
  37. <p class="tips-text">就去哪</p>
  38. </div>
  39. </div>
  40. <div class="bright-item">
  41. <div class="img-wrap">
  42. <img class="label-img" style="bottom:8px" src="~assets/image/activity/invite-user/invite-passive-user/multi.png" />
  43. </div>
  44. <div class="text-wrap">
  45. <p class="title-text">功能全面</p>
  46. <p class="tips-text">三端互通</p>
  47. <p class="tips-text">应有尽有</p>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="form-wrap">
  52. <validation-observer ref="observer" slim>
  53. <v-form @submit.prevent="submit">
  54. <div class="input-cell-label">
  55. <span class="required">*</span><span class="label-name">手机号</span>
  56. </div>
  57. <validation-provider
  58. v-slot="{ errors }"
  59. ref="providerPhome"
  60. name="手机号码"
  61. rules="phone"
  62. slim
  63. >
  64. <v-text-field
  65. v-model="form.phone"
  66. v-mask="$mask.phone"
  67. label=""
  68. name="phone"
  69. required
  70. :error-messages="errors"
  71. placeholder="请输入11位手机号"
  72. solo
  73. type="tel"
  74. flat
  75. maxlength="11"
  76. />
  77. </validation-provider>
  78. <div class="input-cell-label">
  79. <span class="required">*</span><span class="label-name">短信验证</span>
  80. </div>
  81. <validation-provider
  82. v-slot="{ errors }"
  83. name="短信验证码"
  84. rules="code"
  85. slim
  86. >
  87. <v-text-field
  88. v-model="form.code"
  89. v-mask="'######'"
  90. label=""
  91. :error-messages="errors"
  92. name="code"
  93. maxlength="6"
  94. required
  95. placeholder="请输入验证码"
  96. solo
  97. flat
  98. type="tel"
  99. >
  100. <template #append>
  101. <v-btn
  102. :loading="codeObj.codeSending"
  103. :disabled="codeTime > 0"
  104. small
  105. depressed
  106. color="#D3E0FF"
  107. plain
  108. class="text-base"
  109. @click.prevent="sendSmsCode"
  110. >
  111. <template>
  112. <van-count-down ref="countDown" @finish="()=>codeObj.isFinish = true" :time="60000">
  113. <template #default="timeData">
  114. <span v-if="codeObj.isFinish" class="fetch-code">发送验证码</span>
  115. <span v-else><span style="color: #999">{{ timeData.seconds }}s后重试</span></span>
  116. </template>
  117. </van-count-down>
  118. </template>
  119. </v-btn>
  120. </template>
  121. </v-text-field>
  122. </validation-provider>
  123. </v-form>
  124. </validation-observer>
  125. <div class="req-btn-wrap">
  126. <van-button :loading="submitting" :disabled="form.phone.length < 11 && form.code.length < 6" @click="submit" class="mb-3" type="primary" round block color="#435EFB" text="注册并下载APP" />
  127. </div>
  128. <div class="tips">
  129. 通过登录即可完成注册,成为我们的新用户,登录后表示同意云手机客户端服务协议
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. </template>
  135. <script>
  136. import { registerForInvite } from '~/api/user/client.js';
  137. import { sendSmsCode } from '~/api/message/phone.js';
  138. import WxPopTpis from './components/WxPopTpis';
  139. export default {
  140. auth: false,
  141. name: 'InvitePassiveUser',
  142. head: {
  143. title: '注册',
  144. },
  145. components: { WxPopTpis },
  146. fetch() {
  147. this.form.invitationUserName = this.$route.query.invitationUserName;
  148. this.form.activityId = this.$route.query.activityId;
  149. this.merchantSign = this.$route.query.merchantSign;
  150. },
  151. data() {
  152. return {
  153. merchantSign: '', // 商户标识
  154. form: {
  155. phone: '', // 手机号
  156. code: '', // 验证码
  157. activityId: '', // 活动ID
  158. invitationUserName: '', // 邀请人用户名
  159. },
  160. submitting: false, // 提交按钮状态
  161. codeTime: 0, // 验证码倒计时
  162. codeObj: {
  163. codeSending: false,// 发送验证码按钮状态
  164. isFinish: true, // 验证码倒计时是否完成
  165. }
  166. }
  167. },
  168. computed: {
  169. // 是否为微信浏览器环境
  170. isWeChatBrowser() {
  171. return this.$userAgent.isWx;
  172. }
  173. },
  174. methods: {
  175. // 发送验证码
  176. async sendSmsCode() {
  177. try {
  178. // 如果倒计时未完成,直接返回
  179. if(!this.codeObj.isFinish) return;
  180. this.codeObj.codeSending = true;
  181. let {valid} = await this.$refs.providerPhome.validate(); // 校验手机号
  182. if(!valid) return; // 校验不通过
  183. // 校验通过
  184. let {msg} = await sendSmsCode(this, {
  185. type: 'common',
  186. // authorizationType: 7, // 登录类型
  187. phone: this.form.phone,
  188. },{ headers: { merchantSign: this.merchantSign }});
  189. this.codeObj.isFinish = false;
  190. this.$refs.countDown.reset();
  191. this.$toast.success(msg);
  192. }catch({message}){
  193. message && this.$toast.fail(message);
  194. } finally {
  195. this.codeObj.codeSending = false;
  196. }
  197. },
  198. async submit() {
  199. try {
  200. this.submitting = true;
  201. // 校验表单
  202. const valid = await this.$refs.observer.validate();
  203. if(!valid) return; // 校验不通过
  204. // 校验通过
  205. const res = await registerForInvite(this, this.form, { headers: { merchantSign: this.merchantSign }});
  206. console.log(res)
  207. this.$toast.success(res.msg);
  208. // 注册成功后,下载
  209. this.registerDownload(res.data);
  210. }catch({message}){
  211. message && this.$toast.fail(message);
  212. } finally {
  213. this.submitting = false;
  214. }
  215. },
  216. // 跳转到下载应用
  217. async registerDownload({ downloadUrl }) {
  218. setTimeout(()=>{
  219. window.location.href = downloadUrl;
  220. }, 600)
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .padssive{
  227. padding: 0 16px 16px 16px;
  228. height: 100vh;
  229. overflow: auto;
  230. background: linear-gradient(#D3E0FF, #F5F5F5);
  231. }
  232. .bg-top-img-wrap{
  233. .bg-top-img{
  234. width: 119px;
  235. height: 119px;
  236. }
  237. }
  238. .bright-wrap{
  239. display: flex;
  240. justify-content: space-around;
  241. align-items: center;
  242. flex-wrap: wrap;
  243. align-content: space-around;
  244. margin-bottom: 16px;
  245. .bright-item{
  246. width: 155px;
  247. height: 82px;
  248. background: linear-gradient( 160deg, #62A9FF 0%, #3370FF 100%);
  249. border-radius: 8px;
  250. display: flex;
  251. .img-wrap{
  252. position: relative;
  253. padding-left: 10px;
  254. .label-img{
  255. width: 48px;
  256. height: 53px;
  257. position: relative;
  258. left: 0;
  259. bottom: 5px;
  260. }
  261. }
  262. .text-wrap{
  263. margin-left: 15px;
  264. font-size: 12px;
  265. color: #c6c6c6;
  266. line-height: 18px;
  267. text-align: left;
  268. &>p{
  269. margin-bottom: 0;
  270. }
  271. .title-text{
  272. font-size: 16px;
  273. color: #fff;
  274. line-height: 35px;
  275. font-weight: 600;
  276. }
  277. }
  278. }
  279. }
  280. .form-wrap{
  281. background-color: #fff;
  282. padding: 16px;
  283. border-radius: 8px;
  284. .input-cell-label{
  285. font-size: 14px;
  286. line-height: 20px;
  287. margin-bottom: 8px;
  288. .required{
  289. color: #FE5C5B;
  290. }
  291. .label-name{
  292. font-weight: 600;
  293. color: #242424;
  294. }
  295. }
  296. ::v-deep .theme--light.v-text-field--solo > .v-input__control > .v-input__slot{
  297. background-color: #F3F3F3;
  298. }
  299. .req-btn-wrap{
  300. margin-top: 40px;
  301. }
  302. .tips{
  303. font-weight: 400;
  304. font-size: 14px;
  305. color: #979797;
  306. line-height: 20px;
  307. }
  308. .fetch-code{
  309. color: #3370FF;
  310. }
  311. }
  312. </style>