step1.js
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"use strict";
const common_vendor = require("../../common/vendor.js");
const config = require("../../config.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = {
__name: "step1",
props: {
activity: {
type: Object,
default: () => {
}
}
},
emits: ["next"],
setup(__props, { emit }) {
const agree = common_vendor.ref(false);
function changeAgree() {
if (agree.value) {
agree.value = false;
} else {
agree.value = true;
}
}
function downLoad(url) {
console.log(url);
common_vendor.index.showLoading({
title: "下载中"
});
common_vendor.index.downloadFile({
url,
success: function(res) {
common_vendor.index.hideLoading();
console.log(res);
var filePath = res.tempFilePath;
common_vendor.index.showLoading({
title: "正在打开"
});
common_vendor.index.openDocument({
filePath,
showMenu: true,
success: function(res2) {
common_vendor.index.hideLoading();
},
fail: function(err) {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "打开失败",
icon: "none",
duration: 2e3
});
}
});
},
fail: function(error) {
console.log(error);
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: `下载失败`,
icon: "none",
duration: 2e3
});
}
});
}
function next() {
if (agree.value) {
emit("next");
} else {
common_vendor.index.showToast({
title: `请确认报名须知`,
icon: "none"
});
}
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(($event) => {
var _a, _b;
return downLoad(common_vendor.unref(config.config).trainUrl_api + ((_b = (_a = __props.activity) == null ? void 0 : _a.signNoticeAttachment) == null ? void 0 : _b.url));
}),
b: agree.value
}, agree.value ? {
c: common_vendor.p({
type: "checkbox-filled",
color: "#C5161E",
size: "20"
})
} : {
d: common_vendor.p({
type: "checkbox",
color: "#bbbbbb",
size: "20"
})
}, {
e: common_vendor.o(changeAgree),
f: common_vendor.o(next),
g: common_vendor.n(agree.value ? "btn-red" : "btn-gary")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b5bc287a"], ["__file", "/Users/yangyang/ztx_wx_minapp/training/components/step1.vue"]]);
wx.createComponent(Component);