launch.vue 4.0 KB

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