jmash-core-mp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/app.mpx
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
import mpx, { createComponent, ref, onShow } from '@mpxjs/core'
|
|
29
29
|
import { db } from '../../utils/db';
|
|
30
30
|
import { authApi } from '../../api/auth/index';
|
|
31
|
+
import { auth } from "../../utils/auth.ts";
|
|
31
32
|
|
|
32
33
|
createComponent({
|
|
33
34
|
properties: {
|
|
@@ -35,6 +36,14 @@ createComponent({
|
|
|
35
36
|
type: String,
|
|
36
37
|
value: ''
|
|
37
38
|
},
|
|
39
|
+
backurl: {
|
|
40
|
+
type: String,
|
|
41
|
+
value: '/pages/home'
|
|
42
|
+
},
|
|
43
|
+
tabbar: {
|
|
44
|
+
type: String,
|
|
45
|
+
value: 'false'
|
|
46
|
+
}
|
|
38
47
|
},
|
|
39
48
|
setup(props, context) {
|
|
40
49
|
let config = getApp().globalData.config;
|
|
@@ -42,21 +51,28 @@ createComponent({
|
|
|
42
51
|
let baseUrl = ref(config.baseUrl);
|
|
43
52
|
let token = ref('');
|
|
44
53
|
let userInfo = ref({});
|
|
45
|
-
|
|
46
|
-
onShow(() => {
|
|
54
|
+
let refreshFunc = () => {
|
|
47
55
|
token.value = db.getToken();
|
|
48
56
|
authApi.userInfo().then((resp) => {
|
|
49
57
|
userInfo.value = resp.data;
|
|
50
58
|
})
|
|
51
|
-
}
|
|
59
|
+
};
|
|
60
|
+
onShow(refreshFunc);
|
|
52
61
|
console.log(resourceUrl);
|
|
53
|
-
return { resourceUrl, baseUrl, token, userInfo };
|
|
62
|
+
return { resourceUrl, baseUrl, token, userInfo, refreshFunc };
|
|
54
63
|
},
|
|
55
64
|
methods: {
|
|
56
65
|
handleLogin() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
//检查登录并跳转登录
|
|
67
|
+
auth.loginOnlyAC().then(() => {
|
|
68
|
+
//登录成功,加载业务
|
|
69
|
+
console.log("静默登录成功");
|
|
70
|
+
this.refreshFunc();
|
|
71
|
+
}).catch(() => {
|
|
72
|
+
mpx.navigateTo({
|
|
73
|
+
url: '/jmash/pages/auth/login' + "?backurl=" + encodeURIComponent(this.properties.backurl) + "&tabbar=" + this.properties.tabbar
|
|
74
|
+
})
|
|
75
|
+
});
|
|
60
76
|
},
|
|
61
77
|
handleUpdateUser() {
|
|
62
78
|
mpx.navigateTo({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<jmash-login
|
|
2
|
+
<jmash-login linkType="{{ linkType }}" backurl="{{ backurl }}">
|
|
3
3
|
<image mode="widthFix" src="{{ resourceUrl }}/images/login_bg.png" class="index_bj" slot="before">
|
|
4
4
|
<image mode="widthFix" src="{{ resourceUrl }}/images/logo.png" class="login_logo"></image>
|
|
5
5
|
</image>
|
|
@@ -11,13 +11,23 @@
|
|
|
11
11
|
import { createPage, ref } from '@mpxjs/core'
|
|
12
12
|
|
|
13
13
|
createPage({
|
|
14
|
+
properties: {
|
|
15
|
+
tabbar: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: 'false'
|
|
18
|
+
},
|
|
19
|
+
backurl: {
|
|
20
|
+
type: String,
|
|
21
|
+
value: '/pages/home'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
14
24
|
setup(props) {
|
|
15
25
|
let resourceUrl = ref(getApp().globalData.config.resourceUrl);
|
|
16
26
|
let appName = ref(getApp().globalData.config.name);
|
|
17
|
-
let
|
|
18
|
-
let backurl = ref(props.backurl
|
|
19
|
-
console.log(appName);
|
|
20
|
-
return { resourceUrl, appName,
|
|
27
|
+
let linkType = ref(props.tabbar === 'true' ? "switchTab" : "redirectTo");
|
|
28
|
+
let backurl = ref(props.backurl);
|
|
29
|
+
console.log(appName, linkType, backurl);
|
|
30
|
+
return { resourceUrl, appName, linkType, backurl };
|
|
21
31
|
}
|
|
22
32
|
})
|
|
23
33
|
</script>
|
package/src/pages/home.mpx
CHANGED
|
@@ -6,17 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
8
|
import { createPage } from '@mpxjs/core'
|
|
9
|
-
import { db } from '../utils/db'
|
|
10
9
|
import mpx from '@mpxjs/core'
|
|
10
|
+
import { auth } from "../utils/auth.ts";
|
|
11
11
|
|
|
12
12
|
createPage({
|
|
13
13
|
setup() {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
//检查登录并跳转登录
|
|
15
|
+
auth.loginOnlyAC().then(() => {
|
|
16
|
+
//登录成功,加载业务
|
|
17
|
+
console.log("静默登录成功");
|
|
18
|
+
}).catch(() => {
|
|
16
19
|
mpx.navigateTo({
|
|
17
20
|
url: '/jmash/pages/auth/login'
|
|
18
21
|
})
|
|
19
|
-
}
|
|
22
|
+
});
|
|
20
23
|
return {}
|
|
21
24
|
}
|
|
22
25
|
})
|
package/src/pages/tabbar/my.mpx
CHANGED
package/src/utils/config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AppConfig } from "../types/core";
|
|
|
3
3
|
const config: AppConfig = {
|
|
4
4
|
name: "Jmash Core MPX",
|
|
5
5
|
dev: true,
|
|
6
|
-
testNewUser:
|
|
6
|
+
testNewUser: false,
|
|
7
7
|
tenant: "xyvcard",
|
|
8
8
|
baseUrl: "https://mm.sooyie.cn",
|
|
9
9
|
resourceUrl: "https://mm.sooyie.cn/v1/file/path/wxapp",
|
|
@@ -17,7 +17,7 @@ const config: AppConfig = {
|
|
|
17
17
|
|
|
18
18
|
if (__mpx_mode__ === "wx") {
|
|
19
19
|
// 微信
|
|
20
|
-
config.appId = "
|
|
20
|
+
config.appId = "wx2a8b3d689b8959eb1";
|
|
21
21
|
} else if (__mpx_mode__ === "ali") {
|
|
22
22
|
// 支付宝
|
|
23
23
|
config.appId = "2016102700684542";
|