index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <el-container class="box-all" v-loading="loading">
  3. <el-header>
  4. <div class="flex-box">
  5. <div class="logo-box flex-box flex-center-center">
  6. <img src="./assets/image/logo.png" class="logo" />
  7. <div>功道云积分制</div>
  8. </div>
  9. <div class="flex-1 hea-right flex-box flex-v-ce">
  10. <div class="name flex-1">{{ info.name }}</div>
  11. <div class="flex-box flex-v-ce">
  12. <div>您当前的版本:15~20人(剩余231天)</div>
  13. <el-button size="small" @click="tz" class="upgrade" type="primary" icon="el-icon-upload">续费升级</el-button>
  14. <span class="wn">?</span>
  15. <userImage :user_name="userData.name" :img_url="userData.img_url" width="44px" height="44px"></userImage>
  16. </div>
  17. </div>
  18. </div>
  19. </el-header>
  20. <el-container class="main">
  21. <el-aside>
  22. <el-menu default-active="1" class="el-menu-vertical-demo" :router="true">
  23. <el-menu-item :index="(index + 1).toString()" :route="item.path" v-for="(item, index) in routers" :key="index">
  24. <span class="iconfont" :class="item.meta.icon"></span>
  25. <span slot="title" style="margin-left: 10px;">{{ item.name }}</span>
  26. </el-menu-item>
  27. </el-menu>
  28. </el-aside>
  29. <el-main><router-view /></el-main>
  30. </el-container>
  31. </el-container>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. loading: false,
  38. userData: '',
  39. routers: [],
  40. info: ''
  41. };
  42. },
  43. created() {
  44. this.routers = this.$router.options.routes[0].children;
  45. },
  46. mounted() {
  47. // var url = window.location.href;
  48. // var str = this.GetRequest(url).corpId || '123';
  49. // var corpId = str.split('#')[0];
  50. // if (corpId) {
  51. // this.login(corpId);
  52. this.getTypes();
  53. // }
  54. },
  55. methods: {
  56. tz(){},
  57. login(corpId) {
  58. var that = this;
  59. this.loading=true;
  60. this.$dd.runtime.permission.requestAuthCode({
  61. corpId: corpId, // 企业id
  62. onSuccess: function(info) {
  63. that.$axios.post('api/ding/login', { authCode: info.code, corpId: corpId }).then(res => {
  64. var is=false;
  65. if (res.data.code == 1) {
  66. var { token, user } = res.data.data;
  67. user.employee_detail.role_list.forEach(item=>{
  68. if(user.is_official==1){
  69. if(item.name=='admin'||item.name=='creator'||item.name=='point_manager'){
  70. is=true;
  71. }
  72. }
  73. })
  74. if(is){
  75. that.$setUserData(user);
  76. that.userData = user;
  77. that.getInfo();
  78. }else{
  79. that.$router.replace({path:'/noAccess'})
  80. }
  81. }
  82. }).finally(() => {
  83. that.loading = false;
  84. });
  85. }
  86. });
  87. },
  88. getInfo() {
  89. var that = this;
  90. this.$axios.get('api/site/info').then(res => {
  91. that.info = res.data.data;
  92. });
  93. },
  94. getTypes() {
  95. var that = this;
  96. this.$axios.get('api/integral/types').then(res => {
  97. that.$setTyps(res.data.data.list);
  98. });
  99. },
  100. GetRequest(urlStr) {
  101. if (typeof urlStr == 'undefined') {
  102. var url = decodeURI(location.search); //获取url中"?"符后的字符串
  103. } else {
  104. var url = '?' + urlStr.split('?')[1];
  105. }
  106. var theRequest = new Object();
  107. var strs;
  108. if (url.indexOf('?') != -1) {
  109. var str = url.substr(1);
  110. strs = str.split('&');
  111. for (var i = 0; i < strs.length; i++) {
  112. theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
  113. }
  114. }
  115. return theRequest;
  116. }
  117. }
  118. };
  119. </script>
  120. <style scoped="scoped" lang="scss">
  121. .el-menu-vertical-demo:not(.el-menu--collapse) {
  122. width: 180px;
  123. min-height: 400px;
  124. }
  125. .el-header {
  126. background-color: #fff;
  127. line-height: 60px;
  128. padding: 0 !important;
  129. border-bottom: 1px solid #f1f1f1;
  130. }
  131. .el-menu {
  132. overflow: hidden;
  133. border: none;
  134. }
  135. .el-aside {
  136. transition: width 0.28s;
  137. width: 180px !important;
  138. background-color: #fff;
  139. height: calc(100vh - 60px);
  140. }
  141. .el-aside::-webkit-scrollbar {
  142. width: 0px;
  143. background-color: #fff;
  144. }
  145. .el-aside::-webkit-scrollbar-thumb {
  146. background-color: #ccc;
  147. }
  148. .con_nav_left {
  149. background: #fff;
  150. overflow-y: scroll;
  151. }
  152. .box-all {
  153. height: 100%;
  154. overflow: hidden;
  155. }
  156. .el-main {
  157. background-color: #f4f6f9;
  158. height: calc(100vh - 60px);
  159. overflow-y: scroll;
  160. padding: 10px;
  161. }
  162. .el-main::-webkit-scrollbar{
  163. width: 3px;
  164. height: 10px;
  165. background-color: #fff;
  166. }
  167. .el-main::-webkit-scrollbar-thumb {
  168. background-color: #D9D9D9;
  169. }
  170. .logo-box {
  171. width: 200px;
  172. }
  173. .logo-box .logo {
  174. width: 30px;
  175. height: 30px;
  176. margin-right: 5px;
  177. }
  178. .logo-box div {
  179. font-size: 16px;
  180. font-weight: 600;
  181. }
  182. .wn {
  183. height: 26px;
  184. width: 26px;
  185. border: 1px solid #c0c4cc;
  186. line-height: 26px;
  187. text-align: center;
  188. border-radius: 50px;
  189. margin: 0 10px;
  190. font-size: 18px;
  191. color: #c0c4cc;
  192. }
  193. .hea-right {
  194. padding: 0 20px;
  195. }
  196. .upgrade {
  197. margin-left: 10px;
  198. }
  199. </style>