init.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div>
  3. <div class="noData flex-box-v flex-center-center">
  4. <div class="data-all">
  5. <img src="./assets/image/init.gif" class="appImg" />
  6. <div>管理执行难,就用功道云</div>
  7. <el-button class="refresh" type="primary" :loading="disabled" :disabled="disabled" v-if="isRefresh" @click="openLogin()">{{ text }}</el-button>
  8. </div>
  9. </div>
  10. <el-dialog title="通知" :visible.sync="dialogFormVisible" width="480px" :show-close="false" :close-on-click-modal="false">
  11. <div>
  12. <div style="font-size: 18px;">尊敬的用户:</div>
  13. <div style="margin: 10px 0;">您当前的套餐已到期,如需继续使用,请<span @click="bundleOfServices" style="color:#409eff;cursor:pointer;">联系客服</span>或扫描下方二维码进行续费。</div>
  14. </div>
  15. <div style="border-radius: 15px;border: 1px solid #f1f1f1;padding: 10px; width: 276px;box-sizing: border-box;margin: 0 auto;">
  16. <img src="./assets/image/code.png"/>
  17. </div>
  18. <div class="fontColorC" style="text-align: center;margin-top: 15px;font-size: 18px;">手机钉钉扫码,付费升级</div>
  19. </el-dialog>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. text: '重试',
  27. corpId: '',
  28. isRefresh: false,
  29. disabled: false,
  30. showBtnCunt: 0,
  31. dialogFormVisible:false
  32. };
  33. },
  34. created() {
  35. this.getTypes();
  36. },
  37. mounted() {
  38. var url = window.location.href;
  39. var str = this.GetRequest(url).corpId || '123';
  40. var corpId = str.split('#')[0];
  41. this.corpId = corpId;
  42. if (corpId) {
  43. this.login(corpId);
  44. }
  45. },
  46. methods: {
  47. getTypes() {
  48. var that = this;
  49. this.$axios('get', '/api/integral/types').then(res => {
  50. that.$setTyps(res.data.data.list);
  51. });
  52. },
  53. bundleOfServices(){
  54. this.$dd.biz.util.openSlidePanel({
  55. url:"https://page.dingtalk.com/wow/dingtalk/act/serviceconversation?wh_biz=tm&showmenu=false&goodsCode=DT_GOODS_881607043109331&corpId="+this.$getCache('corpId')+"&token=5784a3e6b5e025ee891517ea814180f4",
  56. title: '客服群',
  57. onSuccess : function(result) {
  58. },
  59. onFail : function(err) {
  60. console.log('onFail')
  61. }
  62. })
  63. },
  64. //重新登录
  65. openLogin() {
  66. var num = 10;
  67. var that = this;
  68. this.disabled = true;
  69. this.showBtnCunt = this.showBtnCunt + 1;
  70. var intterval = setInterval(function() {
  71. num--;
  72. if (num == 0) {
  73. that.text = '重试';
  74. that.disabled = false;
  75. if (that.showBtnCunt >= 2) {
  76. that.$alert('数据加载过慢,请联系客服', '温馨提示', {
  77. confirmButtonText: '确定',
  78. callback: action => {}
  79. });
  80. }
  81. clearInterval(intterval);
  82. return;
  83. }
  84. that.text = num;
  85. }, 1000);
  86. this.login(this.corpId);
  87. },
  88. login(corpId) {
  89. var that = this;
  90. this.loading = true;
  91. this.$setCache('corpId',corpId)
  92. this.$dd.runtime.permission.requestAuthCode({
  93. corpId: corpId, // 企业id
  94. onSuccess: function(info) {
  95. that.$axios('post', '/api/ding/login', { authCode: info.code, corpId: corpId }).then(res => {
  96. if (res.data.code == 1) {
  97. var { token, user } = res.data.data;
  98. if (user.is_official==1) {
  99. that.$setUserData(user);
  100. that.$router.replace({ path: '/index' });
  101. }else{
  102. that.$router.replace({ path: '/noAccess' });
  103. }
  104. }else if(res.data.code==2001){
  105. that.dialogFormVisible=true;
  106. }
  107. }).finally(() => {
  108. that.loading = false;
  109. });
  110. }
  111. });
  112. },
  113. GetRequest(urlStr) {
  114. if (typeof urlStr == 'undefined') {
  115. var url = decodeURI(location.search); //获取url中"?"符后的字符串
  116. } else {
  117. var url = '?' + urlStr.split('?')[1];
  118. }
  119. var theRequest = new Object();
  120. var strs;
  121. if (url.indexOf('?') != -1) {
  122. var str = url.substr(1);
  123. strs = str.split('&');
  124. for (var i = 0; i < strs.length; i++) {
  125. theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
  126. }
  127. }
  128. return theRequest;
  129. },
  130. }
  131. };
  132. </script>
  133. <style scoped="scoped">
  134. .refresh {
  135. margin-top: 100px;
  136. width: 100px;
  137. }
  138. .appImg {
  139. width: 200px;
  140. height: 200px;
  141. }
  142. .noData {
  143. text-align: center;
  144. position: fixed;
  145. left: 0;
  146. top: 0;
  147. right: 0;
  148. bottom: 0;
  149. }
  150. .data-all {
  151. margin-bottom: 10%;
  152. color: #595959;
  153. }
  154. </style>