init
This commit is contained in:
286
pages/tool/shuiyin/image.vue
Normal file
286
pages/tool/shuiyin/image.vue
Normal file
@@ -0,0 +1,286 @@
|
||||
<template>
|
||||
<view class="body">
|
||||
<view v-if="adUnitId" style="width: 94%; margin-left: 3%;">
|
||||
<ad-custom :unit-id="adUnitId" ad-intervals="30" ></ad-custom>
|
||||
</view>
|
||||
<view class="contents">
|
||||
<view class="imagesContent">
|
||||
<view class="titleContent">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="图集"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="IMAGES"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="imagesContent-images">
|
||||
<u-swiper @change="imageCurrentChange" imgMode="aspectFit" height="400" :list="imagesList"
|
||||
previousMargin="30" nextMargin="30" circular :autoplay="false" radius="5" current="imageCurrent"
|
||||
indicatorMode="dot" indicator indicatorInactiveColor="#3c9cff" indicatorActiveColor="red"
|
||||
bgColor="#ffffff"></u-swiper>
|
||||
</view>
|
||||
<view class="imagesContent-buttonGroup">
|
||||
<view class="imagesContent-buttonGroup-top">
|
||||
<view class="imagesContent-buttonGroup-left">
|
||||
<u-button @click="copyImageUrl" type="primary" plain text="复制链接"></u-button>
|
||||
</view>
|
||||
<view class="imagesContent-buttonGroup-right">
|
||||
<u-button @click="download(imagesList[imageCurrent])" type="primary" text="下载单张"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="imagesContent-buttonGroup-bottom">
|
||||
<u-button @click="downloadAll" type="primary" text="下载全部"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="copywritingContent">
|
||||
<view class="titleContent">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="文案"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="TITLE"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="copywritingContent-textarea">
|
||||
<u--textarea maxlength="180" height="140" v-model="copywriting" placeholder="文案内容"></u--textarea>
|
||||
</view>
|
||||
<view class="copywritingContent-button">
|
||||
<u-button @click="copyText(copywriting)" type="primary" text="复制文案"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addNewDownloadUrl
|
||||
} from "@/api/app/index.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
adUnitId:"",
|
||||
imageCurrent: 0,
|
||||
isOpenAd: false,
|
||||
videoAd_id: "",
|
||||
imagesList: [],
|
||||
copywriting: ""
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
let _this = this;
|
||||
this.adUnitId = uni.getStorageSync("sysSet").wzinfoAd
|
||||
uni.getStorage({
|
||||
key: 'analysisData',
|
||||
success: function(res) {
|
||||
_this.imagesList = res.data.pics
|
||||
_this.copywriting = res.data.title
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
imageCurrentChange(e) {
|
||||
let _this = this;
|
||||
_this.imageCurrent = e.current
|
||||
},
|
||||
copyImageUrl() {
|
||||
let _this = this;
|
||||
// console.log(this.imageCurrent)
|
||||
_this.copyText(_this.imagesList[_this.imageCurrent])
|
||||
},
|
||||
downloadAll() {
|
||||
let _this = this;
|
||||
for (let i = 0; i < _this.imagesList.length; i++) {
|
||||
_this.download(_this.imagesList[i])
|
||||
}
|
||||
},
|
||||
download(url) {
|
||||
let _this = this;
|
||||
const downloadTask = uni.downloadFile({
|
||||
url: url.replace('http://', 'https://'), //仅为示例,并非真实的资源
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
console.log('下载成功');
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: downloadRes.tempFilePath,
|
||||
success() {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "下载成功!"
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.hideLoading();
|
||||
console.log(err)
|
||||
if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
|
||||
err
|
||||
.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err
|
||||
.errMsg ===
|
||||
"saveImageToPhotosAlbum:fail authorize no response"
|
||||
) {
|
||||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要您授权保存相册',
|
||||
showCancel: false,
|
||||
success: modalSuccess => {
|
||||
uni.openSetting({
|
||||
success(settingdata) {
|
||||
console.log(
|
||||
"settingdata",
|
||||
settingdata)
|
||||
if (settingdata
|
||||
.authSetting[
|
||||
'scope.writePhotosAlbum'
|
||||
]) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限成功,再次点击图片即可保存',
|
||||
showCancel: false,
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限失败,将无法保存到相册哦~',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(failData) {
|
||||
console.log("failData",
|
||||
failData)
|
||||
},
|
||||
complete(finishData) {
|
||||
console.log(
|
||||
"finishData",
|
||||
finishData)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
if (err.errMsg.includes("fail url not in domain list")) {
|
||||
addNewDownloadUrl(url.replace(/^https?:\/\/(.*?)(:\d+)?\/.*$/, '$1')).then(response => {}),
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '因为微信限制,下载失败,可以通过浏览器链接下载,是否复制链接自行去浏览器下载?',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
_this.copyText(url)
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '下载失败了',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
|
||||
// console.log(err)
|
||||
}
|
||||
});
|
||||
downloadTask.onProgressUpdate((downloadTaskRes) => {
|
||||
uni.showLoading({
|
||||
title: '下载进度' + downloadTaskRes.progress + '%',
|
||||
mask:true
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
copyText(text) {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: function(res) {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
});
|
||||
},
|
||||
fail() {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '复制失败了'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $u-bg-color;
|
||||
}
|
||||
|
||||
.ad-show {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.contents {
|
||||
padding: 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.imagesContent,
|
||||
.copywritingContent {
|
||||
margin-top: 30rpx;
|
||||
padding: 30rpx 20rpx;
|
||||
box-shadow: 3px 3px 4px rgba(26, 26, 26, 0.2);
|
||||
background-color: white;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.titleContent {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.title-shadow {
|
||||
position: absolute;
|
||||
bottom: -20rpx;
|
||||
font-style: italic;
|
||||
opacity: 0.4;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.imagesContent-images,
|
||||
.copywritingContent-textarea {
|
||||
padding: 0 16rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.imagesContent-buttonGroup {
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
padding-top: 30rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.imagesContent-buttonGroup-top {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.imagesContent-buttonGroup-bottom,
|
||||
.copywritingContent-button {
|
||||
padding-top: 25rpx;
|
||||
width: 100%;
|
||||
box-shadow: 3px 3px 4px rgba(0, 102, 204, 0.2);
|
||||
}
|
||||
|
||||
.imagesContent-buttonGroup-left,
|
||||
.imagesContent-buttonGroup-right {
|
||||
width: 45%;
|
||||
box-shadow: 3px 3px 4px rgba(0, 102, 204, 0.2);
|
||||
}
|
||||
</style>
|
||||
170
pages/tool/shuiyin/problem.vue
Normal file
170
pages/tool/shuiyin/problem.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<view class="body">
|
||||
<view class="course">
|
||||
<view class="course-title">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="使用教程"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="COURSE"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="course-body">
|
||||
<view class="course-body-view">
|
||||
<view class="course-body-view-title">
|
||||
<u--text size="16" :text="courseTitle1"></u--text>
|
||||
</view>
|
||||
<view class="course-body-view-contents">
|
||||
<view class="introduction-content">
|
||||
<u--text size="14" :text="courseContent1"></u--text>
|
||||
</view>
|
||||
<view class="introduction-content-images">
|
||||
<view class="introduction-content-image">
|
||||
<u--image :showLoading="true" :src="showPic1_1" width="160px" height="160px"></u--image>
|
||||
</view>
|
||||
<view class="introduction-content-image">
|
||||
<u--image :showLoading="true" :src="showPic1_2" width="160px" height="160px"></u--image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="course-body-view">
|
||||
<view class="course-body-view-title">
|
||||
<u--text size="16" :text="courseTitle2"></u--text>
|
||||
</view>
|
||||
<view class="course-body-view-contents">
|
||||
<view class="introduction-content">
|
||||
<u--text size="14" :text="courseContent2_1"></u--text>
|
||||
</view>
|
||||
<view class="introduction-content">
|
||||
<u--text size="14" :text="courseContent2_2"></u--text>
|
||||
</view>
|
||||
<view class="introduction-content">
|
||||
<u--text size="14" :text="courseContent2_3"></u--text>
|
||||
</view>
|
||||
<u--text type="error" size="14" :text="promptTitle"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="problem">
|
||||
<view class="problem-title">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="常见问题"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="PROBLEM"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="problem-body">
|
||||
<view v-for="(item,index) in proContentList" :key="index" class="problem-body-view">
|
||||
<view class="problem-body-view-title">
|
||||
<u--text size="16" :text="item.problemTitle"></u--text>
|
||||
</view>
|
||||
<view class="problem-body-view-contents">
|
||||
<view class="introduction-content">
|
||||
<u--text size="14" :text="item.problemContent"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
courseTitle1: "01 如何复制视频链接",
|
||||
courseContent1: "打开您的APP,然后点击分享,就会出现一个复制链接的选项,点击复制链接(注意:链接不要超过150字),然后来到小程序,粘贴链接再点解析就可以去水印了。",
|
||||
showPic1_1: "https://www.myazurepicture.llgulugulu.top/api/picture/getImageByte?pid=075b593ed4c9000d027a9ce83936d815",
|
||||
showPic1_2: "https://www.myazurepicture.llgulugulu.top/api/picture/getImageByte?pid=8e2e0e22653ab150c40fb1c0a12ecc56",
|
||||
courseTitle2: "02 为什么下载失败",
|
||||
courseContent2_1: "由于手机系统及微信的安全机制,视频大小不能超过10M左右,所以超过这个大小的视频,需要解析成功后,复制无水印链接到浏览器下载。",
|
||||
courseContent2_2: "1、如果您是安卓手机,直接复制无水印链接,然后任意一个浏览器打开即可。",
|
||||
courseContent2_3: "2、如果您是苹果手机,需要下载软件 documents 才能在浏览器中进行下载视频。",
|
||||
promptTitle: "温馨提示:进入下载界面请及时下载!若退出重新进入需要花费新的积分!",
|
||||
proContentList: [{
|
||||
problemTitle: "1、无法下载视频?",
|
||||
problemContent: "请先授权保存到手机相册的权限。由于手机系统及微信的安全机制,视频大小不能超过10M左右,所以超过这个大小的视频,需要解析成功后,复制无水印链接到浏览器下载。"
|
||||
},
|
||||
{
|
||||
problemTitle: "2、为什么下载视频那么慢?",
|
||||
problemContent: "有些视频比较长,或者多人同时下载,会导致下载速度缓慢,可以点击旁边的【复制链接】按钮到手机浏览器上打开即可使用手机上的网速下载。"
|
||||
},
|
||||
{
|
||||
problemTitle: "3、提示域名不合法等无法下载视频?",
|
||||
problemContent: "因为微信小程序需要配置download域名,没有配置的则不能下载(在您遇到不能下载的时候,会记录此时的域名,后续会手动加上)。可以在解析成功后点击下载按钮旁边的【复制链接】按钮,粘贴到手机浏览器打开即可下载。"
|
||||
},
|
||||
{
|
||||
problemTitle: "4、为什么视频成功解析了还有水印?",
|
||||
problemContent: "视频自带的无法去除哦,如果这个视频在该平台APP直接播放是没有水印的,解析后却有水印请联系客服。"
|
||||
},
|
||||
{
|
||||
problemTitle: "5、为什么小程序突然不能使用了,显示网络错误?",
|
||||
problemContent: "因为每天的凌晨3点到3点半,系统会进行自我维护,这段时间暂时不可用;其他时间段不能用请联系客服。"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $u-bg-color;
|
||||
}
|
||||
|
||||
.course,
|
||||
.problem {
|
||||
padding: 20rpx 20rpx 5rpx 20rpx;
|
||||
}
|
||||
|
||||
.course-title,
|
||||
.problem-title {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.title-shadow {
|
||||
position: absolute;
|
||||
bottom: -20rpx;
|
||||
font-style: italic;
|
||||
opacity: 0.4;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.course-body,
|
||||
.problem-body {
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.course-body-view,
|
||||
.problem-body-view {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.course-body-view-title,
|
||||
.problem-body-view-title {
|
||||
padding-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.introduction-content {
|
||||
padding-top: 5rpx;
|
||||
padding-bottom: 5rpx;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.introduction-content-images {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.introduction-content-image {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
421
pages/tool/shuiyin/video.vue
Normal file
421
pages/tool/shuiyin/video.vue
Normal file
@@ -0,0 +1,421 @@
|
||||
<template>
|
||||
<view class="body">
|
||||
<view v-if="adUnitId" style="width: 94%; margin-left: 3%;">
|
||||
<ad-custom :unit-id="adUnitId" ad-intervals="30" ></ad-custom>
|
||||
</view>
|
||||
<view class="contents">
|
||||
<view class="videoContent">
|
||||
<view class="titleContent">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="视频"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="VIDEO"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="videoContent-video">
|
||||
<video :src="videoUrl" class="video" @error="videoErrorCallback"></video>
|
||||
</view>
|
||||
<view class="videoContent-buttonGroup">
|
||||
<view class="videoContent-buttonGroup-left">
|
||||
<u-button @click="copyText(videoUrl)" type="primary" plain text="复制链接"></u-button>
|
||||
</view>
|
||||
<view class="videoContent-buttonGroup-right">
|
||||
<u-button @click="downloadVideo(videoUrl)" type="primary" text="保存视频"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="videoContent-problem">
|
||||
<u--text @click="showTips" align="center" type="primary" decoration="underline"
|
||||
text="下载失败?点我查看解决方案"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coverContent">
|
||||
<view class="titleContent">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="封面"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="COVER"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coverContent-image">
|
||||
<u--image radius="7" mode="widthFix" :src="coverUrl" width="100%" height="auto"></u--image>
|
||||
</view>
|
||||
<view class="coverContent-buttonGroup">
|
||||
<view class="coverContent-buttonGroup-left">
|
||||
<u-button @click="copyText(coverUrl)" type="primary" plain text="复制链接"></u-button>
|
||||
</view>
|
||||
<view class="coverContent-buttonGroup-right">
|
||||
<u-button @click="downloadImage(coverUrl)" type="primary" text="保存封面"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="copywritingContent">
|
||||
<view class="titleContent">
|
||||
<view class="title-content">
|
||||
<u--text bold size="18" color="#0081ff" text="文案"></u--text>
|
||||
</view>
|
||||
<view class="title-shadow">
|
||||
<u--text bold color="#0081ff" text="TITLE"></u--text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="copywritingContent-textarea">
|
||||
<u--textarea maxlength="180" height="140" v-model="copywriting" placeholder="文案内容"></u--textarea>
|
||||
</view>
|
||||
<view class="copywritingContent-button">
|
||||
<u-button @click="copyText(copywriting)" type="primary" text="复制文案"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// var App = require("@/common.js");
|
||||
import {
|
||||
addNewDownloadUrl
|
||||
} from "@/api/app/index.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
adUnitId:"",
|
||||
isOpenAd: false,
|
||||
videoAd_id: "",
|
||||
videoUrl: "",
|
||||
audioUrl: "",
|
||||
coverUrl: "",
|
||||
copywriting: "",
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
let _this = this;
|
||||
this.adUnitId = uni.getStorageSync("sysSet").wzinfoAd
|
||||
uni.getStorage({
|
||||
key: 'analysisData',
|
||||
success: function(res) {
|
||||
console.log(res)
|
||||
_this.videoUrl = res.data.url
|
||||
_this.coverUrl = res.data.img
|
||||
_this.copywriting = res.data.title
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
downloadImage(url) {
|
||||
let _this = this;
|
||||
const downloadTask = uni.downloadFile({
|
||||
url: url.replace('http://', 'https://'), //仅为示例,并非真实的资源
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
console.log('下载成功');
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: downloadRes.tempFilePath,
|
||||
success() {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "下载成功!"
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.hideLoading();
|
||||
if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
|
||||
err
|
||||
.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err
|
||||
.errMsg ===
|
||||
"saveImageToPhotosAlbum:fail authorize no response"
|
||||
) {
|
||||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要您授权保存相册',
|
||||
showCancel: false,
|
||||
success: modalSuccess => {
|
||||
uni.openSetting({
|
||||
success(settingdata) {
|
||||
console.log(
|
||||
"settingdata",
|
||||
settingdata)
|
||||
if (settingdata
|
||||
.authSetting[
|
||||
'scope.writePhotosAlbum'
|
||||
]) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限成功,再次点击图片即可保存',
|
||||
showCancel: false,
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限失败,将无法保存到相册哦~',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(failData) {
|
||||
console.log("failData",
|
||||
failData)
|
||||
},
|
||||
complete(finishData) {
|
||||
console.log(
|
||||
"finishData",
|
||||
finishData)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
if (err.errMsg.includes("fail url not in domain list")) {
|
||||
// App._get("/api/download/addNewDownloadUrl", {
|
||||
// url: url.replace(/^https?:\/\/(.*?)(:\d+)?\/.*$/, '$1')
|
||||
// }, res => {
|
||||
|
||||
// })
|
||||
addNewDownloadUrl(url.replace(/^https?:\/\/(.*?)(:\d+)?\/.*$/, '$1')).then(response => {}),
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '因为微信限制,下载失败,可以通过浏览器链接下载,是否复制链接自行去浏览器下载?',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
_this.copyText(url)
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '下载失败了',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
// console.log(err)
|
||||
}
|
||||
});
|
||||
downloadTask.onProgressUpdate((downloadTaskRes) => {
|
||||
uni.showLoading({
|
||||
title: '下载进度' + downloadTaskRes.progress + '%',
|
||||
mask: true
|
||||
})
|
||||
})
|
||||
},
|
||||
downloadVideo(url) {
|
||||
let _this = this;
|
||||
this.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "下载中,请稍等 ",
|
||||
icon: false
|
||||
})
|
||||
const downloadTask = uni.downloadFile({
|
||||
url: url.replace('http://', 'https://'), //仅为示例,并非真实的资源
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
console.log('下载成功');
|
||||
uni.saveVideoToPhotosAlbum({
|
||||
filePath: downloadRes.tempFilePath,
|
||||
success() {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "下载成功!"
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.hideLoading();
|
||||
if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
|
||||
err
|
||||
.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err
|
||||
.errMsg ===
|
||||
"saveImageToPhotosAlbum:fail authorize no response"
|
||||
) {
|
||||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要您授权保存相册',
|
||||
showCancel: false,
|
||||
success: modalSuccess => {
|
||||
uni.openSetting({
|
||||
success(settingdata) {
|
||||
console.log(
|
||||
"settingdata",
|
||||
settingdata)
|
||||
if (settingdata
|
||||
.authSetting[
|
||||
'scope.writePhotosAlbum'
|
||||
]) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限成功,再次点击图片即可保存',
|
||||
showCancel: false,
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取权限失败,将无法保存到相册哦~',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(failData) {
|
||||
console.log("failData",
|
||||
failData)
|
||||
},
|
||||
complete(finishData) {
|
||||
console.log(
|
||||
"finishData",
|
||||
finishData)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
if (err.errMsg.includes("fail url not in domain list")) {
|
||||
// App._get("/api/download/addNewDownloadUrl", {
|
||||
// url: url.replace(/^https?:\/\/(.*?)(:\d+)?\/.*$/, '$1')
|
||||
// }, res => {
|
||||
|
||||
// })
|
||||
addNewDownloadUrl(url.replace(/^https?:\/\/(.*?)(:\d+)?\/.*$/, '$1')).then(response => {}),
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '因为微信限制,下载失败,可以通过浏览器链接下载,是否复制链接自行去浏览器下载?',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
_this.copyText(url)
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '下载失败了',
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
// console.log(err)
|
||||
}
|
||||
});
|
||||
downloadTask.onProgressUpdate((downloadTaskRes) => {
|
||||
uni.showLoading({
|
||||
title: '下载进度' + downloadTaskRes.progress + '%',
|
||||
mask: true
|
||||
})
|
||||
})
|
||||
},
|
||||
videoErrorCallback: function(e) {
|
||||
// console.log(e)
|
||||
uni.showModal({
|
||||
content: e.mp["@warning"],
|
||||
showCancel: false
|
||||
})
|
||||
},
|
||||
showTips() {
|
||||
uni.showModal({
|
||||
showCancel: false,
|
||||
content: '点击“复制链接”,到浏览器打开即可下载(推荐使用QQ浏览器打开)'
|
||||
})
|
||||
},
|
||||
copyText(text) {
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: function(res) {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
});
|
||||
},
|
||||
fail() {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '复制失败了'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $u-bg-color;
|
||||
}
|
||||
|
||||
.ad-show {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.contents {
|
||||
padding: 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.videoContent,
|
||||
.coverContent,
|
||||
.copywritingContent {
|
||||
margin-top: 30rpx;
|
||||
padding: 30rpx 20rpx;
|
||||
box-shadow: 3px 3px 4px rgba(26, 26, 26, 0.2);
|
||||
background-color: white;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.titleContent {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.title-shadow {
|
||||
position: absolute;
|
||||
bottom: -20rpx;
|
||||
font-style: italic;
|
||||
opacity: 0.4;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.videoContent-video,
|
||||
.coverContent-image,
|
||||
.copywritingContent-textarea {
|
||||
padding: 0 16rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.videoContent-buttonGroup,
|
||||
.coverContent-buttonGroup,
|
||||
.copywritingContent-button {
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
padding-top: 30rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.videoContent-buttonGroup-left,
|
||||
.videoContent-buttonGroup-right,
|
||||
.coverContent-buttonGroup-left,
|
||||
.coverContent-buttonGroup-right {
|
||||
width: 45%;
|
||||
box-shadow: 3px 3px 4px rgba(0, 102, 204, 0.2);
|
||||
}
|
||||
|
||||
.videoContent-problem {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user