first commit
This commit is contained in:
182
pages/extract/extract.js
Normal file
182
pages/extract/extract.js
Normal file
@@ -0,0 +1,182 @@
|
||||
var util = require('../../utils/util.js'); // 确保你有这样一个文件
|
||||
|
||||
var e = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
text: "",
|
||||
type: "",
|
||||
wxid: "",
|
||||
alias: "",
|
||||
uuid: "",
|
||||
openid: ""
|
||||
},
|
||||
onLoad: function(e) {
|
||||
wx.showShareMenu({
|
||||
withShareTicket: !0,
|
||||
menus: [ "shareAppMessage", "shareTimeline" ]
|
||||
}), this.setData({
|
||||
text: decodeURIComponent(e.text),
|
||||
type: decodeURIComponent(e.type) || "",
|
||||
wxid: decodeURIComponent(e.wxid) || "",
|
||||
alias: decodeURIComponent(e.alias) || ""
|
||||
});
|
||||
},
|
||||
copyText: function() {
|
||||
wx.setClipboardData({
|
||||
success: function() {
|
||||
wx.showToast({
|
||||
title: "复制成功",
|
||||
duration: 1200
|
||||
});
|
||||
},
|
||||
data: this.data.text
|
||||
});
|
||||
},
|
||||
onAdClick: function() {
|
||||
e.广告();
|
||||
},
|
||||
rewriteText: function() {
|
||||
if (console.log(wx.getStorageSync("defaultDailyFreeParseNum")), wx.getStorageSync("defaultDailyFreeParseNum") > 0 || wx.getStorageSync("isMember")) {
|
||||
var t = this;
|
||||
wx.showLoading({
|
||||
title: "ai改写中..."
|
||||
}), e.apiRequest({
|
||||
url: "/myapp/rewrite_text/",
|
||||
method: "POST",
|
||||
data: {
|
||||
text: this.data.text,
|
||||
uuid: wx.getStorageSync("uuid"),
|
||||
openid: wx.getStorageSync("openid"),
|
||||
type: this.data.type || "",
|
||||
wxid: this.data.wxid || "",
|
||||
alias: this.data.alias || ""
|
||||
},
|
||||
success: function(e) {
|
||||
wx.hideLoading(), "success" === e.data.status ? (
|
||||
t.setData({
|
||||
text: e.data.rewritten_text
|
||||
}),
|
||||
wx.showToast({
|
||||
title: "改写完成",
|
||||
icon: "success",
|
||||
duration: 2e3
|
||||
})
|
||||
) : "次数不足或不是会员" == e.data.error ? wx.showModal({
|
||||
title: "提示",
|
||||
content: "已无体验次数,前往个人中心领取或开通会员",
|
||||
confirmColor: "#00B269",
|
||||
cancelColor: "#858585",
|
||||
success: function(e) {
|
||||
e.confirm ? (console.log("确定"), wx.navigateTo({
|
||||
url: "../vip_recharge/vip_recharge?show=true"
|
||||
})) : e.cancel && console.log("取消");
|
||||
}
|
||||
}) : wx.showToast({
|
||||
title: e.data.error,
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
console.error("改写请求失败", e), wx.hideLoading(), wx.showToast({
|
||||
title: "请求出错",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
});
|
||||
} else wx.showToast({
|
||||
title: "免费次数已用完!",
|
||||
icon: "none"
|
||||
}), wx.showModal({
|
||||
title: "提示",
|
||||
content: "已无体验次数,前往个人中心领取或开通会员",
|
||||
confirmColor: "#00B269",
|
||||
cancelColor: "#858585",
|
||||
success: function(e) {
|
||||
e.confirm ? (console.log("确定"), wx.navigateTo({
|
||||
url: "../vip_recharge/vip_recharge?show=true"
|
||||
})) : e.cancel && console.log("取消");
|
||||
}
|
||||
});
|
||||
},
|
||||
saveCopywriting: function() {
|
||||
e.apiRequest({
|
||||
url: "/myapp/create_copywriting/",
|
||||
method: "POST",
|
||||
data: {
|
||||
text_content: this.data.text,
|
||||
uuid: wx.getStorageSync("uuid") || "",
|
||||
openid: wx.getStorageSync("openid") || "",
|
||||
source: this.data.type || "",
|
||||
tag: this.data.wxid || "",
|
||||
type: this.data.type || "",
|
||||
wxid: this.data.wxid || "",
|
||||
alias: this.data.alias || ""
|
||||
},
|
||||
success: function(e) {
|
||||
console.log(e);
|
||||
},
|
||||
fail: function(e) {
|
||||
console.error("请求失败:", e);
|
||||
}
|
||||
});
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {
|
||||
e.checkUpdateVersion(), wx.showLoading(), e.getUserInfo().then(function() {
|
||||
console.log("获取用户开始"), console.log("获取用户结束");
|
||||
}).catch(function(e) {
|
||||
console.error("获取用户信息失败:", e);
|
||||
}).finally(function() {
|
||||
console.log("getUserInfo调用完成");
|
||||
});
|
||||
},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: "推荐一款免费又超好用的视频文案创作工具,分享给大家一起使用",
|
||||
path: "/pages/index/index?uuid=" + wx.getStorageSync("uuid"),
|
||||
imageUrl: "/images/share.jpg",
|
||||
success: function(e) {
|
||||
wx.showToast({
|
||||
title: "分享成功",
|
||||
icon: "success",
|
||||
duration: 2e3
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
wx.showToast({
|
||||
title: "分享失败",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
onShareTimeline: function() {
|
||||
return {
|
||||
title: "推荐一款免费又超好用的视频文案创作工具,分享给大家一起使用",
|
||||
path: "/pages/index/index?uuid=" + wx.getStorageSync("uuid"),
|
||||
imageUrl: "/images/share.jpg",
|
||||
success: function(e) {
|
||||
wx.showToast({
|
||||
title: "分享成功",
|
||||
icon: "success",
|
||||
duration: 2e3
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
wx.showToast({
|
||||
title: "分享失败",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
7
pages/extract/extract.json
Normal file
7
pages/extract/extract.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "文案提取",
|
||||
"navigationBarBackgroundColor": "#222238",
|
||||
"navigationBarTextStyle": "white",
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
12
pages/extract/extract.wxml
Normal file
12
pages/extract/extract.wxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<view class="container">
|
||||
<textarea readonly class="extracted-text" maxlength="-1" placeholder="这里将显示提取的文案" value="{{text}}"></textarea>
|
||||
<view class="buttons-container">
|
||||
<button bindtap="copyText" class="action-button copy">复制文案</button>
|
||||
<button bindtap="rewriteText" class="action-button rewrite">AI改写</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="center" style="color: #fff;font-size: 12px;">文字不要超出2000字哦,否则改写失败</view>
|
||||
<view class="center">版权归视频原作者和平台所有</view>
|
||||
<!-- <view bindtap="onAdClick" class="advertisement">
|
||||
<image src="https://file.guimiaokeji.com/kecheng.png"></image>
|
||||
</view> -->
|
||||
63
pages/extract/extract.wxss
Normal file
63
pages/extract/extract.wxss
Normal file
@@ -0,0 +1,63 @@
|
||||
page {
|
||||
border-top: 1px solid hsla(0,31%,87%,.5);
|
||||
}
|
||||
|
||||
.container,page {
|
||||
background-color: #222238;
|
||||
}
|
||||
|
||||
.container {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.extracted-text {
|
||||
background-color: #333;
|
||||
border: 1px solid #333;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
height: 300px;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.buttons-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
border-radius: 25px;
|
||||
flex: 1;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.copy,.rewrite {
|
||||
background: linear-gradient(90deg,#6949bb,#4052ca);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.center {
|
||||
color: #f0f0f0;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.advertisement {
|
||||
margin: 5px 0;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.advertisement image {
|
||||
width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user