bindNumber.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view>
  3. <view style="margin-top: 300rpx;">
  4. <view v-if="userInfo&&userInfo.mobile" class="phone">{{userInfo.mobile.substring(0,3)}}****{{userInfo.mobile.substring(userInfo.mobile.length-4,3)}}</view>
  5. <input v-model="saleNo" placeholder-class="input-placeholder" placeholder="请输入工号"/>
  6. </view>
  7. <view class="btn" @click="submit">确认绑定</view>
  8. </view>
  9. </template>
  10. <script>
  11. import { setTimeout } from "timers";
  12. const app = getApp();
  13. const req = require("../../utils/request.js");
  14. export default {
  15. components: {},
  16. props: {},
  17. data() {
  18. return {
  19. userInfo:{},
  20. systems: {},
  21. isTop:0,
  22. saleNo:''
  23. }
  24. },
  25. onLoad(options) {
  26. this.userInfo = req.getStorage('userInfo')
  27. },
  28. onShow() {
  29. },
  30. methods: {
  31. submit(){
  32. if(!this.saleNo) req.msg("请输入工号")
  33. req.postRequest('/api/user/bindSaleNo',{saleNo:this.saleNo},res=>{
  34. req.msg("绑定成功")
  35. setTimeout(()=>{
  36. uni.navigateBack()
  37. },1000)
  38. })
  39. }
  40. },
  41. mounted() {
  42. const systemInfo = uni.getSystemInfoSync();
  43. // px转换到rpx的比例
  44. let pxToRpxScale = 750 / systemInfo.windowWidth;
  45. let systems = {
  46. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  47. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  48. };
  49. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  50. this.systems = systems;
  51. },
  52. onPageScroll: function(e) {
  53. if (e.scrollTop > this.systems.barHeight) {
  54. this.isTop = 1;
  55. } else {
  56. this.isTop = 0;
  57. }
  58. }
  59. }
  60. </script>
  61. <style>
  62. @import "./bindNumber.css";
  63. </style>