improve: 整理代码

This commit is contained in:
From-wh 2023-04-27 18:26:26 +08:00
parent 2b15d4b547
commit fbbcf4bded
29 changed files with 18 additions and 89 deletions

View File

@ -69,14 +69,13 @@ export default {
components: {
VueCropper,
},
props: ['Name'],
data() {
return {
name: this.Name,
name: '',
resImg: '',
previews: {},
option: {
img: this.Name, //裁剪图片的地址
img: '', //裁剪图片的地址
outputSize: 1, //裁剪生成图片的质量(可选0.1 - 1)
outputType: 'png', //裁剪生成图片的格式(jpeg || png || webp)
info: true, //图片大小信息
@ -84,8 +83,8 @@ export default {
autoCrop: true, //是否默认生成截图框
autoCropWidth: 200, //默认生成截图框宽度
autoCropHeight: 200, //默认生成截图框高度
fixed: false, //是否开启截图框宽高固定比例
fixedNumber: [1.53, 1], //截图框的宽高比例
fixed: true, //是否开启截图框宽高固定比例
fixedNumber: [1, 1], //截图框的宽高比例
full: false, //false按原比例裁切图片,不失真
fixedBox: false, //固定截图框大小,不允许改变
canMove: true, //上传图片是否可以移动
@ -183,7 +182,6 @@ export default {
const formData = new FormData();
formData.append('file', file);
fileUpload(formData).then((res) => {
console.log(res);
if (res.status == 200) {
this.$emit('uploadImgSuccess', res.data);
} else {

View File

@ -93,7 +93,6 @@ export default {
});
if (this.$store.state.themeConfig.themeConfig.layout !== 'columns') {
this.bus.$on('routesListChange', () => {
console.log('变了大哥');
this.setFilterRoutes();
});
}

View File

@ -63,7 +63,6 @@ export default {
},
// 设置分栏布局风格
setColumnsAsidelayout() {
console.log('111');
return this.$store.state.themeConfig.themeConfig.columnsAsideLayout;
},
Layout() {
@ -74,7 +73,6 @@ export default {
},
},
beforeDestroy() {
console.log('zoule');
this.bus.$off('routesListChange');
},
mounted() {

View File

@ -35,7 +35,6 @@ export default {
mounted() {
this.setFilterRoutes();
this.bus.$on('routesListChange', () => {
console.log('变了大哥');
this.setFilterRoutes();
});
},

View File

@ -113,7 +113,6 @@ export default {
methods: {
...mapMutations(['setBreadCrumb', 'setTagNavList', 'addTag', 'setLocal', 'setHomeRoute', 'closeTag']),
clickDropdown(e) {
// console.log(e, this.$route.path);
let data = { id: e, path: this.$route.path };
this.onCurrentContextmenuClick(data);
},
@ -148,8 +147,6 @@ export default {
scrollTag(production) {
let scrollRefs = this.$refs.scrollbarRef.$refs.wrap.scrollWidth;
let scrollLeft = this.$refs.scrollbarRef.$refs.wrap.scrollLeft;
console.log(production, this.$refs.scrollbarRef.$refs.wrap.scrollLeft);
if (production === 'left') {
this.$refs.scrollbarRef.$refs.wrap.scrollLeft = scrollLeft - 300 <= 0 ? 0 : scrollLeft - 300;
} else {
@ -252,12 +249,10 @@ export default {
// this.tagsViewList = Session.get('tagsViewList');
// } else {
let arr = [];
console.log(this.tagsViewRoutesList);
this.tagsViewRoutesList.map((v) => {
if (v.meta && v.meta.isAffix) arr.push({ ...v });
});
// }
console.log(arr);
this.setTagNavList(arr);
// 初始化当前元素(li)的下标
this.getTagsRefsIndex(this.$route.path);
@ -339,7 +334,6 @@ export default {
this.tagsViewRoutesList.map((v) => {
if ((v.meta && v.meta.isAffix) || v.path === path) tagsViewList.push({ ...v });
});
console.log(tagsViewList, this.tagsViewRoutesList, path);
this.addBrowserSetSession(tagsViewList);
this.$router.push({ path, query });

View File

@ -88,7 +88,6 @@ service.interceptors.response.use(
}
},
(error) => {
console.log(error);
Message.error(error.msg);
return Promise.reject(error);
},

View File

@ -226,11 +226,9 @@ export const findFirstNonNullChildren = (arr) => {
export const findFirstNonNullChildrenKeys = (obj, lastArr) => {
let ids = lastArr;
console.log(ids);
// 如果第一个对象没有children属性,返回该对象
if (!obj.children) {
ids.push(obj.id);
console.log(ids);
return ids;
}
// 如果第一个对象的children属性是数组,

View File

@ -155,7 +155,6 @@ export default {
this.selectIds = this.goodsList.map((i) => {
return i.product_id;
});
console.log(this.selectIds, this.goodsList);
},
// 生成直播商品
liveGoods() {

View File

@ -106,7 +106,6 @@ export default {
created() {
this.isChecked = this.$route.query.type;
this.onIsLogin();
console.log(this.$route);
},
methods: {
// 查看是否登录

View File

@ -74,7 +74,6 @@ export default {
},
methods: {
mealPay(val) {
console.log(val);
this.$router.push({ path: this.$routeProStr + '/setting/sms/sms_pay/index', query: { type: val } });
},
getCopyConfig() {

View File

@ -470,7 +470,6 @@ export default {
if (item.name == 'search_box' || item.name == 'nav_bar') {
return this.$Message.warning('该组件禁止移动');
}
console.log(item);
// if (item.name == "nav_bar") {
// return this.$Message.warning("该组件禁止移动");
// }

View File

@ -75,7 +75,6 @@ export default {
methods: {
//接收iframe值
handleMessage(event) {
console.log(event.data.name)
if (event.data.name) {
let obj = { name: event.data.name, num: event.data.dataName };
this.configName = obj;

View File

@ -307,7 +307,6 @@ export default {
}
},
changeUnique(val) {
console.log(val.target.value);
let value = this.$routeProStr + val.target.value;
if (value.slice(0, 1) === '/') value = value.replace('/', '');
this.formValidate.unique_auth = value.replaceAll('/', '-');

View File

@ -234,7 +234,6 @@ export default {
};
menusBatch(data)
.then((res) => {
console.log(res);
this.getData();
})
.catch((res) => {
@ -282,7 +281,6 @@ export default {
this.routeType = '0';
// this.getRuleList();
menusRuleCate().then((res) => {
console.log(res);
this.ruleCateList = res.data;
this.ruleModal = true;
if (res.data.length) {
@ -296,7 +294,6 @@ export default {
});
},
handleNodeClick(data) {
console.log(data);
this.getRuleList(data.id);
},
modalchange() {

View File

@ -261,7 +261,6 @@ export default {
created() {
this.interfaceData = this.formValidate;
this.interfaceData.request_body = JSON.parse(JSON.stringify(this.interfaceData.request_params));
console.log(this.interfaceData);
},
mounted() {},
methods: {
@ -275,8 +274,6 @@ export default {
});
},
async requestData() {
console.log(this.$refs.xTable.getTableData().tableData);
console.log(this.filtersData((await this.$refs.xTable.getTableData().tableData) || []));
let url, method, params, body, headers;
url = this.interfaceData.url;
method = this.interfaceData.method;
@ -284,12 +281,10 @@ export default {
body = this.filtersData((await this.$refs.yTable.getTableData().tableData) || []);
let h = this.filtersData((await this.$refs.zTable.getTableData().tableData) || []);
let h1 = this.filtersData((await this.$refs.zaTable.getTableData().tableData) || []);
console.log(this.interfaceData, h, h1);
headers = {
...h,
...h1,
};
console.log(url, method, params, body, headers);
requestMethod(url, method, params, body, headers)
.then((res) => {
this.codes = res + '';
@ -299,14 +294,12 @@ export default {
});
},
filtersData(arr) {
console.log(arr);
try {
let x = {};
arr.map((e) => {
if (!e.parentId) {
for (let i in e) {
if (i == 'attribute') {
console.log(e);
if (e.type !== 'array') {
x[e[i]] = e.value || '';
} else {
@ -344,7 +337,6 @@ export default {
},
changeTab(name) {
if (name === 'Header') {
console.log(this.interfaceData.headerData);
if (!this.interfaceData.headerData) {
this.insertEvent('zTable', {
attribute: 'Content-Type',
@ -353,7 +345,6 @@ export default {
this.insertEvent('zaTable');
}
}
console.log(this.interfaceData);
},
async insertEvent(type, d) {
const $table = this.$refs[type];

View File

@ -804,7 +804,6 @@ export default {
},
onChangeName(params) {
console.log(params);
if (params.eventType == 'blur') {
let data = {
name: params.newName,
@ -821,7 +820,6 @@ export default {
},
onAddNode(params) {
console.log(params);
// this.$router.push({
// path: '/admin/setting/system_out_interface/add',
// query: {

View File

@ -35,8 +35,6 @@ service.interceptors.request.use(
if (token || kefuToken) {
config.headers['Authori-zation'] = config.kefu ? 'Bearer ' + kefuToken : 'Bearer ' + token;
}
console.log('请求了', config);
return config;
},
(error) => {

View File

@ -292,12 +292,10 @@ export default {
created() {
this.interfaceData = this.formValidate;
this.interfaceData.request_body = JSON.parse(JSON.stringify(this.interfaceData.request));
console.log(this.interfaceData);
},
mounted() {},
methods: {
async handleChange(e, row, type) {
console.log(type, row);
if (e.value !== 'array' && e.value !== 'object') {
if (row.children.length) {
let arr = this.$refs[type].getTableData().tableData;
@ -331,36 +329,30 @@ export default {
: this.filtersData((await this.$refs.yTable.getTableData().tableData) || []);
let h = this.filtersData((await this.$refs.zTable.getTableData().tableData) || []);
headers = h;
console.log(url, method, params, body, headers);
this.codes = '';
requestMethod(url, method, params, body, headers)
.then((res) => {
console.log(res, 'res');
if (!res) return this.$Message.error('接口异常');
this.codes = JSON.stringify(res);
})
.catch((err) => {
console.log(err, 'err');
if (!err) return this.$Message.error('接口异常');
this.codes = JSON.stringify(err);
});
},
filtersData(arr) {
console.log(arr);
try {
let x = {};
arr.map((e) => {
if (!e.parentId) {
for (let i in e) {
if (i == 'attribute') {
console.log(e.type);
if (e.type === 'object') {
let obj = {};
e.children.map((item, index) => {
obj = this.filtersObj(item, 1);
});
console.log(obj, 'objobjobj');
x[e[i]] = obj;
} else if (e.type !== 'array') {
x[e[i]] = e.value || '';
@ -385,13 +377,11 @@ export default {
let x = {};
for (let i in obj) {
if (i == 'attribute') {
console.log(obj, 'obj111');
if (obj.type === 'object') {
let oj = {};
obj.children.map((item, index) => {
oj[obj.attribute] = this.filtersObj(item);
});
console.log(oj, 'oj');
x = oj;
} else if (obj.type !== 'array') {
if (type) {
@ -420,7 +410,6 @@ export default {
// this.insertEvent('zaTable');
// }
}
console.log(this.interfaceData);
},
async insertEvent(type, d) {
const $table = this.$refs[type];

View File

@ -31,12 +31,19 @@
<div></div>
<div
class="tree-node"
:class="{ node: slotProps.model.method, open: formValidate.path == slotProps.model.path && formValidate.method == slotProps.model.method }"
:class="{
node: slotProps.model.method,
open: formValidate.path == slotProps.model.path && formValidate.method == slotProps.model.method,
}"
@click.stop="onClick(slotProps.model)"
>
<span class="" :class="{ open: formValidate.path == slotProps.model.path && formValidate.method == slotProps.model.method }">{{
slotProps.model.name
}}</span>
<span
class=""
:class="{
open: formValidate.path == slotProps.model.path && formValidate.method == slotProps.model.method,
}"
>{{ slotProps.model.name }}</span
>
<Dropdown
transfer
@on-click="
@ -652,9 +659,7 @@ export default {
this.paramsId = params.id;
this.getRoteData(params.id);
}
} catch (error) {
console.log(error);
}
} catch (error) {}
},
getRoteData(id) {
routeDet(id)
@ -662,7 +667,6 @@ export default {
this.formValidate = res.data;
})
.catch((err) => {
console.log(err);
this.$Message.error(err);
});
},
@ -674,7 +678,6 @@ export default {
} else if (!this.formValidate.path) {
return this.$Message.warning('请输入路由地址');
}
console.log(await this.$refs.xTable.getTableData());
this.formValidate.request = await this.$refs.xTable.getTableData().tableData;
this.formValidate.response = await this.$refs.resTable.getTableData().tableData;
this.formValidate.error_code = await this.$refs.codeTable.getTableData().tableData;
@ -895,7 +898,6 @@ export default {
},
//
onDel(node) {
console.log(node);
let method = node.cate_id ? routeDel : routeCateDel;
this.$Modal.confirm({
title: '警告',
@ -915,7 +917,6 @@ export default {
},
onChangeName(params) {
console.log(params);
if (params.eventType == 'blur') {
let data = {
name: params.newName,
@ -932,7 +933,6 @@ export default {
},
onAddNode(params) {
console.log(params);
// this.$router.push({
// path: '/admin/setting/system_out_interface/add',
// query: {

View File

@ -39,8 +39,6 @@ service.interceptors.request.use(
if (token || kefuToken) {
config.headers['Authori-zation'] = config.kefu ? 'Bearer ' + kefuToken : 'Bearer ' + token;
}
console.log('请求了', config);
return config;
},
(error) => {

View File

@ -251,7 +251,6 @@ export default {
},
getCrudMenus() {
crudMenus().then((res) => {
console.log(res);
this.menusList = res.data;
});
crudColumnType().then((res) => {

View File

@ -228,10 +228,7 @@ export default {
this.optionsModal = true;
},
addOptions() {
console.log(this.optionsList);
this.$set(this.tableField[this.index], 'options', this.optionsList);
// this.tableField[this.index].options = this.optionsList;
console.log(this.tableField[this.index].options);
},
changeRadio(status) {
this.tableField = [];

View File

@ -118,7 +118,6 @@ export default {
this.currentTab--;
},
addRow() {
console.log(this.formItem);
let foundation = this.formItem.foundation;
if (!foundation.tableName) return this.$Message.warning('请先填写表名');
let data = {

View File

@ -259,15 +259,9 @@ export default {
var postURL = Setting.apiBaseURL + '/system/crud/npm?token=' + getCookies('token');
this.source = new EventSource(postURL);
let self = this; //因EventSource中this的指向变了,所以要提前存储一下
this.source.onopen = function (res) {
console.log('项目链接Eventsource成功', res);
};
this.source.onmessage = function (data) {
//代码块
console.log(data);
};
this.source.onopen = function (res) {};
this.source.onmessage = function (data) {};
this.source.onerror = function (err) {
console.log('项目Eventsource链接失败', err);
//链接失败后EventSource会每隔三秒左右重新发起链接
};
} else {
@ -331,7 +325,6 @@ export default {
},
// 编辑
edit(row) {
console.log(row);
this.spinShow = true;
// 创建代码容器
this.title = row.name;
@ -350,7 +343,6 @@ export default {
//打开文件
openfile(id) {
try {
console.log(id);
this.editId = id;
let that = this;
this.editorIndex = [];
@ -401,7 +393,6 @@ export default {
initEditor(index, conetnt) {
try {
let that = this;
console.log('111');
that.$nextTick(() => {
// 初始化编辑器,确保dom已经渲染
that.editor = monaco.editor.create(document.getElementById('container_' + index), {

View File

@ -256,7 +256,6 @@ export default {
this.changeMarkData.mark = this.mark;
updateMark(this.changeMarkData).then((res) => {
this.$Message.success(res.msg);
console.log(this.rows);
if (this.changeMarkData.is_field) {
this.Info({ name: this.changeMarkData.table, comment: this.rows.comment });
} else {

View File

@ -356,7 +356,6 @@ export default {
this.getList(false, false);
},
jumpRoute(item) {
console.log
let data = {
path: item.route,
filename: '',

View File

@ -377,7 +377,6 @@ export default {
});
},
onSubmit2(formData) {
console.log('1')
memberBatchSetValue(formData.id, {
field: 'title',
value: formData.title,

View File

@ -938,7 +938,6 @@ export default {
if (str.length > 10) {
//如果字符长度超过10,后面的字符就变成...可自行调整长度和代替字符
str = str.substr(0, 10) + '...'; //截取从第一个字符开始,往后取10个字符,剩余的用...代替
//console.log(str); // 'js字符超出指定个数...'
}
return str;
},

View File

@ -9,14 +9,11 @@ export const uploadByPieces = ({ file, pieceSize = 2, success, error, uploading
// 获取md5
const readFileMD5 = () => {
// 读取视频文件的md5
console.log('获取文件的MD5值');
let fileRederInstance = new FileReader();
console.log('file', file);
fileRederInstance.readAsBinaryString(file);
fileRederInstance.addEventListener('load', (e) => {
let fileBolb = e.target.result;
fileMD5 = md5(fileBolb);
console.log('fileMD5', fileMD5);
console.log('文件未被上传,将分片上传');
readChunkMD5();
});