qrcode.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <image src="../../static/img/ie.png"></image>
  5. <view class="tips">
  6. PC网页端登录确认
  7. </view>
  8. </view>
  9. <view class="btns">
  10. <view class="ok" @tap="login(2)">确认登录</view>
  11. <view class="cancle" @tap="quit()">取消登录</view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import http from "../../library/http.js"
  17. export default {
  18. data() {
  19. return {
  20. agent:''
  21. }
  22. },
  23. onLoad(opts) {
  24. this.agent=opts.agent;
  25. this.login(1)
  26. },
  27. onUnload() {
  28. this.login(0)
  29. },
  30. methods: {
  31. login(step){
  32. var data={uid: uni.getStorageSync('access_token'),step:step,agent:this.agent};
  33. http.setWait(false).get('index.php?act=qrcode_sublogin',data).then(res=>{
  34. if(res.code==200){
  35. if(step==2){
  36. uni.showToast({
  37. title:'登录成功',
  38. icon:'none'
  39. })
  40. setTimeout(function(){ uni.navigateBack();},1000)
  41. }
  42. }
  43. })
  44. },
  45. quit(){
  46. this.login(0);
  47. uni.navigateBack();
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. @import '../../static/css/uni.css';
  54. .content{
  55. margin-top: 120px;
  56. text-align: center;
  57. }
  58. .content image{
  59. height: 100px;
  60. width: 100px;
  61. vertical-align: top;
  62. }
  63. .content .tips{
  64. height: 30px;
  65. line-height: 30px;
  66. font-size: 12px;
  67. color: #666;
  68. margin-top: 10px;
  69. }
  70. .btns{
  71. position: fixed;
  72. z-index: 1;
  73. left: 0px;width: 100%;
  74. bottom: 0px;
  75. }
  76. .btns > view{
  77. height: 40px;
  78. line-height: 40px;
  79. margin-bottom: 20px;;
  80. display: block;
  81. text-align: center;
  82. }
  83. .btns .ok{
  84. width: 180px;
  85. background-color: #3388ff;
  86. border-radius: 5px;
  87. color: #fff;
  88. font-size: 16px;
  89. margin: 20px auto;
  90. }
  91. .btns .cancel{
  92. color: #666;
  93. font-size: 14px;
  94. }
  95. </style>