register-invite-fission.vue 8.3 KB

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