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.
122 lines
2.3 KiB
122 lines
2.3 KiB
1 year ago
|
import { urlPrefix, ossAK, ossHost } from '../../config/index';
|
||
|
import Toast, { hideToast } from 'tdesign-miniprogram/toast/index';
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
prompt: '',
|
||
|
typeValue: '1',
|
||
|
typeOptions: [
|
||
|
{
|
||
|
value: '1',
|
||
|
label: '小红书',
|
||
|
},
|
||
|
{
|
||
|
value: '2',
|
||
|
label: '微信朋友圈',
|
||
|
}
|
||
|
],
|
||
|
wordValue: '100',
|
||
|
wordOptions: [
|
||
|
{
|
||
|
value: '100',
|
||
|
label: '100字',
|
||
|
},
|
||
|
{
|
||
|
value: '150',
|
||
|
label: '150字',
|
||
|
},
|
||
|
{
|
||
|
value: '200',
|
||
|
label: '200字',
|
||
|
},
|
||
|
{
|
||
|
value: '250',
|
||
|
label: '250字',
|
||
|
},
|
||
|
{
|
||
|
value: '300',
|
||
|
label: '300字',
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(options) {
|
||
|
|
||
|
},
|
||
|
onShow() {
|
||
|
|
||
|
},
|
||
|
|
||
|
//提示词输入框监听输入
|
||
|
promptChangeHandle(e) {
|
||
|
this.setData({
|
||
|
prompt: e.detail.value
|
||
|
});
|
||
|
},
|
||
|
|
||
|
typeChange(e) {
|
||
|
this.setData({
|
||
|
'typeValue': e.detail.value,
|
||
|
});
|
||
|
},
|
||
|
|
||
|
wordChange(e) {
|
||
|
this.setData({
|
||
|
'wordValue': e.detail.value,
|
||
|
});
|
||
|
},
|
||
|
|
||
|
generateHandle(e) {
|
||
|
let that = this;
|
||
|
Toast({
|
||
|
context: this,
|
||
|
selector: '#t-toast',
|
||
|
message: '生成中...',
|
||
|
theme: 'loading',
|
||
|
direction: 'column',
|
||
|
duration: -1
|
||
|
});
|
||
|
wx.setStorageSync('txt_type_id', this.data.typeValue);
|
||
|
wx.setStorageSync('txt_word_count', this.data.wordValue);
|
||
|
wx.setStorageSync('txt_prompt', this.data.prompt);
|
||
|
wx.request({
|
||
|
url: urlPrefix + '/QingLong/HuiYa/wxWenToWen',
|
||
|
method: "POST",
|
||
|
header: {
|
||
|
'content-type': 'application/x-www-form-urlencoded'
|
||
|
},
|
||
|
data: {
|
||
|
token: wx.getStorageSync('token'),
|
||
|
prompt: this.data.prompt,
|
||
|
limit: this.data.wordValue,
|
||
|
platform_id: this.data.typeValue
|
||
|
},
|
||
|
success(res) {
|
||
|
wx.setStorageSync('txt_message', res.data.message);
|
||
|
hideToast({
|
||
|
context: that,
|
||
|
selector: '#t-toast',
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
|
||
|
toast_close(e) {
|
||
|
wx.navigateTo({
|
||
|
url: '/pages/text_res/index',
|
||
|
});
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
})
|
||
|
|