index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <el-container class="box-all" v-loading="loading">
  3. <el-header>
  4. <div class="flex-box" style="height: 60px;">
  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" v-if="info.name">
  10. <div class="name flex-1">{{ info.name }}</div>
  11. <div class="flex-box flex-v-ce">
  12. <div>您当前为 <span class="blue">"{{corpMessage.package_name}}"</span>,有效期至<span style="color:#FF9600">{{corpMessage.expire_time}}</span></div>
  13. <el-button size="small" @click="isTz=true" class="upgrade" type="primary" icon="el-icon-upload">续费升级</el-button>
  14. <el-tooltip class="item" effect="dark" content="设置向导" placement="bottom">
  15. <img src="./assets/image/wn.png" class="wn" @click="showWn">
  16. </el-tooltip>
  17. <userImage :user_name="userData.name" :img_url="userData.img_url" width="44px" height="44px"></userImage>
  18. </div>
  19. </div>
  20. </div>
  21. </el-header>
  22. <el-container class="main">
  23. <el-aside>
  24. <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" :router="true" @select="activeRouter" >
  25. <el-submenu :index="index.toString()" v-for="(item, index) in routers" :key="index">
  26. <template slot="title"><span class="iconfont titleIcon" :class="item.icon" style="font-size: 20px;"></span><span style="margin-left: 5px;">{{item.name}}</span></template>
  27. <template v-for="(item2, index2) in item.children">
  28. <el-menu-item :index="returnIndex(index,index2)" :ref="item2.path" :route="item2.path" :key="index2" class="font-flex-word">
  29. <span slot="title" style="margin-left: 10px;width:120px">{{ item2.name }}</span>
  30. </el-menu-item>
  31. </template>
  32. </el-submenu>
  33. </el-menu>
  34. </el-aside>
  35. <el-main>
  36. <router-view />
  37. <div class="fontColorF" style="text-align: center;margin: 20px 0;">Copyright © 2020 广东功道云数字科技有限公司 All Rights Reserved</div>
  38. </el-main>
  39. </el-container>
  40. <!-- 续费升级 -->
  41. <el-dialog class="续费升级" :visible.sync="isTz" width="400px">
  42. <div style="border-radius: 15px;border: 1px solid #f1f1f1;padding: 10px; width: 276px;box-sizing: border-box;margin: 0 auto;">
  43. <img src="./assets/image/code.png"/>
  44. </div>
  45. <div class="fontColorF" style="text-align: center;margin-top: 15px;font-size: 18px;">手机钉钉扫码,付费升级</div>
  46. </el-dialog>
  47. <el-dialog title="设置向导" :visible.sync="wn_show" width="600px">
  48. <div>
  49. <div class="wn-title fontColorF">三步轻松搭建积分管理体系:定人员、分责权、建制度</div>
  50. <div class="flex-box flex-v-ce wn-box">
  51. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(0)">
  52. <div><span class="iconfont " :class="routers_one[0].meta.icon"></span></div>
  53. <div>1、确定{{routers_one[0].name}}</div>
  54. </div>
  55. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(1)">
  56. <div><span class="iconfont " :class="routers_one[1].meta.icon"></span></div>
  57. <div>2、分配{{routers_one[1].name}}</div>
  58. </div>
  59. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(2)">
  60. <div><span class="iconfont " :class="routers_one[2].meta.icon"></span></div>
  61. <div>3、建立{{routers_one[2].name}}</div>
  62. </div>
  63. </div>
  64. </div>
  65. <div>
  66. <div class="wn-title fontColorF">更有效地做好积分激励和认可,你还可以设置以下3项</div>
  67. <div class="flex-box flex-v-ce wn-box">
  68. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(3)">
  69. <div><span class="iconfont " :class="routers_one[3].meta.icon"></span></div>
  70. <div>{{routers_one[3].name}}</div>
  71. </div>
  72. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(4)">
  73. <div><span class="iconfont " :class="routers_one[4].meta.icon"></span></div>
  74. <div>{{routers_one[4].name}}</div>
  75. </div>
  76. <div class="flex-1 flex-box-v flex-v-ce" @click="openView(5)">
  77. <div><span class="iconfont " :class="routers_one[5].meta.icon"></span></div>
  78. <div>{{routers_one[5].name}}</div>
  79. </div>
  80. </div>
  81. </div>
  82. </el-dialog>
  83. <!-- <el-drawer
  84. title="我是标题"
  85. :visible.sync="isTz"
  86. :direction="direction"
  87. >
  88. <span>我来啦!</span>
  89. </el-drawer> -->
  90. </el-container>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. loading: false,
  97. userData: {},
  98. routers:[],
  99. routers_one:[],
  100. info: {},
  101. wn_show:false,
  102. defaultActive:"0-0",
  103. isShowWn:true,
  104. isTz:false,
  105. direction: 'rtl',
  106. corpMessage:{},//企业套餐信息
  107. };
  108. },
  109. created() {
  110. this.routers=[
  111. // {name:'首页',children:this.returnRoutersArr('home'),icon:'icon-xuanzhong_shouye'},
  112. // {name:'A/B分',children:this.returnRoutersArr('abPoint'),icon:'icon-PC_gongzuotai_ABfen'},
  113. {name:'设置',children:this.returnRoutersArr('set'),icon:'icon-dingdingPC_shezhi'},
  114. {name:'统计',children:this.returnRoutersArr('ranking'),icon:'icon-dingdingPC_tongji'},
  115. ];
  116. this.routers_one=this.returnRoutersArr('set');
  117. this.userData=this.$getUserData();
  118. if(this.$route.path!='/home'){//当刷新页面是控制左边导航栏的选中
  119. this.defaultActive=localStorage.getItem("path");
  120. }
  121. },
  122. mounted() {
  123. this.getTypes();
  124. this.getInfo();
  125. var url = window.location.href;
  126. var str = this.GetRequest(url).corpId || '123';
  127. var corpId = str.split('#')[0];
  128. if (corpId) {
  129. this.getCorp(corpId);
  130. }
  131. this.$nextTick(function() {
  132. if (localStorage.getItem('wn_show')) {
  133. this.wn_show = false;
  134. this.isShowWn=false;
  135. } else {
  136. this.wn_show = true;
  137. localStorage.setItem('wn_show','true');
  138. }
  139. });
  140. },
  141. methods: {
  142. GetRequest(urlStr) {
  143. if (typeof urlStr == 'undefined') {
  144. var url = decodeURI(location.search); //获取url中"?"符后的字符串
  145. } else {
  146. var url = '?' + urlStr.split('?')[1];
  147. }
  148. var theRequest = new Object();
  149. var strs;
  150. if (url.indexOf('?') != -1) {
  151. var str = url.substr(1);
  152. strs = str.split('&');
  153. for (var i = 0; i < strs.length; i++) {
  154. theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
  155. }
  156. }
  157. return theRequest;
  158. },
  159. //获取套餐信息
  160. getCorp(corpId) {
  161. this.$axios('get',"api/order/corp", {corp_id:corpId}).then((res) => {
  162. this.corpMessage = res.data.data;
  163. })
  164. },
  165. getSku(){
  166. var that = this;
  167. this.$axios('get','api/order/goods/sku',{callback: "https://test-ding.g107.com/#/index", goods_code: 'DD_GOODS-610003' }).then(res => {
  168. });
  169. },
  170. //当刷新页面是控制左边导航栏的选中
  171. activeRouter(index,indexPath){
  172. // console.log(index,indexPath)
  173. localStorage.setItem("path",indexPath[1]);
  174. },
  175. returnRoutersArr(str){
  176. var routers = this.$router.options.routes[0].children;
  177. var routersArr=[];
  178. routers.forEach(item=>{
  179. if(item.meta.groupCode==str){
  180. routersArr.push(item);
  181. }
  182. })
  183. return routersArr;
  184. },
  185. returnIndex(str,str2){
  186. return str+"-"+str2;
  187. },
  188. openView(e){
  189. this.wn_show=false;
  190. this.isShowWn=false;
  191. this.$router.push({path:this.routers_one[e].path})
  192. this.defaultActive="0-"+(e).toString();
  193. localStorage.setItem("path",this.defaultActive);
  194. },
  195. showWn(){
  196. this.wn_show=true;
  197. },
  198. getInfo() {
  199. var that = this;
  200. this.$axios('get','/api/site/info').then(res => {
  201. that.info = res.data.data;
  202. });
  203. },
  204. getTypes() {
  205. var that = this;
  206. this.$axios('get','/api/integral/types').then(res => {
  207. that.$setTyps(res.data.data.list);
  208. });
  209. },
  210. }
  211. };
  212. </script>
  213. <style scoped="scoped" lang="scss">
  214. .wn-box{
  215. padding: 20px 0;
  216. }
  217. .wn-box .flex-1{
  218. cursor: pointer;
  219. }
  220. .wn-box .flex-1 div:nth-child(1){
  221. width: 55px;
  222. height: 55px;
  223. border-radius: 50%;
  224. text-align: center;
  225. line-height: 55px;
  226. background-color: #E0F2FF;
  227. color: #26A2FF;
  228. margin-bottom: 20px;
  229. }
  230. .wn-box .flex-1 div:nth-child(2){
  231. width: 110px;
  232. border-radius: 25px;
  233. border: 1px solid #26A2FF;
  234. padding:7px 10px;
  235. text-align: center;
  236. color: #26A2FF;
  237. }
  238. .wn-box .flex-1:hover div:nth-child(1){
  239. color: #fff;
  240. background-color: #26A2FF;
  241. }
  242. .wn-box .flex-1:hover div:nth-child(2){
  243. color: #fff;
  244. background-color: #26A2FF;
  245. }
  246. .el-menu-vertical-demo:not(.el-menu--collapse) {
  247. width: 180px;
  248. // min-height: 400px;
  249. }
  250. .el-header {
  251. background-color: #fff;
  252. // line-height: 60px;
  253. padding: 0 !important;
  254. border-bottom: 1px solid #f1f1f1;
  255. }
  256. .el-menu {
  257. overflow: hidden;
  258. border: none;
  259. }
  260. .el-aside {
  261. transition: width 0.28s;
  262. width: 180px !important;
  263. background-color: #fff;
  264. height: calc(100vh - 60px);
  265. }
  266. .el-aside::-webkit-scrollbar {
  267. width: 0px;
  268. background-color: #fff;
  269. }
  270. .el-aside::-webkit-scrollbar-thumb {
  271. background-color: #ccc;
  272. }
  273. .con_nav_left {
  274. background: #fff;
  275. overflow-y: scroll;
  276. }
  277. .box-all {
  278. height: 100%;
  279. overflow: hidden;
  280. }
  281. .el-main {
  282. background-color: #f4f6f9;
  283. height: calc(100vh - 60px);
  284. overflow-y: scroll;
  285. padding: 10px;
  286. }
  287. .el-main::-webkit-scrollbar{
  288. width: 3px;
  289. height: 10px;
  290. background-color: #fff;
  291. }
  292. .el-main::-webkit-scrollbar-thumb {
  293. background-color: #D9D9D9;
  294. }
  295. .logo-box {
  296. width: 180px;
  297. }
  298. .logo-box .logo {
  299. width: 30px;
  300. height: 30px;
  301. margin-right: 5px;
  302. border-radius: 6px;
  303. }
  304. .logo-box div {
  305. font-size: 16px;
  306. font-weight: 600;
  307. }
  308. .wn {
  309. height: 26px;
  310. width: 26px;
  311. margin-right: 12px;
  312. cursor: pointer;
  313. }
  314. .hea-right {
  315. padding: 0 20px;
  316. }
  317. .upgrade {
  318. margin-left: 10px;
  319. margin-right: 10px;
  320. }
  321. ::v-deep .el-menu-item{
  322. padding-right: 10px !important;
  323. }
  324. ::v-deep .el-menu-item.is-active {
  325. color: #26A2FF;
  326. background-color: #ecf5ff;
  327. }
  328. </style>