login.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <ax-body blank="0" hideIndicatorArea>
  3. <image src="@/static/img/page-bg01.png" class="page-background"></image>
  4. <view class="body">
  5. <view class="title">
  6. <view>
  7. <view class="h1">您好!</view>
  8. <view class="h2">欢迎使用中数电动</view>
  9. </view>
  10. <image src="@/static/img/logo.svg" class="logo" mode="widthFix"></image>
  11. </view>
  12. <view class="logo-wrap">
  13. <image src="@/static/img/login-bg.svg" class="bg" mode="widthFix"></image>
  14. </view>
  15. <view class="footer" style="padding-left: 0;padding-right: 0;">
  16. <button @getphonenumber="onGetPhoneNumber" open-type="getPhoneNumber" class="submit"
  17. :disabled="!agreement" style="margin-left: 35px;width: calc(100% - 70px);">
  18. <text class="ax ax-iconblock i-weixin"></text>
  19. <text>微信用户一键登录</text>
  20. </button>
  21. <view class="cancel">取消返回</view>
  22. <view @click="agreement = !agreement" class="agreement" style="font-size: 17px;">
  23. <view class="mask" :class="{active:agreement}"><text class="ax ax-iconline i-select"></text></view>
  24. <text>我已阅读并理解和同意</text>
  25. <text @click.stop="checkPrivacy()" class="em">《隐私政策协议》</text>
  26. </view>
  27. </view>
  28. </view>
  29. </ax-body>
  30. </template>
  31. <script>
  32. export default {
  33. onLoad() {
  34. uni.getPrivacySetting({
  35. success: res => {
  36. this.privacy.name = res.privacyContractName;
  37. this.privacy.need = res.needAuthorization;
  38. }
  39. });
  40. },
  41. data() {
  42. return {
  43. agreement: false,
  44. privacy: {
  45. need: true,
  46. name: ''
  47. },
  48. }
  49. },
  50. methods: {
  51. // 查看隐私
  52. checkPrivacy() {
  53. uni.openPrivacyContract();
  54. },
  55. onGetPhoneNumber(e) {
  56. console.log(e);
  57. // let channelUrl='http://192.168.110.241:9120/zs/channel/admin/'
  58. let channelUrl='https://channel-api.zonelife.cn/zs/channel/admin/'
  59. if (e.detail.code) {
  60. this.$api.base("post", '/userApi/getPhone', {
  61. code: e.detail.code
  62. }).then(async res => {
  63. await this.$app.storage.set('USER_INFO', res.userInfo);
  64. // 识别用户是否通过分销码进入小程序
  65. if(uni.getStorageSync('ADMIN_USERID')){
  66. uni.request({
  67. url:channelUrl+'ums/umsAdminUser/distributionBindUser',
  68. method: 'POST',
  69. header: {
  70. 'content-type': 'application/json'
  71. },
  72. data: {
  73. userId: res.userInfo.id,
  74. adminUserId: uni.getStorageSync('ADMIN_USERID'),
  75. },
  76. success: (res) => {
  77. console.info(res.data,'----扫码接口调用');
  78. setTimeout(()=>{
  79. this.$app.storage.remove('ADMIN_USERID')
  80. },500)
  81. },
  82. fail(err) {
  83. console.log(err,'----错误信息');
  84. }
  85. });
  86. }
  87. if(this.$app.storage.get('FRIM_ID')){
  88. this.$api.base("post","/userApi/add-firm-user?firmId="+parseInt(this.$app.storage.get('FRIM_ID')),{},{error: false}).then(res=>{
  89. this.$app.popup.alert(res.msg);
  90. setTimeout(()=>{
  91. this.$app.storage.remove('FRIM_ID')
  92. },500)
  93. console.log(res,'----企业用户通过扫码进入');
  94. }).catch(err=>{
  95. setTimeout(()=>{
  96. this.$app.storage.remove('FRIM_ID')
  97. },500)
  98. })
  99. }
  100. this.$app.url.back()
  101. });
  102. }
  103. },
  104. }
  105. }
  106. </script>
  107. <style scoped>
  108. @import url("login.css");
  109. </style>