diff --git a/yudao-ui-admin/src/utils/auth.js b/yudao-ui-admin/src/utils/auth.js index 15bbf661e..ac7e4b860 100644 --- a/yudao-ui-admin/src/utils/auth.js +++ b/yudao-ui-admin/src/utils/auth.js @@ -94,3 +94,6 @@ export function setTenantId(username) { export function removeTenantId() { localStorage.removeItem(TenantIdKey) } + +export class getToken { +} diff --git a/yudao-ui-admin/src/views/mp/components/wx-msg/main.vue b/yudao-ui-admin/src/views/mp/components/wx-msg/main.vue index 850b05d27..dde473aae 100644 --- a/yudao-ui-admin/src/views/mp/components/wx-msg/main.vue +++ b/yudao-ui-admin/src/views/mp/components/wx-msg/main.vue @@ -81,7 +81,7 @@
- + 发送(S)
@@ -95,6 +95,7 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' import WxNews from '@/views/mp/components/wx-news/main.vue'; import WxLocation from '@/views/mp/components/wx-location/main.vue'; import WxMusic from '@/views/mp/components/wx-music/main.vue'; +import {getUser} from "@/api/mp/user"; export default { name: "wxMsg", @@ -110,7 +111,7 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' userId: { type: String, required: true - } + }, }, data() { return { @@ -126,17 +127,27 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' user: { // 由于微信不再提供昵称,直接使用“用户”展示 nickname: '用户', avatar: require("@/assets/images/profile.jpg"), + accountId: 0, // 公众号账号编号 }, mp: { nickname: '公众号', avatar: require("@/assets/images/wechat.png"), }, - objData:{ // 微信发送消息 - repType: 'text' + objData: { // 微信发送消息 + type: 'text', }, } }, created() { + // 获得用户信息 + getUser(this.userId).then(response => { + this.user.nickname = response.data.nickname | this.user.nickname; + this.user.avatar = response.data.avatar | this.user.avatar; + // 设置公众号账号编号 + this.objData.accountId = response.data.accountId; + }) + + // 加载消息 this.refreshChange() }, methods:{ @@ -144,7 +155,7 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' if (!this.objData) { return; } - if (this.objData.repType === 'news') { + if (this.objData.type === 'news') { this.objData.content.articles = [this.objData.content.articles[0]] this.$message({ showClose: true, @@ -157,7 +168,6 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' userId: this.userId }, { ...this.objData, - type: this.objData.repType, // content: this.objData.repContent, // TODO 芋艿:临时适配,保证可用 })).then(response => { @@ -167,7 +177,8 @@ import {getMessagePage, sendMessage} from '@/api/mp/message' this.scrollToBottom() // 重置 objData 状态 this.objData = { - repType: 'text' + type: 'text', + content: '', } }).catch(() => { this.sendLoading = false diff --git a/yudao-ui-admin/src/views/mp/components/wx-reply/main.vue b/yudao-ui-admin/src/views/mp/components/wx-reply/main.vue index a8e9cdf3b..615469faa 100644 --- a/yudao-ui-admin/src/views/mp/components/wx-reply/main.vue +++ b/yudao-ui-admin/src/views/mp/components/wx-reply/main.vue @@ -1,30 +1,36 @@