xyvcard-wechat-auth 0.0.32 → 0.0.33

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.
@@ -1,4 +1,4 @@
1
1
  <view class="auth-btn-box">
2
- <button class="btn-left" style="background-color: {{ leftBgColor }}; color: {{ leftColor }}; border-radius: {{ btnRadius }}; border: {{ leftBorder }};" bind:tap="handleLeft">{{ leftText }}</button>
3
- <button class="btn-right" style="background-color: {{ rightBgColor }}; color: {{ rightColor }}; border-radius: {{ btnRadius }}; border: {{ rightBorder }};" bind:tap="handleRight">{{ rightText }}</button>
2
+ <button class="btn-left" style="background: {{ leftBgColor }}; color: {{ leftColor }}; border-radius: {{ btnRadius }}; border: {{ leftBorder }};" bind:tap="handleLeft">{{ leftText }}</button>
3
+ <button class="btn-right" style="background: {{ rightBgColor }}; color: {{ rightColor }}; border-radius: {{ btnRadius }}; border: {{ rightBorder }};" bind:tap="handleRight">{{ rightText }}</button>
4
4
  </view>
@@ -0,0 +1,101 @@
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: "#2563EB"
25
+ },
26
+ // 左侧按钮字体颜色
27
+ leftColor: {
28
+ type: String,
29
+ value: ""
30
+ },
31
+ // 右侧按钮字体颜色
32
+ rightColor: {
33
+ type: String,
34
+ value: "#fff"
35
+ },
36
+ // 右侧按钮圆角
37
+ rightRadius: {
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
+ centerText: {
53
+ type: String,
54
+ value: ""
55
+ },
56
+ // 中间按钮背景色
57
+ centerBgColor: {
58
+ type: String,
59
+ value: ""
60
+ },
61
+ // 中间按钮字体颜色
62
+ centerColor: {
63
+ type: String,
64
+ value: ""
65
+ },
66
+ // 中间边框
67
+ centerBorder: {
68
+ type: String,
69
+ value: ""
70
+ },
71
+ // 中间按钮圆角
72
+ centerRadius: {
73
+ type: String,
74
+ value: ""
75
+ },
76
+ // 左侧按钮圆角
77
+ leftRadius: {
78
+ type: String,
79
+ value: ""
80
+ }
81
+ },
82
+ /**
83
+ * 组件的初始数据
84
+ */
85
+ data: {},
86
+ /**
87
+ * 组件的方法列表
88
+ */
89
+ methods: {
90
+ handleLeft() {
91
+ this.triggerEvent("leftbtn");
92
+ },
93
+ handleRight() {
94
+ this.triggerEvent("rightbtn");
95
+ },
96
+ // 中间按钮事件
97
+ handleCenter() {
98
+ this.triggerEvent("centerbtn");
99
+ }
100
+ }
101
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,5 @@
1
+ <view class="auth-btn-box">
2
+ <button class="btn-left" style="background: {{ leftBgColor }}; color: {{ leftColor }}; border-radius: {{ leftRadius }}; border: {{ leftBorder }};" bind:tap="handleLeft">{{ leftText }}</button>
3
+ <button class="btn-left" style="background: {{ centerBgColor }}; color: {{ centerColor }}; border-radius: {{ centerRadius }}; border: {{ centerBorder }};" bind:tap="handleCenter">{{ centerText }}</button>
4
+ <button class="btn-right" style="background: {{ rightBgColor }}; color: {{ rightColor }}; border-radius: {{ rightRadius }}; border: {{ rightBorder }};" bind:tap="handleRight">{{ rightText }}</button>
5
+ </view>
@@ -0,0 +1 @@
1
+ .auth-btn-box{display:flex;align-items:center;justify-content:space-between;width:100%}.auth-btn-box .btn-left{width:28%;margin-right:3%;height:96rpx;font-size:32rpx;line-height:96rpx}.auth-btn-box .btn-right{height:96rpx;font-size:32rpx;width:44%;line-height:96rpx}
@@ -0,0 +1,104 @@
1
+ import { config } from "../../../../utils/config.js";
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ // 背景封面上传
8
+ coverUpload: {
9
+ type: String,
10
+ value: "/icon_image/border_plus.png"
11
+ },
12
+ // 限制上传数量
13
+ limit: {
14
+ type: Number,
15
+ value: 6
16
+ }
17
+ },
18
+ /**
19
+ * 组件的初始数据
20
+ */
21
+ data: {
22
+ resourceUrl: config.resourceUrl,
23
+ baseUrl: config.baseUrl + "/v1/file/image/resize/160/160/",
24
+ imageArray: []
25
+ },
26
+ /**
27
+ * 组件的方法列表
28
+ */
29
+ methods: {
30
+ handleUploadImage() {
31
+ const that = this;
32
+ if (that.data.imageArray.length > that.data.limit - 1) {
33
+ wx.showToast({
34
+ title: "图片最多上传" + that.data.limit + "张",
35
+ icon: "none",
36
+ duration: 2e3
37
+ });
38
+ return;
39
+ }
40
+ wx.showActionSheet({
41
+ itemList: ["从相册中选择", "拍照"],
42
+ itemColor: "#486aff",
43
+ success: function(res) {
44
+ if (res.tapIndex === 0) {
45
+ that.chooseWxHeadImage("album");
46
+ } else if (res.tapIndex == 1) {
47
+ that.chooseWxHeadImage("camera");
48
+ }
49
+ }
50
+ });
51
+ },
52
+ chooseWxHeadImage(type) {
53
+ const that = this;
54
+ const token = wx.getStorageSync("token") ? "Bearer " + wx.getStorageSync("token") : "";
55
+ wx.chooseMedia({
56
+ count: that.data.limit,
57
+ sizeType: ["original", "compressed"],
58
+ sourceType: [type],
59
+ success: function(res) {
60
+ const tempFilePaths = res.tempFiles[0].tempFilePath;
61
+ wx.uploadFile({
62
+ url: config.baseUrl + "/v1/file/upload?tenant=" + config.tenant,
63
+ filePath: tempFilePaths,
64
+ header: {
65
+ "Content-Type": "multipart/form-data",
66
+ Authorization: token
67
+ },
68
+ formData: {
69
+ method: "POST"
70
+ //请求方式
71
+ },
72
+ name: "file",
73
+ success(response) {
74
+ if (response.statusCode === 200) {
75
+ const src = JSON.parse(response.data).fileSrc;
76
+ that.data.imageArray.push(src);
77
+ that.setData({
78
+ imageArray: that.data.imageArray
79
+ });
80
+ console.log(that.data.imageArray);
81
+ that.triggerEvent("imageList", that.data.imageArray);
82
+ } else {
83
+ wx.showToast({
84
+ title: "图片上传失败",
85
+ icon: "none",
86
+ duration: 2e3
87
+ });
88
+ }
89
+ }
90
+ });
91
+ }
92
+ });
93
+ },
94
+ // 删除图片
95
+ handleDel(e) {
96
+ var _a;
97
+ this.data.imageArray.splice((_a = e.currentTarget) == null ? void 0 : _a.dataset.index, 1);
98
+ this.setData({
99
+ imageArray: this.data.imageArray
100
+ });
101
+ this.triggerEvent("imageList", this.data.imageArray);
102
+ }
103
+ }
104
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,9 @@
1
+ <view class="upload-box">
2
+ <view class="upload-image" wx:for="{{ imageArray }}" wx:key="index">
3
+ <image src="{{ baseUrl + item }}" class="plus-image"></image>
4
+ <image src="{{ resourceUrl }}/icon_image/close_circle2x.png" class="delete-image" data-index="{{ index }}" bind:tap="handleDel"></image>
5
+ </view>
6
+ <view class="upload-cover" bind:tap="handleUploadImage">
7
+ <image src="{{ resourceUrl + coverUpload }}" class="plus-image"></image>
8
+ </view>
9
+ </view>
@@ -0,0 +1 @@
1
+ .upload-box{display:flex;align-items:center;flex-wrap:wrap}.upload-box .upload-image{margin:0 12rpx 30rpx 0;position:relative;width:calc(100% - 18px)/4;height:160rpx}.upload-box .upload-image .delete-image{width:40rpx;height:40rpx;position:absolute;right:-14rpx;top:-14rpx}.plus-image{width:160rpx;height:160rpx}
@@ -15,7 +15,7 @@ Component({
15
15
  type: String,
16
16
  value: ""
17
17
  },
18
- // 左侧icon图标 跳转到查看消息页面
18
+ // 是否显示左侧按钮
19
19
  isLeftIcon: {
20
20
  type: Boolean,
21
21
  value: true
@@ -1,4 +1,4 @@
1
- <view class="auth-top" style="background-color: {{ style.color }};">
1
+ <view class="auth-top" style="background: {{ style.color }};">
2
2
  <view class="auth-top-navigation" style="padding-top: {{ style.paddingTop }}px; height: {{ style.height }}px;color: {{ titleColor }}">
3
3
  <van-icon name="arrow-left" size="22px" wx:if="{{ isLeftIcon }}" color="{{ titleColor }}" bind:tap="handleBack" />
4
4
  <text class="title">{{ title }}</text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xyvcard-wechat-auth",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",