Commit 70b5837b by 温丽香

页面完善

1 parent e69959c4
Pipeline #3671 passed
in 1 minute 6 seconds
......@@ -24,6 +24,7 @@ module.exports = {
// add your custom rules here
rules: {
"no-control-regex": 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
......
window.g = {
baseURL: 'http://hzdev.seetatech.com:9997',
baseURL: 'https://hzdev.seetatech.com:9997',
defaultLang: 'zh-CN', // 目前支持 zh-CN / ja-JP
}
\ No newline at end of file
......@@ -59,6 +59,7 @@
<!-- 普通列 -->
<!-- 表头居中 -->
<el-table-column
show-overflow-tooltip
header-align="left"
align="left"
v-else-if="!(typeof col.render === 'function')"
......@@ -109,6 +110,7 @@
</template>
<slot></slot>
</el-table>
<div class="pagination"><slot name="pagination"></slot></div>
<div class="pagination" v-if="pagination">
<el-pagination
:current-page.sync="currentPage"
......
......@@ -15,7 +15,7 @@ function notificationError(title: any, msg: any, duration: number = 1500) {
})
}
// Axios.defaults.baseURL = '/front'
// Axios.defaults.baseURL = baseUrl
export default (method, url, data, config) => {
method = method.toLowerCase()
......
......@@ -16,7 +16,7 @@
</ul>
<template v-slot:reference>
<span class="user-info flex right">
<span v-if="userData.info">{{ userData.info.username }}</span>
<span v-if="userData.info">{{ userData.info.creater }}</span>
<i class="iconfont icon-mianxingxiala"
:class="{
'expand': showInfo,
......
......@@ -30,13 +30,13 @@ VueRouter.prototype.push = function push(location) {
// 取消转圈圈
NProgress.configure({ showSpinner: false })
router.beforeEach((to, from, next) => {
// if ((!browserStorage.getItem('id') || !browserStorage.getItem('userId')) && to.path !== '/login' && to.path !== '/register') {
// notificationError('提示', 'token无效或过期')
// next({ name: 'login' })
// return
// }
// NProgress.start()
// store.commit('CHNAGE_BREADCRUMB', to.path)
if (!browserStorage.getItem('token') && to.path !== '/login' && to.path !== '/register') {
notificationError('提示', 'token无效或过期')
next({ name: 'login' })
return
}
NProgress.start()
store.commit('CHNAGE_BREADCRUMB', to.path)
next()
})
router.afterEach((to, from) => {
......
......@@ -62,3 +62,13 @@ export function isArrayEqual(value1 = [], value2 = []) {
}
return false
}
export function calculateByte(base64) {
if (base64.indexOf('base64,') !== -1) {
base64 = base64.substring(base64.indexOf('base64,') + 7)
}
if (base64.indexOf('=') !== -1) {
base64 = base64.substring(0, base64.indexOf('='))
}
return base64.length * 0.75
}
......@@ -24,3 +24,23 @@ export const base64ToFile = (base64, fileName) => {
const blob = new Blob([u8arr], { type: mime })
return new File([blob], fileName, { type: mime })
}
export const stringToBase64 = str => {
// 对字符串进行编码
const encode = encodeURI(str)
// 对编码的字符串转化base64
const base64 = btoa(encode)
return base64
}
export const base64ToString = base64 => {
// 对base64转编码
const decode = atob(base64)
// 编码转字符串
const str = decodeURI(decode)
return str
}
export const isASCII = str => {
return /^[\x00-\x7F]*$/.test(str)
}
......@@ -75,7 +75,7 @@ export default {
},
methods: {
async getData() {
const res = await getApp({ pages: 0, pagesize: 5 })
const res = await getApp({ pages: 0, pagesize: 10 })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.apps
this.total = res.data.data.total
......
......@@ -104,15 +104,29 @@ export default {
},
],
tokenList: [],
currentPage: 1,
currentSize: 10,
total: 0
}
},
watch: {
'$route.query': {
handler(val) {
if (!val) return
this.currentPage = Number(val.page_index)
this.currentSize = Number(val.page_size) || 10
this.getData()
},
immediate: true,
deep: true
}
},
mounted() {
this.getData()
// this.getData()
},
methods: {
async getData() {
const res = await getTable({ pages: 0, pagesize: 5 })
const res = await getTable({ pages: this.currentPage - 1, pagesize: this.currentSize })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.tables
this.total = res.data.data.total
......@@ -129,6 +143,7 @@ export default {
this.getData()
}
this.showDialog = false
this.form = {}
},
async handleDelete(row) {
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此数据表?' })
......
......@@ -86,9 +86,11 @@
<div class="btn-box" v-if="scope.row.type === 'blob'">
<span class="upload-btn" v-if="!scope.row.value">Select File</span>
<input type="file" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)" class="input-btn" v-if="!scope.row.value">
<span class="file-btn" v-if="scope.row.value">
<el-image v-if="scope.row.value" style="width: 24px; height: 24px" :src="scope.row.value" fit="fit"></el-image>
<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i>
<span v-if="scope.row.value">
<span style="float: left;margin-right: 10px">{{calculateByte(scope.row.value)}}字节</span>
<el-image style="width: 42px; height: 28px;overflow: visible" :src="scope.row.value" fit="fit">
<div slot="error" style="width: 80px; height: 28px;overflow: visible">(不可预览)</div>
</el-image>
</span>
</div>
<div v-if="scope.row.type === 'table'">
......@@ -126,6 +128,7 @@
<script>
import { createParameter, getTable, getParameter } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -166,6 +169,7 @@ export default {
this.getBaseOptions()
},
methods: {
calculateByte: base64 => calculateByte(base64),
async getTableOptions() {
const res = await getTable({ pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
......@@ -204,20 +208,17 @@ export default {
table: tableObj
}
})
Toast.success('操作成功')
this.$router.push({ path: '/params' })
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.$router.push({ path: '/params' })
}
},
cancel() {
this.$router.push({ path: '/params' })
},
async handleUpload(event, row) {
row.file = event.target.files[0]
row.value = await fileToBase64(event.target.files[0])
},
deleteFile(row) {
row.file = ''
row.value = ''
},
insertTableData() {
this.tableData.push({ field: '', type: '', value: '' })
},
......@@ -229,7 +230,6 @@ export default {
this.flexHeight = ele && ele.clientHeight
},
handleChange(row) {
row.file = ''
row.value = ''
},
handleVisibleChange(val) {
......
......@@ -33,9 +33,9 @@
<span v-if="row.type === 'number' || row.type === 'string'">{{row.value}}</span>
<span v-if="row.type === 'blob'" style="line-height: 28px">
<!-- TODO -->
<span style="float: left;margin-right: 10px">{{row.value.length * 0.75}}字节</span>
<span style="float: left;margin-right: 10px">{{calculateByte(row.value)}}字节</span>
<el-image style="width: 42px; height: 28px;overflow: visible" :src="row.value" fit="fit">
<div slot="error">(不可预览)</div>
<div slot="error" style="width: 80px; height: 28px;overflow: visible">(不可预览)</div>
</el-image>
</span>
<span v-if="row.type === 'table'" style="color: #409EFF; cursor: pointer" @click="$router.push({ path: '/data' })">{{row.value}}</span>
......@@ -49,6 +49,7 @@
<script>
import { detailParameter } from '@/axios'
import { calculateByte } from '@/utils/system'
export default {
data() {
return {
......@@ -91,6 +92,7 @@ export default {
}
},
methods: {
calculateByte: base64 => calculateByte(base64),
}
}
</script>
......
......@@ -86,15 +86,10 @@
<div class="btn-box" v-if="scope.row.type === 'blob'">
<span class="upload-btn" v-if="!scope.row.value">Select File</span>
<input type="file" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)" class="input-btn" v-if="!scope.row.value">
<span v-if="scope.row.value" style="float: left;margin-right: 10px">{{scope.row.value.length * 0.75}}字节</span>
<span class="file-btn" v-if="scope.row.value">
<el-image v-if="scope.row.value" style="width: 24px; height: 24px" :src="scope.row.value" fit="fit"></el-image>
<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i>
</span>
<!-- <span v-if="scope.row.value" style="float: left;margin-right: 10px">{{scope.row.value.length * 0.75}}字节</span>
<span v-if="scope.row.value" style="float: left;margin-right: 10px">{{calculateByte(scope.row.value)}}字节</span>
<el-image v-if="scope.row.value" style="width: 42px; height: 28px;overflow: visible" :src="scope.row.value" fit="fit">
<div slot="error">(不可预览)</div>
</el-image> -->
<div slot="error" style="width: 80px; height: 28px;overflow: visible">(不可预览)</div>
</el-image>
</div>
<div v-if="scope.row.type === 'table'">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
......@@ -114,7 +109,7 @@
</template>
</el-table-column>
</el-table>
<div class="add-btn" @click="addTableData">
<div class="add-btn" @click="insertTableData">
<span class="add-btn-text"><i class="iconfont icon-tianjia"></i> 添加</span>
</div>
</div>
......@@ -131,6 +126,7 @@
<script>
import { editParameter, getParameter, detailParameter, getTable } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -173,6 +169,7 @@ export default {
this.getBaseOptions()
},
methods: {
calculateByte: base64 => calculateByte(base64),
async getTableOptions() {
const res = await getTable({ pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
......@@ -204,7 +201,9 @@ export default {
}
}
},
cancel() {},
cancel() {
this.$router.push({ path: '/params' })
},
async save() {
const tableData = this.tableData.filter(item => item.field && item.value)
const scalarsArr = tableData.filter(item => item.type === 'string' || item.type === 'number')
......@@ -230,29 +229,21 @@ export default {
table: tableObj
}
})
Toast.success('操作成功')
this.$router.push({ path: '/params' })
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.$router.push({ path: '/params' })
}
},
async handleUpload(event, row) {
row.file = event.target.files[0]
row.value = await fileToBase64(event.target.files[0])
},
deleteFile(row) {
row.file = ''
row.value = ''
},
setFlexHeight() {
const ele = document.getElementsByClassName('flex-item') && document.getElementsByClassName('flex-item')[0]
this.flexHeight = ele && ele.clientHeight
},
addTableData() {
this.tableData.push({ field: '', type: 'string', value: '' })
insertTableData() {
this.tableData.push({ field: '', type: '', value: '' })
},
handleDelete(index) {
this.tableData.splice(index, 1)
},
handleChange(row) {
row.file = ''
row.value = ''
},
handleVisibleChange(val) {
......@@ -260,6 +251,10 @@ export default {
this.setCurrent()
}
},
setFlexHeight() {
const ele = document.getElementsByClassName('flex-item') && document.getElementsByClassName('flex-item')[0]
this.flexHeight = ele && ele.clientHeight
},
handleBlur(event) {
this.setCurrent()
event.target && event.target.classList && event.target.classList.remove('write')
......
......@@ -9,7 +9,7 @@
<st-button type="primary" @click="$router.push({ path: '/params/add', query: { level: 1 } })">
<i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="oneVal">
<i class="el-input__icon el-icon-search"></i>
</div>
</div>
......@@ -22,13 +22,19 @@
list: oneList,
total: oneTotal,
}"
:pagination="false"
highlight-current-row
@row-click="handleClickRow">
<div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name }})">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span>
<span class="operate operate-delete" @click="handleDelete(row, 1)">删除</span>
</div>
<el-pagination slot="pagination" layout="prev, pager, next"
@current-change="handleOneCurrentChange"
:current-page="oneCurrentPage"
:total="oneTotal">
</el-pagination>
</st-table>
</div>
</div>
......@@ -39,7 +45,7 @@
<st-button type="primary" @click="$router.push({ path: '/params/add', query: { level: 2 } })">
<i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="twoVal">
<i class="el-input__icon el-icon-search"></i>
</div>
</div>
......@@ -48,6 +54,7 @@
<st-table
ref="vTable"
:options="definitions"
:pagination="false"
:data="{
list: twoList,
total: twoTotal,
......@@ -55,8 +62,13 @@
<div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name } })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span>
<span class="operate operate-delete" @click="handleDelete(row, 2)">删除</span>
</div>
<el-pagination slot="pagination" layout="prev, pager, next"
@current-change="handleTwoCurrentChange"
:current-page="twoCurrentPage"
:total="twoTotal">
</el-pagination>
</st-table>
</div>
</div>
......@@ -71,7 +83,14 @@ import Dialog from '@/helpers/dialog'
export default {
data() {
return {
inputVal: '',
oneVal: '',
twoVal: '',
oneList: [],
twoList: [],
oneTotal: 0,
twoTotal: 0,
oneCurrentPage: 1,
twoCurrentPage: 1,
definitions: [
{
label: '序号',
......@@ -96,41 +115,48 @@ export default {
slotName: 'operate'
},
],
oneList: [],
twoList: [],
oneTotal: 0,
twoTotal: 0
}
},
mounted() {
this.getData()
this.getOneData()
this.getTwoData()
},
methods: {
async getData() {
const oneLevel = await getParameter({ base: 1, pages: 0, pagesize: 5 })
async getOneData() {
const oneLevel = await getParameter({ base: 1, pages: this.oneCurrentPage - 1, pagesize: 10 })
if (oneLevel && oneLevel.data && oneLevel.data.code === 0) {
this.oneList = oneLevel.data.parameters.datas
this.oneTotal = oneLevel.data.parameters.total
}
const twoLevel = await getParameter({ base: 0, pages: 0, pagesize: 5 })
},
async getTwoData() {
const twoLevel = await getParameter({ base: 0, pages: this.twoCurrentPage - 1, pagesize: 10 })
if (twoLevel && twoLevel.data && twoLevel.data.code === 0) {
this.twoList = twoLevel.data.parameters.datas
this.twoTotal = twoLevel.data.parameters.total
}
},
async handleDelete(row) {
console.log(row)
async handleDelete(row, level) {
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此模板?' })
if (!confirmDelete) return
const res = await deleteParameter({ name: row.name })
if (res) {
Toast.success('操作成功')
this.getData()
if (level === 1) this.getOneData()
if (level === 2) this.getTwoData()
}
},
handleClickRow(row, column, event) {
console.log(row)
},
handleOneCurrentChange(val) {
this.oneCurrentPage = val
this.getOneData()
},
handleTwoCurrentChange(val) {
this.twoCurrentPage = val
this.getTwoData()
}
}
}
......
......@@ -7,26 +7,26 @@
<st-form
ref="form"
label-width="70px"
:model="form">
:model="userData">
<st-form-item
style="margin-bottom:10px"
:label="'头像'+':'">
<el-image style="width: 80px; height: 80px" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" fit="fit"></el-image>
<el-image style="width: 80px; height: 80px" :src="userData.image" fit="fit"></el-image>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
:label="'账户'+':'">
<span>{{form.account}}asdfasdf</span>
<span>{{userData.role}}</span>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
:label="'姓名'+':'">
<span>{{form.name}}asdfasdf</span><span class="btn-text" @click="showDialog = true;type = 'name'">编辑</span>
<span>{{userData.creater}}</span><span class="btn-text" @click="showDialog = true;type = 'name'">编辑</span>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
:label="'邮箱'+':'">
<span>{{form.email}}asdfasdf</span><span class="btn-text" @click="showDialog = true;type = 'email'">编辑</span>
<span>{{userData.email}}</span><span class="btn-text" @click="showDialog = true;type = 'email'">编辑</span>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
......@@ -78,11 +78,12 @@
</template>
<script>
import { getUser } from '@/utils/user'
export default {
data() {
return {
showDialog: false,
form: {},
userData: {},
type: '',
email: '',
name: '',
......@@ -92,7 +93,8 @@ export default {
}
},
mounted() {
// this.getData()
this.userData = getUser().info
console.log(this.userData)
},
methods: {
submit() {
......
......@@ -289,9 +289,10 @@ export default {
// })
// .then(response => console.log(response.data))
// .catch(e => console.log(e))
if (res && res.data.code === 0) {
if (res && res.data && res.data.code === 0) {
// TokenId
browserStorage.setItem('token', res.data.token)
browserStorage.setItem('user', JSON.stringify(res.data))
this.$router.push({ path: '/params' })
} else {
Toast.danger(res.data.msg)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!