Files
tk-mini-program/unpackage/dist/dev/mp-weixin/NewAddedPk.js
pengxiaolong 6ca66f45d4 首页列表
2025-05-22 16:21:07 +08:00

196 lines
6.6 KiB
JavaScript

"use strict";
const common_vendor = require("./common/vendor.js");
const components_NationalDictionary = require("./components/NationalDictionary.js");
const components_request = require("./components/request.js");
const common_assets = require("./common/assets.js");
const _sfc_main = {
data() {
return {
genders: "",
//性别
Gender: [
{ label: "男", value: 1 },
{ label: "女", value: 2 }
],
Country: components_NationalDictionary.optionsArray,
countrys: "",
//国家
nameAnchor: "",
//主播名称
numberCoins: "",
//金币数量
remarks: "",
//备注
Display: false,
Hint: false,
datetimesingle: "",
//日期
id: null
//用户id
};
},
onLoad() {
common_vendor.index.getStorage({
key: "userinfo",
success: (res) => {
this.id = res.data.id;
}
});
},
methods: {
gender(item) {
this.genders = item.value;
common_vendor.index.__f__("log", "at pages/NewAddedPk/NewAddedPk.vue:115", item);
},
country(item) {
this.countrys = item.value;
common_vendor.index.__f__("log", "at pages/NewAddedPk/NewAddedPk.vue:120", item);
},
handleOverlayClick(event) {
if (event.target === this.$el) {
this.Display = false;
this.Hint = false;
}
},
open() {
if (this.Display) {
this.Display = false;
this.Hint = false;
this.nameAnchor = "";
this.genders = "";
this.numberCoins = "";
this.remarks = "";
this.datetimesingle = "";
this.countrys = "";
} else {
this.Display = true;
}
},
//获取主播名称
NameAnchor: function(event) {
this.nameAnchor = event.target.value;
},
async Publish() {
if (this.nameAnchor === "" || this.genders === "" || this.numberCoins === "" || this.countrys === "" || this.datetimesingle === "") {
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}`);
}
this.datetimesingle = Math.floor(timestamp / 1e3);
common_vendor.index.showLoading({
title: "发布中...",
mask: true
});
const res = await components_request.request({
url: "pk/addPkData",
method: "POST",
data: {
anchorId: this.nameAnchor,
pk_time: this.datetimesingle,
sex: this.genders,
country: this.countrys,
coin: this.numberCoins,
remark: this.remarks,
status: 0,
sender_id: this.id,
anchorIcon: ""
},
userInfo: true
});
if (res.code === 200) {
this.Display = false;
this.Hint = false;
this.nameAnchor = "";
this.genders = "";
this.numberCoins = "";
this.remarks = "";
this.datetimesingle = "";
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
});
}
}
}
};
if (!Array) {
const _easycom_wht_select2 = common_vendor.resolveComponent("wht-select");
const _easycom_uni_number_box2 = common_vendor.resolveComponent("uni-number-box");
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
(_easycom_wht_select2 + _easycom_uni_number_box2 + _easycom_uni_datetime_picker2 + _easycom_uni_easyinput2)();
}
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";
const _easycom_uni_datetime_picker = () => "./uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
const _easycom_uni_easyinput = () => "./uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
if (!Math) {
(_easycom_wht_select + _easycom_uni_number_box + _easycom_uni_datetime_picker + _easycom_uni_easyinput)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.Display
}, $data.Display ? common_vendor.e({
b: common_vendor.o$1(($event) => $options.open()),
c: common_assets._imports_0$5,
d: common_vendor.o$1((...args) => $options.NameAnchor && $options.NameAnchor(...args)),
e: $data.nameAnchor === "" && $data.Hint === true
}, $data.nameAnchor === "" && $data.Hint === true ? {} : {}, {
f: common_vendor.o$1($options.gender),
g: common_vendor.p({
options: $data.Gender,
placeholder: "性别"
}),
h: $data.genders === "" && $data.Hint === true
}, $data.genders === "" && $data.Hint === true ? {} : {}, {
i: common_vendor.o$1($options.country),
j: common_vendor.p({
options: $data.Country,
filterable: true,
placeholder: "请选择国家"
}),
k: $data.countrys === "" && $data.Hint === true
}, $data.countrys === "" && $data.Hint === true ? {} : {}, {
l: common_vendor.o$1(($event) => $data.numberCoins = $event),
m: common_vendor.p({
modelValue: $data.numberCoins
}),
n: $data.numberCoins === "" && $data.Hint === true
}, $data.numberCoins === "" && $data.Hint === true ? {} : {}, {
o: common_vendor.o$1(_ctx.changeLog),
p: common_vendor.o$1(($event) => $data.datetimesingle = $event),
q: common_vendor.p({
type: "datetime",
modelValue: $data.datetimesingle
}),
r: $data.datetimesingle === "" && $data.Hint === true
}, $data.datetimesingle === "" && $data.Hint === true ? {} : {}, {
s: common_vendor.o$1(($event) => $data.remarks = $event),
t: common_vendor.p({
type: "textarea",
placeholder: "备注",
modelValue: $data.remarks
}),
v: common_vendor.o$1(($event) => $options.Publish()),
w: common_vendor.o$1(() => {
}),
x: common_vendor.o$1(($event) => $options.open())
}) : {});
}
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