index.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>瑞吉外卖管理端</title>
  8. <link rel="shortcut icon" href="favicon.ico">
  9. <!-- 引入样式 -->
  10. <link rel="stylesheet" href="plugins/element-ui/index.css" />
  11. <link rel="stylesheet" href="styles/common.css" />
  12. <link rel="stylesheet" href="styles/index.css" />
  13. <link rel="stylesheet" href="styles/icon/iconfont.css" />
  14. <style>
  15. .body{
  16. min-width: 1366px;
  17. }
  18. .app-main{
  19. height: calc(100% - 64px);
  20. }
  21. .app-main .divTmp{
  22. width: 100%;
  23. height: 100%;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="app" id="app">
  29. <div class="app-wrapper openSidebar clearfix">
  30. <!-- sidebar -->
  31. <div class="sidebar-container">
  32. <div class="logo">
  33. <!-- <img src="images/logo.png" width="122.5" alt="" /> -->
  34. <img src="images/login/login-logo.png" alt="" style="width: 117px; height: 32px" />
  35. </div>
  36. <el-scrollbar wrap-class="scrollbar-wrapper">
  37. <el-menu
  38. :default-active="defAct"
  39. :unique-opened="false"
  40. :collapse-transition="false"
  41. background-color="#343744"
  42. text-color="#bfcbd9"
  43. active-text-color="#f4f4f5"
  44. >
  45. <div v-for="item in menuList" :key="item.id">
  46. <el-submenu :index="item.id" v-if="item.children && item.children.length>0">
  47. <template slot="title">
  48. <i class="iconfont" :class="item.icon"></i>
  49. <span>{{item.name}}</span>
  50. </template>
  51. <el-menu-item
  52. v-for="sub in item.children"
  53. :index="sub.id"
  54. :key="sub.id"
  55. @click="menuHandle(sub,false)"
  56. >
  57. <i :class="iconfont" :class="sub.icon"></i>
  58. <span slot="title">{{sub.name}}</span>
  59. </el-menu-item
  60. >
  61. </el-submenu>
  62. <el-menu-item v-else :index="item.id" @click="menuHandle(item,false)">
  63. <i class="iconfont" :class="item.icon"></i>
  64. <span slot="title">{{item.name}}</span>
  65. </el-menu-item>
  66. </div>
  67. </el-menu>
  68. </el-scrollbar>
  69. </div>
  70. <div class="main-container">
  71. <!-- <navbar /> -->
  72. <div class="navbar">
  73. <div class="head-lable">
  74. <span v-if="goBackFlag" class="goBack" @click="goBack()"
  75. ><img src="images/icons/btn_back@2x.png" alt="" /> 返回</span
  76. >
  77. <span>{{headTitle}}</span>
  78. </div>
  79. <div class="right-menu">
  80. <div class="avatar-wrapper">{{ userInfo.name }}</div>
  81. <!-- <div class="logout" @click="logout">退出</div> -->
  82. <img src="images/icons/btn_close@2x.png" class="outLogin" alt="退出" @click="logout" />
  83. </div>
  84. </div>
  85. <div class="app-main" v-loading="loading">
  86. <div class="divTmp" v-show="loading"></div>
  87. <iframe
  88. id="cIframe"
  89. class="c_iframe"
  90. name="cIframe"
  91. :src="iframeUrl"
  92. width="100%"
  93. height="auto"
  94. frameborder="0"
  95. v-show="!loading"
  96. ></iframe>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <!-- 开发环境版本,包含了有帮助的命令行警告 -->
  102. <script src="plugins/vue/vue.js"></script>
  103. <!-- 引入组件库 -->
  104. <script src="plugins/element-ui/index.js"></script>
  105. <!-- 引入axios -->
  106. <script src="plugins/axios/axios.min.js"></script>
  107. <script src="js/request.js"></script>
  108. <script src="api/login.js"></script>
  109. <script>
  110. new Vue({
  111. el: '#app',
  112. data() {
  113. return {
  114. defAct: '2',
  115. menuActived: '2',
  116. userInfo: {},
  117. menuList: [
  118. // {
  119. // id: '1',
  120. // name: '门店管理',
  121. // children: [
  122. {
  123. id: '2',
  124. name: '员工管理',
  125. url: 'page/member/list.html',
  126. icon: 'icon-member'
  127. },
  128. {
  129. id: '3',
  130. name: '分类管理',
  131. url: 'page/category/list.html',
  132. icon: 'icon-category'
  133. },
  134. {
  135. id: '4',
  136. name: '菜品管理',
  137. url: 'page/food/list.html',
  138. icon: 'icon-food'
  139. },
  140. {
  141. id: '5',
  142. name: '套餐管理',
  143. url: 'page/combo/list.html',
  144. icon: 'icon-combo'
  145. },
  146. {
  147. id: '6',
  148. name: '订单明细',
  149. url: 'page/order/list.html',
  150. icon: 'icon-order'
  151. }
  152. // ],
  153. // },
  154. ],
  155. iframeUrl: 'page/member/list.html',
  156. headTitle: '员工管理',
  157. goBackFlag: false,
  158. loading: true,
  159. timer: null
  160. }
  161. },
  162. computed: {},
  163. created() {
  164. const userInfo = window.localStorage.getItem('userInfo')
  165. if (userInfo) {
  166. this.userInfo = JSON.parse(userInfo)
  167. }
  168. this.closeLoading()
  169. },
  170. beforeDestroy() {
  171. this.timer = null
  172. clearTimeout(this.timer)
  173. },
  174. mounted() {
  175. window.menuHandle = this.menuHandle
  176. },
  177. methods: {
  178. logout() {
  179. logoutApi().then((res)=>{
  180. if(res.code === 1){
  181. localStorage.removeItem('userInfo')
  182. window.location.href = '/backend/page/login/login.html'
  183. }
  184. })
  185. },
  186. goBack() {
  187. // window.location.href = 'javascript:history.go(-1)'
  188. const menu = this.menuList.find(item=>item.id===this.menuActived)
  189. // this.goBackFlag = false
  190. // this.headTitle = menu.name
  191. this.menuHandle(menu,false)
  192. },
  193. menuHandle(item, goBackFlag) {
  194. this.loading = true
  195. this.menuActived = item.id
  196. this.iframeUrl = item.url
  197. this.headTitle = item.name
  198. this.goBackFlag = goBackFlag
  199. this.closeLoading()
  200. },
  201. closeLoading(){
  202. this.timer = null
  203. this.timer = setTimeout(()=>{
  204. this.loading = false
  205. },1000)
  206. }
  207. }
  208. })
  209. </script>
  210. </body>
  211. </html>