瀏覽代碼

7.26修改下载前提交

李万涛 1 年之前
父節點
當前提交
66923aa30a
共有 14 個文件被更改,包括 228 次插入123 次删除
  1. 6 2
      App.vue
  2. 10 9
      pages.json
  3. 2 2
      pages/robot/generate/index.scss
  4. 10 14
      pages/robot/generate/index.vue
  5. 81 71
      pages/robot/index.scss
  6. 82 8
      pages/robot/index.vue
  7. 11 8
      pages/user/signin.vue
  8. 26 9
      pages/user/user.vue
  9. 二進制
      static/images/audio.png
  10. 二進制
      static/images/bg.png
  11. 二進制
      static/images/createBg.png
  12. 二進制
      static/images/role.png
  13. 二進制
      static/images/user_bg.jpg
  14. 二進制
      static/images/yusu.png

+ 6 - 2
App.vue

xqd
@@ -7,8 +7,12 @@
 			init(options);
 			// #ifndef MP-TOUTIAO
 			uni.hideTabBar({});
-			// #endif		
-
+			// #endif
+			if (!uni.getStorageSync('token')) {
+				uni.reLaunch({
+					url: '/pages/user/signin'
+				})
+			}
 		}
 	};
 </script>

+ 10 - 9
pages.json

xqd
@@ -415,15 +415,16 @@
 		"selectedColor": "#26B3A0",
 		"borderStyle": "white",
 		"backgroundColor": "#fff",
-		"list": [{
-				"pagePath": "pages/index/index"
-			},
-			{
-				"pagePath": "pages/template/template"
-			},
-			{
-				"pagePath": "pages/painting/painting"
-			},
+		"list": [
+			// {
+			// 	"pagePath": "pages/index/index"
+			// },
+			// {
+			// 	"pagePath": "pages/template/template"
+			// },
+			// {
+			// 	"pagePath": "pages/painting/painting"
+			// },
 			{
 				"pagePath": "pages/robot/index"
 			},

+ 2 - 2
pages/robot/generate/index.scss

xqd xqd
@@ -43,7 +43,7 @@ page {
 				display: flex;
 				justify-content: space-between;
 				height: 96rpx;
-				background: #26b3a0;
+				background: linear-gradient(to right,#06C68E,#02BCCD);
 				margin-top: 30rpx;
 				padding-left: 40rpx;
 				padding-right: 40rpx;
@@ -54,7 +54,7 @@ page {
 					.left{
 						width: 64rpx;
 						height: 64rpx;
-						margin-right: 10rpx;
+						// margin-right: 10rpx;
 						image{
 							width: 100%;
 							height: 100%;

+ 10 - 14
pages/robot/generate/index.vue

xqd xqd xqd xqd
@@ -7,14 +7,10 @@
 			<view class="top" @click="show4=true">
 				<view class="videoBox1" v-if="bgItem.scale==1&&selBgPic">
 					<image class="img16" :src="selBgPic" mode=""></image>
-					<!-- <view v-else class="emptyVideo" style="background: #ccc;height: 100%;"></view> -->
 				</view>
 				<view class="videoBox2" v-if="bgItem.scale==2&&selBgPic" :style="{}">
 					<image class="img16" :src="selBgPic" mode=""></image>
 				</view>
-				<!-- <view class="videoBox2" v-if="!bgItem.scale&&selBgPic" :style="{}">
-					<image class="img16" :src="selBgPic" mode=""></image>
-				</view> -->
 				<view class="videoBox" v-if="!bgItem.scale&&!selBgPic" :style="{minHeight:!selBgPic?'465rpx':''}">
 					<view class="emptyVideo" style="background: #ccc;height: 100%;"></view>
 				</view>
@@ -45,9 +41,9 @@
 			</view>
 			<view class="centerMenuBar">
 				<view class="barItem" v-for="(item,index) in menuList" @click="handleSetBox(item)">
-					<view class="left"
-						style="display: flex;justify-content: center;align-items: center;background: #fff;border-radius: 50%;">
-						<text class="iconfont " :class="[item.icon]" style="color: #26b3a0;font-weight: 600;"></text>
+					<view class="left" style="display: flex;justify-content: flex-end;align-items: center;">
+						<!-- <text class="iconfont " :class="[item.icon]" style="color: #26b3a0;font-weight: 600;"></text> -->
+						<image :src="item.icon" mode=""></image>
 					</view>
 					<view class="right">
 						{{item.name}}
@@ -65,12 +61,12 @@
 				placeholder="请输入播报内容"></u--textarea>
 
 			<view class="btnBox">
-				<view class="btn" @click="genRobot">
-					合成
-				</view>
 				<view class="btn draft" @click="saveDraft">
 					存草稿
 				</view>
+				<view class="btn" @click="genRobot" style="background: linear-gradient(to right,#06C68E,#02BCCD);">
+					合成
+				</view>
 			</view>
 
 		</view>
@@ -398,19 +394,19 @@
 				value: 1,
 				show: false,
 				menuList: [{
-						icon: 'icon-sudu',
+						icon: require('@/static/images/yusu.png'),
 						name: '全局语速'
 					},
 					{
-						icon: 'icon-beijingtupian',
+						icon: require('@/static/images/audio.png'),
 						name: '声音'
 					},
 					{
-						icon: 'icon-jurassic_add-user',
+						icon: require('@/static/images/role.png'),
 						name: '角色'
 					},
 					{
-						icon: 'icon-beijingtupian',
+						icon: require('@/static/images/bg.png'),
 						name: '背景'
 					},
 				],

+ 81 - 71
pages/robot/index.scss

xqd xqd xqd xqd
@@ -17,7 +17,8 @@ page {
 			border-radius: 15rpx;
 			height: 306rpx;
 			// aspect-ratio: 7/3;
-			background: #999;
+			background:url('@/static/images/createBg.png') no-repeat;
+			background-size: 100% 100%;
 			display: flex;
 			align-items: center;
 			justify-content: center;
@@ -40,8 +41,8 @@ page {
 				}
 				.addTxt{
 					margin-top: 20rpx;
-					// color:#26b3a0 ;
 					font-weight: 600;
+					color:white;
 				}
 			}
 		}
@@ -75,74 +76,7 @@ page {
 								border-radius: 15rpx;
 							}
 							
-							.preloader_1 {
-								position: absolute;
-								margin-right: 65px;
-								top:50%;
-								width: 100%;
-							
-								left:50%;
-								transform: translateX(-5%);
-								background: red;
-								width: 100%;
-								z-index: 9;
-							}
-							
-							.preloader_1 view {
-								display: block;
-								bottom: 0px;
-								width: 9px;
-								height: 5px;
-								background: #9b59b6;
-								position: absolute;
-								animation: preloader_1 1.5s infinite ease-in-out;
-							}
-							
-							.preloader_1 view:nth-child(2) {
-								left: 11px;
-								animation-delay: .2s;
-							}
-							
-							.preloader_1 view:nth-child(3) {
-								left: 22px;
-								animation-delay: .4s;
-							}
-							
-							.preloader_1 view:nth-child(4) {
-								left: 33px;
-								animation-delay: .6s;
-							}
-							
-							.preloader_1 view:nth-child(5) {
-								left: 44px;
-								animation-delay: .8s;
-							}
-							
-							@keyframes preloader_1 {
-								0% {
-									height: 5px;
-									transform: translateY(0px);
-									background: #9b59b6;
-								}
-							
-								25% {
-									height: 30px;
-									transform: translateY(15px);
-									background: #3498db;
-								}
 							
-								50% {
-									height: 5px;
-									transform: translateY(0px);
-									background: #9b59b6;
-								}
-							
-								100% {
-									height: 5px;
-									transform: translateY(0px);
-									background: #9b59b6;
-								}
-							}
 						}
 						.bottom{
 							display: flex;
@@ -170,10 +104,86 @@ page {
 	}
 
 	.tipBox{
+		// position: relative;
+		.preloader_1 {
+			position: absolute;
+			margin-right: 65px;
+			top:50%;
+			width: 100%;
+			left:35%;
+			transform: translateX(0%);
+			background: red;
+			width: 100%;
+			z-index: 9;
+		}
+		
+		.preloader_1 view {
+			display: block;
+			bottom: 0px;
+			width: 9px;
+			height: 5px;
+			background: #9b59b6;
+			position: absolute;
+			animation: preloader_1 1.5s infinite ease-in-out;
+		}
+		
+		.preloader_1 view:nth-child(2) {
+			left: 11px;
+			animation-delay: .2s;
+		}
+		
+		.preloader_1 view:nth-child(3) {
+			left: 22px;
+			animation-delay: .4s;
+		}
+		
+		.preloader_1 view:nth-child(4) {
+			left: 33px;
+			animation-delay: .6s;
+		}
+		
+		.preloader_1 view:nth-child(5) {
+			left: 44px;
+			animation-delay: .8s;
+		}
+		
+		@keyframes preloader_1 {
+			0% {
+				height: 5px;
+				transform: translateY(0px);
+				background: #9b59b6;
+			}
+		
+			25% {
+				height: 30px;
+				transform: translateY(15px);
+				background: #3498db;
+			}
+		
+			50% {
+				height: 5px;
+				transform: translateY(0px);
+				background: #9b59b6;
+			}
+		
+			100% {
+				height: 5px;
+				transform: translateY(0px);
+				background: #9b59b6;
+			}
+		}
+		
 		.tip{
 			position: absolute;
 			bottom: 25%;
-		width: 100%;
-		text-align: center;
+		    width: 100%;
+		    text-align: center;
+		}
+		.progress{
+			margin-top:150%;
+			// position: absolute;
+			// z-index: 9;
+			// bottom: 35%;
+			// left: 10%;
 		}
 	}

+ 82 - 8
pages/robot/index.vue

xqd xqd xqd xqd xqd xqd xqd
@@ -50,13 +50,25 @@
 							</image>
 
 							<view class="tipBox" v-else>
-								<view class="preloader_1" :style="{left:isPc?'':'40%'}">
+								<!-- <view class="preloader_1" :style="{left:isPc?'':'40%'}">
+									<view></view>
+									<view></view>
+									<view></view>
+									<view></view>
+									<view></view>
+								</view> -->
+
+								<view class="preloader_1" style="">
 									<view></view>
 									<view></view>
 									<view></view>
 									<view></view>
 									<view></view>
 								</view>
+								<!-- <view class="progress">
+									<u-line-progress :percentage="'percentage'+item.id" :showText="true"
+										activeColor="#9b59b6" height="12"></u-line-progress>
+								</view> -->
 								<view class="tip" style="color:#26b3a0">
 									生成中...
 								</view>
@@ -80,12 +92,12 @@
 			</view>
 
 
-			<!-- <button @click="test">测试网络请求</button> -->
+			<!-- <button @click="test">{{percentage216}}</button> -->
 
 
-			<u-picker :closeOnClickOverlay="true" :showIcon="true" :show="showMoreMenu" :columns="columns" title="更多"
-				confirmColor="" @cancel="showMoreMenu=false" @confirm="handleConfirm"
-				@close="showMoreMenu=false"></u-picker>
+			<u-picker :defaultIndex='[0]' :closeOnClickOverlay="true" :showIcon="true" :show="showMoreMenu"
+				:columns="columns" title="更多" confirmColor="" @cancel="showMoreMenu=false" @confirm="handleConfirm"
+				@close="handleClosePicker"></u-picker>
 
 			<wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar>
 		</view>
@@ -116,7 +128,9 @@
 
 				is_wx: false,
 				isPc: false,
-				timer: null
+				timer: null,
+				// percentage: 0,
+				reqTimes: 0
 			};
 		},
 		computed: {
@@ -140,12 +154,28 @@
 				_this.timer = setInterval(async () => {
 					let res = await workList({})
 					if (res.code == 0) {
+						// _this.reqTimes += 1
 						_this.workList = res.data
+						// res.data.forEach((item, index) => {
+						// 	console.log('每一个percentage', _this['percentage' + item.id]);
+						// 	if (_this.reqTimes <= 5) {
+						// 		_this['percentage' + item.id] += 10
+						// 	} else {
+						// 		_this['percentage' + item.id] += 1
+						// 	}
+						// 	if (item.state == 1) {
+						// 		console.log('已完成的那一项', item);
+						// 		_this['percentage' + item.id] = 100
+						// 	}
+						// })
+
 						let allSuc = res.data.every((item, index) => {
 							return item.state == 1
 						})
 						if (allSuc) {
 							clearInterval(_this.timer)
+							// _this.percentage = 100
+							return
 						}
 						console.log('定时器--数字人作品列表返回值:', res);
 					} else {
@@ -180,6 +210,12 @@
 			this.getIndexData()
 		},
 		methods: {
+			handleClosePicker() {
+				this.showMoreMenu = false
+				// this.columns = [
+				// 	['删除', '下载视频', '复制链接']
+				// ]
+			},
 			toCreateDetail(item) {
 				getApp().draftDetail = item
 				uni.navigateTo({
@@ -260,6 +296,12 @@
 				if (res.code == 0) {
 					uni.stopPullDownRefresh()
 					this.workList = res.data
+					// let parm = {}
+					// res.data.forEach((item, index) => {
+					// 	parm['percentage' + item.id] = 0
+					// })
+					// this.$data = Object.assign(this.$data, parm);
+					// console.log('百分比批量赋值后:', this.$data);
 					console.log('数字人作品列表返回值:', res);
 				} else {
 					uni.showToast({
@@ -364,10 +406,42 @@
 						return
 					} else {
 						if (detectDeviceType()) {
+							let _this = this
 							// PC端
-							// this.delItem.url = 'http://www.liwantao.top/test.mp4'
+							this.delItem.url = 'http://www.liwantao.top/test.mp4'
+
+							// downLoad3(this.delItem.url, '数字人' + this.delItem.name + '视频', 'video/mp4')
+
+							const downloadTask = uni.downloadFile({
+								url: _this.delItem.url, //文件链接
+								success: (res) => {
+									if (res.statusCode === 200) {
+										var oA = document.createElement("a");
+										oA.download = _this.delItem.name; // 设置下载的文件名,默认是'下载'	
+										oA.href = res.tempFilePath; //临时路径再保存到本地
+										document.body.appendChild(oA);
+										oA.click();
+										oA.remove(); // 下载之后把创建的元素删除
+									}
+								},
+								fail: (err) => {
+									uni.showToast({
+										icon: 'none',
+										mask: true,
+										title: '失败请重新下载',
+									});
+								},
+							})
 
-							downLoad3(this.delItem.url, '数字人' + this.delItem.name + '视频', 'video/mp4')
+							downloadTask.onProgressUpdate((res) => {
+								if (res.progress > 0) {
+									// this.isShowProgress = true;
+								}
+								// this.progress = res.progress;
+								console.log('下载进度:' + res.progress);
+								console.log('已下载长度:' + res.totalBytesWritten);
+								console.log('文件总长度:' + res.totalBytesExpectedToWrite);
+							})
 						} else {
 							// 其他移动端浏览器
 							window.open(this.delItem.url)

+ 11 - 8
pages/user/signin.vue

xqd xqd xqd
@@ -11,9 +11,9 @@
 			<view class="site_logo">
 				<image class="weixin" :src="appInfo.site_logo_path" mode="aspectFill"></image>
 			</view>
-			<view class="site_name">{{appInfo.site_name}}</view>
+			<view class="site_name">{{appInfo1.site_name}}</view>
 			<view class="detailed">
-				<view class="">欢迎畅游{{appInfo.site_name}}</view>
+				<view class="">欢迎畅游{{appInfo1.site_name}}</view>
 				<view class="">登录后,可免费获得问答及优惠套餐等服务</view>
 			</view>
 			<u-popup :show="showlogin" mode="bottom" :round="10" closeable @close="showlogin = false">
@@ -46,23 +46,22 @@
 				</view>
 			</u-popup>
 			<!-- #ifdef MP-WEIXIN -->
-			<view class="flxe justify-center">
+			<!-- 	<view class="flxe justify-center">
 				<view class="grant" @click="showAuthorizationModal = true">
 					<u-icon name="weixin-fill" color="#ffffff" size="26"></u-icon>
 					<view class="dlu">微信授权登录</view>
 				</view>
-				<!-- <button class="getbutton" open-type="getPhoneNumber" @getphonenumber="getphone"></button> -->
-			</view>
+			</view> -->
 			<!-- #endif -->
 			<!-- #ifdef H5 -->
 			<block v-if="appInfo.h5_run_mode">
 				<block v-if="appInfo.h5_run_mode == 1">
-					<view v-if="platform == 'wxOfficialAccount'" class="flxe justify-center">
+					<!-- 	<view v-if="platform == 'wxOfficialAccount'" class="flxe justify-center">
 						<view class="grant" @click="thirdLogin('wechat')">
 							<u-icon name="weixin-fill" color="#ffffff" size="26"></u-icon>
 							<view class="dlu">微信授权登录</view>
 						</view>
-					</view>
+					</view> -->
 					<view v-if="appInfo.is_account&&appInfo.is_account==1" class="flxe justify-center">
 						<view class="grants" @click="showlogon = true,showlogin = true">
 							<u-icon name="account-fill" color="#199063" size="26"></u-icon>
@@ -169,7 +168,11 @@
 				},
 				password2: '',
 				showlogon: true,
-				route: ''
+				route: '',
+				appInfo1: {
+					site_name: '数字人系统'
+				}
+
 				// register:0
 			}
 		},

+ 26 - 9
pages/user/user.vue

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -3,10 +3,9 @@
 		<view class="user" v-if="appInfo.page_template == 2 || appInfo.page_template == 1">
 
 			<!-- 头部 -->
-			<view class="user-wrap"
-				:style="{ backgroundImage: `url(${appInfo.user_bg_path ? appInfo.user_bg_path : 'https://source.iduomi.cc/user_bg.jpg'})` }">
+			<view class="user-wrap" style="">
 				<view class="setting iconfont icon31shezhi"></view>
-				<view v-if="isLogin" class="info">
+				<!-- 	<view v-if="isLogin" class="info">
 					<image @click="modify" class="avatar" mode="aspectFill"
 						:src="userInfo.avatar ? userInfo.avatar : '/static/images/head.jpg'"></image>
 					<view class="nickname">
@@ -14,12 +13,16 @@
 							@click="copyText(userInfo.id_number)">{{ userInfo.nickname ? userInfo.nickname : '默认用户'}}</text>
 						<u-icon name="edit-pen" color="#18b566" size="20" @click="modify"></u-icon>
 					</view>
-
-				</view>
-				<view v-else class="info" @click="getlogin">
+				</view> -->
+				<!-- <view class="info" @click="getlogin"> -->
+				<view class="info" @click="getlogin" v-if="!hasLogin">
 					<image class="avatar" mode="aspectFill" src="/static/images/head.jpg"></image>
 					<view class="nickname">点击立即登录/注册</view>
 				</view>
+				<view class="info" @click="" v-else>
+					<image class="avatar" mode="aspectFill" src="/static/images/head.jpg"></image>
+					<view class="nickname1" style="align-items: center;">您已登录</view>
+				</view>
 			</view>
 
 			<!-- 订单状态 -->
@@ -136,7 +139,7 @@
 			<!-- 用户服务 -->
 			<view class="com-item">
 				<view class="com-wrap">
-					<view v-if="qrcode" class="cell" @click="getlogin">
+					<view v-if="!hasLogin" class="cell" @click="getlogin">
 						<view class="cell-left">
 							<!-- <u-icon name="scan" color="#007aff" size="22"></u-icon> -->
 							<view class="cell-text">立即登录</view>
@@ -144,7 +147,7 @@
 						<u-icon name="arrow-right" color="#9e9e9e" size="18"></u-icon>
 					</view>
 
-					<view v-if="qrcode" class="cell" @click="loginout">
+					<view v-if="hasLogin" class="cell" @click="loginout">
 						<view class="cell-left">
 							<!-- <u-icon name="scan" color="#007aff" size="22"></u-icon> -->
 							<view class="cell-text">退出登录</view>
@@ -488,6 +491,8 @@
 		components: {},
 		data() {
 			return {
+				hasLogin: false,
+
 				// API_ROOT: API_ROOT,
 				perfectResume: false, //简历是否完善
 				tobheight: 45,
@@ -604,6 +609,10 @@
 		},
 
 		onShow: function() {
+			if (uni.getStorageSync('token')) {
+				this.hasLogin = true
+			}
+
 			if (this.isLogin) {
 				this.getUserData();
 				if (this.$ws.socketStatus()) {
@@ -911,7 +920,7 @@
 			padding: 30rpx;
 			z-index: 9;
 			// border-radius: 0 0 20% 20%;
-			// background: url('https://mp-ea41a5d2-ea75-4ec6-aa57-ac841611f485.cdn.bspapp.com/cloudstorage/796de0fd-c730-40b8-9177-1250bb76d0a3.jpg') no-repeat;
+			background: url('@/static/images/user_bg.jpg') no-repeat;
 			background-size: cover;
 
 			.setting {
@@ -940,6 +949,14 @@
 					font-weight: bold;
 					display: flex;
 				}
+
+				.nickname1 {
+					color: #fff;
+					font-size: 30rpx;
+					margin-top: 20rpx;
+					font-weight: bold;
+					// display: flex;
+				}
 			}
 		}
 

二進制
static/images/audio.png


二進制
static/images/bg.png


二進制
static/images/createBg.png


二進制
static/images/role.png


二進制
static/images/user_bg.jpg


二進制
static/images/yusu.png