index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div>
  3. <div class='top-page'>
  4. <view style='text-align: center;padding-top:15px'>
  5. <image style='width:146rpx' src='/static/images/success_icon.png' mode="widthFix"></image>
  6. </view>
  7. <view class='main_scale_njhd'>
  8. <img class='main_xing_left' src="/static/images/xing_left2.png" />
  9. <view class='main_scale_font_njhd'>支付成功</view>
  10. <img class='main_xing_right' src="/static/images/xing_right2.png" />
  11. </view>
  12. <!-- <div class="saveP">
  13. 保存您的付费报告到手机
  14. </div>
  15. <div class="save-phone-cla">
  16. 请绑定您的手机号
  17. </div> -->
  18. <div class='page-connent'>
  19. <view class="phone_tip">请输入您的手机号码,我们将为您推送专属报告链接</view>
  20. <div class='verification-phone'>
  21. <uni-easyinput class="uni-mt-5 verification-phone1" @blur="checkPhone()" trim="all"
  22. placeholder="请输入手机号" v-model='phone' placeholder-style="font-size:32rpx"></uni-easyinput>
  23. </div>
  24. <div class='verification-code'>
  25. <uni-easyinput class="uni-mt-5 verification-code1" placeholder="请输入验证码" v-model="code"
  26. placeholder-style="font-size:32rpx">
  27. <template #right><text
  28. style="font-size:32rpx; margin-right:20px;background:#F8F6F7;color:#03A2AD;line-height:35px;"
  29. @click='sendCode()'>{{sendCodeFlag}}</text></template>
  30. </uni-easyinput>
  31. </div>
  32. <div><button class='phone-button' @click='saveAndView()'>保存并查看结果</button></div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. phone: '',
  42. code: '',
  43. //时间标志
  44. time: null,
  45. //倒计时数字
  46. timeCount: 60,
  47. //显示倒计时还是发送验证码
  48. sendCodeFlag: '发送验证码',
  49. userId: '',
  50. resultId: ''
  51. }
  52. },
  53. onLoad(options) {
  54. if (options.userId && options.resultId) {
  55. this.userId = options.userId;
  56. this.resultId = options.resultId;
  57. }
  58. },
  59. onUnload() {
  60. clearInterval(this.time);
  61. this.phone = '';
  62. this.code = '';
  63. this.timeCount = 60;
  64. this.sendCodeFlag = '发送验证码';
  65. },
  66. methods: {
  67. //对手机号进行校验
  68. checkPhone() {
  69. var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
  70. if (phoneReg.test(this.phone)) {
  71. return true;
  72. } else {
  73. uni.showToast({
  74. title: '请输入正确手机号',
  75. icon: 'error'
  76. })
  77. return false;
  78. }
  79. },
  80. sendCode() {
  81. if (!this.checkPhone()) {
  82. return;
  83. }
  84. if (this.sendCodeFlag == '重新发送' || this.sendCodeFlag == '发送验证码') {
  85. this.timeCount = 60;
  86. clearInterval(this.time)
  87. //起一个定时器开始倒计时
  88. this.sendCodeFlag = this.timeCount + 's'
  89. this.time = setInterval(() => {
  90. this.timeCount -= 1;
  91. this.sendCodeFlag = this.timeCount + 's'
  92. //如果倒计时为0时则停止倒计时
  93. if (this.timeCount == 0) {
  94. clearInterval(this.time)
  95. this.sendCodeFlag = '重新发送'
  96. }
  97. }, 1000)
  98. this.$request.get({
  99. url: 'user/authCode',
  100. loadingTip: "加载中...",
  101. data: {
  102. phone: this.phone
  103. },
  104. }).then((res) => {
  105. uni.showToast({
  106. title: '验证码已发送',
  107. icon: 'success',
  108. })
  109. })
  110. }
  111. },
  112. // 绑定手机号并查看报告
  113. saveAndView() {
  114. // 校验手机和验证码格式
  115. if (this.checkPhone() && this.code != '') {
  116. this.$request.get({
  117. url: 'user/updateMobile',
  118. loadingTip: "加载中...",
  119. data: {
  120. id: this.userId,
  121. mobile: this.phone,
  122. authCode: this.code,
  123. },
  124. }).then((res) => {
  125. if (res.code == 200) {
  126. uni.showToast({
  127. icon: 'success',
  128. title: '保存成功'
  129. })
  130. uni.navigateTo({
  131. url: `/scaleTestResults/testResults/index?resultId=${this.resultId}&messageShare=1`
  132. });
  133. } else {
  134. uni.showToast({
  135. icon: 'none',
  136. title: res.msg
  137. })
  138. }
  139. })
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style scoped>
  146. .top-page {
  147. width: 90%;
  148. height: 100vh;
  149. /* background-image: url(/static/images/top-bg.png); */
  150. background: linear-gradient(180deg, #D8FFF2 0%, #46E2ED 42%, #BEFFE8 98%);
  151. padding-left: 5%;
  152. padding-right: 5%;
  153. }
  154. .page-success {
  155. color: #32d961;
  156. font-weight: 700;
  157. display: flex;
  158. flex-direction: row;
  159. align-items: center;
  160. padding-top: 40px;
  161. padding-bottom: 20px;
  162. }
  163. .saveP {
  164. font-size: 18px;
  165. font-weight: 600;
  166. }
  167. .save-phone-cla {
  168. color: #6e6a6a;
  169. font-weight: 700;
  170. margin-top: 10px;
  171. }
  172. .verification-code {
  173. margin-top: 20px;
  174. }
  175. .verification-phone {
  176. /* background-color: #6e6a6a; */
  177. margin-top: 20px;
  178. }
  179. .phone-button {
  180. margin-top: 80rpx;
  181. background: linear-gradient(270deg, #069EBC 0%, #00D8E7 100%);
  182. box-shadow: inset 0rpx 0rpx 0rpx 0rpx rgba(47, 146, 255, 0.1936);
  183. border-radius: 73rpx 73rpx 73rpx 73rpx;
  184. color: #ffffff;
  185. font-size: 32rpx;
  186. font-family: Source Han Sans-Regular, Source Han Sans;
  187. font-weight: 400;
  188. color: #FFFFFF;
  189. line-height: 92rpx;
  190. }
  191. .verification-phone>>>.content-clear-icon {
  192. color: #57eded !important;
  193. }
  194. .verification-code>>>.content-clear-icon {
  195. color: #57eded !important;
  196. }
  197. uni-button:after {
  198. content: ' ';
  199. width: 200%;
  200. height: 200%;
  201. position: absolute;
  202. top: 0;
  203. left: 0;
  204. border: 1px solid transparent !important;
  205. transform: scale(0.5);
  206. transform-origin: 0 0;
  207. box-sizing: border-box;
  208. border-radius: 10px;
  209. }
  210. .page-connent {
  211. background-color: #ffffff;
  212. padding-top: 20px;
  213. padding-bottom: 20px;
  214. padding-left: 10px;
  215. padding-right: 10px;
  216. border-radius: 10px;
  217. margin-top: 30px;
  218. }
  219. .verification-phone1>>>uni-view {
  220. height: 92rpx;
  221. background-color: #F8F6F7 !important;
  222. border: 0px;
  223. border-radius: 20rpx 20rpx 20rpx 20rpx;
  224. }
  225. .verification-code1>>>uni-view {
  226. font-size: 32rpx;
  227. height: 92rpx;
  228. background-color: #F8F6F7 !important;
  229. border: 0px;
  230. border-radius: 20rpx 20rpx 20rpx 20rpx;
  231. }
  232. .verification-code {
  233. margin-top: 23px;
  234. }
  235. .verification-phone {
  236. /* background-color: #6e6a6a; */
  237. margin-top: 26px;
  238. }
  239. .phone-button {
  240. margin-top: 40px;
  241. border-radius: 40px;
  242. border-color: transparent;
  243. background-color: #fff82a;
  244. margin-bottom: 30px;
  245. }
  246. .main_scale_njhd {
  247. display: flex;
  248. justify-content: center;
  249. align-items: center;
  250. }
  251. .main_scale_font_njhd {
  252. font-size: 52rpx;
  253. font-family: AlibabaPuHuiTi-Heavy, AlibabaPuHuiTi;
  254. font-weight: 900;
  255. color: #069EBC;
  256. line-height: 30px;
  257. }
  258. .main_xing_left {
  259. height: 60rpx;
  260. margin-right: 20rpx;
  261. }
  262. .main_xing_right {
  263. height: 60rpx;
  264. margin-left: 20px;
  265. }
  266. .phone_tip {
  267. font-size: 24rpx;
  268. font-family: Source Han Sans-Regular, Source Han Sans;
  269. font-weight: 400;
  270. color: #656C74;
  271. line-height: 34rpx;
  272. text-align: center;
  273. }
  274. /deep/ .uni-easyinput__content-input {
  275. line-height: inherit;
  276. }
  277. /deep/ .uni-input-input {
  278. font-size: 32rpx;
  279. }
  280. </style>