index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view>
  3. <view class="ceng"></view>
  4. <view class="update-pop">
  5. <view class="bind-mobile">
  6. <image :src="picUrlss+'sim_phone.png'"></image>
  7. <view class="update-tip">更多服务,请授权登录</view></view>
  8. <button class="update-btn ddflex" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">一键登录</button>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. const app = getApp();
  15. const req = require('../../utils/request.js');
  16. export default {
  17. data() {
  18. return {
  19. picUrlss: req.public.picUrls,
  20. };
  21. },
  22. components: {},
  23. props: {
  24. },
  25. watch: {},
  26. mounted() {
  27. },
  28. methods: {
  29. getPhoneNumber(e) {
  30. let that = this;
  31. let sessionKey = '';
  32. app.globalData.getCheckSessoin(json => {
  33. sessionKey = json.session_key;
  34. let _params = {
  35. sessionKey: sessionKey,
  36. iv: e.detail.iv,
  37. encryptedData: e.detail.encryptedData
  38. };
  39. if (req.getStorage('pidCode')) {
  40. _params.parentId = req.getStorage('pidCode');
  41. }
  42. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  43. req.postRequest('/api/weixin/mobile', _params, json => {
  44. if (json.mobile) {
  45. var userInfo = req.getStorage('userInfo');
  46. userInfo.mobile = json.mobile;
  47. req.setStorage('userInfo', userInfo);
  48. that.closeUpdate();
  49. req.removeStorage('isShowUpdateMobile')
  50. }
  51. });
  52. } else {
  53. }
  54. });
  55. },
  56. closeUpdate() {
  57. this.$emit('closePop');
  58. }
  59. }
  60. };
  61. </script>
  62. <style>
  63. @import './index.css';
  64. </style>