Skip to content

Commit 43e3e97

Browse files
authored
feat(login): 375 [Migration] Complete login logic (#376)
Done #375
1 parent 3dbff9f commit 43e3e97

File tree

9 files changed

+116
-67
lines changed

9 files changed

+116
-67
lines changed

package-lock.json

+88-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/component/base/table/lin-table.vue.rej

-7
This file was deleted.

src/component/layout/user.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
>
4949
<div style="text-align: center;">
5050
<div class="avatar-croppa-container">
51-
<croppa
51+
<!-- <croppa
5252
ref="croppa"
5353
:width="cropRule.width"
5454
:height="cropRule.height"
@@ -63,7 +63,7 @@
6363
:quality="quality"
6464
:initial-image="cropImg"
6565
>
66-
</croppa>
66+
</croppa> -->
6767
</div>
6868
<div style="margin-top: 1em;">通过鼠标滚轮调节头像大小</div>
6969
</div>
@@ -111,14 +111,14 @@
111111

112112
<script>
113113
import { mapActions, mapGetters } from 'vuex'
114-
import Vue from 'vue'
115-
import Croppa from 'vue-croppa'
114+
// import Vue from 'vue'
115+
// import Croppa from 'vue-croppa'
116116
import axios, { post } from '@/lin/plugin/axios'
117117
import User from '@/lin/model/user'
118118
import 'vue-croppa/dist/vue-croppa.css'
119119
import defaultAvatar from '@/assets/image/user/user.png'
120120
121-
Vue.use(Croppa)
121+
// Vue.use(Croppa)
122122
123123
const width = 150
124124
const height = 150

src/lin/plugin/preview/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import Vue from 'vue'
1+
// TODO: Vue3 Plugin
2+
import { createApp } from 'vue'
23
import Preview from '@/component/base/preview/preview'
34

45
const previewImage = {}
6+
const app = createApp()
57
previewImage.install = vue => {
68
// eslint-disable-line
79
const PreviewConstructor = vue.extend(Preview)
@@ -22,7 +24,7 @@ previewImage.install = vue => {
2224
return instance
2325
}
2426

25-
vue.prototype.$imagePreview = (opts = {}) => {
27+
app.config.globalProperties.$imagePreview = (opts = {}) => {
2628
// eslint-disable-line
2729
const elem = document.createElement('div')
2830
if (!instance) {
@@ -44,6 +46,6 @@ previewImage.install = vue => {
4446
}
4547
}
4648

47-
Vue.use(previewImage)
49+
// Vue.use(previewImage)
4850

4951
export default previewImage

src/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@ app.directive('permission', permissionDirective)
3232

3333
app.mount('#app')
3434

35+
app.config.devtools = true
36+
3537
// 设置 App 实例
3638
window.App = app

src/view/about/about.vue

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ import { ref, onMounted } from 'vue'
173173
174174
export default {
175175
setup() {
176+
console.log(1111)
177+
176178
const showTeam = ref(false)
177179
const activeName = ref('first')
178180
const { clientWidth } = document.body

src/view/center/center.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
>
7171
<div style="text-align: center;">
7272
<div class="avatar-croppa-container">
73-
<croppa
73+
<!-- <croppa
7474
ref="croppa"
7575
:width="cropRule.width"
7676
:height="cropRule.height"
@@ -84,7 +84,7 @@
8484
:show-loading="true"
8585
:quality="quality"
8686
:initial-image="cropImg"
87-
></croppa>
87+
></croppa> -->
8888
</div>
8989
<div style="margin-top: 1em;">通过鼠标滚轮调节头像大小</div>
9090
</div>
@@ -100,14 +100,14 @@
100100

101101
<script>
102102
import { mapActions, mapGetters } from 'vuex'
103-
import Vue from 'vue'
104-
import Croppa from 'vue-croppa'
103+
// import Vue from 'vue'
104+
// import Croppa from 'vue-croppa'
105105
import User from '@/lin/model/user'
106106
import axios, { post, put } from '@/lin/plugin/axios'
107107
import 'vue-croppa/dist/vue-croppa.css'
108108
import defaultAvatar from '@/assets/image/user/user.png'
109109
110-
Vue.use(Croppa)
110+
// Vue.use(Croppa)
111111
112112
const width = 150
113113
const height = 150

src/view/login/login.vue

+8-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
</template>
2323

2424
<script>
25-
import { reactive, ref, onMounted } from 'vue'
26-
import { Message } from 'element-plus'
25+
import { reactive, ref, onMounted, getCurrentInstance } from 'vue'
2726
import { useStore } from 'vuex'
2827
import { useRouter } from 'vue-router'
2928
import UserModel from '@/lin/model/user'
3029
import Utils from '@/lin/util/util'
30+
import Config from '@/config'
3131

3232
export default {
3333
setup() {
@@ -36,6 +36,7 @@ export default {
3636
const store = useStore()
3737
const router = useRouter()
3838
const throttleLogin = ref(null)
39+
const { ctx } = getCurrentInstance()
3940

4041
const account = reactive({
4142
username: 'root',
@@ -52,11 +53,13 @@ export default {
5253
await UserModel.getToken(username, password)
5354
await getInformation()
5455
loading.value = false
55-
router.push('/about')
56-
Message.success('登录成功')
56+
router.push(Config.defaultRoute)
57+
ctx.$message({
58+
message: '登录成功',
59+
type: 'success',
60+
})
5761
} catch (e) {
5862
loading.value = false
59-
console.log(e)
6063
}
6164
}
6265

vue.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
.loader('vue-markdown-loader/lib/markdown-compiler')
2424
},
2525
configureWebpack: {
26+
devtool: 'source-map',
2627
resolve: {
2728
extensions: ['.js', '.json', '.vue', '.scss', '.html'],
2829
},

0 commit comments

Comments
 (0)