Skip to content

Commit da9093d

Browse files
author
施伟达
committed
修改静态资源图片地址,修改部分代码,更改域名
1 parent b79fbd6 commit da9093d

33 files changed

+5433
-4665
lines changed

.env

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
VUE_APP_API_URL = http://127.0.0.1:8080/api/v2
2-
VUE_APP_STATIC_URL = https://static.golang365.com/
1+
VUE_APP_API_URL = http://api.golang365.top/api/v2
2+
VUE_APP_STATIC_URL = http://img.golang365.top/
3+
VUE_APP_AVATAR_URL = https://api.dicebear.com/7.x/bottts-neutral/svg
34
VUE_APP_OUTPUT_DIR = dev

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// 开发环境
22
VUE_APP_API_URL = http://localhost:8080/api/v2
33
// VUE_APP_STATIC_URL = http://localhost:9000/
4-
VUE_APP_STATIC_URL = https://static.golang365.com/
4+
VUE_APP_STATIC_URL = https://img.golang365.top/
55
VUE_APP_OUTPUT_DIR = dev

.env.production

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// 生产环境
2-
BASE_URL = http://api.golang365.com/api/v2
3-
VUE_APP_API_URL = http://api.golang365.com/api/v2
4-
VUE_APP_STATIC_URL = https://static.golang365.com/
2+
BASE_URL = https://api.golang365.top/api/v2
3+
VUE_APP_API_URL = http:s//api.golang365.top/api/v2
4+
VUE_APP_STATIC_URL = https://img.golang365.top/
55
VUE_APP_OUTPUT_DIR = prod

.env.sit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
NODE_ENV = 'sit'
33
VUE_APP_API_URL = http://localhost:8080/api/v2
44
// VUE_APP_STATIC_URL = http://localhost:9000/
5-
VUE_APP_STATIC_URL = http://static.golang365.com/
5+
VUE_APP_STATIC_URL = http://static.golang365.top/
66
VUE_APP_OUTPUT_DIR = sit

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# vue-blog v2 重构
22

33
**base on vue-cli3**
4-
博客页面:[http://www.golang365.com](http://www.golang365.com)
5-
后台页面:[http://www.golang365.com/manage.html#/login](http://www.golang365.com/manage.html#/login)
4+
博客页面:[http://www.golang365.top](http://www.golang365.top)
5+
后台页面:[http://www.golang365.top/manage.html#/login](http://www.golang365.top/manage.html#/login)
66

77
1.多页面配置,博客页面和后台页面分离
88
2.图片上传又拍云
@@ -113,7 +113,7 @@ server
113113
// 添加下面三行
114114
location /api {
115115
add_header 'Access-Control-Allow-Origin' '*';
116-
proxy_pass http://api.golang365.com/api/v2;
116+
proxy_pass http://api.golang365.top/api/v2;
117117
}
118118
...
119119
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"highlight.js": "^10.4.1",
2121
"iview": "^3.0.1",
2222
"mavon-editor": "^2.8.2",
23+
"vue-fragment": "^1.6.0",
2324
"vue-marked": "^0.1.1",
2425
"vue-router": "^3.0.1",
2526
"vue-savedata": "^2.0.2",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="zh">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

public/r

Whitespace-only changes.

src/404.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
}
1313
},
1414
methods: {
15-
goIndex() {
15+
goIndex () {
1616
window.history.length > 1
1717
? this.$router.go(-1)
1818
: this.$router.push('/')

src/api/baseUrlConfig.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22
* 定义各个API的 baseURL
33
*/
44
const common = {
5-
static_url: 'http://static.golang365.com/',
5+
static_url: 'http://static.golang365.top/',
66
}
77

88
const baseURL = {
9-
/** 生产 */
9+
/** 生产 */
1010
production: {
1111
...common,
12-
api_url: 'http://api.golang365.com/api/v2',
12+
api_url: 'https://api.golang365.top/api/v2',
1313
dist_name: 'prod',
1414
},
1515
/** 开发 */
1616
development: {
1717
...common,
18-
api_url: "http://127.0.0.1:8080/api/v2",
18+
api_url: "https://api.golang365.top/api/v2",
1919
dist_name: 'dev',
2020
},
2121
/** 测试 */
2222
test: {
2323
...common,
24-
api_url: "http://blog-test.golang365.com/api/v2",
24+
api_url: "http://blog-test.golang365.top/api/v2",
2525
dist_name: 'test',
2626
},
2727
/** sit */
2828
sit: {
2929
...common,
30-
api_url: "http://blog-sit.golang365.com/api/v2",
30+
api_url: "http://blog-sit.golang365.top/api/v2",
3131
dist_name: 'sit',
3232
}
3333
}[process.env.NODE_ENV || 'production']

src/components/SpinLoading.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import spinLoading from './spinLoading.vue'
2+
// 这里是重点
3+
const SpinLoading = {
4+
install: function(Vue) {
5+
Vue.component('SpinLoading', spinLoading)
6+
},
7+
}
8+
9+
// 导出组件
10+
export default SpinLoading

src/components/spinLoading.vue

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<template>
2+
<fragment>
3+
<div class="spinner" v-if="isLoading">
4+
<div class="bounce1 aa"></div>
5+
<div class="bounce2 bb"></div>
6+
<div class="bounce3"></div>
7+
</div>
8+
<slot v-else></slot>
9+
</fragment>
10+
</template>
11+
12+
<script>
13+
export default {
14+
name: 'spinLoading',
15+
props: {
16+
isLoading: {
17+
type: Boolean,
18+
default: true
19+
}
20+
},
21+
// watch: {
22+
// isLoading: function (newValue, oldValue) {
23+
// // 监听 countWatcher 的变化
24+
// console.log("props.isLoading 的值已变为:" + newValue);
25+
// }
26+
// },
27+
}
28+
</script>
29+
30+
<style scoped lang="stylus">
31+
.spinner {
32+
margin: 100px auto 60px;
33+
width: 150px;
34+
text-align: center;
35+
36+
&>div {
37+
width: 30px;
38+
height: 30px;
39+
background-color: #67CF22;
40+
border-radius: 100%;
41+
display: inline-block;
42+
-webkit-animation: bouncedelay 1.4s infinite ease-in-out;
43+
animation: bouncedelay 1.4s infinite ease-in-out;
44+
/* Prevent first frame from flickering when animation starts */
45+
-webkit-animation-fill-mode: both;
46+
animation-fill-mode: both;
47+
}
48+
49+
.bounce1 {
50+
-webkit-animation-delay: -0.32s;
51+
animation-delay: -0.32s;
52+
}
53+
54+
.bounce2 {
55+
-webkit-animation-delay: -0.16s;
56+
animation-delay: -0.16s;
57+
}
58+
}
59+
60+
61+
@keyframes bouncedelay {
62+
63+
0%,
64+
80%,
65+
100% {
66+
-webkit-transform: scale(0);
67+
}
68+
69+
40% {
70+
-webkit-transform: scale(1);
71+
}
72+
}
73+
74+
@keyframes bouncedelay {
75+
76+
0%,
77+
80%,
78+
100% {
79+
transform: scale(0);
80+
-webkit-transform: scale(0);
81+
}
82+
83+
40% {
84+
transform: scale(1);
85+
-webkit-transform: scale(1);
86+
}
87+
}
88+
</style>

src/components/textLoading.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<template>
2-
<div class="text_loading">
2+
<div class="text_loading" >
33
<div class="hr"></div>
44
<div class="box">
5-
<i class="iconfont lv-icon-huore"></i> <p></p>
6-
<i class="iconfont lv-icon-biaoqian6"></i> <p></p>
5+
<i class="iconfont lv-icon-huore"></i>
6+
<p></p>
7+
<i class="iconfont lv-icon-biaoqian6"></i>
8+
<p></p>
79
</div>
810
<div class="hr hr2"></div>
911
<div class="hr hr1"></div>
@@ -14,9 +16,13 @@
1416

1517
<script>
1618
export default {
17-
methods: {
18-
19-
}
19+
name: 'textLoading',
20+
// props: {
21+
// isLoading: {
22+
// type: Boolean,
23+
// default: true
24+
// }
25+
// }
2026
}
2127
</script>
2228

src/directive/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import Vue from 'vue'
22

33
const defaultErrorImg = require("@/assets/errorImg.jpg");
4+
const staticUrl = process.env.VUE_APP_STATIC_URL
45

56
//全局注册自定义指令,用于判断当前图片是否能够加载成功,可以加载成功则赋值为img的src属性,否则使用默认图片
67
Vue.directive("imgUrl", async function(el, binding) {
78
let imgURL = binding.value; //获取图片地址
8-
let errorImg = el.getAttribute("error-img"); //获取错误图片地址,如果没有则获取默认的
9+
//获取错误图片地址,如果没有则获取默认的
10+
let errorImg = el.getAttribute("error-img") || defaultErrorImg;
11+
let totalImgUrl = staticUrl + imgURL
12+
913
if (imgURL) {
1014
// 是否http开头
1115
let isHttp = imgURL.indexOf('http')
@@ -14,18 +18,21 @@ Vue.directive("imgUrl", async function(el, binding) {
1418
if (exist) {
1519
el.setAttribute("src", imgURL);
1620
} else {
17-
el.setAttribute("src", errorImg || defaultErrorImg);
21+
el.setAttribute("src", errorImg);
22+
el.setAttribute("img-data", totalImgUrl);
1823
}
1924
} else {
20-
let exist = await imageIsExist(process.env.VUE_APP_STATIC_URL + imgURL);
25+
let exist = await imageIsExist(totalImgUrl);
2126
if (exist) {
22-
el.setAttribute("src", process.env.VUE_APP_STATIC_URL + imgURL);
27+
el.setAttribute("src", totalImgUrl);
2328
} else {
24-
el.setAttribute("src", errorImg || defaultErrorImg);
29+
el.setAttribute("src", errorImg);
30+
el.setAttribute("img-data", totalImgUrl);
2531
}
2632
}
2733
} else {
28-
el.setAttribute("src", errorImg || defaultErrorImg);
34+
el.setAttribute("src", errorImg);
35+
el.setAttribute("img-data", totalImgUrl);
2936
}
3037
});
3138

@@ -38,7 +45,7 @@ Vue.directive("real-img", async function(el, binding) {
3845
if (exist) {
3946
el.setAttribute("src", imgURL);
4047
} else {
41-
el.setAttribute("src", errorImg || defaultErrorImg);
48+
el.setAttribute("src", errorImg);
4249
}
4350
}
4451
});

src/modules/index/App.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<Headnav></Headnav>
44
<section class="content blog">
55
<keep-alive>
6-
<router-view v-if="$route.meta.keepAlive" class="slide animate03" ></router-view>
6+
<router-view v-if="$route.meta.keepAlive" class="slide animate03"></router-view>
77
</keep-alive>
8-
<router-view v-if="!$route.meta.keepAlive" class="slide animate03" ></router-view>
8+
<router-view v-if="!$route.meta.keepAlive" class="slide animate03"></router-view>
99

1010
<!-- <transition name="el-fade-in">
1111
<router-view class="main animate03" />
@@ -37,10 +37,10 @@ export default {
3737
computed: {
3838
...mapGetters(['user', 'token', 'webInfo', 'banners']),
3939
},
40-
data() {
40+
data () {
4141
return {}
4242
},
43-
created() {
43+
created () {
4444
// 有token,没有user时才请求用户信息
4545
if (this.token) {
4646
this.UserInfo()

src/modules/index/api/article.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import request from "utils/httpIndex";
1+
import request from "@/utils/httpIndex";
22
import baseURL from "./baseUrlConfig";
33

44
// 文章详情
5-
export function ArticleDetial(data) {
5+
export function ArticleDetial (data) {
66
return request({
77
// baseURL: baseURL.host,
88
url: '/apis/article',
@@ -12,7 +12,7 @@ export function ArticleDetial(data) {
1212
}
1313

1414
// 文章列表
15-
export function ArticleList(data) {
15+
export function ArticleList (data) {
1616
return request({
1717
// baseURL: baseURL.host,
1818
url: '/apis/article/list',
@@ -22,7 +22,7 @@ export function ArticleList(data) {
2222
}
2323

2424
// 点赞
25-
export function ArticleLike(data) {
25+
export function ArticleLike (data) {
2626
return request({
2727
// baseURL: baseURL.host,
2828
url: '/apis/article/like',
@@ -32,7 +32,7 @@ export function ArticleLike(data) {
3232
}
3333

3434
// 标签
35-
export function TagList(data) {
35+
export function TagList (data) {
3636
return request({
3737
// baseURL: baseURL.host,
3838
url: '/apis/tag/list',

0 commit comments

Comments
 (0)