Commit a01d911d authored by mengwenhao's avatar mengwenhao

update: 合并dev分支代码

parents a66321bf f0407c55
#!/bin/bash
# 更新项目的基础镜像,当依赖发生更改时,
# 需要将更改后的 package.json 合并到 master 之后执行此脚本
# 执行脚本前置条件:
# 1. 有 swan 权限
# 2. 有测试机 10.103.17.21 的登录权限
name=$1
build_machine="10.103.17.21"
echo "Login in swan to access the build machine. User: $name"
ssh -tt $name@swan "ssh -tt worker@$build_machine \"sh /home/worker/zhangxiaozheng/build_base_images/ui/build_ui_base_image.sh conf/op-web-service.conf init\""
#!/usr/bin/env bash
# Start commands for each container, one cmd a line
START_CMDS="tar zxf webui_opwebservice_package.tar.gz -C opservice.yidianzixun.com/htdocs && cd opservice.yidianzixun.com && ${start_cmd}"
# Container names for each container, one name a line, same order with $start_cmds
CONTAINER_NAMES="webui-opwebservice-${env}"
# Port maps for each container, one map a line, same order with $start_cmds
DOCKER_PORT_MAPS="9008:8055"
# This is for changing container name, remove old containers when deploy new one
OLD_CONTAINER_NAMES="
webui-opwebservice-${env}
webui-opwebservice
"
# Volumn maps for each container, one map a line, same order with $start_cmds
DOCKER_VOLUMN_MAPS="
~/_logs/webui-opwebservice-${env}:/home/worker/opservice.yidianzixun.com/logs
"
# Other docker run options
DOCKER_RUN_OPTIONS=""
# Image name
IMAGE_NAME="docker2.yidian.com:5000/publish/webui-opwebservice-master-${COMMIT_NUMBER}-image"
# This is for stopping container, kill sepicify process inside the container before 'docker stop' and 'docker rm'
DOCKER_PRESTOP_CMD=""
# Service port for apitest
SERVICE_PORT="9008"
# Service port inside container
ORIGIN_SERVICE_PORT="8055"
#!/usr/bin/env bash
DIST_FILE_NAME="webui_opwebservice_package.tar.gz"
PROJECT_DIR="opservice.yidianzixun.com"
START_SCRIPT="./start_env/${PROJECT_DIR}/start.sh"
SYNC_DATA_OPERATIONS=""
DEST_FILE_NAME="webui_opwebservice_package.tar.gz"
DEST_FILE_PATH="start_env"
BASE_IMAGE="docker2.yidian.com:5000/webui/op-web-service:20210527"
MAINTAINER=""
HOME_DIR="/home/worker"
LOG_DIRS="${HOME_DIR}/${PROJECT_DIR}/logs"
DATA_DIRS=""
rm /home/worker/opservice.yidianzixun.com/logs/start_script.done
cd /home/worker/opservice.yidianzixun.com/htdocs/
mv /opt/project_lib/node_modules /home/worker/opservice.yidianzixun.com/htdocs/
env=$1
port=$2
if [ $env != "" ]; then
cd /home/worker/recipe/$env
sh ./*.rule
cd -
fi
if [ X"$port" = X];then
$port=8055
fi
cd /home/worker/opservice.yidianzixun.com/htdocs/
if [ X"$env" = X"prod" ];then
echo "{\"pm2-logrotate\":{\"max_size\":\"524288000\",\"interval\":\"7\",\"retain\":\"10\"},\"module-db\":{\"pm2-logrotate\":true}}" > /root/.pm2/module_conf.json
port=8055
pm2 start pm2.json
else
PORT=$port NODE_ENV=$env pm2 start app.js --name 'opwebservice' --watch
fi
while true; do
s=`netstat -ntl | grep ":${port}" -c`
if [ "X$s" != "X" ] && [ "$s" != "0" ]; then
break
fi
pm2 restart all;
sleep 10;
done
touch /home/worker/opservice.yidianzixun.com/logs/start_script.done
while true;do
sleep 30;done
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const port = process.env.PORT || 8066; const port = process.env.PORT || 8055;
const LOGIN_URI = { const LOGIN_URI = {
'development': "http://web-rest.int.yidian-inc.com", 'development': "http://web-rest.int.yidian-inc.com",
...@@ -8,9 +8,9 @@ const LOGIN_URI = { ...@@ -8,9 +8,9 @@ const LOGIN_URI = {
} }
const API_INTERNAL_URI = { const API_INTERNAL_URI = {
'development': "", 'development': "bp-test.ini.yidian-inc.com ",
'test': "", 'test': "bp-test.ini.yidian-inc.com ",
'production': "" 'production': "bp-test.go2yd.com "
} }
module.exports = { module.exports = {
......
const { LOGIN_URI, API_INTERNAL_URI } = require("../config.js"); const LOGIN_URI = require('../config.js').LOGIN_URI
const req = require("../utils/request").httpReq; const req = require('../utils/request').httpReq
exports.login = async ctx => {
exports.login = async (ctx) => {
var url = `${LOGIN_URI}/api/v1/pandora/auth`; var url = `${LOGIN_URI}/api/v1/pandora/auth`;
var opts = { var opts = {
url: url, url: url,
method: "POST", method: 'POST',
json: true, json: true,
timeout: 8000, timeout: 8000,
body: ctx.request.body body: ctx.request.body
}; }
ctx.body = await req(ctx, opts)
}
console.log(43444, userInfo, typeof userInfo);
// if userInfo
};
const { API_INTERNAL_URI } = require('../config.js') const { API_INTERNAL_URI } = require("../config.js");
var query = { var query = {
async get_permissions(ctx, next) { async get_permissions (ctx) {
const url = `${API_INTERNAL_URI}/api/v1/pandora/auth`; // http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_list?user_email=jianghaiming@126.com
const url = `${API_INTERNAL_URI}/merchant/authority/get_role_list`;
const { email } = ctx.request.query;
const opts = { const opts = {
url, url,
method: 'POST', method: "GET",
json: true, params: {
body: ctx.request.body email
} }
};
ctx.body = await req(ctx, opts);
} }
} };
exports.query = async (ctx, next) => { exports.query = async (ctx, next) => {
var type = ctx.params.type var type = ctx.params.type;
if (query[type]) { if (query[type]) {
try { try {
ctx.set('Content-Type', 'application/json; charset=utf-8') ctx.set("Content-Type", "application/json; charset=utf-8");
await query[type](ctx, next) await query[type](ctx, next);
} catch (e) { } catch (e) {
console.error('/home/q error', e, ctx.url, ctx.headers['cookie']) console.error("/home/q error", e, ctx.url, ctx.headers["cookie"]);
ctx.body = { status: 'failed', reason: 'Internal Server Error' } ctx.body = { status: "failed", reason: "Internal Server Error" };
} }
} else { } else {
ctx.body = { ctx.body = {
status: 'failed', status: "failed",
reason: 'Invalid type param', reason: "Invalid type param"
};
} }
} };
}
...@@ -3,9 +3,9 @@ const system = require('./controllers/system') ...@@ -3,9 +3,9 @@ const system = require('./controllers/system')
const user = require('./controllers/user') const user = require('./controllers/user')
const router = Router(); const router = Router();
const API_VERSION = "/api/v1";
router.post('/login', system.login); router.post(`${API_VERSION}/login`, system.login);
router.get('/home/user/:type', user.query) router.get(`${API_VERSION}/user/:type`, user.query)
module.exports = router; module.exports = router;
...@@ -9,11 +9,27 @@ ...@@ -9,11 +9,27 @@
<script> <script>
// Layout 为布局组件,控制页面基础布局,通过 slot 实现 // Layout 为布局组件,控制页面基础布局,通过 slot 实现
// import Layout from '@/layouts'; // import Layout from '@/layouts';
// import { fetchCurrentUser } from './services/user';
// async function isUserLogged() {
// return (await fetchCurrentUser()).status === 'success';
// }
// function redirectToLogin() {
// const loginUrl = '//pandora.yidian-inc.com/tools/admin/login';
// const cbUrl = location.href;
// location.href = `${loginUrl}?callback=${cbUrl}`;
// }
export default { export default {
// components: { // components: {
// Layout, // Layout,
// }, // },
// async mounted() {
// if (!(await isUserLogged())) {
// redirectToLogin();
// }
// },
}; };
</script> </script>
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
data () { data () {
return { return {
menuItems, menuItems,
basicPath: "/app/op-management", basicPath: "/",
}; };
}, },
computed: { computed: {
......
import { createApp } from "vue"; import { createApp } from 'vue';
import App from "./App.vue"; import App from './App.vue';
import router from "./router"; import router from './router';
import store from "./store"; import store from './store';
import ElementPlus from "element-plus"; import ElementPlus from 'element-plus';
import { ElMessage } from "element-plus";
// import './assets/styles/index.scss'; // import './assets/styles/index.scss';
import "element-plus/lib/theme-chalk/index.css"; import 'element-plus/lib/theme-chalk/index.css';
import "dayjs/locale/zh-cn"; import 'dayjs/locale/zh-cn';
import locale from "element-plus/lib/locale/lang/zh-cn"; import locale from 'element-plus/lib/locale/lang/zh-cn';
createApp().config.globalProperties.$message = ElMessage;
createApp(App) createApp(App)
.use(router) .use(router)
.use(store) .use(store)
.use(ElementPlus, { locale }) .use(ElementPlus, { locale })
.mount("#app"); .mount('#app');
<template>
<div class="block">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
v-model:currentPage="currentPage"
:page-size="pageSize"
layout=" total,prev, pager, next"
:total="totalNum"
>
</el-pagination>
</div>
</template>
<script>
export default {
props: ['data', 'totalNum'],
data () {
return {
currentPage: 5,
pageSize: 20
}
},
methods: {
handleSizeChange (size) {
console.log(`每页 ${size} 条`);
this.$emit('update', { pageSize: size })
},
handleCurrentChange (pageIndex) {
console.log(`当前页: ${pageIndex}`);
this.$emit('update', { page: pageIndex })
}
},
}
</script>
<style lang="less">
.block {
margin-top: 50px;
}
// 样式可以内联,也可以通过 src 引入
</style>
\ No newline at end of file
<template>
<div class="lifeNoInfo">
<!-- 状态、生活号名称、创建时间、创建人(账号信息,昵称+账号) -->
<el-descriptions
class="margin-top"
title="生活号信息"
:column="3"
:size="size"
border
>
<template #extra> </template>
<el-descriptions-item>
<template #label> ID </template>
00001
</el-descriptions-item>
<el-descriptions-item>
<template #label> 状态 </template>
想吃饭
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建人 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建时间 </template>
2020-03-21
</el-descriptions-item>
<el-descriptions-item>
<template #label> 生活号名称 </template>
生活号名称生活号名称生活号名称
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.lifeNoInfo {
}
</style>
\ No newline at end of file
<template>
<div class="lifeNoUser">
<!-- 管理员:管理员昵称、管理员账号、管理员账号ID
子账号(多个):昵称、账号、账号ID -->
<el-descriptions
class="margin-top"
title="用户信息"
:column="3"
:size="size"
border
>
<template #extra> </template>
<el-descriptions-item>
<template #label>管理员昵称 </template>
派大星
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号 </template>
0001
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号ID </template>
9203201993
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号昵称 </template>
子账号昵称
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号 </template>
0002
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号ID </template>
0002ID
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.lifeNoUser {
.margin-top {
margin-top: 10px;
}
}
</style>
\ No newline at end of file
<template>
<div class="lifeNotype">
<el-descriptions
class="margin-top"
title="类型信息"
:column="3"
:size="size"
border
>
<template #extra> </template>
<el-descriptions-item>
<template #label>职业表标签 </template>
运动员
</el-descriptions-item>
<el-descriptions-item>
<template #label> 姓名 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 身份证号 </template>
XXXXXXXXXX
</el-descriptions-item>
<el-descriptions-item>
<template #label> 统一社会信用代码(注册码) </template>
00019
</el-descriptions-item>
<el-descriptions-item>
<template #label> 企业注册名称 </template>
不二杂货铺
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.lifeNotype {
.margin-top {
margin-top: 10px;
}
}
</style>
\ No newline at end of file
<template>
<div class="life-no">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="生活号名称/企业名称">
<el-input
class="search_life"
maxlength="15"
v-model="formInline.user"
placeholder="生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="formInline.region" placeholder="类型">
<el-option value="shanghai"></el-option>
<el-option value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
<el-table
:data="tableData"
border
style="width: 100%"
@row-click="toLifeDetail"
>
<el-table-column prop="id" label="ID"> </el-table-column>
<el-table-column prop="name" label="生活号名称"> </el-table-column>
<el-table-column prop="address" label="类型"> </el-table-column>
<el-table-column prop="name" label="状态"> </el-table-column>
<el-table-column prop="date" label="创建时间"> </el-table-column>
</el-table>
<page :totalNum="totalNum" @update="update" />
</div>
</template>
<script>
import page from "./components/Pagination"
export default {
components: {
page
},
data () {
return {
params: {
page: 1,
pageSize: 10
},
totalNum: 1000,
lifeList: [],
tableData: [{
id: '001',
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
id: '002',
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
id: '003',
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
id: '004',
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}],
formInline: {
user: '',
region: ''
}
}
},
methods: {
//查询
onSearchSubmit () {
console.log(this.formInline.user, this.formInline.region, 'submit!');
},
//重置
onReset () {
this.formInline.user = "",
this.formInline.region = ""
},
update (obj) {
Object.assign(this.params, obj)
this.getlifeNoList(this.params)
},
toLifeDetail (row) {
// this.$router.push({ path: lifeNoDetail })
console.log(row.id, 'eee去详情')
},
//获取列表数据
getlifeNoList () {
}
}
}
</script>
<style lang="less" scoped>
.life-no {
margin: 30px;
.search_life {
width: 280px;
}
}
</style>
<template>
<div class="life-no-detail">
<lifeNoInfo />
<lifeNotype />
<lifeNoUser />
</div>
</template>
<script>
import lifeNoInfo from './components/lifeNoInfo'
import lifeNotype from './components/lifeNotype'
import lifeNoUser from './components/lifeNoUser'
export default {
components: {
lifeNoInfo,
lifeNotype,
lifeNoUser
},
data () {
return {
lifeNoInfo: {}
}
}
}
</script>
<style lang="less" scoped>
.life-no-detail {
margin: 50px;
.box-card {
width: 100%;
}
}
</style>
\ No newline at end of file
<template>
<div class="addRole">
<el-button type="primary" @click="dialogFormVisible = true">新增</el-button>
<el-table
:data="tableData"
style="width: 100%; margin-top: 10px"
:header-cell-style="{ background: '#e1e4e5', color: '#80878f' }"
>
<el-table-column prop="name" label="角色名称" width="180">
</el-table-column>
<el-table-column prop="address" label="角色范围"> </el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button
size="mini"
type="text"
@click="handleModify(scope.$index, scope.row)"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
<el-dialog title="新增角色" v-model="dialogFormVisible">
<el-form>
<el-form-item label="角色名称" :label-width="formLabelWidth">
<el-input
style="width: 400px"
v-model="roleName"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="角色范围" :label-width="formLabelWidth">
<el-cascader
v-model="selectedOptions"
:options="options"
:props="props"
ref="cascaderAddr"
@change="parentCateChange"
filterable
clearable
></el-cascader>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmRole">确 定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script>
export default {
data () {
return {
tableData: [{
id: '1',
name: '超级管理员',
address: '角色范围'
}, {
id: '2',
name: '普通角色',
address: '角色范围'
}, {
id: '3',
name: '超级管理员',
address: '角色范围'
}, {
id: '4',
name: '普通角色',
address: '角色范围'
}],
vals: [],
dialogFormVisible: false,
roleName: '',
checkedRole: [],//已经选择的角色
roleTitle: '新增角色',
props: {
multiple: true,//设置为多选
checkStrictly: true,
value: 'name', //value值和哪个值绑定
label: 'desc',//label值和哪个值绑定
children: 'button_list'//children值和哪个值绑定
},
formLabelWidth: '120px',
selectedOptions: [],
rolePrivilege: [],
currentRolePrivilege: '',
options: [
{
"name": "用户列表",
"desc": "用户列表",
// "menu_redirect":"\/user\/user\/list",
"button_list": [
{
"name": "deleteBtn",
"desc": "删除用户"
},
{
"name": "addBtn",
"desc": "添加用户"
},
{
"name": "updateBtn",
"desc": "修改用户"
}
]
},
{
"menu_name": "企业审核列表",
// "menu_redirect": "\/aut\/user\/list",
"desc": "企业审核列表",
"button_list": [
{
"name": "addBtn",
"desc": "添加"
},
{
"name": "showBtn",
"desc": "查看"
}
]
}
]
}
},
methods: {
//修改
handleModify (index, row) {
console.log(index, row, 'index, row')
this.roleTitle = '角色修改'
this.dialogFormVisible = true
},
confirmRole () {
console.log(this.roleName, 'roleNameroleName')
this.dialogFormVisible = false
},
getCascaderObj (val, opt) {
console.log(val, opt, 'val, opt')
return val.map(function (value) {
for (var itm of opt) {
if (itm.value == value) { opt = itm.children; return itm; }
}
return null;
});
},
parentCateChange () {
this.vals = this.getCascaderObj(this.selectedOptions, this.options);
const checkedNodes = this.$refs['cascaderAddr'].getCheckedNodes()
console.log(checkedNodes[0].pathLabels, '000') // 获取由 label 组成的数
},
// getCurrentPrivilege (id) {
// get("/merchant/authority/get_role_list").then((res) => {
// if (res.status == 200) {
// this.rolePrivilege = res.data;
// res.data.forEach((item) => {
// if (item.id == id) {
// this.currentRolePrivilege = item;
// console.log(item);
// // this.getCheckedId(this.currentRolePrivilege);
// }
// });
// }
// });
// },
// getSelectedKeys (obj) {
// this.SelectedKeys = [];
// console.log(obj);
// obj.privileges.forEach((item, index) => {
// if (item.parentId != null) {
// this.selectedKeys.push([item.btn_name, item.btn_desc]);
// } else {
// this.selectedKeys.push([item.btn_name, item.btn_desc]);
// }
// });
// console.log(this.checkedId);
// },
}
}
</script>
<style lang="less" scoped>
.addRole {
margin: 50px;
}
</style>
\ No newline at end of file
<template>
<div class="user-detail">
<el-descriptions class="margin-top" :column="3" :size="size" border>
<el-descriptions-item>
<template #label> 用户姓名 </template>
kooriookami
</el-descriptions-item>
<el-descriptions-item>
<template #label> 手机号 </template>
18100000000
</el-descriptions-item>
<el-descriptions-item>
<template #label> 所属组织 </template>
研发部
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加人账号 </template>
XXXX
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加时间 </template>
2020-12-01
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改人账号 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改时间 </template>
2021-05-21
</el-descriptions-item>
<el-descriptions-item>
<template #label> 已拥有角色池 </template>
角色池
</el-descriptions-item>
<el-descriptions-item>
<template #label> 角色名称 </template>
管理员
</el-descriptions-item>
<el-descriptions-item>
<template #label> 敏感词权限 </template>
敏感词权限
</el-descriptions-item>
<el-descriptions-item>
<template #label> 数据权限 </template>
数据权限
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
userInfoList: [{
}]
}
}
}
</script>
<style lang="less" scoped>
.user-detail {
margin: 50px;
}
</style>
\ No newline at end of file
{
"apps": [
{
"name": "opwebservice",
"script": "index.js",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"cwd": "/home/worker/opservice.yidianzixun.com/htdocs",
"exec_mode": "cluster",
"instances": 0,
"error_file": "/home/worker/opservice.yidianzixun.com/logs/opwebservice.err.log",
"out_file": "/home/worker/opservice.yidianzixun.com/logs/opwebservice.out.log",
"max_memory_restart": "1G",
"env": {
"NODE_ENV": "production",
"PORT": "8055"
}
}
]
}
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import Home from "../pages/Home"; import Home from "../pages/Home";
import Login from "../pages/Login"; import Login from "../pages/Login";
import LifeNo from '../pages/Life-no/index.vue'
import LifeNoDetail from '../pages/Life-no/life-no-detail.vue'
import UserDetail from '../pages/User/user-detail.vue'
import AddRole from '../pages/Role/add-role.vue'
const routes = [ const routes = [
{ {
...@@ -32,7 +37,30 @@ const routes = [ ...@@ -32,7 +37,30 @@ const routes = [
path: '/enterprise/establish', path: '/enterprise/establish',
name: 'Establish', name: 'Establish',
component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Enterprise/Establish') component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Enterprise/Establish')
} },
//生活号管理
{
path: '/life-no/life',
name: 'LifeNo',
component: LifeNo,
},
{
path: '/life-no/lifeNoDetail',
name: 'LifeNoDetail',
component: LifeNoDetail,
},
//用户管理
{
path: '/user/userDetail',
name: 'UserDetail',
component: UserDetail,
},
//角色管理
{
path: '/role/addRole',
name: 'AddRole',
component: AddRole,
},
]; ];
const router = createRouter({ const router = createRouter({
......
import axios from '../utils/request';
export async function userLogin(email, password) {
let res = await axios.post(`api/v1/login`, {
email, password, authCode: ''
});
return res.data;
}
\ No newline at end of file
import axios from '../utils/request'; import axios from '../utils/request';
export async function login(email, password) { export async function login(email, password) {
const res = await axios.post(`api/login`, { const res = await axios.post(`api/v1/login`, {
email, password, authCode: '' email, password, authCode: ''
}); });
return res.data; return res.data;
......
import { createStore } from "vuex"; import Vuex from "vuex";
import { getPermissions } from '@/service/user';
export default createStore({ export default Vuex.createStore({
state: { state: {},
userPermission: null, mutations: {},
}, actions: {},
mutations: {
updateUserPermission(state, payload) {
state.userPermission = payload;
}
},
actions: {
async getUserPermission({ commit }, payload) {
const permissions = await getPermissions(payload.email);
commit(permissions)
}
},
modules: {}, modules: {},
getters: {
}
}); });
...@@ -5,16 +5,18 @@ const isDev = process.env.NODE_ENV === 'development'; ...@@ -5,16 +5,18 @@ const isDev = process.env.NODE_ENV === 'development';
module.exports = { module.exports = {
outputDir: isDev outputDir: isDev
? './dist' ? './dist'
: path.resolve('../../../www/dist/app/'), : path.resolve('../../../www/dist/'),
publicPath: isDev ? '/' : '/dist/', publicPath: isDev ? '' : '/dist/',
configureWebpack: { configureWebpack: {
devServer: { devServer: {
proxy: { // proxy: {
'/api': { // '/api': {
target: 'http://localhost:8055', // target: 'http://localhost:8055',
changeOrigin: true, // // pathRewrite: { '^/api': '/api/v1' },
}, // changeOrigin: true,
}, // },
// },
proxy: 'http://localhost:8055'
}, },
}, },
chainWebpack: config => { chainWebpack: config => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment