launch.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="content">
  3. <view class="loadding" v-if="loadding==true">
  4. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/fs/20250416/1744811256845.png"></image>
  5. <text class="text">壹道正气</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. loading: null,
  14. outUserId: null,
  15. qwUserId: null,
  16. currentPath: null,
  17. baseUrl:uni.getStorageSync('requestPath')
  18. };
  19. },
  20. onShow() {
  21. // this.getUserId();
  22. this.navigatHandler();
  23. },
  24. methods: {
  25. navigatHandler() {
  26. if (!this.utils.isLogin()) {
  27. // #ifdef H5
  28. uni.reLaunch({
  29. url: '/pages/auth/login',
  30. })
  31. // #endif
  32. // #ifdef MP-WEIXIN
  33. uni.reLaunch({
  34. url: '/pages/auth/wxlogin',
  35. })
  36. // #endif
  37. } else {
  38. // #ifdef H5
  39. uni.reLaunch({
  40. url: '/pages/index/index',
  41. })
  42. // #endif
  43. // #ifdef MP-WEIXIN
  44. console.log('现在')
  45. uni.reLaunch({
  46. url: '/pages/enterprise/enterprise',
  47. })
  48. // #endif
  49. }
  50. },
  51. getUserId() {
  52. const urlParams = new URLSearchParams(window.location.search);
  53. const currentUrl = window.location.href.split('#')[0];
  54. const companyId = urlParams.get('companyId');
  55. const code = urlParams.get('code');
  56. var data={
  57. companyId: companyId,
  58. url: currentUrl,
  59. code: code
  60. }
  61. getConfigSignature(data).then(
  62. res => {
  63. uni.hideLoading()
  64. if(res.code==200){
  65. const agentConfigSignature = res.config.agentConfigSignature;
  66. const configSignature = res.config.configSignature;
  67. const corpId = res.config.corpId;
  68. const nonceStr = res.config.nonceStr;
  69. const timestamp = res.config.timestamp;
  70. const agentId = res.config.agentId;
  71. this.qwUserId = res.config.userid;
  72. wx.config({
  73. beta: true,
  74. debug: false,
  75. appId: corpId,
  76. timestamp: timestamp,
  77. nonceStr: nonceStr,
  78. signature: configSignature,
  79. jsApiList: ['getCurExternalContact']
  80. });
  81. wx.ready(() => {
  82. wx.agentConfig({
  83. corpid: corpId,
  84. agentid: agentId,
  85. timestamp: timestamp,
  86. nonceStr: nonceStr,
  87. signature: agentConfigSignature,
  88. jsApiList: ['getCurExternalContact'],
  89. success: (res) => {
  90. wx.invoke('getCurExternalContact', {}, async (res) => {
  91. if (res.err_msg === "getCurExternalContact:ok") {
  92. this.outUserId = res.userId;
  93. uni.showToast({
  94. title: res.userId,
  95. icon: 'none'
  96. })
  97. } else {
  98. // 错误处理
  99. }
  100. });
  101. },
  102. fail: (res) => {
  103. console.error('agentConfig fail:', res);
  104. }
  105. });
  106. });
  107. wx.error((res) => {
  108. console.error('wx.error:', res);
  109. });
  110. }
  111. else{
  112. uni.showToast({
  113. title: res.msg,
  114. icon: 'none'
  115. })
  116. }
  117. },
  118. rej => {}
  119. );
  120. }
  121. }
  122. };
  123. </script>
  124. <style lang="scss">
  125. page{
  126. background-color: #fff;
  127. }
  128. .content {
  129. background-color: #fff;
  130. height: 100%;
  131. width: 100%;
  132. position: relative;
  133. }
  134. .loadding{
  135. background-color: #fff;
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. justify-content: center;
  140. position: absolute;
  141. top: 0;
  142. left: 0;
  143. width: 100%;
  144. height: 100%;
  145. z-index: 9999;
  146. image{
  147. border-radius: 50%;
  148. animation: load linear 1s infinite;
  149. width: 120rpx;
  150. height:120rpx;
  151. }
  152. .text{
  153. font-size: 28rpx;
  154. margin-top: 20rpx;
  155. }
  156. }
  157. </style>