index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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. watch:{
  142. $route(to,from){
  143. this.defaultActive = to.meta.identification
  144. }
  145. },
  146. methods: {
  147. GetRequest(urlStr) {
  148. if (typeof urlStr == 'undefined') {
  149. var url = decodeURI(location.search); //获取url中"?"符后的字符串
  150. } else {
  151. var url = '?' + urlStr.split('?')[1];
  152. }
  153. var theRequest = new Object();
  154. var strs;
  155. if (url.indexOf('?') != -1) {
  156. var str = url.substr(1);
  157. strs = str.split('&');
  158. for (var i = 0; i < strs.length; i++) {
  159. theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
  160. }
  161. }
  162. return theRequest;
  163. },
  164. //获取套餐信息
  165. getCorp(corpId) {
  166. this.$axios('get',"api/order/corp", {corp_id:corpId}).then((res) => {
  167. this.corpMessage = res.data.data;
  168. })
  169. },
  170. getSku(){
  171. var that = this;
  172. this.$axios('get','api/order/goods/sku',{callback: "https://test-ding.g107.com/#/index", goods_code: 'DD_GOODS-610003' }).then(res => {
  173. });
  174. },
  175. //当刷新页面是控制左边导航栏的选中
  176. activeRouter(index,indexPath){
  177. // console.log(index,indexPath)
  178. localStorage.setItem("path",indexPath[1]);
  179. },
  180. returnRoutersArr(str){
  181. var routers = this.$router.options.routes[0].children;
  182. var routersArr=[];
  183. routers.forEach(item=>{
  184. if(item.meta.groupCode==str){
  185. routersArr.push(item);
  186. }
  187. })
  188. return routersArr;
  189. },
  190. returnIndex(str,str2){
  191. return str+"-"+str2;
  192. },
  193. openView(e){
  194. this.wn_show=false;
  195. this.isShowWn=false;
  196. this.$router.push({path:this.routers_one[e].path})
  197. this.defaultActive="2-"+(e).toString();
  198. localStorage.setItem("path",this.defaultActive);
  199. },
  200. showWn(){
  201. this.wn_show=true;
  202. },
  203. getInfo() {
  204. var that = this;
  205. this.$axios('get','/api/site/info').then(res => {
  206. that.info = res.data.data;
  207. });
  208. },
  209. getTypes() {
  210. var that = this;
  211. this.$axios('get','/api/integral/types').then(res => {
  212. that.$setTyps(res.data.data.list);
  213. });
  214. },
  215. }
  216. };
  217. </script>
  218. <style scoped="scoped" lang="scss">
  219. .wn-box{
  220. padding: 20px 0;
  221. }
  222. .wn-box .flex-1{
  223. cursor: pointer;
  224. }
  225. .wn-box .flex-1 div:nth-child(1){
  226. width: 55px;
  227. height: 55px;
  228. border-radius: 50%;
  229. text-align: center;
  230. line-height: 55px;
  231. background-color: #E0F2FF;
  232. color: #26A2FF;
  233. margin-bottom: 20px;
  234. }
  235. .wn-box .flex-1 div:nth-child(2){
  236. width: 110px;
  237. border-radius: 25px;
  238. border: 1px solid #26A2FF;
  239. padding:7px 10px;
  240. text-align: center;
  241. color: #26A2FF;
  242. }
  243. .wn-box .flex-1:hover div:nth-child(1){
  244. color: #fff;
  245. background-color: #26A2FF;
  246. }
  247. .wn-box .flex-1:hover div:nth-child(2){
  248. color: #fff;
  249. background-color: #26A2FF;
  250. }
  251. .el-menu-vertical-demo:not(.el-menu--collapse) {
  252. width: 180px;
  253. // min-height: 400px;
  254. }
  255. .el-header {
  256. background-color: #fff;
  257. // line-height: 60px;
  258. padding: 0 !important;
  259. border-bottom: 1px solid #f1f1f1;
  260. }
  261. .el-menu {
  262. overflow: hidden;
  263. border: none;
  264. }
  265. .el-aside {
  266. transition: width 0.28s;
  267. width: 180px !important;
  268. background-color: #fff;
  269. height: calc(100vh - 60px);
  270. }
  271. .el-aside::-webkit-scrollbar {
  272. width: 0px;
  273. background-color: #fff;
  274. }
  275. .el-aside::-webkit-scrollbar-thumb {
  276. background-color: #ccc;
  277. }
  278. .con_nav_left {
  279. background: #fff;
  280. overflow-y: scroll;
  281. }
  282. .box-all {
  283. height: 100%;
  284. overflow: hidden;
  285. }
  286. .el-main {
  287. background-color: #f4f6f9;
  288. height: calc(100vh - 60px);
  289. overflow-y: scroll;
  290. padding: 10px;
  291. }
  292. .el-main::-webkit-scrollbar{
  293. width: 3px;
  294. height: 10px;
  295. background-color: #fff;
  296. }
  297. .el-main::-webkit-scrollbar-thumb {
  298. background-color: #D9D9D9;
  299. }
  300. .logo-box {
  301. width: 180px;
  302. }
  303. .logo-box .logo {
  304. width: 30px;
  305. height: 30px;
  306. margin-right: 5px;
  307. border-radius: 6px;
  308. }
  309. .logo-box div {
  310. font-size: 16px;
  311. font-weight: 600;
  312. }
  313. .wn {
  314. height: 26px;
  315. width: 26px;
  316. margin-right: 12px;
  317. cursor: pointer;
  318. }
  319. .hea-right {
  320. padding: 0 20px;
  321. }
  322. .upgrade {
  323. margin-left: 10px;
  324. margin-right: 10px;
  325. }
  326. ::v-deep .el-menu-item{
  327. padding-right: 10px !important;
  328. }
  329. ::v-deep .el-menu-item.is-active {
  330. color: #26A2FF;
  331. background-color: #ecf5ff;
  332. }
  333. </style>