75 lines
1.6 KiB
TypeScript
75 lines
1.6 KiB
TypeScript
import { taskinfo } from "../../../utils/request"
|
|||
|
|
|
||
|
|
function createTaskId() {
|
||
|
|
return `task_${Date.now()}`
|
||
|
|
}
|
||
|
|
|
||
|
|
Page({
|
||
|
|
|
||
|
|
data: {
|
||
|
|
taskinfo: null as any,
|
||
|
|
userinfo: null,
|
||
|
|
price: 40,
|
||
|
|
start: false
|
||
|
|
},
|
||
|
|
|
||
|
|
onLoad(ops: { taskId: string }) {
|
||
|
|
this.setData({ userinfo: wx.getStorageSync('userInfo') })
|
||
|
|
taskinfo(ops.taskId).then((res: any) => {
|
||
|
|
console.log(res);
|
||
|
|
if (!res.code) {
|
||
|
|
this.setData({ taskinfo: res.data });
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
handleBack() {
|
||
|
|
wx.navigateBack({
|
||
|
|
fail: () => wx.navigateTo({ url: '/pages/aiPackage/bg/index' }),
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
handleViewScript() {
|
||
|
|
wx.showToast({ title: '展示完整文案', icon: 'none' })
|
||
|
|
},
|
||
|
|
|
||
|
|
handleGenerate() {
|
||
|
|
if (!this.data.taskinfo) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let task_no = this.data.taskinfo.task_no || '';
|
||
|
|
const detailUrl = `/pages/historyPackage/historyDetail/index?status=processing&taskId=${encodeURIComponent(task_no)}`
|
||
|
|
|
||
|
|
let userinfo = wx.getStorageSync('userinfo');
|
||
|
|
if (userinfo.diamond < this.data.price) {
|
||
|
|
wx.showModal({ title: '温馨提示', content: '余额不足' })
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.setData({ start: true })
|
||
|
|
|
||
|
|
// wx.redirectTo({ url: detailUrl })
|
||
|
|
},
|
||
|
|
|
||
|
|
handleDownload() {
|
||
|
|
// wx.showToast({ title: '开始下载', icon: 'none' })
|
||
|
|
wx.downloadFile({
|
||
|
|
url: '',
|
||
|
|
success(res) {
|
||
|
|
wx.showModal({ title: '温馨提示', content: '下载成功' })
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
handleRegenerate() {
|
||
|
|
// wx.showToast({ title: '重新生成', icon: 'none' })
|
||
|
|
},
|
||
|
|
|
||
|
|
handleHome() {
|
||
|
|
wx.switchTab({
|
||
|
|
url: '/pages/index/index',
|
||
|
|
})
|
||
|
|
},
|
||
|
|
})
|
||
|
|
|