diff --git a/package.json b/package.json
index c655c86..6322e30 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"core-js": "^3.6.4",
"crc-32": "^1.2.0",
"crypto-js": "^4.0.0",
+ "lrz": "^4.9.40",
"register-service-worker": "^1.6.2",
"vconsole": "^3.3.4",
"vue": "^2.6.11",
diff --git a/src/App.vue b/src/App.vue
index 50ac4cc..3bc7534 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -13,17 +13,30 @@ export default {
data: () => {
return {};
},
+ computed: {
+ ...mapState(["bg_img_url"])
+ },
methods: {
...mapActions(["setBgImgUrl"]),
init() {
- let url = `https://i.picsum.photos/id/${Math.floor(
- Math.random() * 1000
- )}/1920/1080.jpg`;
- this.setBgImgUrl([url, this])
+ // 刷新本页vuex
+ this.$store.replaceState(
+ Object.assign(
+ this.$store.state,
+ JSON.parse(localStorage.getItem("storeState"))
+ )
+ );
+ if (!this.bg_img_url) {
+ let url = `https://i.picsum.photos/id/${Math.floor(
+ Math.random() * 1000
+ )}/1920/1080.jpg`;
+ this.setBgImgUrl([url, this]);
+ }
+
// Light theme
- this.$vuetify.theme.themes.light.primary = '#000'
+ this.$vuetify.theme.themes.light.primary = "#000";
// Dark theme
- this.$vuetify.theme.themes.dark.primary = '#fff'
+ this.$vuetify.theme.themes.dark.primary = "#fff";
}
},
created() {
diff --git a/src/UI/snackBar/index.js b/src/UI/snackBar/index.js
new file mode 100644
index 0000000..0965695
--- /dev/null
+++ b/src/UI/snackBar/index.js
@@ -0,0 +1,10 @@
+import Snackbar from './src/main.js';
+import Vue from 'vue'
+const install = () => {
+ Object.defineProperty(Vue.prototype, '$snackbar', {
+ get () {
+ return Snackbar
+ }
+ })
+ }
+export default install;
diff --git a/src/UI/snackBar/src/main.js b/src/UI/snackBar/src/main.js
new file mode 100644
index 0000000..a646cbb
--- /dev/null
+++ b/src/UI/snackBar/src/main.js
@@ -0,0 +1,50 @@
+import Main from './main.vue'
+import Vue from 'vue'
+let SnackBarConstructor = Vue.extend(Main)
+let instance
+let seed = 1
+
+const Snackbar = (options) => {
+ if (Vue.prototype.$isServer) return;
+ options = options || {};
+ if (typeof options === 'string') {
+ options = {
+ message: options
+ };
+ }
+ let id = 'snackbar_' + seed++;
+ instance = new SnackBarConstructor({
+ data: options
+ });
+ instance.id = id;
+ instance.$mount();
+ document.getElementById('app').appendChild(instance.$el);
+ return instance;
+}
+
+['success', 'info', 'error'].forEach(type => {
+ Snackbar[type] = options => {
+ if (typeof options === 'string') {
+ options = {
+ message: options
+ };
+ }
+ switch(type) {
+ case 'success':
+ options.color = '#43A047';
+ options.timeout = 1500
+ break;
+ case 'info':
+ options.color = '#03A9F4';
+ options.timeout = 1500
+ break;
+ case 'error':
+ options.color = '#FF5252';
+ options.timeout = 4000
+ break;
+ }
+ return Snackbar(options);
+ };
+});
+
+export default Snackbar
\ No newline at end of file
diff --git a/src/UI/snackBar/src/main.vue b/src/UI/snackBar/src/main.vue
new file mode 100644
index 0000000..f5e73fe
--- /dev/null
+++ b/src/UI/snackBar/src/main.vue
@@ -0,0 +1,15 @@
+
+ {{ message }}
+
+
diff --git a/src/axios/fetch.js b/src/axios/fetch.js
new file mode 100644
index 0000000..f591afb
--- /dev/null
+++ b/src/axios/fetch.js
@@ -0,0 +1,23 @@
+import axios from 'axios'
+
+export const api = axios.create({
+ baseURL: 'https://yg.canary.moe/v1/',
+ // baseURL: window.location.origin + '/api/',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Access-Control-Allow-Origin': '*'
+ },
+ timeout: 30 * 1000
+})
+
+//设置拦截器
+api.interceptors.response.use(
+ (response) => {
+ // console.log('拦截器:请求成功', response)
+ return response
+ }, (error) => {
+ // console.log('拦截器:发生错误', error.response)
+ return Promise.reject(error)
+ }
+)
diff --git a/src/main.js b/src/main.js
index c7ed902..7eb071b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -23,6 +23,9 @@ Vue.use(VueTouch, {name: 'v-touch'})
import Vconsole from 'vconsole';
new Vconsole();
+import SnackBarAlert from '@/UI/snackBar/index'
+Vue.use(SnackBarAlert)
+
new Vue({
router,
store,
diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js
index 76cede0..b79acf1 100644
--- a/src/registerServiceWorker.js
+++ b/src/registerServiceWorker.js
@@ -21,6 +21,7 @@ if (process.env.NODE_ENV === 'production') {
},
updated () {
console.log('New content is available; please refresh.')
+ window.location.reload(true)
},
offline () {
console.log('No internet connection found. App is running in offline mode.')
diff --git a/src/store/index.js b/src/store/index.js
index a669171..ff4ffb0 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -7,12 +7,18 @@ export default new Vuex.Store({
state: {
// 全局背景图片
bg_img_url: '',
+ // 用户信息
+ user_info: '',
},
mutations: {
// 设置全局背景图片
SET_BGIMGURL(state, bg_img_url) {
state.bg_img_url = bg_img_url;
},
+ // 设置用户信息
+ SET_USERINFO(state, user_info) {
+ state.user_info = user_info;
+ },
},
actions: {
// 设置全局背景图片
@@ -20,6 +26,11 @@ export default new Vuex.Store({
commit('SET_BGIMGURL', arg[0]);
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
},
+ // 设置用户信息
+ setUserInfo({ commit }, arg) {
+ commit('SET_USERINFO', arg[0]);
+ localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
+ },
},
modules: {
}
diff --git a/src/views/Account/Account.vue b/src/views/Account/Account.vue
index 56a11c4..80dfe67 100644
--- a/src/views/Account/Account.vue
+++ b/src/views/Account/Account.vue
@@ -47,9 +47,9 @@
block
color="primary"
:disabled="!valid"
- @click="resetValidation"
:loading="loading_switch"
class="float-right mt-5"
+ @click="loginStart"
>验证账户
@@ -98,7 +98,7 @@
消息:{{user_info.msg.length}}条
- 查看
+ 查看
@@ -108,7 +108,7 @@
已发布:{{user_info.created.length}}条
- 查看
+ 查看
@@ -133,6 +133,7 @@
color="primary"
@click="logout_dialog_switch = true"
class="float-right mt-5"
+ :disabled="loading_switch"
>退出登录
@@ -147,7 +148,7 @@
取消
- 继续
+ 继续
@@ -160,13 +161,20 @@
-
+
取消
- 提交
+ 提交
@@ -187,9 +195,9 @@
diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index 812e370..d90e13e 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -11,7 +11,7 @@
- Canary 失物招领
+ 曳光 失物招领
@@ -177,18 +177,8 @@ export default {
},
methods: {
init() {
- for (let i = 0; i < 10; i++) {
- let item = {
- title: "这是丢失的物品",
- create_time: "2020-01-01",
- img_url: "https://picsum.photos/1920/1080?random",
- total_addr: "长理东区",
- good_type: "lost",
- good_id: i
- };
- this.lost.push(item);
- this.found.push(item);
- }
+ // 刷新本页vuex
+ this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("storeState"))));
},
// 关闭底部表单-add
diff --git a/src/views/Home/children/Add.vue b/src/views/Home/children/Add.vue
index 4dac4a0..d789631 100644
--- a/src/views/Home/children/Add.vue
+++ b/src/views/Home/children/Add.vue
@@ -1,7 +1,7 @@
-
+
-
+
@@ -17,79 +17,101 @@
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+ 确认提交
+
- 重置
-
- 确认提交
-
+
+
+
+ 提示
+ 您即将提交信息进行审核,是否继续
+
+
+ 取消
+ 继续
+
+
+
+
+