mirror of
				https://gitee.com/lab1024/smart-admin.git
				synced 2025-11-04 18:33:43 +08:00 
			
		
		
		
	优化h5项目
This commit is contained in:
		@@ -1,4 +1,3 @@
 | 
			
		||||
NODE_ENV = development
 | 
			
		||||
VUE_APP_ENV = dev
 | 
			
		||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api/
 | 
			
		||||
 | 
			
		||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
NODE_ENV = development
 | 
			
		||||
VUE_APP_ENV = local
 | 
			
		||||
VUE_APP_URL=http://127.0.0.1:10086/smart-admin-api/
 | 
			
		||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
NODE_ENV = production
 | 
			
		||||
VUE_APP_ENV = pre
 | 
			
		||||
VUE_APP_URL = http://smartadmin.1024lab.net/api/
 | 
			
		||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
NODE_ENV = production
 | 
			
		||||
VUE_APP_ENV = prod
 | 
			
		||||
VUE_APP_URL = http://smartadmin.1024lab.net/api/
 | 
			
		||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
NODE_ENV = production
 | 
			
		||||
VUE_APP_ENV = sit
 | 
			
		||||
VUE_APP_URL=http://127.0.0.1:10086/smart-admin-api/
 | 
			
		||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
// 详情请看 https://github.com/michael-ciniawsky/postcss-load-config
 | 
			
		||||
module.exports = {
 | 
			
		||||
  plugins: {
 | 
			
		||||
    autoprefixer: {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
[defaults]
 | 
			
		||||
url = https://sentry.1024lab.net/
 | 
			
		||||
org = 1024lab
 | 
			
		||||
org = 1024lab-sentry
 | 
			
		||||
project = smart-admin-h5
 | 
			
		||||
 | 
			
		||||
[auth]
 | 
			
		||||
token = 8bab45b9152d44b19d4e0a762a93dd34a1318ee8317f46a0a007c48da0e9888e
 | 
			
		||||
token = 8dflijsldjkasdo3u49230948pkjdasoia8023jl3k4jr29o81029i40534p545ke
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
# ren-min-yi-xue-manage-h5
 | 
			
		||||
 | 
			
		||||
#### Description
 | 
			
		||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
 | 
			
		||||
 | 
			
		||||
#### Software Architecture
 | 
			
		||||
Software architecture description
 | 
			
		||||
 | 
			
		||||
#### Installation
 | 
			
		||||
 | 
			
		||||
1.  xxxx
 | 
			
		||||
2.  xxxx
 | 
			
		||||
3.  xxxx
 | 
			
		||||
 | 
			
		||||
#### Instructions
 | 
			
		||||
 | 
			
		||||
1.  xxxx
 | 
			
		||||
2.  xxxx
 | 
			
		||||
3.  xxxx
 | 
			
		||||
 | 
			
		||||
#### Contribution
 | 
			
		||||
 | 
			
		||||
1.  Fork the repository
 | 
			
		||||
2.  Create Feat_xxx branch
 | 
			
		||||
3.  Commit your code
 | 
			
		||||
4.  Create Pull Request
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### Gitee Feature
 | 
			
		||||
 | 
			
		||||
1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
 | 
			
		||||
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
 | 
			
		||||
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
 | 
			
		||||
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
 | 
			
		||||
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
 | 
			
		||||
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
 | 
			
		||||
@@ -1,39 +1,4 @@
 | 
			
		||||
# ren-min-yi-xue-manage-h5
 | 
			
		||||
# SmartAdmin-H5
 | 
			
		||||
 | 
			
		||||
#### 介绍
 | 
			
		||||
{**以下是 Gitee 平台说明,您可以替换此简介**
 | 
			
		||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
 | 
			
		||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
 | 
			
		||||
 | 
			
		||||
#### 软件架构
 | 
			
		||||
软件架构说明
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### 安装教程
 | 
			
		||||
 | 
			
		||||
1.  xxxx
 | 
			
		||||
2.  xxxx
 | 
			
		||||
3.  xxxx
 | 
			
		||||
 | 
			
		||||
#### 使用说明
 | 
			
		||||
 | 
			
		||||
1.  xxxx
 | 
			
		||||
2.  xxxx
 | 
			
		||||
3.  xxxx
 | 
			
		||||
 | 
			
		||||
#### 参与贡献
 | 
			
		||||
 | 
			
		||||
1.  Fork 本仓库
 | 
			
		||||
2.  新建 Feat_xxx 分支
 | 
			
		||||
3.  提交代码
 | 
			
		||||
4.  新建 Pull Request
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### 特技
 | 
			
		||||
 | 
			
		||||
1.  使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
 | 
			
		||||
2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
 | 
			
		||||
3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
 | 
			
		||||
4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
 | 
			
		||||
5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
 | 
			
		||||
6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
 | 
			
		||||
SmartAdmin-H5 是SmartAdmin 平台的移动端web项目
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "smart-admin-h5",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "description": "基于Smart-H5的SmartAdmin的H5端",
 | 
			
		||||
  "description": "基于vue和vant的h5模板",
 | 
			
		||||
  "author": "zhuoluodada@qq.com",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "scripts": {
 | 
			
		||||
@@ -26,12 +26,12 @@
 | 
			
		||||
    "moment": "^2.29.0",
 | 
			
		||||
    "nprogress": "^0.2.0",
 | 
			
		||||
    "regenerator-runtime": "^0.13.5",
 | 
			
		||||
    "vant": "^2.10.2",
 | 
			
		||||
    "vue": "^2.6.11",
 | 
			
		||||
    "vant": "^2.11.1",
 | 
			
		||||
    "vue": "^2.6.12",
 | 
			
		||||
    "vue-enum": "^1.0.5",
 | 
			
		||||
    "vue-loading-overlay": "^3.4.2",
 | 
			
		||||
    "vue-router": "^3.2.0",
 | 
			
		||||
    "vuex": "^3.4.0"
 | 
			
		||||
    "vue-router": "^3.4.0",
 | 
			
		||||
    "vuex": "^3.6.0"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@sentry/webpack-plugin": "^1.11.1",
 | 
			
		||||
@@ -46,15 +46,13 @@
 | 
			
		||||
    "compression-webpack-plugin": "^3.1.0",
 | 
			
		||||
    "eslint": "^6.7.2",
 | 
			
		||||
    "eslint-plugin-vue": "^6.2.2",
 | 
			
		||||
    "less": "^3.11.2",
 | 
			
		||||
    "less-loader": "^6.1.0",
 | 
			
		||||
    "node-sass": "^4.14.1",
 | 
			
		||||
    "postcss-pxtorem": "^5.1.1",
 | 
			
		||||
    "sass-loader": "^8.0.2",
 | 
			
		||||
    "script-ext-html-webpack-plugin": "^2.1.4",
 | 
			
		||||
    "sass": "^1.3.0",
 | 
			
		||||
    "sass-loader": "^9.0.3",
 | 
			
		||||
    "script-ext-html-webpack-plugin": "^2.1.5",
 | 
			
		||||
    "uglifyjs-webpack-plugin": "^2.2.0",
 | 
			
		||||
    "vconsole": "^3.3.4",
 | 
			
		||||
    "vue-template-compiler": "^2.6.11",
 | 
			
		||||
    "webpack-bundle-analyzer": "^3.8.0"
 | 
			
		||||
    "vue-template-compiler": "^2.6.12",
 | 
			
		||||
    "webpack-bundle-analyzer": "^4.2.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ export default {
 | 
			
		||||
  name: 'App'
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="less">
 | 
			
		||||
<style lang="scss">
 | 
			
		||||
#nprogress .bar {
 | 
			
		||||
  background: #1989fa !important;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
import { getAxios, postAxios } from '@/lib/http';
 | 
			
		||||
 | 
			
		||||
export const crmSchoolApi = {
 | 
			
		||||
 | 
			
		||||
  // 分校列表 - 分校 by yandanyang
 | 
			
		||||
  querySchoolList: (data) => {
 | 
			
		||||
    return postAxios('/admin/crm/school/list', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 分校跟进详列表 - 分校 by yandanyang
 | 
			
		||||
  querySchoolTrackList: data => {
 | 
			
		||||
    return postAxios('/admin/crm/school/track/list', data);
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  // 分校跟进 - 分校 by yandanyang
 | 
			
		||||
  addSchoolTrack: data => {
 | 
			
		||||
    return postAxios('/admin/crm/school/track/add', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 分校跟进 - 分校 by yandanyang
 | 
			
		||||
  getSchoolTrackDetail: schoolTrackId => {
 | 
			
		||||
    return getAxios(`/admin/crm/school/track/detail/${schoolTrackId}`);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -2,42 +2,42 @@ import { postAxios, getAxios } from '@/lib/http';
 | 
			
		||||
export const employeeApi = {
 | 
			
		||||
  // 员工管理查询
 | 
			
		||||
  getEmployeeList: (data) => {
 | 
			
		||||
    return postAxios('/employee/query', data);
 | 
			
		||||
    return postAxios('admin/employee/query', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 添加员工
 | 
			
		||||
  addEmployee: (data) => {
 | 
			
		||||
    return postAxios('/employee/add', data);
 | 
			
		||||
    return postAxios('admin/employee/add', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 更新员工信息
 | 
			
		||||
  updateEmployee: (data) => {
 | 
			
		||||
    return postAxios('/employee/update', data);
 | 
			
		||||
    return postAxios('admin/employee/update', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 禁用启用单个员工
 | 
			
		||||
  updateStatus: (employeeId, status) => {
 | 
			
		||||
    return getAxios('/employee/updateStatus/' + employeeId + '/' + status);
 | 
			
		||||
    return getAxios('admin/employee/updateStatus/' + employeeId + '/' + status);
 | 
			
		||||
  },
 | 
			
		||||
  // 批量禁用
 | 
			
		||||
  updateStatusBatch: (data) => {
 | 
			
		||||
    return postAxios('/employee/batchUpdateStatus', data);
 | 
			
		||||
    return postAxios('admin/employee/batchUpdateStatus', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 单个员工角色授权
 | 
			
		||||
  updateRoles: (data) => {
 | 
			
		||||
    return postAxios('/employee/updateRoles', data);
 | 
			
		||||
    return postAxios('admin/employee/updateRoles', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 修改密码
 | 
			
		||||
  updatePwd: (data) => {
 | 
			
		||||
    return postAxios('/employee/updatePwd', data);
 | 
			
		||||
    return postAxios('admin/employee/updatePwd', data);
 | 
			
		||||
  },
 | 
			
		||||
  // 重置密码
 | 
			
		||||
  resetPassword: (employeeId) => {
 | 
			
		||||
    return getAxios('/employee/resetPasswd/' + employeeId);
 | 
			
		||||
    return getAxios('admin/employee/resetPasswd/' + employeeId);
 | 
			
		||||
  },
 | 
			
		||||
  // 通过部门id获取当前部门的人员&没有部门的人
 | 
			
		||||
  getListEmployeeByDeptId: (departmentId) => {
 | 
			
		||||
    return getAxios('/employee/listEmployeeByDeptId/' + departmentId);
 | 
			
		||||
    return getAxios('admin/employee/listEmployeeByDeptId/' + departmentId);
 | 
			
		||||
  },
 | 
			
		||||
  // 删除员工
 | 
			
		||||
  deleteEmployee: (employeeId) => {
 | 
			
		||||
    return postAxios('/employee/delete/' + employeeId);
 | 
			
		||||
    return postAxios('admin/employee/delete/' + employeeId);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,10 @@
 | 
			
		||||
import { getAxios, postAxios } from '@/lib/http';
 | 
			
		||||
 | 
			
		||||
export const loginApi = {
 | 
			
		||||
  getVerificationCode: () => {
 | 
			
		||||
    return getAxios('/verificationCode');
 | 
			
		||||
  },
 | 
			
		||||
  login: (data) => {
 | 
			
		||||
    return postAxios('/login', data);
 | 
			
		||||
    return postAxios('/session/login', data);
 | 
			
		||||
  },
 | 
			
		||||
  logout: (token) => {
 | 
			
		||||
    return getAxios(`/logout?x-access-token=${token}`);
 | 
			
		||||
    return getAxios(`/session/logOut?x-access-token=${token}`);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								smart-admin-h5/src/api/user.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								smart-admin-h5/src/api/user.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
import { getAxios } from '@/lib/http';
 | 
			
		||||
 | 
			
		||||
export const userApi = {
 | 
			
		||||
  getSession: () => {
 | 
			
		||||
    return getAxios('/session/get');
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -1,13 +1,5 @@
 | 
			
		||||
@import './variables.scss';
 | 
			
		||||
@import './mixin.scss';
 | 
			
		||||
 | 
			
		||||
html,
 | 
			
		||||
body .app {
 | 
			
		||||
  color: #333333;
 | 
			
		||||
  font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
 | 
			
		||||
  background-color: $background-color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.app-container {
 | 
			
		||||
  padding-bottom: 50px;
 | 
			
		||||
}
 | 
			
		||||
$text-color: #323233;
 | 
			
		||||
$border-color: #ebedf0;
 | 
			
		||||
$active-color: #f2f3f5;
 | 
			
		||||
$background-color: #f7f8fa;
 | 
			
		||||
$background-color-light: #fafafa;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
// mixin
 | 
			
		||||
// 清除浮动
 | 
			
		||||
@mixin clearfix {
 | 
			
		||||
  &:after {
 | 
			
		||||
    content: "";
 | 
			
		||||
    display: table;
 | 
			
		||||
    clear: both;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
// 多行隐藏
 | 
			
		||||
@mixin textoverflow($clamp:1) {
 | 
			
		||||
  display: block;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow: ellipsis;
 | 
			
		||||
  -o-text-overflow: ellipsis;
 | 
			
		||||
  display: -webkit-box;
 | 
			
		||||
  -webkit-line-clamp: $clamp;
 | 
			
		||||
  /*! autoprefixer: ignore next */
 | 
			
		||||
  -webkit-box-orient: vertical;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//flex box
 | 
			
		||||
@mixin flexbox($jc:space-between, $ai:center, $fd:row, $fw:nowrap) {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  display: -webkit-flex;
 | 
			
		||||
  flex: 1;
 | 
			
		||||
  justify-content: $jc;
 | 
			
		||||
  -webkit-justify-content: $jc;
 | 
			
		||||
  align-items: $ai;
 | 
			
		||||
  -webkit-align-items: $ai;
 | 
			
		||||
  flex-direction: $fd;
 | 
			
		||||
  -webkit-flex-direction: $fd;
 | 
			
		||||
  flex-wrap: $fw;
 | 
			
		||||
  -webkit-flex-wrap: $fw;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
 
 | 
			
		||||
// variables
 | 
			
		||||
$background-color: #f8f8f8;
 | 
			
		||||
@@ -1,54 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <van-tabbar fixed route v-model="active" @change="handleChange">
 | 
			
		||||
      <van-tabbar-item v-for="(item, index) in data" :to="item.to" :icon="item.icon" :key="index">
 | 
			
		||||
        {{ item.title }}
 | 
			
		||||
      </van-tabbar-item>
 | 
			
		||||
    </van-tabbar>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'TabBar',
 | 
			
		||||
  props: {
 | 
			
		||||
    defaultActive: {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 0
 | 
			
		||||
    },
 | 
			
		||||
    data: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => {
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      active: this.defaultActive
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleChange(value) {
 | 
			
		||||
      this.$emit('change', value)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
 | 
			
		||||
<style scoped>
 | 
			
		||||
h3 {
 | 
			
		||||
  margin: 40px 0 0;
 | 
			
		||||
}
 | 
			
		||||
ul {
 | 
			
		||||
  list-style-type: none;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
}
 | 
			
		||||
li {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  margin: 0 10px;
 | 
			
		||||
}
 | 
			
		||||
a {
 | 
			
		||||
  color: #42b983;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
* @description:department-employee-selector
 | 
			
		||||
* @author: zhuoda
 | 
			
		||||
* @date: 2020/10/30 13:56
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@ import cookie from '@/lib/cookie';
 | 
			
		||||
import { userApi } from 'api/user';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 此 mixin为登录以后的页面用的,因为所有的有效路由(排除登录、注册、404,500 这个几个特殊页面)都会走 other-main 或者 tabber-main两个父级组件。
 | 
			
		||||
 * 所以对于一些session的信息获取只能放到这个两个main组件上,故此mixin只用于两个main组件,起到全局的作用
 | 
			
		||||
 * 此 mixin为登录以后的页面用的,因为所有的有效路由(排除登录、注册、404,500 这个几个特殊页面)都会走 App.vue里的router
 | 
			
		||||
 * @author zhuoda
 | 
			
		||||
 */
 | 
			
		||||
export default {
 | 
			
		||||
  created: function() {
 | 
			
		||||
@@ -12,12 +12,14 @@ module.exports = {
 | 
			
		||||
   */
 | 
			
		||||
  baseUrl: {
 | 
			
		||||
    apiUrl: process.env.VUE_APP_URL,
 | 
			
		||||
    erpApiUrl: process.env.VUE_APP_ERP_URL,
 | 
			
		||||
    webSocketUrl: process.env.VUE_APP_SOCKET_URL
 | 
			
		||||
  },
 | 
			
		||||
  /**
 | 
			
		||||
   * 打包后静态资源地址;如果是走cdn的话,可以配置如下:
 | 
			
		||||
   * publicPath: isProd ? 'https://cdn.1024lab.net/static/smart-h5/' : '/'
 | 
			
		||||
   */
 | 
			
		||||
  publicPath: isProductionEnv ? '/smart-admin-h5/' : '/',
 | 
			
		||||
  publicPath: isProductionEnv ? '/manage-h5/' : '/',
 | 
			
		||||
 | 
			
		||||
  // ==================== cdn 相关 begin ====================
 | 
			
		||||
  cdn: {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										165
									
								
								smart-admin-h5/src/constants/erp/contact-company.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										165
									
								
								smart-admin-h5/src/constants/erp/contact-company.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,165 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 往来单位性质
 | 
			
		||||
 * @type {{ENTERPRISE: {value: number, desc: string}, PERSONAL: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const CONTACT_COMPANY_NATURE_ENUM =
 | 
			
		||||
  {
 | 
			
		||||
    ENTERPRISE: {
 | 
			
		||||
      value: 0,
 | 
			
		||||
      desc: '企业'
 | 
			
		||||
    },
 | 
			
		||||
    PERSONAL: {
 | 
			
		||||
      value: 1,
 | 
			
		||||
      desc: '个人'
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
/**
 | 
			
		||||
 * 往来机构类型
 | 
			
		||||
 * @type {{CUSTOMER: {value: number, desc: string}, SUPPLIER: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const
 | 
			
		||||
  CONTACT_COMPANY_TYPE_ENUM =
 | 
			
		||||
    {
 | 
			
		||||
      CUSTOMER: {
 | 
			
		||||
        value: 0,
 | 
			
		||||
        desc: '客户'
 | 
			
		||||
      },
 | 
			
		||||
      SUPPLIER: {
 | 
			
		||||
        value: 1,
 | 
			
		||||
        desc: '供应商'
 | 
			
		||||
      },
 | 
			
		||||
      SCHOOL: {
 | 
			
		||||
        value: 2,
 | 
			
		||||
        desc: '分校'
 | 
			
		||||
      },
 | 
			
		||||
      COOPERATIVE_ORG: {
 | 
			
		||||
        value: 3,
 | 
			
		||||
        desc: '合作机构'
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 付款方式
 | 
			
		||||
 * @type {{BANK: {value: number, desc: string}, ZHI_FU_BAO: {value: number, desc: string}, WE_CHAT: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const
 | 
			
		||||
  PAYMENT_TYPE_ENUM =
 | 
			
		||||
    {
 | 
			
		||||
      BANK: {
 | 
			
		||||
        value: 0,
 | 
			
		||||
        desc: '银行卡'
 | 
			
		||||
      },
 | 
			
		||||
      WE_CHAT: {
 | 
			
		||||
        value: 1,
 | 
			
		||||
        desc: '微信'
 | 
			
		||||
      },
 | 
			
		||||
      ZHI_FU_BAO: {
 | 
			
		||||
        value: 2,
 | 
			
		||||
        desc: '支付宝'
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 往来机构余额类型
 | 
			
		||||
 * @type {{RECEIVE_BALANCE: {value: number, desc: string}, PAY_BALANCE: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const
 | 
			
		||||
  CONTACT_COMPANY_BALANCE_TYPE =
 | 
			
		||||
    {
 | 
			
		||||
      PAY_BALANCE: {
 | 
			
		||||
        value: 0,
 | 
			
		||||
        desc: '应付款余额'
 | 
			
		||||
      },
 | 
			
		||||
      RECEIVE_BALANCE: {
 | 
			
		||||
        value: 1,
 | 
			
		||||
        desc: '应收款余额'
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 往来单位等级
 | 
			
		||||
 * @type {{CORE: {value: number, desc: string}, POTENTIAL: {value: number, desc: string}, BAD: {value: number, desc: string}, GENERAL: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const CONTACT_COMPANY_GRADE_ENUM = {
 | 
			
		||||
  CORE: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '核心',
 | 
			
		||||
    color: 'green'
 | 
			
		||||
  },
 | 
			
		||||
  POTENTIAL: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '有潜力',
 | 
			
		||||
    color: 'cyan'
 | 
			
		||||
  },
 | 
			
		||||
  GENERAL: {
 | 
			
		||||
    value: 3,
 | 
			
		||||
    desc: '普通',
 | 
			
		||||
    color: 'blue'
 | 
			
		||||
  },
 | 
			
		||||
  BAD: {
 | 
			
		||||
    value: 4,
 | 
			
		||||
    desc: '较差',
 | 
			
		||||
    color: 'purple'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 往来单位等级
 | 
			
		||||
 * @type {{OWNER: {value: number, desc: string}, SHARER: {value: number, desc: string}, COMMON: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const CONTACT_COMPANY_SHARE_TYPE_ENUM = {
 | 
			
		||||
  OWNER: {
 | 
			
		||||
    value: 0,
 | 
			
		||||
    desc: '属于我的'
 | 
			
		||||
  },
 | 
			
		||||
  SHARER: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '共享的'
 | 
			
		||||
  },
 | 
			
		||||
  COMMON: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '公共的'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 往来单位标签
 | 
			
		||||
 * @type {{OWNER: {value: number, desc: string}, SHARER: {value: number, desc: string}, COMMON: {value: number, desc: string}}}
 | 
			
		||||
 */
 | 
			
		||||
export const CONTACT_COMPANY_TAG_ENUM = {
 | 
			
		||||
  POTENTIAL: {
 | 
			
		||||
    value: 0,
 | 
			
		||||
    desc: '潜在',
 | 
			
		||||
    color: 'green'
 | 
			
		||||
  },
 | 
			
		||||
  INTENTION: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '意向',
 | 
			
		||||
    color: 'cyan'
 | 
			
		||||
  },
 | 
			
		||||
  NEGOTIATION: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '洽谈',
 | 
			
		||||
    color: 'blue'
 | 
			
		||||
  },
 | 
			
		||||
  DEAL: {
 | 
			
		||||
    value: 3,
 | 
			
		||||
    desc: '成交',
 | 
			
		||||
    color: 'geekblue'
 | 
			
		||||
  },
 | 
			
		||||
  LOSS: {
 | 
			
		||||
    value: 4,
 | 
			
		||||
    desc: '流失',
 | 
			
		||||
    color: 'red'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  CONTACT_COMPANY_NATURE_ENUM,
 | 
			
		||||
  CONTACT_COMPANY_TYPE_ENUM,
 | 
			
		||||
  PAYMENT_TYPE_ENUM,
 | 
			
		||||
  CONTACT_COMPANY_BALANCE_TYPE,
 | 
			
		||||
  CONTACT_COMPANY_GRADE_ENUM,
 | 
			
		||||
  CONTACT_COMPANY_SHARE_TYPE_ENUM,
 | 
			
		||||
  CONTACT_COMPANY_TAG_ENUM
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										6
									
								
								smart-admin-h5/src/constants/erp/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								smart-admin-h5/src/constants/erp/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
import contactCompany from './contact-company';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  ...contactCompany
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
import file from './file';
 | 
			
		||||
import school from '@/constants/school';
 | 
			
		||||
import erp from './erp';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  ...file,
 | 
			
		||||
  ...school,
 | 
			
		||||
  ...erp
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										71
									
								
								smart-admin-h5/src/constants/school.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								smart-admin-h5/src/constants/school.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
/**
 | 
			
		||||
 *  分校标签
 | 
			
		||||
 */
 | 
			
		||||
export const SCHOOL_TAG_ENUM = {
 | 
			
		||||
  POTENTIAL: {
 | 
			
		||||
    value: 0,
 | 
			
		||||
    desc: '潜在'
 | 
			
		||||
  },
 | 
			
		||||
  INTENTION: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '意向'
 | 
			
		||||
  },
 | 
			
		||||
  NEGOTIATION: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '洽谈'
 | 
			
		||||
  },
 | 
			
		||||
  DEAL: {
 | 
			
		||||
    value: 3,
 | 
			
		||||
    desc: '成交'
 | 
			
		||||
  },
 | 
			
		||||
  LOSS: {
 | 
			
		||||
    value: 4,
 | 
			
		||||
    desc: '流失'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 分校等级
 | 
			
		||||
 */
 | 
			
		||||
export const SCHOOL_GRADE_ENUM = {
 | 
			
		||||
  CORE: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '核心'
 | 
			
		||||
  },
 | 
			
		||||
  POTENTIAL: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '有潜力'
 | 
			
		||||
  },
 | 
			
		||||
  GENERAL: {
 | 
			
		||||
    value: 3,
 | 
			
		||||
    desc: '普通'
 | 
			
		||||
  },
 | 
			
		||||
  BAD: {
 | 
			
		||||
    value: 4,
 | 
			
		||||
    desc: '较差'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 共享类型
 | 
			
		||||
 */
 | 
			
		||||
export const SCHOOL_SHARE_TYPE_ENUM = {
 | 
			
		||||
  OWNER: {
 | 
			
		||||
    value: 0,
 | 
			
		||||
    desc: '属于我的'
 | 
			
		||||
  },
 | 
			
		||||
  SHARER: {
 | 
			
		||||
    value: 1,
 | 
			
		||||
    desc: '共享的'
 | 
			
		||||
  },
 | 
			
		||||
  COMMON: {
 | 
			
		||||
    value: 2,
 | 
			
		||||
    desc: '公共的'
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  SCHOOL_TAG_ENUM,
 | 
			
		||||
  SCHOOL_GRADE_ENUM,
 | 
			
		||||
  SCHOOL_SHARE_TYPE_ENUM
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										65
									
								
								smart-admin-h5/src/lib/erp-http.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								smart-admin-h5/src/lib/erp-http.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
import Axios from 'axios';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import cookie from '@/lib/cookie';
 | 
			
		||||
import { Toast } from 'vant';
 | 
			
		||||
 | 
			
		||||
export const baseUrl = config.baseUrl.erpApiUrl;
 | 
			
		||||
 | 
			
		||||
const axios = Axios.create({
 | 
			
		||||
  baseURL: baseUrl,
 | 
			
		||||
  timeout: 30000,
 | 
			
		||||
  headers: {
 | 
			
		||||
    'Content-Type': 'application/json; charset=utf-8'
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// 添加请求拦截器
 | 
			
		||||
axios.interceptors.request.use(
 | 
			
		||||
  function(config) {
 | 
			
		||||
    const token = cookie.getToken();
 | 
			
		||||
    if (token) {
 | 
			
		||||
      config.headers['x-access-token'] = token;
 | 
			
		||||
    }
 | 
			
		||||
    return config;
 | 
			
		||||
  },
 | 
			
		||||
  function(error) {
 | 
			
		||||
    return Promise.reject(error);
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
// 添加响应拦截器
 | 
			
		||||
axios.interceptors.response.use(
 | 
			
		||||
  res => {
 | 
			
		||||
    const { data } = res;
 | 
			
		||||
    if (data && data.code && data.code !== 1) {
 | 
			
		||||
      if (data.code === 121) {
 | 
			
		||||
        cookie.clearToken();
 | 
			
		||||
        localStorage.clear();
 | 
			
		||||
        window.location.href = window.location.pathname + '#/login';
 | 
			
		||||
        Toast.fail('未登录,或登录失效,请登录');
 | 
			
		||||
        return;
 | 
			
		||||
      } else if (data.code === 502) {
 | 
			
		||||
        window.location.href = window.location.pathname + '#/500';
 | 
			
		||||
        return;
 | 
			
		||||
      } else {
 | 
			
		||||
        Toast.fail(data.msg);
 | 
			
		||||
        return Promise.reject(res);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return Promise.resolve(data);
 | 
			
		||||
  },
 | 
			
		||||
  error => {
 | 
			
		||||
    Toast.fail('服务内部错误');
 | 
			
		||||
    return Promise.reject(error);
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
export const postAxios = (url, data, config) => {
 | 
			
		||||
  return axios.post(url, data, config);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getAxios = (url, data) => {
 | 
			
		||||
  return axios.get(url, {
 | 
			
		||||
    params: data
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * @Author: zhuoda
 | 
			
		||||
 * @Author: hanyu
 | 
			
		||||
 * @Date: 2020-05-28 12:46:06
 | 
			
		||||
 * @LastEditTime: 2020-07-08 09:16:15
 | 
			
		||||
 * @LastEditors: hy
 | 
			
		||||
 */
 | 
			
		||||
// smart sentry
 | 
			
		||||
import * as Sentry from '@sentry/browser';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,84 +0,0 @@
 | 
			
		||||
// 处理table操作按钮
 | 
			
		||||
const tableAction = (h, array) => {
 | 
			
		||||
  let btnArray = [];
 | 
			
		||||
  let btnMore = [];
 | 
			
		||||
  array.map((item, index) => {
 | 
			
		||||
    if (index < 2) {
 | 
			
		||||
      let btn = h(
 | 
			
		||||
        'a',
 | 
			
		||||
        {
 | 
			
		||||
          props: {
 | 
			
		||||
            type: !index ? 'primary' : 'info',
 | 
			
		||||
            size: 'small',
 | 
			
		||||
            to: item.to ? item.to : '',
 | 
			
		||||
            target: item.target ? item.target : '_self',
 | 
			
		||||
            ghost: true
 | 
			
		||||
          },
 | 
			
		||||
          style: {
 | 
			
		||||
            marginLeft: '5px'
 | 
			
		||||
          },
 | 
			
		||||
          directives: item.directives,
 | 
			
		||||
          on: {
 | 
			
		||||
            click: item.action
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        item.title
 | 
			
		||||
      );
 | 
			
		||||
      btnArray.push(btn);
 | 
			
		||||
    } else {
 | 
			
		||||
      btnMore.push(
 | 
			
		||||
        h(
 | 
			
		||||
          'DropdownItem',
 | 
			
		||||
          {
 | 
			
		||||
            nativeOn: {
 | 
			
		||||
              click: item.action
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          item.title
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  let dropdown = h(
 | 
			
		||||
    'Dropdown',
 | 
			
		||||
    {
 | 
			
		||||
      props: {
 | 
			
		||||
        transfer: true
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    [
 | 
			
		||||
      h(
 | 
			
		||||
        'a',
 | 
			
		||||
        {
 | 
			
		||||
          props: {
 | 
			
		||||
            type: 'default',
 | 
			
		||||
            size: 'small'
 | 
			
		||||
          },
 | 
			
		||||
          style: {
 | 
			
		||||
            marginLeft: '5px'
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        [
 | 
			
		||||
          h('span', '更多'),
 | 
			
		||||
          h('Icon', {
 | 
			
		||||
            props: {
 | 
			
		||||
              type: 'ios-arrow-down'
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        ]
 | 
			
		||||
      ),
 | 
			
		||||
      h(
 | 
			
		||||
        'DropdownMenu',
 | 
			
		||||
        {
 | 
			
		||||
          slot: 'list'
 | 
			
		||||
        },
 | 
			
		||||
        btnMore
 | 
			
		||||
      )
 | 
			
		||||
    ]
 | 
			
		||||
  );
 | 
			
		||||
  if (array.length > 2) {
 | 
			
		||||
    btnArray.push(dropdown);
 | 
			
		||||
  }
 | 
			
		||||
  return btnArray;
 | 
			
		||||
};
 | 
			
		||||
export default tableAction;
 | 
			
		||||
@@ -12,7 +12,7 @@ import 'vant/lib/index.css';
 | 
			
		||||
// 引入首个组件
 | 
			
		||||
import App from './App.vue';
 | 
			
		||||
// 引入自定义主题样式
 | 
			
		||||
import './themes/index.less';
 | 
			
		||||
import './themes/index.scss';
 | 
			
		||||
// 引入过滤器
 | 
			
		||||
import './filters';
 | 
			
		||||
// 引入配置信息
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								smart-admin-h5/src/router/dashboard/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								smart-admin-h5/src/router/dashboard/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * dashboard首页
 | 
			
		||||
 */
 | 
			
		||||
export const dashboardRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/',
 | 
			
		||||
    // redirect: '/dashboard/contact-company',
 | 
			
		||||
    redirect: '/dashboard/user',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '首页',
 | 
			
		||||
      keepAlive: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/dashboard/dashboard'),
 | 
			
		||||
    children: [
 | 
			
		||||
      // {
 | 
			
		||||
      //   path: '/dashboard/contact-company',
 | 
			
		||||
      //   name: 'ContactCompany',
 | 
			
		||||
      //   meta: {
 | 
			
		||||
      //     title: '往来单位',
 | 
			
		||||
      //     keepAlive: true,
 | 
			
		||||
      //     showTabbar: true,
 | 
			
		||||
      //     permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
      //   },
 | 
			
		||||
      //   component: () => import('@/views/erp/contact-company/contact-company')
 | 
			
		||||
      // },
 | 
			
		||||
      {
 | 
			
		||||
        path: '/dashboard/user',
 | 
			
		||||
        name: 'Mine',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '我的',
 | 
			
		||||
          keepAlive: false,
 | 
			
		||||
          showTabbar: true,
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () => import('@/views/user/index')
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
							
								
								
									
										21
									
								
								smart-admin-h5/src/router/develop/develop.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								smart-admin-h5/src/router/develop/develop.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const developRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/develop',
 | 
			
		||||
    component: () => import('@/views/dashboard/dashboard'),
 | 
			
		||||
    children: [
 | 
			
		||||
      {
 | 
			
		||||
        path: '/develop/config',
 | 
			
		||||
        name: 'DevelopConfig',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '开发专用配置',
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () => import('views/develop/config')
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
// 错误页
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const error = [
 | 
			
		||||
export const errorRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/404',
 | 
			
		||||
    name: 'Error404',
 | 
			
		||||
@@ -10,7 +10,7 @@ export const error = [
 | 
			
		||||
      access: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/error/404.vue')
 | 
			
		||||
    component: () => import('views/error/404.vue')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '/500',
 | 
			
		||||
@@ -21,17 +21,6 @@ export const error = [
 | 
			
		||||
      noValidatePrivilege: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/error/404.vue')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '*',
 | 
			
		||||
    name: 'http://localhost:8080/#employee/role-employee-manage',
 | 
			
		||||
    meta: {
 | 
			
		||||
      hideInMenu: true,
 | 
			
		||||
      access: true,
 | 
			
		||||
      noValidatePrivilege: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/error/404.vue')
 | 
			
		||||
    component: () => import('views/error/404.vue')
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
@@ -10,6 +10,10 @@ const projectConfig = require('@/config/index.js');
 | 
			
		||||
 | 
			
		||||
Vue.use(Router);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 导入所有的router
 | 
			
		||||
 * @type {VueRouter}
 | 
			
		||||
 */
 | 
			
		||||
const router = new Router({
 | 
			
		||||
  routes: routers
 | 
			
		||||
});
 | 
			
		||||
@@ -27,6 +31,8 @@ Router.prototype.push = function(location) {
 | 
			
		||||
 | 
			
		||||
const LOGIN_PAGE_NAME = 'Login';
 | 
			
		||||
 | 
			
		||||
// --------------------- router 守卫 begin ---------------------
 | 
			
		||||
 | 
			
		||||
router.beforeEach((to, from, next) => {
 | 
			
		||||
  // 加载进度条
 | 
			
		||||
  NProgress.start();
 | 
			
		||||
@@ -77,6 +83,19 @@ router.afterEach(to => {
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// --------------------- router 守卫 end ---------------------
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * router 检测
 | 
			
		||||
 *
 | 
			
		||||
 * 如果存在相同的 path 或者 name 是一件非常恐怖的事情,所以在develop环境将所有router进行一次遍历<br>
 | 
			
		||||
 * 检测内容如下:<br>
 | 
			
		||||
 * 1、相同的router name
 | 
			
		||||
 * 2、相同的router name
 | 
			
		||||
 * 3、path没有以 / 开头
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const tempCheckObj = {
 | 
			
		||||
  checkRouterNameMap: new Map(),
 | 
			
		||||
  checkRouterPathMap: new Map()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								smart-admin-h5/src/router/login/login.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								smart-admin-h5/src/router/login/login.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const loginRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/login',
 | 
			
		||||
    name: 'Login',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '登录',
 | 
			
		||||
      keepAlive: false,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/login/login.vue')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
];
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const develop = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/develop/config',
 | 
			
		||||
    name: 'DevelopConfig',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '开发专用配置',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () =>
 | 
			
		||||
      import('@/views/develop/config')
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 其他路由
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { user } from './user';
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
import { develop } from '@/router/other/develop';
 | 
			
		||||
import { school } from '@/router/other/school';
 | 
			
		||||
import { contactCompany } from '@/router/other/erp/contact-company';
 | 
			
		||||
 | 
			
		||||
export const otherRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/other-main',
 | 
			
		||||
    meta: {
 | 
			
		||||
      keepAlive: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('views/main/other-main'),
 | 
			
		||||
    children: [
 | 
			
		||||
      ...user,
 | 
			
		||||
      ...develop,
 | 
			
		||||
      ...school,
 | 
			
		||||
      ...contactCompany
 | 
			
		||||
    ]
 | 
			
		||||
  }];
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const school = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/school/detail',
 | 
			
		||||
    name: 'SchoolDetail',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '学校详情',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/crm/school/school-detail')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '/school/track/add',
 | 
			
		||||
    name: 'SchoolTrackAdd',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '学校拜访记录添加',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/crm/school/add-track')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '/school/track/detail',
 | 
			
		||||
    name: 'SchoolTrackDetail',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '学校拜访记录详情',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/crm/school/track-detail')
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '/school/update',
 | 
			
		||||
    name: 'SchoolUpdate',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '更新学校',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('@/views/crm/school/update-school')
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const user = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/user/change-password',
 | 
			
		||||
    name: 'UserChangePassword',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '修改密码',
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () =>
 | 
			
		||||
      import('@/views/mine/change-password')
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -1,24 +1,32 @@
 | 
			
		||||
import { tabbarRouter } from './tabbar';
 | 
			
		||||
import { otherRouter } from '@/router/other';
 | 
			
		||||
import { error } from './other/error';
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
// 全局错误页面
 | 
			
		||||
import { errorRouter } from './error/error';
 | 
			
		||||
// 登录注册模块
 | 
			
		||||
import { loginRouter } from './login/login';
 | 
			
		||||
// tabbar dashboard 框架页面
 | 
			
		||||
import { dashboardRouter } from './dashboard';
 | 
			
		||||
// 用户相关
 | 
			
		||||
import { userRouter } from './user/user';
 | 
			
		||||
// 开发相关
 | 
			
		||||
import { developRouter } from './develop/develop';
 | 
			
		||||
 | 
			
		||||
// 登录模块
 | 
			
		||||
export const login = {
 | 
			
		||||
  path: '/login',
 | 
			
		||||
  name: 'Login',
 | 
			
		||||
  meta: {
 | 
			
		||||
    title: '登录',
 | 
			
		||||
    keepAlive: false,
 | 
			
		||||
    permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
 | 
			
		||||
  },
 | 
			
		||||
  component: () => import('@/views/login/login.vue')
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 全部路由
 | 
			
		||||
/**
 | 
			
		||||
 * router meta 说明: <br>
 | 
			
		||||
 *
 | 
			
		||||
 * title: 为页面的title,会显示到浏览器的title上
 | 
			
		||||
 * permissionType: 具体使用 router-const.js中的  ROUTER_PERMISSION_TYPE 常量;情况有: 1)不验证 2)校验登录 3)登录后校验权限
 | 
			
		||||
 * keepAlive: true or false ; 是否进行页面keepalive, 如果想删除keepalive,可以使用vuex中的app module里有mutation
 | 
			
		||||
 * showTabbar: true or false ; 是否展示 tabbar, 如果是true, 则会展示tabbar
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
export const routers = [
 | 
			
		||||
  login,
 | 
			
		||||
  ...tabbarRouter,
 | 
			
		||||
  ...otherRouter,
 | 
			
		||||
  ...error
 | 
			
		||||
  // 登录、注册
 | 
			
		||||
  ...loginRouter,
 | 
			
		||||
  // 404、500、403等
 | 
			
		||||
  ...errorRouter,
 | 
			
		||||
  // tab bar 页面
 | 
			
		||||
  ...dashboardRouter,
 | 
			
		||||
  // 用户
 | 
			
		||||
  ...userRouter,
 | 
			
		||||
  // 开发相关
 | 
			
		||||
  ...developRouter
 | 
			
		||||
];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '../router-const';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 主要用于 tabbar 的路由
 | 
			
		||||
 */
 | 
			
		||||
export const tabbarRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/',
 | 
			
		||||
    redirect: '/contact-company',
 | 
			
		||||
    meta: {
 | 
			
		||||
      title: '首页',
 | 
			
		||||
      keepAlive: true,
 | 
			
		||||
      permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
    },
 | 
			
		||||
    component: () => import('views/main/tabbar-main'),
 | 
			
		||||
    children: [
 | 
			
		||||
      {
 | 
			
		||||
        path: '/home',
 | 
			
		||||
        name: 'Home',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '首页',
 | 
			
		||||
          keepAlive: true,
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () => import('@/views/home/index')
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        path: '/business',
 | 
			
		||||
        name: 'Business',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '业务中心',
 | 
			
		||||
          keepAlive: false,
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () => import('@/views/business/index')
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        path: '/mine',
 | 
			
		||||
        name: 'Mine',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '关于我',
 | 
			
		||||
          keepAlive: false,
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () => import('@/views/mine/index')
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
							
								
								
									
										21
									
								
								smart-admin-h5/src/router/user/user.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								smart-admin-h5/src/router/user/user.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
 | 
			
		||||
 | 
			
		||||
export const userRouter = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/user',
 | 
			
		||||
    component: () => import('@/views/dashboard/dashboard'),
 | 
			
		||||
    children: [
 | 
			
		||||
      {
 | 
			
		||||
        path: '/user/change-password',
 | 
			
		||||
        name: 'UserChangePassword',
 | 
			
		||||
        meta: {
 | 
			
		||||
          title: '修改密码',
 | 
			
		||||
          permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
 | 
			
		||||
        },
 | 
			
		||||
        component: () =>
 | 
			
		||||
          import('views/user/change-password')
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@@ -2,6 +2,7 @@ import Vue from 'vue';
 | 
			
		||||
import Vuex from 'vuex';
 | 
			
		||||
 | 
			
		||||
import user from './module/user';
 | 
			
		||||
import app from './module/app';
 | 
			
		||||
 | 
			
		||||
Vue.use(Vuex);
 | 
			
		||||
 | 
			
		||||
@@ -16,6 +17,7 @@ export default new Vuex.Store({
 | 
			
		||||
    //
 | 
			
		||||
  },
 | 
			
		||||
  modules: {
 | 
			
		||||
    app,
 | 
			
		||||
    user
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								smart-admin-h5/src/store/module/app.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								smart-admin-h5/src/store/module/app.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 整个应用相关的状态信息
 | 
			
		||||
 *
 | 
			
		||||
 * 比如: keepalive等
 | 
			
		||||
 */
 | 
			
		||||
export default {
 | 
			
		||||
  namespaced: true,
 | 
			
		||||
  state: {
 | 
			
		||||
    // 缓存路由
 | 
			
		||||
    keepAliveIncludes: []
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  mutations: {
 | 
			
		||||
    // 加入keep-alive缓存
 | 
			
		||||
    pushKeepAliveIncludes(state, val) {
 | 
			
		||||
      if (state.keepAliveIncludes.length < 30) {
 | 
			
		||||
        const number = state.keepAliveIncludes.findIndex(e => e === val);
 | 
			
		||||
        if (number === -1) {
 | 
			
		||||
          state.keepAliveIncludes.push(val);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 删除缓存
 | 
			
		||||
    deleteKeepAliveIncludes(state, val) {
 | 
			
		||||
      const number = state.keepAliveIncludes.findIndex(e => e === val);
 | 
			
		||||
      if (number !== -1) {
 | 
			
		||||
        state.keepAliveIncludes.splice(number, 1);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
 | 
			
		||||
@text-color: #323233;
 | 
			
		||||
@border-color: #ebedf0;
 | 
			
		||||
@active-color: #f2f3f5;
 | 
			
		||||
@background-color: #f7f8fa;
 | 
			
		||||
@background-color-light: #fafafa;
 | 
			
		||||
							
								
								
									
										6
									
								
								smart-admin-h5/src/themes/index.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								smart-admin-h5/src/themes/index.scss
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
 | 
			
		||||
html,
 | 
			
		||||
body {
 | 
			
		||||
  font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
 | 
			
		||||
  background-color: $background-color;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										110
									
								
								smart-admin-h5/src/utils/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								smart-admin-h5/src/utils/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by PanJiaChen on 16/11/18.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parse the time to string
 | 
			
		||||
 * @param {(Object|string|number)} time
 | 
			
		||||
 * @param {string} cFormat
 | 
			
		||||
 * @returns {string}
 | 
			
		||||
 */
 | 
			
		||||
export function parseTime(time, cFormat) {
 | 
			
		||||
  if (arguments.length === 0) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
 | 
			
		||||
  let date
 | 
			
		||||
  if (typeof time === 'object') {
 | 
			
		||||
    date = time
 | 
			
		||||
  } else {
 | 
			
		||||
    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
 | 
			
		||||
      time = parseInt(time)
 | 
			
		||||
    }
 | 
			
		||||
    if ((typeof time === 'number') && (time.toString().length === 10)) {
 | 
			
		||||
      time = time * 1000
 | 
			
		||||
    }
 | 
			
		||||
    date = new Date(time)
 | 
			
		||||
  }
 | 
			
		||||
  const formatObj = {
 | 
			
		||||
    y: date.getFullYear(),
 | 
			
		||||
    m: date.getMonth() + 1,
 | 
			
		||||
    d: date.getDate(),
 | 
			
		||||
    h: date.getHours(),
 | 
			
		||||
    i: date.getMinutes(),
 | 
			
		||||
    s: date.getSeconds(),
 | 
			
		||||
    a: date.getDay()
 | 
			
		||||
  }
 | 
			
		||||
  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
 | 
			
		||||
    let value = formatObj[key]
 | 
			
		||||
    // Note: getDay() returns 0 on Sunday
 | 
			
		||||
    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
 | 
			
		||||
    if (result.length > 0 && value < 10) {
 | 
			
		||||
      value = '0' + value
 | 
			
		||||
    }
 | 
			
		||||
    return value || 0
 | 
			
		||||
  })
 | 
			
		||||
  return time_str
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {number} time
 | 
			
		||||
 * @param {string} option
 | 
			
		||||
 * @returns {string}
 | 
			
		||||
 */
 | 
			
		||||
export function formatTime(time, option) {
 | 
			
		||||
  if (('' + time).length === 10) {
 | 
			
		||||
    time = parseInt(time) * 1000
 | 
			
		||||
  } else {
 | 
			
		||||
    time = +time
 | 
			
		||||
  }
 | 
			
		||||
  const d = new Date(time)
 | 
			
		||||
  const now = Date.now()
 | 
			
		||||
 | 
			
		||||
  const diff = (now - d) / 1000
 | 
			
		||||
 | 
			
		||||
  if (diff < 30) {
 | 
			
		||||
    return '刚刚'
 | 
			
		||||
  } else if (diff < 3600) {
 | 
			
		||||
    // less 1 hour
 | 
			
		||||
    return Math.ceil(diff / 60) + '分钟前'
 | 
			
		||||
  } else if (diff < 3600 * 24) {
 | 
			
		||||
    return Math.ceil(diff / 3600) + '小时前'
 | 
			
		||||
  } else if (diff < 3600 * 24 * 2) {
 | 
			
		||||
    return '1天前'
 | 
			
		||||
  }
 | 
			
		||||
  if (option) {
 | 
			
		||||
    return parseTime(time, option)
 | 
			
		||||
  } else {
 | 
			
		||||
    return (
 | 
			
		||||
      d.getMonth() +
 | 
			
		||||
      1 +
 | 
			
		||||
      '月' +
 | 
			
		||||
      d.getDate() +
 | 
			
		||||
      '日' +
 | 
			
		||||
      d.getHours() +
 | 
			
		||||
      '时' +
 | 
			
		||||
      d.getMinutes() +
 | 
			
		||||
      '分'
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {string} url
 | 
			
		||||
 * @returns {Object}
 | 
			
		||||
 */
 | 
			
		||||
export function param2Obj(url) {
 | 
			
		||||
  const search = url.split('?')[1]
 | 
			
		||||
  if (!search) {
 | 
			
		||||
    return {}
 | 
			
		||||
  }
 | 
			
		||||
  return JSON.parse(
 | 
			
		||||
    '{"' +
 | 
			
		||||
      decodeURIComponent(search)
 | 
			
		||||
        .replace(/"/g, '\\"')
 | 
			
		||||
        .replace(/&/g, '","')
 | 
			
		||||
        .replace(/=/g, '":"')
 | 
			
		||||
        .replace(/\+/g, ' ') +
 | 
			
		||||
      '"}'
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								smart-admin-h5/src/utils/request.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								smart-admin-h5/src/utils/request.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
import axios from 'axios'
 | 
			
		||||
import store from '@/store'
 | 
			
		||||
import { Toast } from 'vant'
 | 
			
		||||
// 根据环境不同引入不同api地址
 | 
			
		||||
import { baseApi } from '@/config'
 | 
			
		||||
// create an axios instance
 | 
			
		||||
const service = axios.create({
 | 
			
		||||
  baseURL: baseApi, // url = base api url + request url
 | 
			
		||||
  withCredentials: true, // send cookies when cross-domain requests
 | 
			
		||||
  timeout: 5000 // request timeout
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
// request拦截器 request interceptor
 | 
			
		||||
service.interceptors.request.use(
 | 
			
		||||
  config => {
 | 
			
		||||
    // 不传递默认开启loading
 | 
			
		||||
    if (!config.hideloading) {
 | 
			
		||||
      // loading
 | 
			
		||||
      Toast.loading({
 | 
			
		||||
        forbidClick: true
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
    if (store.getters.token) {
 | 
			
		||||
      config.headers['X-Token'] = ''
 | 
			
		||||
    }
 | 
			
		||||
    return config
 | 
			
		||||
  },
 | 
			
		||||
  error => {
 | 
			
		||||
    // do something with request error
 | 
			
		||||
    console.log(error) // for debug
 | 
			
		||||
    return Promise.reject(error)
 | 
			
		||||
  }
 | 
			
		||||
)
 | 
			
		||||
// respone拦截器
 | 
			
		||||
service.interceptors.response.use(
 | 
			
		||||
  response => {
 | 
			
		||||
    Toast.clear()
 | 
			
		||||
    const res = response.data
 | 
			
		||||
    if (res.status && res.status !== 200) {
 | 
			
		||||
      // 登录超时,重新登录
 | 
			
		||||
      if (res.status === 401) {
 | 
			
		||||
        store.dispatch('FedLogOut').then(() => {
 | 
			
		||||
          location.reload()
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      return Promise.reject(res || 'error')
 | 
			
		||||
    } else {
 | 
			
		||||
      return Promise.resolve(res)
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  error => {
 | 
			
		||||
    Toast.clear()
 | 
			
		||||
    console.log('err' + error) // for debug
 | 
			
		||||
    return Promise.reject(error)
 | 
			
		||||
  }
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
export default service
 | 
			
		||||
							
								
								
									
										20
									
								
								smart-admin-h5/src/utils/validate.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								smart-admin-h5/src/utils/validate.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by Sunnie on 19/06/04.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {string} path
 | 
			
		||||
 * @returns {Boolean}
 | 
			
		||||
 */
 | 
			
		||||
export function isExternal(path) {
 | 
			
		||||
  return /^(https?:|mailto:|tel:)/.test(path)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {string} str
 | 
			
		||||
 * @returns {Boolean}
 | 
			
		||||
 */
 | 
			
		||||
export function validUsername(str) {
 | 
			
		||||
  const valid_map = ['admin', 'editor']
 | 
			
		||||
  return valid_map.indexOf(str.trim()) >= 0
 | 
			
		||||
}
 | 
			
		||||
@@ -1,97 +0,0 @@
 | 
			
		||||
<!-- home -->
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <van-nav-bar title="审批中心">
 | 
			
		||||
      <template #right>
 | 
			
		||||
        <van-icon name="search" size="18" style="margin-right: 20px" />
 | 
			
		||||
        <van-icon name="filter-o" size="18" />
 | 
			
		||||
      </template>
 | 
			
		||||
    </van-nav-bar>
 | 
			
		||||
 | 
			
		||||
    <van-tabs v-model="bpmStatusActive" sticky>
 | 
			
		||||
      <van-tab title="标签 1">
 | 
			
		||||
        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
 | 
			
		||||
          <van-list
 | 
			
		||||
            v-model="loading"
 | 
			
		||||
            :finished="finished"
 | 
			
		||||
            finished-text="没有更多了"
 | 
			
		||||
            @load="onLoad"
 | 
			
		||||
          >
 | 
			
		||||
 | 
			
		||||
            <van-cell title="单元格" value="内容" size="large" label="描述信息" />
 | 
			
		||||
            <van-cell title="单元格" value="内容" size="large" label="描述信息" />
 | 
			
		||||
            <van-cell title="单元格" value="内容" size="large" label="描述信息" />
 | 
			
		||||
            <van-cell title="单元格" value="内容" size="large" label="描述信息" />
 | 
			
		||||
 | 
			
		||||
          </van-list>
 | 
			
		||||
        </van-pull-refresh>
 | 
			
		||||
      </van-tab>
 | 
			
		||||
      <van-tab title="标签 2">内容 2</van-tab>
 | 
			
		||||
      <van-tab title="标签 3">内容 3</van-tab>
 | 
			
		||||
      <van-tab title="标签 4">内容 4</van-tab>
 | 
			
		||||
    </van-tabs>
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      list: ['asdasd', 'asdasd', 'asdasd'],
 | 
			
		||||
      bpmStatusActive: 0,
 | 
			
		||||
      finished: true,
 | 
			
		||||
      refreshing: true,
 | 
			
		||||
      loading: true
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  computed: {},
 | 
			
		||||
 | 
			
		||||
  mounted() {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  methods: {
 | 
			
		||||
    onRefresh() {
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    onLoad() {
 | 
			
		||||
      this.finished = true;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.index-container {
 | 
			
		||||
  .warpper {
 | 
			
		||||
    padding: 12px;
 | 
			
		||||
    background: #fff;
 | 
			
		||||
 | 
			
		||||
    .demo-home__title {
 | 
			
		||||
      margin: 0 0 6px;
 | 
			
		||||
      font-size: 32px;
 | 
			
		||||
 | 
			
		||||
      .demo-home__title img,
 | 
			
		||||
      .demo-home__title span {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        vertical-align: middle;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      img {
 | 
			
		||||
        width: 32px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      span {
 | 
			
		||||
        margin-left: 16px;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .demo-home__desc {
 | 
			
		||||
      margin: 0 0 20px;
 | 
			
		||||
      color: rgba(69, 90, 100, 0.6);
 | 
			
		||||
      font-size: 14px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,66 +0,0 @@
 | 
			
		||||
<!-- home -->
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="index-container">
 | 
			
		||||
    <div class="warpper">
 | 
			
		||||
      <h2 class="demo-home__desc">
 | 
			
		||||
        业务
 | 
			
		||||
      </h2>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { Cell } from 'vant';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  components: {
 | 
			
		||||
    [Cell.name]: Cell
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      list: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  computed: {},
 | 
			
		||||
 | 
			
		||||
  mounted() {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  methods: {}
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.index-container {
 | 
			
		||||
  .warpper {
 | 
			
		||||
    padding: 12px;
 | 
			
		||||
    background: #fff;
 | 
			
		||||
 | 
			
		||||
    .demo-home__title {
 | 
			
		||||
      margin: 0 0 6px;
 | 
			
		||||
      font-size: 32px;
 | 
			
		||||
 | 
			
		||||
      .demo-home__title img,
 | 
			
		||||
      .demo-home__title span {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        vertical-align: middle;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      img {
 | 
			
		||||
        width: 32px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      span {
 | 
			
		||||
        margin-left: 16px;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .demo-home__desc {
 | 
			
		||||
      margin: 0 0 20px;
 | 
			
		||||
      color: rgba(69, 90, 100, 0.6);
 | 
			
		||||
      font-size: 14px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										99
									
								
								smart-admin-h5/src/views/dashboard/dashboard.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								smart-admin-h5/src/views/dashboard/dashboard.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
 | 
			
		||||
    <!---------------- 页面内容 begin ---------------->
 | 
			
		||||
    <div class="main-content">
 | 
			
		||||
      <keep-alive :include="keepAliveIncludes">
 | 
			
		||||
        <router-view/>
 | 
			
		||||
      </keep-alive>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!---------------- 页面内容 end ---------------->
 | 
			
		||||
 | 
			
		||||
    <!---------------- 底部 tabbar begin ---------------->
 | 
			
		||||
 | 
			
		||||
    <!---------------- 对于一些需要展示tabbar的页面,则进行展示 ---------------->
 | 
			
		||||
    <div class="main-footer" v-show="$route.meta && $route.meta.showTabbar">
 | 
			
		||||
      <van-tabbar
 | 
			
		||||
        fixed
 | 
			
		||||
        route
 | 
			
		||||
        v-model="active"
 | 
			
		||||
      >
 | 
			
		||||
        <van-tabbar-item
 | 
			
		||||
          v-for="(item, index) in tabbar"
 | 
			
		||||
          :to="item.to"
 | 
			
		||||
          :icon="item.icon"
 | 
			
		||||
          :name="item.name"
 | 
			
		||||
          :key="index">
 | 
			
		||||
          {{ item.title }}
 | 
			
		||||
        </van-tabbar-item>
 | 
			
		||||
      </van-tabbar>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!---------------- 底部 tabbar end ---------------->
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
import SessionMixin from 'components/mixin/session-mixin';
 | 
			
		||||
import { mapMutations, mapState } from 'vuex';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'DashBoard',
 | 
			
		||||
  mixins: [SessionMixin],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      active: 'Mine',
 | 
			
		||||
      tabbar: [
 | 
			
		||||
        // {
 | 
			
		||||
        //   name: 'ContactCompany',
 | 
			
		||||
        //   title: '首页',
 | 
			
		||||
        //   icon: 'user-o',
 | 
			
		||||
        //   badge: 0,
 | 
			
		||||
        //   to: '/contact-company'
 | 
			
		||||
        // },
 | 
			
		||||
        {
 | 
			
		||||
          name: 'Mine',
 | 
			
		||||
          title: '我的',
 | 
			
		||||
          icon: 'user-o',
 | 
			
		||||
          to: '/user'
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    ...mapState({
 | 
			
		||||
      keepAliveIncludes: state => state.app.keepAliveIncludes
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    // 通过路由跳转绑定Tabbar的选中
 | 
			
		||||
    this.updateTabbarSelected(this.$route.name);
 | 
			
		||||
    this.checkRouterKeepAlive(this.$route);
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    $route(newRoute) {
 | 
			
		||||
      this.checkRouterKeepAlive(newRoute);
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    ...mapMutations('app', [
 | 
			
		||||
      'pushKeepAliveIncludes',
 | 
			
		||||
      'deleteKeepAliveIncludes'
 | 
			
		||||
    ]),
 | 
			
		||||
    checkRouterKeepAlive(newRoute) {
 | 
			
		||||
      const { name, meta } = newRoute;
 | 
			
		||||
      if (meta && meta.keepAlive) {
 | 
			
		||||
        this.pushKeepAliveIncludes(name);
 | 
			
		||||
      } else {
 | 
			
		||||
        this.deleteKeepAliveIncludes(name);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    updateTabbarSelected(item) {
 | 
			
		||||
      console.log(item, 12222);
 | 
			
		||||
      this.active = item;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!-- home -->
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <router-nav-bar path="/mine" title="开发专用配置" left-text="返回" left-arrow />
 | 
			
		||||
    <router-nav-bar path="/dashboard/user" title="开发专用配置" left-text="返回" left-arrow />
 | 
			
		||||
 | 
			
		||||
    <van-cell center title="VConsole">
 | 
			
		||||
      <van-switch v-model="vconsoleFlag" @change="switchVConsole" />
 | 
			
		||||
@@ -13,6 +13,7 @@
 | 
			
		||||
import RouterNavBar from 'components/van-bar/RouterNavBar';
 | 
			
		||||
const VCONSOLE_ID = '__vconsole';
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'DevelopConfig',
 | 
			
		||||
  components: {
 | 
			
		||||
    RouterNavBar
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,68 +0,0 @@
 | 
			
		||||
<!-- home -->
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <div style="background-color: #1989fa;height: ">
 | 
			
		||||
      <h4>
 | 
			
		||||
        <center>首页</center>
 | 
			
		||||
      </h4>
 | 
			
		||||
      <van-row gutter="20">
 | 
			
		||||
        <van-col span="12">span: 8</van-col>
 | 
			
		||||
        <van-col span="12">span: 8</van-col>
 | 
			
		||||
      </van-row>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      list: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  computed: {},
 | 
			
		||||
 | 
			
		||||
  mounted() {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  methods: {}
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.index-container {
 | 
			
		||||
  .warpper {
 | 
			
		||||
    padding: 12px;
 | 
			
		||||
    background: #fff;
 | 
			
		||||
 | 
			
		||||
    .demo-home__title {
 | 
			
		||||
      margin: 0 0 6px;
 | 
			
		||||
      font-size: 32px;
 | 
			
		||||
 | 
			
		||||
      .demo-home__title img,
 | 
			
		||||
      .demo-home__title span {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        vertical-align: middle;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      img {
 | 
			
		||||
        width: 32px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      span {
 | 
			
		||||
        margin-left: 16px;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .demo-home__desc {
 | 
			
		||||
      margin: 0 0 20px;
 | 
			
		||||
      color: rgba(69, 90, 100, 0.6);
 | 
			
		||||
      font-size: 14px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -38,26 +38,12 @@ export default {
 | 
			
		||||
        loginName: '',
 | 
			
		||||
        loginPwd: ''
 | 
			
		||||
      },
 | 
			
		||||
      codeUrl: ''
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 获取验证码
 | 
			
		||||
    async getVerificationCode() {
 | 
			
		||||
      try {
 | 
			
		||||
        const res = await loginApi.getVerificationCode();
 | 
			
		||||
        const data = res.data;
 | 
			
		||||
        this.formData.codeUuid = data.uuid;
 | 
			
		||||
        this.codeUrl = data.code;
 | 
			
		||||
        this.formData.code = '';
 | 
			
		||||
        console.log(this.codeUrl);
 | 
			
		||||
      } catch (e) {
 | 
			
		||||
        this.$smartSentry.captureException(e);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 提交表单
 | 
			
		||||
    // 提交登录表单
 | 
			
		||||
    async onSubmit() {
 | 
			
		||||
      this.$smart.loading();
 | 
			
		||||
      try {
 | 
			
		||||
@@ -66,9 +52,9 @@ export default {
 | 
			
		||||
        this.$store.commit('user/updateSession', loginInfo);
 | 
			
		||||
        cookie.setToken(loginInfo.xaccessToken);
 | 
			
		||||
        this.$toast.success('登录成功');
 | 
			
		||||
        this.$router.replace('/bpm');
 | 
			
		||||
        this.$router.replace('/dashboard/user');
 | 
			
		||||
        // this.$router.replace('/contact-company');
 | 
			
		||||
      } catch (e) {
 | 
			
		||||
        console.log(e);
 | 
			
		||||
        this.$smartSentry.captureException(e);
 | 
			
		||||
        await this.getVerificationCode();
 | 
			
		||||
      } finally {
 | 
			
		||||
@@ -78,3 +64,5 @@ export default {
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,31 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
 | 
			
		||||
    <!---------------- 頁面内容 begin ---------------->
 | 
			
		||||
    <div class="main-content">
 | 
			
		||||
      <keep-alive>
 | 
			
		||||
        <router-view v-if="$route.meta.keepAlive" />
 | 
			
		||||
      </keep-alive>
 | 
			
		||||
      <router-view v-if="!$route.meta.keepAlive" />
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
import mainMixin from './main-mixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'OtherMain',
 | 
			
		||||
  mixins: [mainMixin],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  methods: {}
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="less" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,96 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
 | 
			
		||||
    <!---------------- 頁面内容 begin ---------------->
 | 
			
		||||
    <div class="main-content">
 | 
			
		||||
      <keep-alive>
 | 
			
		||||
        <router-view v-if="$route.meta.keepAlive" />
 | 
			
		||||
      </keep-alive>
 | 
			
		||||
      <router-view v-if="!$route.meta.keepAlive" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <!---------------- 頁面内容 end ---------------->
 | 
			
		||||
 | 
			
		||||
    <!---------------- 底部 tabbar begin ---------------->
 | 
			
		||||
    <div class="main-footer">
 | 
			
		||||
      <van-tabbar
 | 
			
		||||
        fixed
 | 
			
		||||
        route
 | 
			
		||||
        v-model="active"
 | 
			
		||||
      >
 | 
			
		||||
        <van-tabbar-item
 | 
			
		||||
          v-for="(item, index) in tabbar"
 | 
			
		||||
          :to="item.to"
 | 
			
		||||
          :icon="item.icon"
 | 
			
		||||
          :name="item.name"
 | 
			
		||||
          :key="index">
 | 
			
		||||
          {{ item.title }}
 | 
			
		||||
        </van-tabbar-item>
 | 
			
		||||
      </van-tabbar>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!---------------- 底部 tabbar end ---------------->
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
import mainMixin from 'views/main/main-mixin';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'TabbarMain',
 | 
			
		||||
  mixins: [mainMixin],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      active: 'ContactCompany',
 | 
			
		||||
      tabbar: [
 | 
			
		||||
        // {
 | 
			
		||||
        //   name: 'Home',
 | 
			
		||||
        //   title: '首页',
 | 
			
		||||
        //   icon: 'wap-home-o',
 | 
			
		||||
        //   to: '/home'
 | 
			
		||||
        // },
 | 
			
		||||
        // {
 | 
			
		||||
        //   name: 'Business',
 | 
			
		||||
        //   title: '业务中心',
 | 
			
		||||
        //   icon: 'apps-o',
 | 
			
		||||
        //   to: '/business'
 | 
			
		||||
        // },
 | 
			
		||||
        {
 | 
			
		||||
          name: 'ContactCompany',
 | 
			
		||||
          title: '往来机构',
 | 
			
		||||
          icon: 'user-o',
 | 
			
		||||
          badge: 0,
 | 
			
		||||
          to: '/contact-company'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: 'Mine',
 | 
			
		||||
          title: '我的',
 | 
			
		||||
          icon: 'user-o',
 | 
			
		||||
          to: '/mine'
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    // 通过路由跳转绑定Tabbar的选中
 | 
			
		||||
    this.updateTabbarSelected(this.$route.name);
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    // 监听路由变化,保证路由跳转Tabbar选中正常
 | 
			
		||||
    $route: {
 | 
			
		||||
      handler(val, oldval) {
 | 
			
		||||
        // this.updateTabbarSelected(val.name)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    deep: true
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  methods: {
 | 
			
		||||
    updateTabbarSelected(item) {
 | 
			
		||||
      console.log(item, 12222);
 | 
			
		||||
      this.active = item;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="less" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<!-- home -->
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <router-nav-bar path="/mine" title="修改密码" left-text="返回" left-arrow />
 | 
			
		||||
    <router-nav-bar path="/dashboard/user" title="修改密码" left-text="返回" left-arrow />
 | 
			
		||||
 | 
			
		||||
    <van-form @submit="onSubmit">
 | 
			
		||||
      <van-field
 | 
			
		||||
@@ -22,6 +22,7 @@
 | 
			
		||||
        <van-field
 | 
			
		||||
          style="width: 60%;float:left"
 | 
			
		||||
          v-model="formData.code"
 | 
			
		||||
          type="password"
 | 
			
		||||
          name="新密码"
 | 
			
		||||
          label="新密码"
 | 
			
		||||
          placeholder="新密码"
 | 
			
		||||
@@ -37,8 +38,6 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { loginApi } from '@/api/login';
 | 
			
		||||
import cookie from '@/lib/cookie';
 | 
			
		||||
import RouterNavBar from 'components/van-bar/RouterNavBar';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
@@ -57,36 +56,17 @@ export default {
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.getVerificationCode();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 获取验证码
 | 
			
		||||
    async getVerificationCode() {
 | 
			
		||||
      try {
 | 
			
		||||
        const res = await loginApi.getVerificationCode();
 | 
			
		||||
        const data = res.data;
 | 
			
		||||
        this.formData.codeUuid = data.uuid;
 | 
			
		||||
        this.codeUrl = data.code;
 | 
			
		||||
        this.formData.code = '';
 | 
			
		||||
        console.log(this.codeUrl);
 | 
			
		||||
      } catch (e) {
 | 
			
		||||
        this.$smartSentry.captureException(e);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 提交表单
 | 
			
		||||
    async onSubmit() {
 | 
			
		||||
    onSubmit() {
 | 
			
		||||
      this.$smart.loading();
 | 
			
		||||
      try {
 | 
			
		||||
        const res = await loginApi.login(this.formData);
 | 
			
		||||
        const loginInfo = res.data;
 | 
			
		||||
        this.$store.commit('user/updateSession', loginInfo);
 | 
			
		||||
        cookie.setToken(loginInfo.xaccessToken);
 | 
			
		||||
        this.$toast.success('登录成功');
 | 
			
		||||
        this.$router.replace('/home');
 | 
			
		||||
        this.$toast.success('暂未实现');
 | 
			
		||||
        this.$router.replace('/dashboard/user');
 | 
			
		||||
      } catch (e) {
 | 
			
		||||
        console.log(e);
 | 
			
		||||
        this.$smartSentry.captureException(e);
 | 
			
		||||
        await this.getVerificationCode();
 | 
			
		||||
      } finally {
 | 
			
		||||
        this.$smart.loadingClear();
 | 
			
		||||
      }
 | 
			
		||||
@@ -8,10 +8,9 @@
 | 
			
		||||
    </van-grid>
 | 
			
		||||
 | 
			
		||||
    <van-cell-group>
 | 
			
		||||
      <!--      <van-cell icon="user-o" title="订单" is-link />-->
 | 
			
		||||
      <!--      <van-cell icon="location-o" title="设置" is-link />-->
 | 
			
		||||
      <!--      <van-cell icon="location-o" to="/user/change-password" title="修改密码" is-link />-->
 | 
			
		||||
      <van-cell icon="bulb-o" title="更新权限" @click="updatePrivilege" is-link/>
 | 
			
		||||
      <van-cell icon="location-o" to="/user/change-password" title="修改密码" is-link />
 | 
			
		||||
      <van-cell icon="bulb-o" title="更新权限" @click="forceUpdatePrivilege" is-link/>
 | 
			
		||||
      <van-cell icon="delete" title="清空缓存" @click="clearCache" is-link/>
 | 
			
		||||
      <van-cell icon="apps-o" title="开发专用" is-link to="/develop/config"/>
 | 
			
		||||
    </van-cell-group>
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +29,7 @@ import cookie from '@/lib/cookie';
 | 
			
		||||
import { userApi } from 'api/user';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'Mine',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      actualName: null
 | 
			
		||||
@@ -43,7 +43,12 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  methods: {
 | 
			
		||||
    async updatePrivilege() {
 | 
			
		||||
    // 清空缓存
 | 
			
		||||
    clearCache() {
 | 
			
		||||
      this.$toast('清空了!!');
 | 
			
		||||
    },
 | 
			
		||||
    // 更新权限
 | 
			
		||||
    async forceUpdatePrivilege() {
 | 
			
		||||
      this.$smart.loading();
 | 
			
		||||
      try {
 | 
			
		||||
        const res = await userApi.getSession();
 | 
			
		||||
@@ -56,6 +61,7 @@ export default {
 | 
			
		||||
        this.$smart.loadingClear();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 退出
 | 
			
		||||
    async logout() {
 | 
			
		||||
      this.$smart.loading();
 | 
			
		||||
      try {
 | 
			
		||||
@@ -51,10 +51,18 @@ module.exports = {
 | 
			
		||||
    // }
 | 
			
		||||
  },
 | 
			
		||||
  css: {
 | 
			
		||||
    // 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
 | 
			
		||||
    // 是否使用css分离插件 ExtractTextPlugin 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
 | 
			
		||||
    extract: isProductionEnv,
 | 
			
		||||
    // 开启 CSS source maps
 | 
			
		||||
    sourceMap: false,
 | 
			
		||||
    modules: false
 | 
			
		||||
    // 使用vw布局去掉这个
 | 
			
		||||
    requireModuleExtension: true,
 | 
			
		||||
    loaderOptions: {
 | 
			
		||||
      // 引入全局变量
 | 
			
		||||
      scss: {
 | 
			
		||||
        additionalData: `@import "@/assets/css/index";` // 全局引入
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  configureWebpack: config => {
 | 
			
		||||
    config.name = projectConfig.title;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,3 +11,5 @@ sa/123456
 | 
			
		||||
LoginService.getSession
 | 
			
		||||
 | 
			
		||||
5 test类中去掉代码生成run
 | 
			
		||||
 | 
			
		||||
6 前端百度统计
 | 
			
		||||
		Reference in New Issue
	
	Block a user