You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.4 KiB
66 lines
1.4 KiB
import { urlPrefix, ossAK, ossHost } from '../../config/index';
|
|
import Toast, { hideToast } from 'tdesign-miniprogram/toast/index';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
confirmBtn: { content: '知道了', variant: 'base' },
|
|
showContentOnly: false,
|
|
dialog_conent: '',
|
|
prompt: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
|
|
},
|
|
onShow() {
|
|
|
|
},
|
|
|
|
//提示词输入框监听输入
|
|
promptChangeHandle(e) {
|
|
this.setData({
|
|
prompt: e.detail.value
|
|
});
|
|
},
|
|
|
|
generateHandle(e) {
|
|
let that = this;
|
|
Toast({
|
|
context: this,
|
|
selector: '#t-toast',
|
|
message: '生成中...',
|
|
theme: 'loading',
|
|
direction: 'column',
|
|
duration: -1
|
|
});
|
|
wx.request({
|
|
url: urlPrefix + '/QingLong/HuiYa/wxWenToMusic',
|
|
method: "POST",
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
token: wx.getStorageSync('token'),
|
|
prompt: this.data.prompt
|
|
},
|
|
success(res) {
|
|
hideToast({
|
|
context: that,
|
|
selector: '#t-toast',
|
|
});
|
|
that.setData({ showContentOnly: true, dialog_conent: res.data.message })
|
|
}
|
|
});
|
|
},
|
|
closeDialog() {
|
|
this.setData({ showContentOnly: false });
|
|
}
|
|
})
|
|
|