xyvcard-wechat-auth 0.0.19 → 0.0.20

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.
Files changed (67) hide show
  1. package/dist/api/auth/index.js +159 -1
  2. package/dist/api/auth/types.js +1 -1
  3. package/dist/api/dict/index.js +36 -1
  4. package/dist/api/dict/types.js +1 -1
  5. package/dist/api/dicts.js +53 -1
  6. package/dist/api/files/index.js +135 -1
  7. package/dist/api/files/types.js +1 -1
  8. package/dist/api/index.js +12 -1
  9. package/dist/api/myorgan/index.js +1 -1
  10. package/dist/api/myorgan/types.js +1 -1
  11. package/dist/api/types.js +9 -1
  12. package/dist/components/auth-user/jmash-update-user/index.js +133 -1
  13. package/dist/components/auth-user/jmash-user/index.js +56 -1
  14. package/dist/components/common/auth-avatar/avatar-edit/index.js +82 -1
  15. package/dist/components/common/auth-basic-title/basic-title-view/index.js +39 -0
  16. package/dist/{pages/home → components/common/auth-basic-title/basic-title-view}/index.json +1 -0
  17. package/dist/components/common/auth-basic-title/basic-title-view/index.wxml +5 -0
  18. package/dist/components/common/auth-basic-title/basic-title-view/index.wxss +1 -0
  19. package/dist/components/common/auth-btn/double-btn/index.js +67 -1
  20. package/dist/components/common/auth-btn/single-btn/index.js +34 -1
  21. package/dist/components/common/auth-none-data/none-data-image/index.js +53 -1
  22. package/dist/components/common/auth-popup/index.js +53 -1
  23. package/dist/components/common/auth-popup/index.wxml +2 -2
  24. package/dist/components/common/auth-popup/index.wxss +1 -1
  25. package/dist/components/common/auth-search/index.js +60 -1
  26. package/dist/components/common/auth-top-navigation/index.js +49 -1
  27. package/dist/components/jmash-half-login/index.js +105 -1
  28. package/dist/components/jmash-login/index.js +121 -1
  29. package/dist/constant.js +15 -1
  30. package/dist/index.js +35 -1
  31. package/dist/utils/auth.js +212 -1
  32. package/dist/utils/common.js +113 -1
  33. package/dist/utils/config.js +29 -1
  34. package/dist/utils/db.js +188 -1
  35. package/dist/utils/request.js +86 -1
  36. package/dist/utils/util.js +88 -1
  37. package/package.json +1 -1
  38. package/dist/app.d.ts +0 -0
  39. package/dist/app.js +0 -1
  40. package/dist/app.json +0 -27
  41. package/dist/app.wxss +0 -0
  42. package/dist/pages/auth/login/index.js +0 -1
  43. package/dist/pages/auth/login/index.json +0 -5
  44. package/dist/pages/auth/login/index.wxml +0 -6
  45. package/dist/pages/auth/login/index.wxss +0 -1
  46. package/dist/pages/demo/index.d.ts +0 -0
  47. package/dist/pages/demo/index.js +0 -1
  48. package/dist/pages/demo/index.json +0 -14
  49. package/dist/pages/demo/index.wxml +0 -11
  50. package/dist/pages/demo/index.wxss +0 -0
  51. package/dist/pages/half-home/index.d.ts +0 -1
  52. package/dist/pages/half-home/index.js +0 -1
  53. package/dist/pages/half-home/index.json +0 -5
  54. package/dist/pages/half-home/index.wxml +0 -5
  55. package/dist/pages/half-home/index.wxss +0 -0
  56. package/dist/pages/home/index.d.ts +0 -1
  57. package/dist/pages/home/index.js +0 -1
  58. package/dist/pages/home/index.wxml +0 -2
  59. package/dist/pages/home/index.wxss +0 -0
  60. package/dist/pages/index/index.d.ts +0 -1
  61. package/dist/pages/index/index.js +0 -1
  62. package/dist/pages/index/index.json +0 -4
  63. package/dist/pages/index/index.wxml +0 -8
  64. package/dist/pages/index/index.wxss +0 -0
  65. package/dist/sitemap.json +0 -7
  66. package/xyvcard-wechat-auth-0.0.1.tgz +0 -0
  67. /package/dist/{pages/auth/login → components/common/auth-basic-title/basic-title-view}/index.d.ts +0 -0
@@ -1 +1,82 @@
1
- "use strict";const e=require("../../../../utils/config.js"),t=require("../../../../api/files/index.js");Component({properties:{value:{type:String,value:"",observer(){this.setData({avatar:this.properties.value?t.fileApi.imageUrl(this.properties.value,320,320,"trans"):this.data.avatar})}},logoImg:{type:String,value:"",observer(){this.setData({avatar:this.properties.logoImg?this.properties.logoImg:this.data.avatar})}},logo:{type:Boolean,value:!1,observer(){this.setData({avatar:this.properties.logo?this.data.defaultlogo:this.data.avatar})}},pathType:{type:Boolean,value:!1}},data:{resourceUrl:e.config.resourceUrl+"/images",avatar:e.config.resourceUrl+"/images/components/gray_head2x.png",defaultlogo:e.config.resourceUrl+"/images/components/gray_logo.png"},lifetimes:{attached(){""!=this.properties.value&&(this.data.avatar=this.properties.pathType?this.properties.value:t.fileApi.imageUrl(this.properties.value,320,320,"trans"),this.setData({avatar:this.data.avatar}))}},methods:{onChooseAvatar(e){const{avatarUrl:a}=e.detail;t.fileApi.uploadFile(a).then(e=>{this.triggerEvent("change",e,{}),this.setData({avatar:t.fileApi.imageUrl(e.data.fileSrc,320,320,"trans")})})}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "../../../../utils/config.js";
2
+ import { fileApi } from "../../../../api/files/index.js";
3
+ Component({
4
+ /**
5
+ * 组件的属性列表
6
+ */
7
+ properties: {
8
+ // 头像路径 form绑定的这个属性
9
+ value: {
10
+ type: String,
11
+ value: "",
12
+ observer() {
13
+ this.setData({
14
+ avatar: this.properties.value ? fileApi.imageUrl(this.properties.value, 320, 320, "trans") : this.data.avatar
15
+ });
16
+ }
17
+ },
18
+ // logo图片路径-全路径 编辑回显使用
19
+ logoImg: {
20
+ type: String,
21
+ value: "",
22
+ observer() {
23
+ this.setData({
24
+ avatar: this.properties.logoImg ? this.properties.logoImg : this.data.avatar
25
+ });
26
+ }
27
+ },
28
+ // 是否显示默认logo
29
+ logo: {
30
+ type: Boolean,
31
+ value: false,
32
+ observer() {
33
+ this.setData({
34
+ avatar: this.properties.logo ? this.data.defaultlogo : this.data.avatar
35
+ });
36
+ }
37
+ },
38
+ // 路径的类型,全路径状态为true,相对路径状态为false
39
+ pathType: {
40
+ type: Boolean,
41
+ value: false
42
+ }
43
+ },
44
+ /**
45
+ * 组件的初始数据
46
+ */
47
+ data: {
48
+ resourceUrl: config.resourceUrl + "/images",
49
+ // 默认头像图片
50
+ avatar: config.resourceUrl + "/images/components/gray_head2x.png",
51
+ // 默认logo图片
52
+ defaultlogo: config.resourceUrl + "/images/components/gray_logo.png"
53
+ },
54
+ /**
55
+ * 组件的生命周期
56
+ */
57
+ lifetimes: {
58
+ attached() {
59
+ if (this.properties.value != "") {
60
+ this.data.avatar = this.properties.pathType ? this.properties.value : fileApi.imageUrl(this.properties.value, 320, 320, "trans");
61
+ this.setData({
62
+ avatar: this.data.avatar
63
+ });
64
+ }
65
+ }
66
+ },
67
+ /**
68
+ * 组件的方法列表
69
+ */
70
+ methods: {
71
+ // 选择头像
72
+ onChooseAvatar(e) {
73
+ const { avatarUrl } = e.detail;
74
+ fileApi.uploadFile(avatarUrl).then((res) => {
75
+ this.triggerEvent("change", res, {});
76
+ this.setData({
77
+ avatar: fileApi.imageUrl(res.data.fileSrc, 320, 320, "trans")
78
+ });
79
+ });
80
+ }
81
+ }
82
+ });
@@ -0,0 +1,39 @@
1
+ import { config } from "../../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ // 主题色
8
+ themeColor: {
9
+ type: String,
10
+ value: ""
11
+ },
12
+ // 标题
13
+ title: {
14
+ type: String,
15
+ value: ""
16
+ },
17
+ // 是否显示查看更多
18
+ isMore: {
19
+ type: Boolean,
20
+ value: true
21
+ }
22
+ },
23
+ /**
24
+ * 组件的初始数据
25
+ */
26
+ data: {
27
+ // 图片资源路径/v1/file/path/wxapp/
28
+ resourceUrl: config.resourceUrl + "/images/icon_image"
29
+ },
30
+ /**
31
+ * 组件的方法列表
32
+ */
33
+ methods: {
34
+ // 查看更多
35
+ handleMore() {
36
+ this.triggerEvent("more");
37
+ }
38
+ }
39
+ });
@@ -1,3 +1,4 @@
1
1
  {
2
+ "component": true,
2
3
  "usingComponents": {}
3
4
  }
@@ -0,0 +1,5 @@
1
+ <view class="basic-view">
2
+ <image class="basic-icon" src="{{ resourceUrl }}/rectangle2x_{{ themeColor }}.png" />
3
+ <text class="basic-title">{{ title }}</text>
4
+ <view class="basic-more" bind:tap="handleMore" wx:if="{{ isMore }}">查看更多</view>
5
+ </view>
@@ -0,0 +1 @@
1
+ .basic-view{display:flex;align-items:center;padding:12px 0}.basic-view .basic-icon{margin-right:8px;width:4px;height:15px}.basic-view .basic-more{margin-left:auto;color:#999;font-size:12px}.basic-view .basic-title{font-size:15px;font-weight:bold;color:#333}
@@ -1 +1,67 @@
1
- "use strict";Component({properties:{leftText:{type:String,value:""},rightText:{type:String,value:""},leftBgColor:{type:String,value:""},rightBgColor:{type:String,value:""},leftColor:{type:String,value:""},rightColor:{type:String,value:""},btnRadius:{type:String,value:""},leftBorder:{type:String,value:""},rightBorder:{type:String,value:""}},data:{},methods:{handleLeft(){this.triggerEvent("leftbtn")},handleRight(){this.triggerEvent("rightbtn")}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(t){exports[t]=module.exports[t]});
1
+ Component({
2
+ /**
3
+ * 组件的属性列表
4
+ */
5
+ properties: {
6
+ // 左侧的文本内容
7
+ leftText: {
8
+ type: String,
9
+ value: ""
10
+ },
11
+ // 右侧的文本内容
12
+ rightText: {
13
+ type: String,
14
+ value: ""
15
+ },
16
+ // 左侧按钮背景色
17
+ leftBgColor: {
18
+ type: String,
19
+ value: ""
20
+ },
21
+ // 右侧按钮背景色
22
+ rightBgColor: {
23
+ type: String,
24
+ value: ""
25
+ },
26
+ // 左侧按钮字体颜色
27
+ leftColor: {
28
+ type: String,
29
+ value: ""
30
+ },
31
+ // 右侧按钮字体颜色
32
+ rightColor: {
33
+ type: String,
34
+ value: ""
35
+ },
36
+ // 按钮圆角
37
+ btnRadius: {
38
+ type: String,
39
+ value: ""
40
+ },
41
+ // 左侧按钮边框
42
+ leftBorder: {
43
+ type: String,
44
+ value: ""
45
+ },
46
+ // 右侧按钮边框
47
+ rightBorder: {
48
+ type: String,
49
+ value: ""
50
+ }
51
+ },
52
+ /**
53
+ * 组件的初始数据
54
+ */
55
+ data: {},
56
+ /**
57
+ * 组件的方法列表
58
+ */
59
+ methods: {
60
+ handleLeft() {
61
+ this.triggerEvent("leftbtn");
62
+ },
63
+ handleRight() {
64
+ this.triggerEvent("rightbtn");
65
+ }
66
+ }
67
+ });
@@ -1 +1,34 @@
1
- "use strict";Component({properties:{text:{type:String,value:""},disabled:{type:Boolean,value:!1},buttonStyle:{type:String,value:"background-color: #2563EB;color: #fff;"}},data:{},methods:{onClick(){this.triggerEvent("click",null,{})}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ Component({
2
+ /**
3
+ * 组件的属性列表
4
+ */
5
+ properties: {
6
+ // 文本
7
+ text: {
8
+ type: String,
9
+ value: ""
10
+ },
11
+ // 禁用
12
+ disabled: {
13
+ type: Boolean,
14
+ value: false
15
+ },
16
+ // 按钮的样式(包括字体颜色,背景色等)
17
+ buttonStyle: {
18
+ type: String,
19
+ value: "background-color: #2563EB;color: #fff;"
20
+ }
21
+ },
22
+ /**
23
+ * 组件的初始数据
24
+ */
25
+ data: {},
26
+ /**
27
+ * 组件的方法列表
28
+ */
29
+ methods: {
30
+ onClick() {
31
+ this.triggerEvent("click", null, {});
32
+ }
33
+ }
34
+ });
@@ -1 +1,53 @@
1
- "use strict";const e=require("../../../../utils/config.js");Component({properties:{marginTop:{type:Number,value:300},paddingTop:{type:Number,value:0},content:{type:String,value:"暂无数据"},imgWidth:{type:String,value:"auto"},imgHeight:{type:String,value:"125px"},imgUrl:{type:String,value:"/components/contacts_nomore2x.png"},contentColor:{type:String,value:"#b6b6b6"}},data:{resourceUrl:e.config.resourceUrl+"/images"},methods:{}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "../../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ // 上外边距
8
+ marginTop: {
9
+ type: Number,
10
+ value: 300
11
+ },
12
+ // 上内边距
13
+ paddingTop: {
14
+ type: Number,
15
+ value: 0
16
+ },
17
+ // 文本内容
18
+ content: {
19
+ type: String,
20
+ value: "暂无数据"
21
+ },
22
+ // 图片的宽
23
+ imgWidth: {
24
+ type: String,
25
+ value: "auto"
26
+ },
27
+ // 图片的高
28
+ imgHeight: {
29
+ type: String,
30
+ value: "125px"
31
+ },
32
+ // 图片的路径
33
+ imgUrl: {
34
+ type: String,
35
+ value: "/components/contacts_nomore2x.png"
36
+ },
37
+ contentColor: {
38
+ type: String,
39
+ value: "#b6b6b6"
40
+ }
41
+ },
42
+ /**
43
+ * 组件的初始数据
44
+ */
45
+ data: {
46
+ // 图片资源路径/v1/file/path/wxapp/
47
+ resourceUrl: config.resourceUrl + "/images"
48
+ },
49
+ /**
50
+ * 组件的方法列表
51
+ */
52
+ methods: {}
53
+ });
@@ -1 +1,53 @@
1
- "use strict";const e=require("../../../utils/config.js");Component({properties:{show:{type:Boolean,value:!1},title:{type:String,value:""},titleShow:{type:Boolean,value:!1},height:{type:String,value:"300px"},backColor:{type:String,value:"#fff"}},data:{resourceUrl:e.config.resourceUrl+"/images",closeModel:!1,titleShow:!0},methods:{closePopup(){this.triggerEvent("close",null,{})}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ // 是否显示
8
+ show: {
9
+ type: Boolean,
10
+ value: false
11
+ },
12
+ // 标题
13
+ title: {
14
+ type: String,
15
+ value: ""
16
+ },
17
+ // 是否显示标题
18
+ titleShow: {
19
+ type: Boolean,
20
+ value: true
21
+ },
22
+ // 高
23
+ height: {
24
+ type: String,
25
+ value: "300px"
26
+ },
27
+ // 背景色
28
+ backColor: {
29
+ type: String,
30
+ value: "#fff"
31
+ },
32
+ borderRadius: {
33
+ type: String,
34
+ value: "25px"
35
+ }
36
+ },
37
+ /**
38
+ * 组件的初始数据
39
+ */
40
+ data: {
41
+ resourceUrl: config.resourceUrl + "/images",
42
+ // 是否显示
43
+ closeModel: false
44
+ },
45
+ /**
46
+ * 组件的方法列表
47
+ */
48
+ methods: {
49
+ closePopup() {
50
+ this.triggerEvent("close", null, {});
51
+ }
52
+ }
53
+ });
@@ -1,5 +1,5 @@
1
- <view class="auth-mask-box" wx:if="{{ show }}"></view>
2
- <view class="auth-mask-popup" wx:if="{{ show }}" style="height: {{ height }}; background-color: {{ backColor }};">
1
+ <view class="auth-mask-box" wx:if="{{ show }}" bind:tap="closePopup"></view>
2
+ <view class="auth-mask-popup" wx:if="{{ show }}" style="height: {{ height }}; background-color: {{ backColor }};border-top-left-radius: {{ borderRadius }};border-top-right-radius: {{ borderRadius }};width: 100%;">
3
3
  <view class="popup-title" titleShow="{{ titleShow }}">
4
4
  {{ title }}
5
5
  <image mode="widthFix" src="{{ resourceUrl + '/icon_image/close_circle2x.png' }}" class="close-icon" bind:tap="closePopup"></image>
@@ -1 +1 @@
1
- .auth-mask-box{position:fixed;left:0;top:0;bottom:0;right:0;width:100%;background-color:rgba(0,0,0,.5);z-index:99999}.auth-mask-popup{position:fixed;bottom:0;left:0;border-top-left-radius:25px;border-top-right-radius:25px;padding:10px 4% 30px 4%;width:92%;z-index:99999}.auth-mask-popup .popup-title{color:#333;font-size:14px;padding:10px 0;font-weight:bold;display:flex;align-items:center;justify-content:space-between}.auth-mask-popup .popup-title .close-icon{width:20px}
1
+ .auth-mask-box{position:fixed;left:0;top:0;bottom:0;right:0;width:100%;background-color:rgba(0,0,0,.5);z-index:99999}.auth-mask-popup{position:fixed;bottom:0;left:0;padding:10px 0 30px 0;width:92%;z-index:99999}.auth-mask-popup .popup-title{color:#333;font-size:14px;padding:10px 0;font-weight:bold;display:flex;align-items:center;justify-content:space-between}.auth-mask-popup .popup-title .close-icon{width:20px}
@@ -1 +1,60 @@
1
- "use strict";const e=require("../../../utils/config.js");Component({properties:{placeholder:{type:String,value:""},disabled:{type:Boolean,value:!1},isSearchBtn:{type:Boolean,value:!1},likeName:{type:String,value:""},backColor:{type:String,value:"#fff"},searchStyle:{type:String,value:""},focus:{type:Boolean,value:!1}},data:{resourceUrl:e.config.resourceUrl+"/images"},methods:{handleInput(e){const{value:t}=e.detail;this.triggerEvent("handleSearch",t)},handleTap(){this.triggerEvent("click")}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ placeholder: {
8
+ type: String,
9
+ value: ""
10
+ },
11
+ disabled: {
12
+ type: Boolean,
13
+ value: false
14
+ },
15
+ // 是否显示右侧内容
16
+ isSearchBtn: {
17
+ type: Boolean,
18
+ value: false
19
+ },
20
+ // value值
21
+ likeName: {
22
+ type: String,
23
+ value: ""
24
+ },
25
+ // 背景色
26
+ backColor: {
27
+ type: String,
28
+ value: "#fff"
29
+ },
30
+ // 是否有阴影
31
+ searchStyle: {
32
+ type: String,
33
+ value: ""
34
+ },
35
+ // 是否聚焦
36
+ focus: {
37
+ type: Boolean,
38
+ value: false
39
+ }
40
+ },
41
+ /**
42
+ * 组件的初始数据
43
+ */
44
+ data: {
45
+ resourceUrl: config.resourceUrl + "/images"
46
+ },
47
+ /**
48
+ * 组件的方法列表
49
+ */
50
+ methods: {
51
+ handleInput(e) {
52
+ const { value } = e.detail;
53
+ this.triggerEvent("handleSearch", value);
54
+ },
55
+ // 一般用于点击搜索框跳转到搜索页
56
+ handleTap() {
57
+ this.triggerEvent("click");
58
+ }
59
+ }
60
+ });
@@ -1 +1,49 @@
1
- "use strict";const e=require("../../../utils/config.js"),t=require("../../../utils/common.js");Component({properties:{title:{type:String,value:""},isLeftIcon:{type:Boolean,value:!0}},data:{resourceUrl:e.config.resourceUrl+"/images",style:{height:t.getHeight().MenuButtonBottom-t.getHeight().MenuButtonTop,titlePaddingTop:t.getHeight().MenuButtonBounding/10,paddingTop:t.getHeight().MenuButtonTop,pageScrollTop:0,buttonWidth:t.getHeight().MenuButtonWidth,color:""}},methods:{handleBack(){this.triggerEvent("eventBackTo")}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "../../../utils/config.js";
2
+ import { getHeight } from "../../../utils/common.js";
3
+ Component({
4
+ /**
5
+ * 组件的属性列表
6
+ */
7
+ properties: {
8
+ // 标题
9
+ title: {
10
+ type: String,
11
+ value: ""
12
+ },
13
+ // 左侧icon图标 跳转到查看消息页面
14
+ isLeftIcon: {
15
+ type: Boolean,
16
+ value: true
17
+ }
18
+ },
19
+ /**
20
+ * 组件的初始数据
21
+ */
22
+ data: {
23
+ resourceUrl: config.resourceUrl + "/images",
24
+ // 样式控制对象
25
+ style: {
26
+ // 导航栏的高度
27
+ height: getHeight().MenuButtonBottom - getHeight().MenuButtonTop,
28
+ // 标题顶部内边距
29
+ titlePaddingTop: getHeight().MenuButtonBounding / 10,
30
+ // 导航栏顶部内边距
31
+ paddingTop: getHeight().MenuButtonTop,
32
+ // 存储当前页面滚动的高度
33
+ pageScrollTop: 0,
34
+ // 胶囊球的宽度
35
+ buttonWidth: getHeight().MenuButtonWidth,
36
+ // 背景色
37
+ color: ""
38
+ }
39
+ },
40
+ /**
41
+ * 组件的方法列表
42
+ */
43
+ methods: {
44
+ // 返回
45
+ handleBack() {
46
+ this.triggerEvent("eventBackTo");
47
+ }
48
+ }
49
+ });
@@ -1 +1,105 @@
1
- "use strict";const e=require("../../utils/auth.js"),t=require("../../utils/config.js");Component({properties:{show:{type:Boolean,value:!1,observer(){this.setData({isShow:this.properties.show})}}},data:{resourceUrl:t.config.resourceUrl+"/images",avatar:t.config.resourceUrl+"/images/components/gray_head2x.png",isShow:!1,isCheckBox:!1,nameValue:"",isValidate:!1},methods:{onClose:function(){this.setData({isShow:!1}),this.triggerEvent("close",this.data.isShow)},onChange:function(){this.data.isCheckBox=!this.data.isCheckBox;let e=this.validate();this.setData({isCheckBox:this.data.isCheckBox,isValidate:e.validate})},onLogin:function(){let e=this.validate();e.validate||wx.showToast({icon:"error",title:e.message,duration:2e3})},onChooseAvatar:function(e){const{avatarUrl:t}=e.detail;this.setData({avatar:t})},wxPhoneLogin:function(t){"getPhoneNumber:ok"===t.detail.errMsg&&e.auth.phoneCodeLogin(t.detail.code,this.data.nameValue).then(e=>{e.status&&(this.triggerEvent("status",e.status),this.onClose())})},bindKeyInput:function(e){var t;this.data.nameValue=null==(t=e.detail)?void 0:t.value;let a=this.validate();this.setData({nameValue:this.data.nameValue,isValidate:a.validate})},validate(){return this.data.isCheckBox?this.data.nameValue?{validate:!0,message:""}:{validate:!1,message:"请输入姓名"}:{validate:!1,message:"是否已阅读协议"}},goInfo(e){var t;const a=null==(t=e.currentTarget)?void 0:t.id;"0"==a?wx.navigateTo({url:"/pages/cms/agreement/index"}):"1"==a&&wx.navigateTo({url:"/pages/cms/policy/index"})}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { auth } from "../../utils/auth.js";
2
+ import { config } from "../../utils/config.js";
3
+ Component({
4
+ /**
5
+ * 组件的属性列表
6
+ */
7
+ properties: {
8
+ show: {
9
+ type: Boolean,
10
+ value: false,
11
+ observer() {
12
+ this.setData({
13
+ isShow: this.properties.show
14
+ });
15
+ }
16
+ }
17
+ },
18
+ /**
19
+ * 组件的初始数据
20
+ */
21
+ data: {
22
+ resourceUrl: config.resourceUrl + "/images",
23
+ avatar: config.resourceUrl + "/images/components/gray_head2x.png",
24
+ isShow: false,
25
+ // 是否勾选协议
26
+ isCheckBox: false,
27
+ // 微信姓名
28
+ nameValue: "",
29
+ // 检验是否通过
30
+ isValidate: false
31
+ },
32
+ /**
33
+ * 组件的方法列表
34
+ */
35
+ methods: {
36
+ onClose: function() {
37
+ this.setData({ isShow: false });
38
+ this.triggerEvent("close", this.data.isShow);
39
+ },
40
+ // 协议勾选方法
41
+ onChange: function() {
42
+ this.data.isCheckBox = !this.data.isCheckBox;
43
+ let res = this.validate();
44
+ this.setData({ isCheckBox: this.data.isCheckBox, isValidate: res.validate });
45
+ },
46
+ onLogin: function() {
47
+ let res = this.validate();
48
+ if (!res.validate) {
49
+ wx.showToast({
50
+ icon: "error",
51
+ title: res.message,
52
+ duration: 2e3
53
+ });
54
+ return;
55
+ }
56
+ },
57
+ // 获取微信头像
58
+ onChooseAvatar: function(e) {
59
+ const { avatarUrl } = e.detail;
60
+ this.setData({ avatar: avatarUrl });
61
+ },
62
+ // 手机号授权登录
63
+ wxPhoneLogin: function(event) {
64
+ if (event.detail.errMsg === "getPhoneNumber:ok") {
65
+ auth.phoneCodeLogin(event.detail.code, this.data.nameValue).then((resp) => {
66
+ if (resp.status) {
67
+ this.triggerEvent("status", resp.status);
68
+ this.onClose();
69
+ }
70
+ });
71
+ }
72
+ },
73
+ // 输入姓名
74
+ bindKeyInput: function(e) {
75
+ var _a;
76
+ this.data.nameValue = (_a = e.detail) == null ? void 0 : _a.value;
77
+ let res = this.validate();
78
+ this.setData({ nameValue: this.data.nameValue, isValidate: res.validate });
79
+ },
80
+ // 校验
81
+ validate() {
82
+ if (!this.data.isCheckBox) {
83
+ return { validate: false, message: "是否已阅读协议" };
84
+ }
85
+ if (!this.data.nameValue) {
86
+ return { validate: false, message: "请输入姓名" };
87
+ }
88
+ return { validate: true, message: "" };
89
+ },
90
+ // 跳转隐私协议
91
+ goInfo(e) {
92
+ var _a;
93
+ const id = (_a = e.currentTarget) == null ? void 0 : _a.id;
94
+ if (id == "0") {
95
+ wx.navigateTo({
96
+ url: "/pages/cms/agreement/index"
97
+ });
98
+ } else if (id == "1") {
99
+ wx.navigateTo({
100
+ url: "/pages/cms/policy/index"
101
+ });
102
+ }
103
+ }
104
+ }
105
+ });