Files
gxtyzx-uniapp/dist/dev/mp-weixin/package/teacher/detail.js
T

203 lines
5.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_booking_course_index = require("../../api/booking/course/index.js");
const store_modules_car = require("../../store/modules/car.js");
store_modules_car.useCarStore();
const _sfc_main = {
data() {
return {
id: 0,
// 课程信息
course: {},
// 课程相册
photo: [],
isLogin: false,
disabled: true,
options: [
{
icon: "headphones",
text: "客服"
},
{
icon: "redo",
text: "分享"
}
],
buttonGroup: [
{
text: "立即报名",
backgroundColor: "linear-gradient(90deg, #FE6035, #EF1224)",
color: "#fff"
}
],
radio2: 0,
sex: [
{
text: "幼儿基础班(10次课,10天连续上课)",
value: 0
},
{
text: "少年基础班(10次课,10天连续上课)",
value: 1
},
{
text: "少年基础班(10次课,10天连续上课)",
value: 2
},
{
text: "成人基础班(10次课,10天连续上课)",
value: 3
}
],
teacher: [
{
text: "姚教练",
value: 0
}
],
student: [
{
text: "全红婵",
value: 0
},
{
text: "新增",
value: 99
}
]
};
},
onLoad(option) {
this.id = option.id;
this.reload();
},
onShow() {
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
this.isLogin = true;
}
},
methods: {
async reload() {
const app = this;
Promise.all([app.getCourse()]).then((res) => {
const course = res[0];
app.course = course;
common_vendor.index.setNavigationBarTitle({
title: course.courseName
});
if (course.files) {
app.photo = JSON.parse(course.files);
}
});
},
getCourse() {
return new Promise((resolve, reject) => {
api_booking_course_index.getCourse(this.id).then((result) => {
resolve(result);
}).catch(reject);
});
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
common_vendor.index.navigateTo({
url
});
},
openBookingTel() {
this.$refs.popup.open("bottom");
},
closeBookingTel() {
this.$refs.popup.close();
},
callPhone(phone) {
common_vendor.index.makePhoneCall({
phoneNumber: phone
});
},
onMap() {
common_vendor.index.getLocation({
type: "gcj02",
//返回可以用于uni.openLocation的经纬度
success: function(res) {
console.log("返回可以用于uni.openLocation的经纬度: ", res);
const latitude = this.course.latitude;
const longitude = this.course.longitude;
common_vendor.index.openLocation({
latitude,
longitude,
success: function() {
console.log("success");
}
});
}
});
},
save() {
if (!this.disabled) {
common_vendor.index.showToast({
title: "请先阅读并同意订票协议",
icon: "none"
});
return false;
}
common_vendor.index.navigateTo({
url: "/package/course/checkout?id=" + this.id
});
}
}
};
if (!Array) {
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
const _easycom_uv_text2 = common_vendor.resolveComponent("uv-text");
const _easycom_uv_empty2 = common_vendor.resolveComponent("uv-empty");
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
(_easycom_uv_avatar2 + _easycom_uv_text2 + _easycom_uv_empty2 + _easycom_uv_gap2 + _easycom_uni_card2)();
}
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
const _easycom_uv_text = () => "../../uni_modules/uv-text/components/uv-text/uv-text.js";
const _easycom_uv_empty = () => "../../uni_modules/uv-empty/components/uv-empty/uv-empty.js";
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
if (!Math) {
(_easycom_uv_avatar + _easycom_uv_text + _easycom_uv_empty + _easycom_uv_gap + _easycom_uni_card)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
src: "https://oss.wsdns.cn/20240608/1de5f5c694de4e339957be8013ca1ab9.jpeg",
size: "100"
}),
b: common_vendor.p({
text: "游泳教练",
align: "center",
size: "16"
}),
c: common_vendor.p({
text: "游泳企事业800",
type: "warning",
size: "12"
}),
d: $data.course.content,
e: common_vendor.p({
icon: "https://cdn.uviewui.com/uview/empty/car.png"
}),
f: common_vendor.p({
height: "50"
}),
g: common_vendor.p({
title: "教练简介",
["is-shadow"]: false,
border: false,
padding: 0
}),
h: common_vendor.p({
height: "80"
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-82126e57"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/teacher/detail.vue"]]);
wx.createPage(MiniProgramPage);