This commit is contained in:
2023-12-28 22:55:04 +08:00
parent 26fec1bf40
commit 06e68e8fc9
6 changed files with 1118 additions and 173 deletions

View File

@@ -33,6 +33,33 @@
label="序号"
width="50">
</el-table-column>
<el-table-column
style="display: none"
align="center"
prop="cate_id"
label="所属编号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="urlId"
label="网站编号"
width="100">
</el-table-column>
<el-table-column align="center" prop="url" label="网站URL" width="150">
<template slot-scope="scope">
<el-tooltip v-if="(scope.row.url) != null && (scope.row.url).length > 12" placement="top" width="150"
trigger="hover"
effect="dark" close-delay="2000">
<div class="MyPopover" slot="content">{{scope.row.url}}</div>
<div>
<span v-if="(scope.row.url) == null">暂无</span>
<span v-else-if="(scope.row.url).length < 12">{{scope.row.url}}</span>
<span v-else-if="(scope.row.url).length > 12">{{ scope.row.url.substr(0,12)}}...</span>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column align="center" key="name" prop="name" label="网站名" width="190">
<template slot-scope="scope">
<el-tooltip placement="top" width="150"
@@ -58,18 +85,19 @@
label="创建时间"
width="140">
</el-table-column>
<el-table-column align="center" key="desc" prop="desc" label="描述" width="100">
<!-- <template slot-scope="scope">-->
<!-- <el-tooltip placement="top" width="150"-->
<!-- trigger="hover"-->
<!-- effect="dark" close-delay="2000">-->
<!-- <div class="MyPopover" slot="content">{{scope.row.desc}}</div>-->
<!-- <div>-->
<!-- <span>{{ scope.row.desc.substr(0,12)}}</span>-->
<!-- <span v-if="(scope.row.desc).length > 12">...</span>-->
<!-- </div>-->
<!-- </el-tooltip>-->
<!-- </template>-->
<el-table-column align="center" key="desc" prop="desc" label="描述" width="200">
<template slot-scope="scope">
<el-tooltip v-if="(scope.row.desc) != null && (scope.row.desc).length > 12" placement="top" width="150"
trigger="hover"
effect="dark" close-delay="2000">
<div class="MyPopover" slot="content">{{scope.row.desc}}</div>
<div>
<span v-if="(scope.row.desc) == null">暂无</span>
<span v-else-if="(scope.row.desc).length < 12">{{scope.row.desc}}</span>
<span v-else-if="(scope.row.desc).length > 12">{{ scope.row.desc.substr(0,12)}}...</span>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
align="center"
@@ -134,7 +162,7 @@
</el-table-column>
</el-table>
<div style="width:100%;height:100px"></div>
<el-dialog title="新增分类" :visible.sync="openAddCategory" width="45%"
<el-dialog :title="titlename" :visible.sync="openAddCategory" width="45%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
@@ -148,12 +176,21 @@
<el-form-item label="网站名" prop="name">
<el-input v-model="form.name" placeholder='网站名' clearable ></el-input>
</el-form-item>
<el-form-item label="网站id" prop="id" style="display: none">
<el-input v-model="form.id" placeholder='网站名' clearable ></el-input>
</el-form-item>
<el-form-item label="网站图标" prop="icon">
<el-input v-model="form.icon" placeholder='网站图标' clearable ></el-input>
</el-form-item>
<el-form-item label="代理提示" prop="agentHint">
<el-input v-model="form.agentHint" placeholder='代理提示' clearable ></el-input>
</el-form-item>
<el-form-item label="网站Tag" prop="tags">
<el-input v-model="form.tags" placeholder='网站Tag' clearable ></el-input>
</el-form-item>
<el-form-item label="网站描述" prop="desc">
<el-input v-model="form.desc" placeholder='网站描述' clearable ></el-input>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="网站归类" prop="cate_id">
@@ -183,7 +220,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12" v-if="titlename=='编辑网址'">
<el-form-item label="是否公开" prop="needLogin">
<el-radio-group v-model="form.needLogin" >
<el-radio :label="1">公开</el-radio>
@@ -194,8 +231,8 @@
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="需要代理" prop="is_need_agent">
<el-radio-group v-model="form.is_need_agent" >
<el-form-item label="需要代理" prop="isNeedAgent">
<el-radio-group v-model="form.isNeedAgent" >
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
@@ -205,7 +242,7 @@
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between;width:60%">
<el-button @click="addCategory('form')" type="primary" style=";margin-top:10px">确认</el-button>
<el-button @click="addCategory('form',titlename)" type="primary" style=";margin-top:10px">确认</el-button>
<el-button @click="reset('form')" type="success" style=";margin-top:10px">重置</el-button>
</div>
</el-form-item>
@@ -240,6 +277,8 @@ export default {
userId:null,
List:[],
form:{
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
@@ -248,7 +287,8 @@ export default {
url:'',
tags:'',
desc:'',
is_need_agent:'',
isNeedAgent:'',
needLogin:'',
},
// 校验规则
rules: {
@@ -266,6 +306,7 @@ export default {
},
mounted() {
this.GetData();
},
created() {
this.getUserInfo();
@@ -276,15 +317,18 @@ export default {
// 重置表单:
reset(){
this.form = {
name:'',
weigh:'',
status:'',
icon:'',
cate_id:'',
url:'',
tags:'',
desc:'',
is_need_agent:'',
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
icon:'',
cate_id:'',
url:'',
tags:'',
desc:'',
isNeedAgent:'',
needLogin:'',
}
},
// 解析网址:
@@ -351,6 +395,8 @@ export default {
// 先重置
//表单重置
that.form = {
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
@@ -359,7 +405,8 @@ export default {
url:'',
tags:'',
desc:'',
is_need_agent:'',
isNeedAgent:'',
needLogin:'',
}
// 后关闭
this.dialogVisible = false;
@@ -376,57 +423,88 @@ export default {
handleEdit(index) {
var _this = this;
this.openAddCategoryFun();
_this.titlename="编辑分类";
_this.titlename="编辑网址";
// 深拷贝
this.form = index;
},
// 提交新增:
addCategory(rulelist){
addCategory(rulelist,title){
var _this = this;
_this.$refs[rulelist].validate((valid)=>{
if(valid){
axios({
method: 'post',
// 请求的地址
url: '/api/admin/weblist/insertUrlByUser',
// URL 中的查询参数
params: {
name: this.form.name,
weigh: this.form.weigh,
icon:this.form.icon,
cateId:this.form.cate_id,
status: this.form.status,
need_login: this.form.need_login,
isNeedAgent:this.form.is_need_agent,
url: this.form.url,
desc: this.form.desc,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
if(title == "编辑网址"){
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
// Vue.prototype.$notify.error({
// title: '错误',
// message: error,
// offset: 50
// });
})
}else{
return;
axios({
method: 'post',
// 请求的地址
url: '/api/admin/weblist/update',
// URL 中的查询参数
params: {
id:this.form.id,
name: this.form.name,
weigh: this.form.weigh,
icon:this.form.icon,
cateId:this.form.cate_id,
status: this.form.status,
isNeedAgent:this.form.isNeedAgent,
url: this.form.url,
desc: this.form.desc,
needLogin:this.form.needLogin,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}else if(title == "新增网址"){
axios({
method: 'post',
// 请求的地址
url: '/api/admin/weblist/insertUrlByUser',
// URL 中的查询参数
params: {
name: this.form.name,
weigh: this.form.weigh,
icon:this.form.icon,
cateId:this.form.cate_id,
status: this.form.status,
isNeedAgent:this.form.isNeedAgent,
url: this.form.url,
desc: this.form.desc,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}
}
})
@@ -486,7 +564,8 @@ export default {
tmp[i].childUC = tmp[i].childUC.map(item=>{
return{
...item,
root:rootName
root:rootName,
root_id:catenum
}
});
tmp2 = tmp2.concat(tmp[i].childUC);
@@ -501,7 +580,6 @@ export default {
}
});
that.form.userId = that.userId;
},
}