Browse Source

fix issue-182 issue-181 and new create the edit about desc link fucntion

tags/v1.21.7.1
hit172587zpz 4 years ago
parent
commit
0bb0dcf14f
4 changed files with 86 additions and 39 deletions
  1. +5
    -11
      templates/repo/home.tmpl
  2. +72
    -24
      web_src/js/components/EditAboutInfo.vue
  3. +5
    -4
      web_src/js/components/basic/editDialog.vue
  4. +4
    -0
      web_src/js/index.js

+ 5
- 11
templates/repo/home.tmpl View File

@@ -178,8 +178,7 @@
<i class="gray linkify icon"></i> <i class="gray linkify icon"></i>
<a class="link" target="_blank" href="{{.Repository.Website}}">{{.Repository.Website}}</a> <a class="link" target="_blank" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
</p> </p>
<!-- {{else}}
<p class="ui" style="display: none;"></p> -->
{{end}} {{end}}


<p class="ui" id="repo-topics"> <p class="ui" id="repo-topics">
@@ -188,7 +187,7 @@
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<a id="manage_topic">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<a id="manage_topic">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}}
</p> </p>
{{if .LanguageStats}}
<p class="ui"> <p class="ui">
<i class="grey code icon"></i> <i class="grey code icon"></i>
{{range .LanguageStats}} {{range .LanguageStats}}
@@ -196,19 +195,14 @@
{{end}} {{end}}
</p> </p>


<!-- {{else}}
<p class="ui" style="display: none;"></p> -->
{{end}}
{{if .LICENSE}} {{if .LICENSE}}
<p class="ui"> <p class="ui">
<i class="grey clone icon"></i> <i class="grey clone icon"></i>
<!-- {{if .LICENSE}} -->
{{.LICENSE}}
<!-- {{end}} -->
{{.LICENSE}}
</p> </p>
<!-- {{else}}
<p class="ui" style="display: none;"></p> -->
{{end}} {{end}}


<div class="ui divider"></div> <div class="ui divider"></div>


+ 72
- 24
web_src/js/components/EditAboutInfo.vue View File

@@ -11,17 +11,19 @@
v-model="editDataDialog" v-model="editDataDialog"
:deleteCallback="editDataFunc" :deleteCallback="editDataFunc"
:deleteLoading ="editDataListLoading" :deleteLoading ="editDataListLoading"
deleteParam = "ruleForm"
@input="initForm"
> >
<div slot="title"> <div slot="title">
</div> </div>
<div slot="content"> <div slot="content">
<el-form :label-position="top" label-width="80px">
<el-form-item label="简介">
<el-input v-model="desc" type="textarea" ></el-input>
<el-form label-position="top" :model="info" :rules="rule" ref="ruleForm">
<el-form-item label="简介" prop="desc">
<el-input v-model="info.desc" type="textarea" :autosize="{minRows:2,maxRows:6}"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="主页">
<el-input v-model="index_web"></el-input>
<el-form-item label="主页" prop="index_web" >
<el-input v-model="info.index_web" placeholder="主页(eg: https://git.openi.org.cn)"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -30,13 +32,9 @@
</template> </template>


<script> <script>
/* eslint-disable eqeqeq */
// import Dropzone from 'dropzone/dist/dropzone.js';
// import 'dropzone/dist/dropzone.css'


const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;


// const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
// const CloudBrainType = 0;
import editDialogCmpt from './basic/editDialog.vue'; import editDialogCmpt from './basic/editDialog.vue';




@@ -49,10 +47,18 @@ export default {
vmContext: this, vmContext: this,
editDataDialog: false, editDataDialog: false,
editDataListLoading: false, editDataListLoading: false,
desc: '',
index_web: '',


url: '',
info: {
desc: '',
index_web: '',
repo_name_name: '',
},
// rule1:[{min:3,max:5,message:'1',trigger:"blur"}],
rule: {
index_web: [
{required: false, pattern: /(^$)|(^(http|https):\/\/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).*)|(^(http|https):\/\/[a-zA-Z0-9]+([_\-\.][a-zA-Z0-9]+)*\.[a-zA-Z]{2,10}(:[0-9]{1,10})?(\?.*)?(\/.*)?$)/,message:'请输入有效的URL',tigger:['change','blur']}
]
}
}; };
}, },
methods: { methods: {
@@ -61,24 +67,65 @@ export default {
}, },
getDesc() { getDesc() {
const el = $('span.description').text(); const el = $('span.description').text();
console.log(el);
this.desc = el;
console.log(this.desc);
this.info.desc = el;
}, },
getWeb() { getWeb() {
const el = $('a.link').text(); const el = $('a.link').text();
console.log(el);
this.index_web = el;
console.log(this.index_web);
this.info.index_web = el;
},
getRepoName() {
const el = this.url.split('/')[2];
this.info.repo_name = el;
},
initForm(diaolog) {
if (diaolog === false) {
console.log("--watch----------")
this.getRepoName();
this.getDesc();
this.getWeb();
}

},
editDataFunc(formName) {
this.$refs[formName].validate((valid)=>{
if (valid) {
this.$axios({
method: 'post',
url: this.url,
header: {'content-type': 'application/x-www-form-urlencoded'},
data: this.qs.stringify({
_csrf: csrf,
action: 'update',
repo_name: this.info.repo_name,
description: this.info.desc,
website: this.info.index_web
})
}).then((res) => {
location.reload();
this.editDataDialog = false;
}).catch((error) => {
this.editDataDialog = false;
})
}
else {
return false;
}
})

},
getUrl() {
const url = `${window.location.pathname}/settings`;
this.url = url;
} }
}, },
editDataFunc() {
console.log(1);
},
mounted() { mounted() {

this.getUrl();
this.getRepoName();
this.getDesc(); this.getDesc();
this.getWeb(); this.getWeb();
},
created() {
} }


}; };
@@ -93,4 +140,5 @@ export default {
color: #8c92a4; color: #8c92a4;
background-color: transparent; background-color: transparent;
} }

</style> </style>

+ 5
- 4
web_src/js/components/basic/editDialog.vue View File

@@ -49,10 +49,8 @@ export default {
} }
}, },
deleteParam: { deleteParam: {
type: Object,
default() {
return {};
}
type: String,
default: ''
}, },
value: { value: {
type: Boolean, type: Boolean,
@@ -101,4 +99,7 @@ export default {
background: #eff3f9; background: #eff3f9;
padding: 20px 30px; padding: 20px 30px;
} }
/deep/ .el-dialog{
width: 40%;
}
</style> </style>

+ 4
- 0
web_src/js/index.js View File

@@ -8,6 +8,8 @@ import './polyfills.js';
import Vue from 'vue'; import Vue from 'vue';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios';
import qs from 'qs';
import 'jquery.are-you-sure'; import 'jquery.are-you-sure';
import './vendor/semanticdropdown.js'; import './vendor/semanticdropdown.js';
import {svg} from './utils.js'; import {svg} from './utils.js';
@@ -35,6 +37,8 @@ import ObsUploader from './components/ObsUploader.vue';
import EditAboutInfo from './components/EditAboutInfo.vue'; import EditAboutInfo from './components/EditAboutInfo.vue';


Vue.use(ElementUI); Vue.use(ElementUI);
Vue.prototype.$axios = axios;
Vue.prototype.qs = qs;
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;


function htmlEncode(text) { function htmlEncode(text) {


Loading…
Cancel
Save