index.vue 6.9 KB

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