上传代码
This commit is contained in:
78
uniapp04/unpackage/dist/dev/mp-weixin/pages/talk/talk.js
vendored
Normal file
78
uniapp04/unpackage/dist/dev/mp-weixin/pages/talk/talk.js
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
userId: "",
|
||||
chatMsg: "",
|
||||
msgList: [
|
||||
{
|
||||
botContent: "商家正在积极出餐吗,请问有什么问题嘛?",
|
||||
recordId: 0,
|
||||
titleId: 0,
|
||||
userContent: "",
|
||||
userId: 0
|
||||
},
|
||||
{
|
||||
botContent: "",
|
||||
recordId: 0,
|
||||
titleId: 0,
|
||||
userContent: "不要香菜",
|
||||
userId: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
windowHeight() {
|
||||
return this.rpxTopx(common_vendor.index.getSystemInfoSync().windowHeight);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rpxTopx(px) {
|
||||
let deviceWidth = common_vendor.index.getSystemInfoSync().windowWidth;
|
||||
let rpx = 750 / deviceWidth * Number(px);
|
||||
return Math.floor(rpx);
|
||||
},
|
||||
handleSend() {
|
||||
if (!this.chatMsg || !/^\s+$/.test(this.chatMsg)) {
|
||||
let obj = {
|
||||
botContent: "",
|
||||
recordId: 0,
|
||||
titleId: 0,
|
||||
userContent: this.chatMsg,
|
||||
userId: 0
|
||||
};
|
||||
this.msgList.push(obj);
|
||||
this.chatMsg = "";
|
||||
} else {
|
||||
this.$modal.showToast("不能发送空白消息");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($data.msgList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: item.userContent != ""
|
||||
}, item.userContent != "" ? {
|
||||
b: common_vendor.t(item.userContent)
|
||||
} : {}, {
|
||||
c: item.botContent != ""
|
||||
}, item.botContent != "" ? {
|
||||
d: common_vendor.t(item.botContent)
|
||||
} : {}, {
|
||||
e: index
|
||||
});
|
||||
}),
|
||||
b: `${$options.windowHeight}rpx`,
|
||||
c: $data.scrollTop,
|
||||
d: $data.chatMsg,
|
||||
e: common_vendor.o(($event) => $data.chatMsg = $event.detail.value),
|
||||
f: common_vendor.o((...args) => $options.handleSend && $options.handleSend(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c08180ec"]]);
|
||||
wx.createPage(MiniProgramPage);
|
Reference in New Issue
Block a user