@@ -243,7 +243,7 @@ const languageList = ref([
243
243
" Zephir" ,
244
244
]);
245
245
246
- const selectDateTime = ref ()
246
+ const selectDateTime = ref ();
247
247
const pasteFormData = ref ({
248
248
title: " " ,
249
249
contents: " " ,
@@ -252,7 +252,9 @@ const pasteFormData = ref({
252
252
password: " " ,
253
253
attachments: [],
254
254
});
255
- const pasteRes = ref (null )
255
+ const pasteRes = ref (null );
256
+
257
+ const linkPre = ` ${ window .location .protocol } //${ window .location .host } `
256
258
257
259
const submiting = ref (false );
258
260
function submit () {
@@ -261,13 +263,13 @@ function submit() {
261
263
.post (" /pasteApi/api/paste/submit" , pasteFormData .value )
262
264
.then ((res ) => {
263
265
submiting .value = false ;
264
- pasteRes .value = res .data
266
+ pasteRes .value = res .data ;
265
267
console .log (res .data );
266
268
})
267
269
.catch ((err ) => {
268
270
submiting .value = false ;
269
271
console .log (err);
270
- pasteRes .value = {res: ' fail' }
272
+ pasteRes .value = { res: " fail" };
271
273
});
272
274
}
273
275
@@ -292,11 +294,22 @@ function removeFile() {
292
294
}
293
295
function expTimeChange (v ) {
294
296
if (v == null ) {
295
- pasteFormData .value .expiry_time = 0
297
+ pasteFormData .value .expiry_time = 0 ;
296
298
} else {
297
- pasteFormData .value .expiry_time = v .getTime () / 1000
299
+ pasteFormData .value .expiry_time = v .getTime () / 1000 ;
298
300
}
299
-
301
+ }
302
+ function back () {
303
+ pasteRes .value = null
304
+ pasteFormData .value = {
305
+ title: " " ,
306
+ language: ' text' ,
307
+ content: " " ,
308
+ expiry_time: 0 ,
309
+ password: " " ,
310
+ attachments: [],
311
+ };
312
+ selectDateTime .value = ' '
300
313
}
301
314
</script >
302
315
@@ -331,7 +344,11 @@ function expTimeChange(v) {
331
344
>
332
345
</el-form-item >
333
346
<el-form-item label =" 到期时间" >
334
- <el-date-picker type =" datetime" v-model =" selectDateTime" @change =" expTimeChange" />
347
+ <el-date-picker
348
+ type =" datetime"
349
+ v-model =" selectDateTime"
350
+ @change =" expTimeChange"
351
+ />
335
352
</el-form-item >
336
353
<el-form-item label =" 密码" >
337
354
<el-input v-model =" pasteFormData.password" />
@@ -349,15 +366,26 @@ function expTimeChange(v) {
349
366
350
367
<div v-else >
351
368
<el-result icon =" success" title =" 成功" v-if =" pasteRes.contents" >
352
- <template #sub-title >
353
- <a :href =" `https://website-2023.aosc.io/paste/detail?id=${pasteRes.paste_id_expr}`" class =" text-link" >
354
- {{ `https://website-2023.aosc.io/paste/detail?id=${pasteRes.paste_id_repr}` }}
355
- </a >
356
- </template >
357
- </el-result >
358
- <el-result v-else icon =" error" sub-title =" 失败" ></el-result >
369
+ <template #sub-title >
370
+ <a
371
+ :href =" `${linkPre}paste/detail?id=${pasteRes.paste_id_repr}`"
372
+ class =" text-link"
373
+ >
374
+ {{
375
+ `${linkPre}paste/detail?id=${pasteRes.paste_id_repr}`
376
+ }}
377
+ </a >
378
+ </template >
379
+ <template #extra >
380
+ <el-button type =" primary" @click =" back" >返回</el-button >
381
+ </template >
382
+ </el-result >
383
+ <el-result v-else icon =" error" sub-title =" 失败" >
384
+ <template #extra >
385
+ <el-button type =" primary" @click =" back" >返回</el-button >
386
+ </template >
387
+ </el-result >
359
388
</div >
360
-
361
389
</div >
362
390
</template >
363
391
0 commit comments