register-invite-fission.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <v-container class="register-for-invite pa-0" fluid :class="`type-${type}`">
  3. <div class="w245h244">
  4. <img class="download-btn" src="~/assets/image/activity/invite-user/fission/btn.png" alt="" @click="download">
  5. </div>
  6. <video class="w325h183" webkit-playsinline="true" playsinline="true" x5-playsinline autoplay muted controls src="~/assets/image/activity/invite-user/fission/20230511-153039.mp4"></video>
  7. <div class="box1">
  8. <!-- <validation-observer ref="observer" class="mlr10" slim>
  9. <v-form>
  10. <validation-provider v-slot="{ errors }" ref="providerPhome" name="手机号码" rules="phone" slim>
  11. <div style="display: flex;">
  12. <div class="label-item">
  13. 手机号
  14. </div>
  15. <v-text-field v-model="form.phone" v-mask="$mask.phone" background-color="#f6f6f6" name="phone" required :error-messages="errors" placeholder="请输入11位手机号" solo type="tel" flat maxlength="11" @input="submit" @focus="addUserVisit(19)" />
  16. </div>
  17. </validation-provider>
  18. </v-form>
  19. </validation-observer> -->
  20. </div>
  21. </v-container>
  22. </template>
  23. <script>
  24. import { Toast } from 'vant';
  25. import { registerForInvite } from '~/api/user/client.js';
  26. import { sendSmsCode } from '~/api/message/phone.js';
  27. export default {
  28. auth: false,
  29. name: 'RegisterForInvite',
  30. data() {
  31. return {
  32. current: 1,
  33. form: {
  34. phone: '',
  35. code: '',
  36. invitationUserName: null,
  37. activityId: null,
  38. invitationType: 3, // 新用户邀请注册
  39. },
  40. codeSending: false,
  41. codeTime: 0,
  42. submitting: false,
  43. client: 1
  44. };
  45. },
  46. fetch() {
  47. this.form.invitationUserName = this.$route.query.invitationUserName;
  48. this.form.activityId = this.$route.query.activityId;
  49. if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
  50. this.client = 1;
  51. } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
  52. this.client = 2;
  53. } else if (this.$userAgent.isMiniProgram) {
  54. this.client = 5;
  55. } else {
  56. this.client = 7;
  57. }
  58. },
  59. head() {
  60. return {
  61. title: '老板疯了,云手机真免费,不领白不领,活动随时结束',
  62. meta: [{
  63. property: 'og:image',
  64. content: 'https://file.phone.androidscloud.com:8121/document/newFile/download/1/347905r86eb745a1sc38/LowLevelMultipartUpload_30813454097856102499'
  65. },
  66. {
  67. property: 'og:description',
  68. content: '老板疯了,云手机真免费,不领白不领,活动随时结束'
  69. },
  70. {
  71. property: 'og:title',
  72. content: '双子星云手机'
  73. }]
  74. }
  75. },
  76. computed: {
  77. type() {
  78. return 2;
  79. },
  80. url() {
  81. return `${location.origin}/cloud/phone/web/#/pages/register/index?invitationUserName=${this.form.invitationUserName}&activityId=${this.form.activityId}&invitationType=5`
  82. }
  83. },
  84. mounted() {
  85. this.makePoint('activity_download_PV')
  86. this.makePoint('activity_download_UV')
  87. this.addUserVisit(16)
  88. },
  89. methods: {
  90. download() {
  91. window.open(this.url, '_self');
  92. this.addUserVisit(18)
  93. },
  94. maskPhone(value) {
  95. return [/\d/, /\d/];
  96. },
  97. makePoint(positionButton) {
  98. this.$axios.$post('/publics/v5/buriedPointRecord/reportRecords', [
  99. {
  100. client: this.client,
  101. eventCode: '28_分享活动',
  102. userName: this.form.invitationUserName,
  103. positionButton,
  104. operationTime: this.getCurrentTime(),
  105. phoneNumber: '',
  106. deviceId: ''
  107. },
  108. ]);
  109. },
  110. getCurrentTime() {
  111. const date = new Date(); // 当前时间
  112. const year = date.getFullYear() // 年
  113. const month = this.repair(date.getMonth() + 1); // 月
  114. const day = this.repair(date.getDate()); // 日
  115. const hour = this.repair(date.getHours()); // 时
  116. const minute = this.repair(date.getMinutes()); // 分
  117. const second = this.repair(date.getSeconds()); // 秒
  118. // 当前时间
  119. const curTime = year + "-" + month + "-" + day +
  120. " " + hour + ":" + minute + ":" + second;
  121. return curTime;
  122. },
  123. repair(i) {
  124. if (i >= 0 && i <= 9) {
  125. return "0" + i;
  126. } else {
  127. return i;
  128. }
  129. },
  130. async submit() {
  131. if (this.form.phone.length < 11 || !/^((13[0-9])|(14[5|7])|(15([0-9]))|(16[0134689])|(17[2-9])|(18[0-9])|(19[0-9]))\d{8}$/.test(this.form.phone)) {
  132. return
  133. }
  134. try {
  135. this.submitting = true;
  136. const valid = await this.$refs.observer.validate();
  137. if (valid) {
  138. this.$tongji.trackEvent('活动', '注册', '', 0);
  139. await registerForInvite(this, this.form);
  140. Toast({
  141. message: '绑定成功',
  142. duration: 3000
  143. });
  144. setTimeout(() => {
  145. window.open('http://wuji.androidscloud.com', '_self');
  146. }, 3000)
  147. }
  148. this.addUserVisit(20);
  149. } catch (error) {
  150. Toast({
  151. message: error.message,
  152. duration: 3000
  153. });
  154. if (error.response.data.status === 1114) {
  155. setTimeout(() => {
  156. window.open('http://wuji.androidscloud.com', '_self');
  157. }, 3000)
  158. }
  159. this.addUserVisit(20);
  160. } finally {
  161. this.submitting = false;
  162. }
  163. },
  164. openSzxApp() {
  165. this.$callSzx.open({ param: {}, path: '' });
  166. },
  167. async sendSmsCode() {
  168. try {
  169. this.codeSending = true;
  170. const validationResult = await this.$refs.providerPhome.validate();
  171. if (validationResult.valid) {
  172. this.$tongji.trackEvent('活动', '发送短信', '', 0);
  173. this.makePoint('activity_Share_获得验证码')
  174. const res = await sendSmsCode(this, {
  175. type: 'common',
  176. authorizationType: 5,
  177. phone: this.form.phone,
  178. });
  179. this.codeTime = 60;
  180. this.codeInterval = setInterval(
  181. () => --this.codeTime <= 0 && clearInterval(this.codeInterval),
  182. 1000,
  183. );
  184. Toast({
  185. message: res.msg,
  186. duration: 3000
  187. });
  188. }
  189. } catch (error) {
  190. Toast({
  191. message: error.message,
  192. duration: 3000
  193. });
  194. } finally {
  195. this.codeSending = false;
  196. }
  197. },
  198. addUserVisit(accessType) {
  199. this.$axios.$post('/user/v5/operateApi/addUserVisit', {
  200. accessType,
  201. loginType: 2,
  202. userName: this.form.invitationUserName
  203. });
  204. }
  205. },
  206. };
  207. </script>
  208. <style lang="scss" scoped>
  209. .w325h183 {
  210. width: 325px;
  211. height: 183px;
  212. border-radius: 19px;
  213. position: absolute;
  214. top: 550px;
  215. left: calc(50% - 162.5px);
  216. background: #F5F5F5;
  217. }
  218. .w245h244 {
  219. margin: 260px auto 0;
  220. position: relative;
  221. img {
  222. width: 100%;
  223. height: 100%;
  224. }
  225. .download-btn {
  226. width: 226px;
  227. height: 82px;
  228. position: absolute;
  229. left: calc(50% - 113px);
  230. }
  231. }
  232. .w282h239 {
  233. width: 282px;
  234. height: 239px;
  235. display: block;
  236. position: absolute;
  237. top: 229px;
  238. right: 21px;
  239. animation: xing 2s infinite;
  240. }
  241. @keyframes xing {
  242. 0% {
  243. transform: scale(1);
  244. }
  245. 25% {
  246. transform: scale(1.1);
  247. }
  248. 50% {
  249. transform: scale(1);
  250. }
  251. 75% {
  252. transform: scale(1.1);
  253. }
  254. }
  255. .mlr10 {
  256. overflow: hidden;
  257. width: 344px;
  258. padding: 0 10px;
  259. box-sizing: border-box;
  260. }
  261. .register-for-invite {
  262. color: #333;
  263. background-size: 100% auto;
  264. // background-position-y: -44px;
  265. overflow: hidden;
  266. padding-bottom: 30px;
  267. min-height: 812px;
  268. &.type-1 {
  269. background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  270. }
  271. &.type-2 {
  272. background-image: url('~/assets/image/activity/invite-user/bj2@2x.png');
  273. }
  274. &.type-3 {
  275. background-image: url('~/assets/image/activity/invite-user/bg-3@2x.png');
  276. }
  277. }
  278. .box1 {
  279. position: absolute;
  280. bottom: 32px;
  281. left: calc(50% - 172px);
  282. width: 344px;
  283. }
  284. .submit-btn-box {
  285. // 解决百度APP广告屏蔽导致按钮被隐藏
  286. display: flex !important;
  287. justify-content: center;
  288. }
  289. .submit-btn {
  290. display: block;
  291. width: 308px !important;
  292. height: 30px !important;
  293. background: linear-gradient(0deg, #F34927 0%, #FDAF7D 100%);
  294. border-radius: 20px;
  295. text-align: center;
  296. font-size: 18px;
  297. font-weight: 500;
  298. color: #FFFFFF !important;
  299. line-height: 30px;
  300. margin-top: 10px;
  301. }
  302. .label-item {
  303. width: 64px;
  304. font-size: 14px;
  305. color: #333;
  306. height: 49px;
  307. line-height: 49px;
  308. text-align: center;
  309. }
  310. .w220 {
  311. width: 220px;
  312. }
  313. </style>