Files
tk-mini-program/unpackage/dist/dev/mp-weixin/NewAddedPk.js

266 lines
8.8 KiB
JavaScript
Raw Normal View History

2025-05-21 17:03:19 +08:00
"use strict";
const common_vendor = require("./common/vendor.js");
const components_NationalDictionary = require("./components/NationalDictionary.js");
2025-05-21 22:52:33 +08:00
const components_request = require("./components/request.js");
2025-05-21 17:03:19 +08:00
const common_assets = require("./common/assets.js");
const _sfc_main = {
data() {
return {
2025-05-23 21:50:04 +08:00
genders: 0,
2025-05-21 22:52:33 +08:00
//性别
Gender: [
{ label: "男", value: 1 },
{ label: "女", value: 2 }
],
Country: components_NationalDictionary.optionsArray,
countrys: "",
//国家
2025-05-21 17:03:19 +08:00
nameAnchor: "",
2025-05-21 22:52:33 +08:00
//主播名称
2025-05-21 17:03:19 +08:00
numberCoins: "",
2025-05-21 22:52:33 +08:00
//金币数量
2025-06-04 22:36:28 +08:00
session: "",
//场数
2025-05-21 17:03:19 +08:00
remarks: "",
2025-05-21 22:52:33 +08:00
//备注
2025-05-21 17:03:19 +08:00
Display: false,
2025-05-21 22:52:33 +08:00
Hint: false,
datetimesingle: "",
//日期
2025-05-23 21:50:04 +08:00
id: null,
2025-05-21 22:52:33 +08:00
//用户id
2025-06-04 22:36:28 +08:00
sendingTime: "",
2025-05-23 21:50:04 +08:00
//发送时间
2025-06-06 22:36:41 +08:00
filterable: true,
2025-06-04 22:36:28 +08:00
//是否可搜索
2025-06-06 22:36:41 +08:00
AnchorProfilePicture: ""
//主播头像
2025-05-21 17:03:19 +08:00
};
},
2025-05-27 13:06:24 +08:00
mounted() {
2025-05-21 17:03:19 +08:00
common_vendor.index.getStorage({
key: "userinfo",
success: (res) => {
2025-05-21 22:52:33 +08:00
this.id = res.data.id;
2025-05-21 17:03:19 +08:00
}
});
},
methods: {
2025-05-21 22:52:33 +08:00
gender(item) {
this.genders = item.value;
2025-06-06 22:36:41 +08:00
common_vendor.index.__f__("log", "at pages/NewAddedPk/NewAddedPk.vue:177", item);
2025-05-21 22:52:33 +08:00
},
country(item) {
this.countrys = item.value;
2025-06-06 22:36:41 +08:00
common_vendor.index.__f__("log", "at pages/NewAddedPk/NewAddedPk.vue:182", item);
2025-05-21 22:52:33 +08:00
},
2025-05-21 17:03:19 +08:00
handleOverlayClick(event) {
if (event.target === this.$el) {
this.Display = false;
2025-05-21 22:52:33 +08:00
this.Hint = false;
2025-05-21 17:03:19 +08:00
}
},
open() {
if (this.Display) {
this.Display = false;
2025-05-21 22:52:33 +08:00
this.Hint = false;
this.nameAnchor = "";
2025-06-06 22:36:41 +08:00
this.genders = 0;
2025-05-21 22:52:33 +08:00
this.numberCoins = "";
this.remarks = "";
this.datetimesingle = "";
this.countrys = "";
2025-06-04 22:36:28 +08:00
this.session = "";
2025-05-21 17:03:19 +08:00
} else {
this.Display = true;
}
},
2025-06-06 22:36:41 +08:00
//获取主播名称以及头像地址
blur(event) {
if (this.nameAnchor !== event.target.value) {
this.nameAnchor = event.target.value;
common_vendor.index.request({
url: "http://47.79.98.113:6600/" + this.nameAnchor,
success: (res) => {
if (res.data.code === 200) {
this.AnchorProfilePicture = res.data.data;
} else {
common_vendor.index.showToast({
title: "主播不存在请确认主播名称",
icon: "none",
duration: 2e3
});
}
},
fail: function(res) {
common_vendor.index.__f__("log", "at pages/NewAddedPk/NewAddedPk.vue:224", "请求失败", res.data);
}
});
} else {
return;
}
2025-05-21 17:03:19 +08:00
},
2025-05-21 22:52:33 +08:00
async Publish() {
2025-06-06 22:36:41 +08:00
if (this.nameAnchor === "" || this.genders === 0 || this.numberCoins === "" || this.countrys === "" || this.datetimesingle === "" || this.session === "") {
2025-05-21 22:52:33 +08:00
this.Hint = true;
return;
}
const isoString = this.datetimesingle.replace(" ", "T");
const timestamp = Date.parse(isoString);
if (isNaN(timestamp)) {
throw new Error(`Invalid date format: ${this.datetimesingle}`);
}
2025-05-23 21:50:04 +08:00
this.sendingTime = Math.floor(timestamp / 1e3);
const secondsTimestamp = Math.floor(Date.now() / 1e3);
if (this.sendingTime < secondsTimestamp) {
common_vendor.index.showToast({
title: "日期不能早于当前时间",
icon: "none",
duration: 2e3
});
return;
}
2025-05-21 22:52:33 +08:00
common_vendor.index.showLoading({
title: "发布中...",
mask: true
});
const res = await components_request.request({
url: "pk/addPkData",
method: "POST",
data: {
anchorId: this.nameAnchor,
2025-05-27 13:06:24 +08:00
pkTime: this.sendingTime,
2025-05-21 22:52:33 +08:00
sex: this.genders,
country: this.countrys,
coin: this.numberCoins,
remark: this.remarks,
2025-05-27 13:06:24 +08:00
senderId: this.id,
2025-06-06 22:36:41 +08:00
anchorIcon: this.AnchorProfilePicture,
2025-06-04 22:36:28 +08:00
pkNumber: this.session
2025-05-21 22:52:33 +08:00
},
userInfo: true
});
if (res.code === 200) {
this.Display = false;
this.Hint = false;
this.nameAnchor = "";
2025-05-23 21:50:04 +08:00
this.genders = 0;
2025-05-21 22:52:33 +08:00
this.numberCoins = "";
this.remarks = "";
this.datetimesingle = "";
2025-06-04 22:36:28 +08:00
this.session = "";
2025-05-21 22:52:33 +08:00
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "发布成功",
icon: "success",
duration: 2e3
});
} else {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "发布失败",
icon: "none",
duration: 2e3
});
}
2025-05-21 17:03:19 +08:00
}
}
};
if (!Array) {
const _easycom_wht_select2 = common_vendor.resolveComponent("wht-select");
const _easycom_uni_number_box2 = common_vendor.resolveComponent("uni-number-box");
2025-05-21 22:52:33 +08:00
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
2025-05-21 17:03:19 +08:00
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
2025-05-21 22:52:33 +08:00
(_easycom_wht_select2 + _easycom_uni_number_box2 + _easycom_uni_datetime_picker2 + _easycom_uni_easyinput2)();
2025-05-21 17:03:19 +08:00
}
const _easycom_wht_select = () => "./uni_modules/wht-select/components/wht-select/wht-select.js";
const _easycom_uni_number_box = () => "./uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js";
2025-05-21 22:52:33 +08:00
const _easycom_uni_datetime_picker = () => "./uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
2025-05-21 17:03:19 +08:00
const _easycom_uni_easyinput = () => "./uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
if (!Math) {
2025-05-21 22:52:33 +08:00
(_easycom_wht_select + _easycom_uni_number_box + _easycom_uni_datetime_picker + _easycom_uni_easyinput)();
2025-05-21 17:03:19 +08:00
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.Display
2025-05-21 22:52:33 +08:00
}, $data.Display ? common_vendor.e({
2025-05-21 17:03:19 +08:00
b: common_vendor.o$1(($event) => $options.open()),
2025-06-05 23:50:08 +08:00
c: common_assets._imports_0$2,
2025-06-06 22:36:41 +08:00
d: common_vendor.o$1((...args) => _ctx.NameAnchor && _ctx.NameAnchor(...args)),
e: common_vendor.o$1((...args) => $options.blur && $options.blur(...args)),
f: $data.nameAnchor === "" && $data.Hint === true
2025-05-21 22:52:33 +08:00
}, $data.nameAnchor === "" && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
g: common_vendor.o$1($options.country),
h: common_vendor.p({
2025-06-03 22:12:34 +08:00
backgroundColor: "#ffffff",
2025-06-04 22:36:28 +08:00
placeholderColor: "#666666",
2025-06-03 22:12:34 +08:00
textColor: "#666666",
2025-05-23 21:50:04 +08:00
borderColor: "#ffffff",
2025-05-21 22:52:33 +08:00
options: $data.Country,
2025-06-04 22:36:28 +08:00
filterable: $data.filterable,
2025-05-21 22:52:33 +08:00
placeholder: "请选择国家"
}),
2025-06-06 22:36:41 +08:00
i: $data.countrys === "" && $data.Hint === true
2025-05-21 22:52:33 +08:00
}, $data.countrys === "" && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
j: common_vendor.o$1($options.gender),
k: common_vendor.p({
2025-06-03 22:12:34 +08:00
backgroundColor: "#ffffff",
placeholderColor: "#666666",
textColor: "#666666",
2025-05-23 21:50:04 +08:00
borderColor: "#ffffff",
options: $data.Gender,
placeholder: "性别"
}),
2025-06-06 22:36:41 +08:00
l: $data.genders === 0
2025-05-23 21:50:04 +08:00
}, $data.genders === 0 ? {
2025-06-06 22:36:41 +08:00
m: common_assets._imports_1$2
2025-05-23 21:50:04 +08:00
} : {}, {
2025-06-06 22:36:41 +08:00
n: $data.genders === 1
2025-05-23 21:50:04 +08:00
}, $data.genders === 1 ? {
2025-06-06 22:36:41 +08:00
o: common_assets._imports_2$3
2025-05-23 21:50:04 +08:00
} : {}, {
2025-06-06 22:36:41 +08:00
p: $data.genders === 2
2025-05-23 21:50:04 +08:00
}, $data.genders === 2 ? {
2025-06-06 22:36:41 +08:00
q: common_assets._imports_3$2
2025-05-23 21:50:04 +08:00
} : {}, {
2025-06-06 22:36:41 +08:00
r: $data.genders === 0 && $data.Hint === true
2025-05-23 21:50:04 +08:00
}, $data.genders === 0 && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
s: common_vendor.o$1(($event) => $data.numberCoins = $event),
t: common_vendor.p({
2025-06-03 22:12:34 +08:00
background: "#03ABA8",
2025-05-21 17:03:19 +08:00
modelValue: $data.numberCoins
}),
2025-06-06 22:36:41 +08:00
v: $data.numberCoins === "" && $data.Hint === true
2025-05-21 22:52:33 +08:00
}, $data.numberCoins === "" && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
w: common_vendor.o$1(($event) => $data.datetimesingle = $event),
x: common_vendor.p({
2025-05-21 22:52:33 +08:00
type: "datetime",
2025-05-27 21:05:01 +08:00
["hide-second"]: "true",
2025-05-21 22:52:33 +08:00
modelValue: $data.datetimesingle
}),
2025-06-06 22:36:41 +08:00
y: $data.datetimesingle === "" && $data.Hint === true
2025-05-21 22:52:33 +08:00
}, $data.datetimesingle === "" && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
z: common_vendor.o$1(($event) => $data.session = $event),
A: common_vendor.p({
2025-06-03 22:12:34 +08:00
background: "#03ABA8",
2025-06-04 22:36:28 +08:00
modelValue: $data.session
2025-05-30 22:04:45 +08:00
}),
2025-06-06 22:36:41 +08:00
B: $data.session === "" && $data.Hint === true
2025-06-04 22:36:28 +08:00
}, $data.session === "" && $data.Hint === true ? {} : {}, {
2025-06-06 22:36:41 +08:00
C: common_vendor.o$1(($event) => $data.remarks = $event),
D: common_vendor.p({
2025-05-21 17:03:19 +08:00
type: "textarea",
placeholder: "备注",
modelValue: $data.remarks
}),
2025-06-06 22:36:41 +08:00
E: common_vendor.o$1(($event) => $options.Publish()),
F: common_vendor.o$1(() => {
2025-05-21 17:03:19 +08:00
}),
2025-06-06 22:36:41 +08:00
G: common_vendor.n($data.Display ? "create-module" : "close-animation "),
H: common_vendor.o$1(($event) => $options.open())
2025-05-21 22:52:33 +08:00
}) : {});
2025-05-21 17:03:19 +08:00
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-96d38e2b"]]);
exports.MiniProgramPage = MiniProgramPage;
//# sourceMappingURL=../.sourcemap/mp-weixin/NewAddedPk.js.map