230 lines
7.0 KiB
JavaScript
230 lines
7.0 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 _sfc_main = {
|
|
data() {
|
|
return {
|
|
genders: 0,
|
|
//性别
|
|
Gender: [
|
|
{ label: "男", value: 1 },
|
|
{ label: "女", value: 2 }
|
|
],
|
|
Country: components_NationalDictionary.optionsArray,
|
|
countrys: "",
|
|
//国家
|
|
nameAnchor: "",
|
|
//主播名称
|
|
Display: false,
|
|
Hint: false,
|
|
id: null,
|
|
//用户id
|
|
filterable: true,
|
|
//是否可搜索
|
|
AnchorProfilePicture: "",
|
|
//主播头像
|
|
uid: null
|
|
//用户id
|
|
};
|
|
},
|
|
props: {
|
|
message: {
|
|
type: Object
|
|
}
|
|
},
|
|
watch: {
|
|
message(newQuestion, oldQuestion) {
|
|
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/modifyStreamer/modifyStreamer.vue:131", newQuestion);
|
|
this.id = newQuestion.id;
|
|
this.nameAnchor = newQuestion.anchorId;
|
|
this.genders = newQuestion.gender;
|
|
this.AnchorProfilePicture = newQuestion.headerIcon.split("/").pop();
|
|
this.countrys = newQuestion.country;
|
|
}
|
|
},
|
|
mounted() {
|
|
common_vendor.index.getStorage({
|
|
key: "userinfo",
|
|
success: (res) => {
|
|
this.uid = res.data.id;
|
|
}
|
|
});
|
|
},
|
|
methods: {
|
|
//性别
|
|
gender(item) {
|
|
this.genders = item.value;
|
|
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/modifyStreamer/modifyStreamer.vue:151", item);
|
|
},
|
|
//国家
|
|
country(item) {
|
|
this.countrys = item.value;
|
|
common_vendor.index.__f__("log", "at pages/Mine/minecomponents/modifyStreamer/modifyStreamer.vue:156", 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 = 0;
|
|
this.countrys = "";
|
|
} else {
|
|
this.Display = true;
|
|
}
|
|
},
|
|
//获取主播名称以及头像地址
|
|
blur(event) {
|
|
if (this.nameAnchor !== event.target.value) {
|
|
this.nameAnchor = event.target.value;
|
|
common_vendor.index.showLoading({
|
|
title: "正在验证主播",
|
|
mask: true
|
|
});
|
|
common_vendor.index.request({
|
|
url: "https://python.yolojt.com/api/" + this.nameAnchor,
|
|
success: (res) => {
|
|
if (res.data.code === 200) {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "查询成功",
|
|
icon: "none",
|
|
duration: 3e3
|
|
});
|
|
this.AnchorProfilePicture = res.data.data;
|
|
} else {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "未查询到该主播",
|
|
icon: "none",
|
|
duration: 3e3
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "网络请求失败",
|
|
icon: "none",
|
|
duration: 3e3
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
return;
|
|
}
|
|
},
|
|
async Publish() {
|
|
if (this.nameAnchor === "" || this.genders === 0 || this.countrys === "" || this.AnchorProfilePicture === "") {
|
|
this.Hint = true;
|
|
return;
|
|
}
|
|
common_vendor.index.showLoading({
|
|
title: "修改中...",
|
|
mask: true
|
|
});
|
|
await components_request.request({
|
|
url: "anchor/updateAnchorInfo",
|
|
method: "POST",
|
|
data: {
|
|
id: this.id,
|
|
anchorId: this.nameAnchor,
|
|
headerIcon: this.AnchorProfilePicture,
|
|
gender: this.genders,
|
|
country: this.countrys,
|
|
createUserId: this.uid
|
|
},
|
|
userInfo: true
|
|
}).then((res) => {
|
|
if (res.code === 200) {
|
|
this.Display = false;
|
|
this.Hint = false;
|
|
this.nameAnchor = "";
|
|
this.genders = 0;
|
|
this.AnchorProfilePicture = "";
|
|
this.country = "";
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "修改成功",
|
|
icon: "success",
|
|
duration: 2e3
|
|
});
|
|
this.$emit("Refresh");
|
|
} else {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
title: "修改失败" + res.msg,
|
|
icon: "none",
|
|
duration: 2e3
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_wht_select2 = common_vendor.resolveComponent("wht-select");
|
|
_easycom_wht_select2();
|
|
}
|
|
const _easycom_wht_select = () => "../../../../uni_modules/wht-select/components/wht-select/wht-select.js";
|
|
if (!Math) {
|
|
_easycom_wht_select();
|
|
}
|
|
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_vendor.o$1((...args) => _ctx.NameAnchor && _ctx.NameAnchor(...args)),
|
|
d: common_vendor.o$1((...args) => $options.blur && $options.blur(...args)),
|
|
e: $data.nameAnchor,
|
|
f: $data.nameAnchor === "" && $data.Hint === true
|
|
}, $data.nameAnchor === "" && $data.Hint === true ? {} : {}, {
|
|
g: common_vendor.o$1($options.country),
|
|
h: common_vendor.p({
|
|
backgroundColor: "#ffffff",
|
|
placeholderColor: "#666666",
|
|
textColor: "#666666",
|
|
borderColor: "#ffffff",
|
|
options: $data.Country,
|
|
filterable: $data.filterable,
|
|
placeholder: "请选择国家",
|
|
value: $data.countrys
|
|
}),
|
|
i: $data.countrys === "" && $data.Hint === true
|
|
}, $data.countrys === "" && $data.Hint === true ? {} : {}, {
|
|
j: common_vendor.o$1($options.gender),
|
|
k: common_vendor.p({
|
|
backgroundColor: "#ffffff",
|
|
placeholderColor: "#666666",
|
|
textColor: "#666666",
|
|
borderColor: "#ffffff",
|
|
options: $data.Gender,
|
|
placeholder: "性别",
|
|
value: $data.genders
|
|
}),
|
|
l: $data.genders === 0
|
|
}, $data.genders === 0 ? {} : {}, {
|
|
m: $data.genders === 1
|
|
}, $data.genders === 1 ? {} : {}, {
|
|
n: $data.genders === 2
|
|
}, $data.genders === 2 ? {} : {}, {
|
|
o: $data.genders === 0 && $data.Hint === true
|
|
}, $data.genders === 0 && $data.Hint === true ? {} : {}, {
|
|
p: common_vendor.o$1(($event) => $options.Publish()),
|
|
q: common_vendor.o$1(() => {
|
|
}),
|
|
r: common_vendor.n($data.Display ? "create-module" : "close-animation "),
|
|
s: common_vendor.o$1(($event) => $options.open())
|
|
}) : {});
|
|
}
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ad97bf06"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/pages/Mine/minecomponents/modifyStreamer/modifyStreamer.js.map
|