对接不知情的接口

master
chen 2022-08-12 18:14:13 +08:00
parent 08ce9d2038
commit 027d00edc4
24 changed files with 255 additions and 59 deletions

View File

@ -5,7 +5,7 @@
projectname:'', // projectname:'', //
lat:'', // lat:'', //
lng:'' ,// lng:'' ,//
hostapi:'https://chuanwujia.scdxtc.cn' // hostapi:'https://chuanwujia.com' //
}, },
// show // show
onLaunch: ()=> { onLaunch: ()=> {

View File

@ -27,6 +27,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="col9 fon24 disjcac pad-sx50" v-if="!dataList.length"></view>
</view> </view>
<view class="bacf pad-sx20 disjcac boxshowt"> <view class="bacf pad-sx20 disjcac boxshowt">
<view @tap="executeEv(1)" class="disjcac fon24" style="width: 380rpx;height: 70rpx;border-radius: 35rpx;background-color: #f37617;color: #FFFFFF;"> <view @tap="executeEv(1)" class="disjcac fon24" style="width: 380rpx;height: 70rpx;border-radius: 35rpx;background-color: #f37617;color: #FFFFFF;">
@ -82,7 +83,8 @@
}, },
// //
checkChoose(){ checkChoose(){
let exitIndex = this.dataList.findIndex(item=>item.coupon_id==this.couponId); console.log(this.couponId,666666);
let exitIndex = this.dataList.findIndex(item=>item.id==this.couponId);
if(exitIndex!=-1){ if(exitIndex!=-1){
this.dataList[exitIndex].ifcheck = true; this.dataList[exitIndex].ifcheck = true;
this.setCoupon(true,exitIndex); this.setCoupon(true,exitIndex);
@ -90,11 +92,13 @@
}, },
// //
setCoupon(flag,index){ setCoupon(flag,index){
this.couponIndex = index; if(this.dataList.length){
this.dataList[index].ifcheck = flag; this.couponIndex = index;
this.couponPrice = flag?this.dataList[index].amount:0;// this.dataList[index].ifcheck = flag;
this.couponId = flag?this.dataList[index].coupon_id:'';//id this.couponPrice = flag?this.dataList[index].amount:0;//
this.couponCount = flag?1:0;// this.couponId = flag?this.dataList[index].id:'';//id
this.couponCount = flag?1:0;//
}
}, },
// //
chooseCoupon(id,index){ chooseCoupon(id,index){

View File

@ -38,6 +38,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex';
export default { export default {
name:'status-nav', name:'status-nav',
props:{ props:{
@ -100,6 +101,11 @@
netTimer:null netTimer:null
} }
}, },
computed: {
...mapState({
fristIn: state => state.moduleA.fristIn
})
},
mounted() { mounted() {
// //
this.$toolAll.tools.networkStatus(); this.$toolAll.tools.networkStatus();
@ -130,7 +136,13 @@
}, },
// //
backEv(){ backEv(){
uni.navigateBack({delta:1}) if(this.fristIn){
uni.reLaunch({
url:'/pages/tabbar/pagehome/pagehome'
})
} else {
uni.navigateBack({delta:1})
}
} }
} }
} }

View File

@ -5,7 +5,7 @@ export function uploadImg(data) {
} }
// 视频上传\音频\文件 // 视频上传\音频\文件
export function uploadFile(data) { export function uploadFile(data) {
return request.upload("/universal/api.upload/upload", data, 'file'); return request.upload("/api/file/upload/video", data, 'video');
} }
// 视频播放记录上报 // 视频播放记录上报
export function reportRecord(data) { export function reportRecord(data) {

View File

@ -46,6 +46,7 @@ const checkError = (e) => {
case 5001:// xxx错误 case 5001:// xxx错误
case 5050:// 服务器错误,请稍后重试 case 5050:// 服务器错误,请稍后重试
case 5051:// 未知错误 case 5051:// 未知错误
console.log(e,7777)
uni.showToast({ uni.showToast({
title:e.data.msg, title:e.data.msg,
icon:'none' icon:'none'
@ -97,6 +98,7 @@ const request = (method, url, options) => {
break; break;
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(`${url}的参数===>`,options);
uni.request({ uni.request({
url: `${getApp().globalData.hostapi}${url}`, url: `${getApp().globalData.hostapi}${url}`,
method: methods, method: methods,
@ -153,7 +155,10 @@ const uploadFile = (url, options, type) => {
if (temp.code == 0) { if (temp.code == 0) {
resolve(temp) resolve(temp)
} }
} } else {
// 接口返回错误信息
checkError(res);
}
} }
}); });
}) })

View File

@ -69,7 +69,7 @@
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
/* */ /* */
"appid" : "wxa02e44170bc722cd", "appid" : "wxfda00ea49fc88f8f",
"setting" : { "setting" : {
"urlCheck" : true, "urlCheck" : true,
"es6" : true, "es6" : true,

View File

@ -205,6 +205,15 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}
,{
"path" : "upload-video/upload-video",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
} }
] ]
} }

View File

@ -117,7 +117,7 @@
city: ya.userInfo.city,// city: ya.userInfo.city,//
gender: ya.userInfo.gender,// gender: ya.userInfo.gender,//
language:ya.userInfo.language,// language:ya.userInfo.language,//
invite_code:uni.getStorageSync('inviteCode')?uni.getStorageSync('inviteCode'):'', invite_code:uni.getStorageSync('invite_code')?uni.getStorageSync('invite_code'):'',
is_active:1 is_active:1
} }
this.$requst.post('/api/user/login',params).then(res => { this.$requst.post('/api/user/login',params).then(res => {

View File

@ -2,7 +2,7 @@
<view> <view>
<status-container :ifReturn="false" titlet="课程列表"> <status-container :ifReturn="false" titlet="课程列表">
<view slot="content" style="margin-top: -20rpx;"> <view slot="content" style="margin-top: -20rpx;">
<view class="posi-sticky" :style="{top:newtop+'px'}"> <view class="bacf">
<view class="pad-sx26 pad-zy20" style="border-bottom: 2rpx solid #fcede8;"> <view class="pad-sx26 pad-zy20" style="border-bottom: 2rpx solid #fcede8;">
<view class="radius40 pad-sx2 disjbac pad-zy20" style="background-color: #fff6f5;border: 2rpx solid #ece6e6;"> <view class="radius40 pad-sx2 disjbac pad-zy20" style="background-color: #fff6f5;border: 2rpx solid #ece6e6;">
<input v-model="keyword" @confirm="getCourseList" type="text" class="fon24 width100 pad-sx6" placeholder="关键字搜索" placeholder-style="color:#aaa4a3"> <input v-model="keyword" @confirm="getCourseList" type="text" class="fon24 width100 pad-sx6" placeholder="关键字搜索" placeholder-style="color:#aaa4a3">
@ -11,6 +11,8 @@
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="posi-sticky" :style="{top:newtop+'px'}">
<swiper-tab id="tab" :list="dataList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab> <swiper-tab id="tab" :list="dataList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
</view> </view>
<view class="pad-zy20"> <view class="pad-zy20">
@ -48,7 +50,7 @@
noMore:false,// noMore:false,//
} }
}, },
onLoad() { onShow() {
// //
this.getCourseCate(); this.getCourseCate();
}, },
@ -108,7 +110,7 @@
// //
goDetail(id){ goDetail(id){
uni.navigateTo({ uni.navigateTo({
url:`/pagesB/course-detail/course-detail?id=${id}` url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}`
}) })
}, },
} }

View File

@ -57,12 +57,11 @@
statusBarHeight: uni.getSystemInfoSync().statusBarHeight, // statusBarHeight: uni.getSystemInfoSync().statusBarHeight, //
newHeight:uni.getSystemInfoSync().screenHeight, // newHeight:uni.getSystemInfoSync().screenHeight, //
isLoading:false, // isLoading:false, //
// {src:'/static/tabbar/icon-panh.png',title:''},
funList:[ funList:[
{src:'/static/tabbar/icon-set.png',title:'个人资料'}, {src:'/static/tabbar/icon-set.png',title:'个人资料'},
{src:'/static/tabbar/icon-course.png',title:'我的课程'}, {src:'/static/tabbar/icon-course.png',title:'我的课程'},
{src:'/static/tabbar/icon-order.png',title:'我的订单'}, {src:'/static/tabbar/icon-order.png',title:'我的订单'},
{src:'/static/tabbar/icon-panh.png',title:'我的练习视频'},
{src:'/static/tabbar/icon-coupon.png',title:'我的优惠券'}, {src:'/static/tabbar/icon-coupon.png',title:'我的优惠券'},
{src:'/static/tabbar/icon-score.png',title:'我的积分'}, {src:'/static/tabbar/icon-score.png',title:'我的积分'},
{src:'/static/tabbar/icon-address.png',title:'我的地址'}, {src:'/static/tabbar/icon-address.png',title:'我的地址'},
@ -97,12 +96,11 @@
// //
chooseFun(index){ chooseFun(index){
// '/pagesA/my-video/my-video',
let list = [ let list = [
'/pagesA/my-data/my-data', '/pagesA/my-data/my-data',
'/pagesA/my-course/my-course', '/pagesA/my-course/my-course',
'/pagesA/my-order/my-order', '/pagesA/my-order/my-order',
'/pagesA/my-video/my-video',
'/pagesA/my-coupon/my-coupon', '/pagesA/my-coupon/my-coupon',
'/pagesA/my-integral/my-integral', '/pagesA/my-integral/my-integral',
'/pagesA/my-address/my-address', '/pagesA/my-address/my-address',

View File

@ -20,7 +20,7 @@
<span class="bold">{{item.price}}</span> <span class="bold">{{item.price}}</span>
<span class="fon20 colf8 mar-z20 tline-through">{{item.original_price}}</span> <span class="fon20 colf8 mar-z20 tline-through">{{item.original_price}}</span>
</view> </view>
<view class="radius18 pad-zy12 pad-sx4 borbot-f disjcac">购买</view> <view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.id}&category_id=${dataList[current].id}`)" class="radius18 pad-zy12 pad-sx4 borbot-f disjcac">{{item.is_buy?'去学习':'购买'}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -98,7 +98,15 @@
// banner // banner
this.$store.commit('setAutoplay',false); this.$store.commit('setAutoplay',false);
}, },
onLoad() { onShareAppMessage(res) {
var shareObj = {
     title: ``, // (slogan)
     path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
},
onLoad(op) {
// //
this.getCourseCate(); this.getCourseCate();
// banner // banner
@ -206,15 +214,15 @@
}, },
// //
palyVideo(index){ palyVideo(index){
if(!this.videoList[index].src){ if(this.videoList[index].type=="video_number"){
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
wx.openChannelsActivity({ wx.openChannelsActivity({
finderUserName:this.videoList[index].video_number, finderUserName:this.videoList[index].video_number,
feedId:this.videoList[index].subtitle, feedId:this.videoList[index].video_id,
success:(res)=>{ success:(res)=>{
reportRecord({id:this.videoList[index].id}).then(result=>{}) reportRecord({id:this.videoList[index].id}).then(result=>{})
},fail:()=>{ },fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除') // this.$toolAll.tools.showToast('')
} }
}) })
// #endif // #endif

View File

@ -91,11 +91,11 @@
}, },
// //
palyVideo(index){ palyVideo(index){
if(!this.dataList[index].src){ if(this.dataList[index].type=="video_number"){
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
wx.openChannelsActivity({ wx.openChannelsActivity({
finderUserName:this.dataList[index].video_number, finderUserName:this.dataList[index].video_number,
feedId:this.dataList[index].subtitle, feedId:this.dataList[index].video_id,
success:(res)=>{ success:(res)=>{
reportRecord({id:this.dataList[index].id}).then(result=>{ reportRecord({id:this.dataList[index].id}).then(result=>{
if(result.code==0){ if(result.code==0){
@ -103,7 +103,7 @@
} }
}) })
},fail:()=>{ },fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除') // this.$toolAll.tools.showToast('')
} }
}) })
// #endif // #endif

View File

@ -16,7 +16,7 @@
<nothingPage content="地址列表空荡荡滴"></nothingPage> <nothingPage content="地址列表空荡荡滴"></nothingPage>
</view> </view>
<view class="disjcac pad-s50"> <view class="disjcac pad-s50">
<view @tap="$toolAll.tools.goPage('/pagesB/add-address/add-address')" class="disjcac radius34" style="width: 396rpx;height: 72rpx;background-color: #f37717;color: #FFFFFF;"> <view @tap="$toolAll.tools.goPage('/pagesB/add-address/add-address')" class="disjcac radius34" style="width: 396rpx;height: 72rpx;background-color: #f37717;color: #FFFFFF;position: relative;z-index: 100;">
<view class="icon icon-add04 fon28"></view> <view class="icon icon-add04 fon28"></view>
<view class="fon26 mar-z10">新增收货地址</view> <view class="fon26 mar-z10">新增收货地址</view>
</view> </view>

View File

@ -18,7 +18,7 @@
<view class="">{{item.name}}</view> <view class="">{{item.name}}</view>
<view class="fon20" style="color: #747474;" v-if="item.begin_at">{{item.begin_at.slice(0,10).split('-').join('.')}}-{{item.end_at.slice(0,10).split('-').join('.')}}</view> <view class="fon20" style="color: #747474;" v-if="item.begin_at">{{item.begin_at.slice(0,10).split('-').join('.')}}-{{item.end_at.slice(0,10).split('-').join('.')}}</view>
</view> </view>
<view class="flexs mar-z20 radius26 colf disjcac" style="width: 124rpx;height: 52rpx;" :style="{backgroundColor:current!=0?'#c0c0c0':'#f37717'}">去使用</view> <view @tap="goCourse" class="flexs mar-z20 radius26 colf disjcac" style="width: 124rpx;height: 52rpx;" :style="{backgroundColor:current!=0?'#c0c0c0':'#f37717'}">去使用</view>
</view> </view>
<!-- <view class="disac fon20 pad-s20" style="color: #747474;"> <!-- <view class="disac fon20 pad-s20" style="color: #747474;">
<span @tap="lookDetail(index)"></span> <span @tap="lookDetail(index)"></span>
@ -89,6 +89,14 @@
this.getCouponList(); this.getCouponList();
}, },
methods: { methods: {
// 使
goCourse(){
if(this.status=='normal'){
uni.reLaunch({
url:'/pages/tabbar/course/course'
})
}
},
// tab // tab
clickTab(index){ clickTab(index){
this.dataList = []; this.dataList = [];

View File

@ -12,7 +12,7 @@
</view> </view>
<view class="disjbac width100"> <view class="disjbac width100">
<view class="fon24">{{item.price}}</view> <view class="fon24">{{item.price}}</view>
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view> <view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.spu_id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -162,6 +162,8 @@
}) })
},1000) },1000)
} }
} else {
this.flag = true;
} }
}) })
} }

View File

@ -14,6 +14,7 @@
</view> </view>
</view> </view>
</status-container> </status-container>
<view @tap="$toolAll.tools.goPage('/pagesB/upload-video/upload-video')" class="disjcac colf fon24 radius34" style="position: fixed;bottom: 30rpx;left: 50%;transform: translateX(-50%);width: 360rpx;height: 68rpx;background-color: #e42417;">上传新的练习视频</view>
</view> </view>
</template> </template>

View File

@ -115,6 +115,11 @@
this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{ this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{
if(res.code==0){ if(res.code==0){
this.$toolAll.tools.showToast('支付成功(*^▽^*)'); this.$toolAll.tools.showToast('支付成功(*^▽^*)');
setTimeout(()=>{
uni.reLaunch({
url:'/pages/tabbar/course/course'
})
},1500)
} else this.$toolAll.tools.showToast(res.msg); } else this.$toolAll.tools.showToast(res.msg);
}) })
}, },
@ -125,6 +130,8 @@
this.flag = true; this.flag = true;
} }
}); });
} else {
this.flag = true;
} }
}) })
} }

View File

@ -175,6 +175,8 @@
}) })
},1000) },1000)
} }
} else {
this.flag = true;
} }
}) })
} }

View File

@ -40,7 +40,7 @@
<view class="posAll disjc" v-if="ifLogin"> <view class="posAll disjc" v-if="ifLogin">
<view class="bacf radius10 posir disjcac fc pad-zy60" style="height: 256rpx;margin-top: 304rpx;"> <view class="bacf radius10 posir disjcac fc pad-zy60" style="height: 256rpx;margin-top: 304rpx;">
<image src="/static/tabbar/icon-password.png" mode="" lazy-load style="width: 86rpx;height: 102rpx;"></image> <image src="/static/tabbar/icon-password.png" mode="" lazy-load style="width: 86rpx;height: 102rpx;"></image>
<view class="fon28 mar-s20">请登录后查看课程<span style="color:#e42417;">去登</span></view> <view class="fon28 mar-s20">请登录后查看课程<span style="color:#e42417;" @tap="goLogin"></span></view>
<view class="posia-sy20" @tap="ifLogin=false"><i class="icon icon-del-white fon24" style="color: #9d9d9d;"></i></view> <view class="posia-sy20" @tap="ifLogin=false"><i class="icon icon-del-white fon24" style="color: #9d9d9d;"></i></view>
</view> </view>
</view> </view>
@ -68,13 +68,20 @@
id:'', //id id:'', //id
page:1, // page:1, //
size:1000, // size:1000, //
courseList:[] courseList:[],
} }
}, },
onLoad(op) { onLoad(op) {
if(op.id){ if(op.id){
if(op.invite_code) {
//
this.$store.commit('setFristIn',true);
uni.setStorageSync('invite_code',op.invite_code);
} else {
this.$store.commit('setFristIn',false);
}
this.id = op.id; this.id = op.id;
this.classId = op.category_id this.classId = op.category_id;
// //
this.getCouresDetail(op.id); this.getCouresDetail(op.id);
} }
@ -82,7 +89,7 @@
onShareAppMessage(res) { onShareAppMessage(res) {
var shareObj = { var shareObj = {
     title: ``, // (slogan)      title: ``, // (slogan)
     path: `/pagesB/course-detail/course-detail?id=${this.id}&category_id=${this.classId}&is_activity=${this.detailObj.is_activity==0 ? 0 : 1}&invite_code=${uni.getStorageSync('invite_code')}`, // /      path: `/pagesB/course-detail/course-detail?id=${this.id}&category_id=${this.classId}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4      imageUrl: ``//PNGJPG imageUrl 使 5:4
  };   };
  return shareObj;   return shareObj;
@ -123,18 +130,22 @@
}, },
// //
goBuy(){ goBuy(){
let params = { if(uni.getStorageSync('is_active')){
sku_list:this.courseList[0].sku_list let params = {
}; sku_list:this.courseList[0].sku_list
this.$requst.post('/api/order/prepare-info',params).then(res=>{ };
if(res.code==0){ this.$requst.post('/api/order/prepare-info',params).then(res=>{
uni.setStorageSync('courseInfo',res.data); if(res.code==0){
uni.setStorageSync('skuList',params.sku_list); uni.setStorageSync('courseInfo',res.data);
uni.navigateTo({ uni.setStorageSync('skuList',params.sku_list);
url:'/pagesB/buy-now/buy-now' uni.navigateTo({
}) url:'/pagesB/buy-now/buy-now'
} })
}) }
})
} else {
this.ifLogin = true;
}
}, },
// //
getCouresRecommend(){ getCouresRecommend(){
@ -145,7 +156,6 @@
id:this.id id:this.id
} }
this.$requst.get('/api/spu/course-recommend',params).then(res=>{ this.$requst.get('/api/spu/course-recommend',params).then(res=>{
console.log(res,'课程推荐')
if(res.code==0) { if(res.code==0) {
this.$refs.refcourse.list = res.data.list; this.$refs.refcourse.list = res.data.list;
} }
@ -160,24 +170,34 @@
}, },
// //
playVideo(){ playVideo(){
if(!this.couresDetail[index].src){ if(this.couresDetail.type=="video_number"){
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
wx.openChannelsActivity({ wx.openChannelsActivity({
finderUserName:this.couresDetail[index].video_number, finderUserName:this.couresDetail.video_number,
feedId:this.couresDetail[index].subtitle, feedId:this.couresDetail.video_id,
success:(res)=>{},fail:()=>{ success:(res)=>{},fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除') // this.$toolAll.tools.showToast('')
} }
}) })
// #endif // #endif
} else { } else {
let newArr = []; if(uni.getStorageSync('is_active')){
newArr.push(this.couresDetail[index]) let newArr = [];
uni.setStorageSync('videoList',newArr); newArr.push({src:this.couresDetail.video})
uni.navigateTo({ uni.setStorageSync('videoList',newArr);
url:`/pagesB/play-video/play-video?current=${index}` uni.navigateTo({
}) url:`/pagesB/play-video/play-video?current=${0}`
})
} else {
this.ifLogin = true;
}
} }
},
//
goLogin(){
uni.navigateTo({
url:`/pages/login/login`
})
} }
} }
} }

View File

@ -124,6 +124,8 @@
}) })
},1000) },1000)
} }
} else {
this.flag = true;
} }
}) })
} }

View File

@ -88,7 +88,22 @@
// banner // banner
this.$store.commit('setAutoplay',false); this.$store.commit('setAutoplay',false);
}, },
onShareAppMessage(res) {
var shareObj = {
     title: ``, // (slogan)
     path: `/pagesB/shop-detail/shop-detail?id=${this.shopId}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
},
onLoad(op) { onLoad(op) {
if(op.invite_code) {
//
this.$store.commit('setFristIn',true);
uni.setStorageSync('invite_code',op.invite_code);
} else {
this.$store.commit('setFristIn',false);
}
this.shopId = op.id; this.shopId = op.id;
// //
this.getDetail(); this.getDetail();

View File

@ -0,0 +1,96 @@
<template>
<view>
<status-container titlet="上传练习视频" returnc="#FFFFFF">
<view slot="content">
<view class="pad-zy20">
<view class="radius8 bacf pad-sx40 pad-zy40 boxshow2 col26 fon24">
<view class="">视频标题</view>
<input v-model="title" class="width100 radius4 mar-s20 pad-zy20" type="text" style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;">
<view class="mar-s40">视频上传</view>
<input @tap="uploadVideo" class="width100 radius4 mar-s20 pad-zy20 tcenter" type="text" placeholder="浏览..." disabled
style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;">
<input @tap="submitEv" class="width100 radius4 mar-s60 tcenter" type="text" placeholder="立即上传" placeholder-style="color:#FFFFFF;" disabled
style="border: 2rpx solid #e42417;background-color: #e42417;height: 70rpx;box-sizing: border-box;">
</view>
</view>
</view>
</status-container>
</view>
</template>
<script>
import {uploadFile} from '@/jsFile/public-api.js';
export default {
data() {
return {
title:'',
videoInfo:{
full_src:'',
src:''
},
flag:true
}
},
methods: {
//
uploadVideo(){
uni.chooseMedia({
sourceType:['album','camera'],
success: (res) => {
uni.showToast({
title:'正在上传...',
icon:'none',
duration:100000
})
uploadFile({path:res.tempFiles[0].tempFilePath}).then(res=>{
if(res.code==0){
this.videoInfo = res.data;
this.$toolAll.tools.showToast('上传视频成功(*^▽^*)');
}
setTimeout(()=>{
uni.hideToast();
},1500)
})
}
})
},
//
submitEv(){
if(!this.title){
this.$toolAll.tools.showToast('请输入视频标题');
} else if(!this.videoInfo.full_src){
this.$toolAll.tools.showToast('请上传视频');
} else {
if(this.flag){
this.flag = false;
let params = {
title:this.title,
video:this.videoInfo.full_src
}
uni.showToast({
title:'正在上传练习视频',
icon:'none',
duration:100000
})
this.$requst.post('/api/user/practice-video',params).then(res=>{
if(res.code==0){
this.title = '';
this.videoInfo.full_src = '';
this.$toolAll.tools.showToast('上传练习视频成功');
}
setTimeout(()=>{
uni.hideToast();
},1500)
}).catch(err=>{
this.flag = true;
})
}
}
}
}
}
</script>
<style>
</style>

View File

@ -2,12 +2,17 @@ export default {
state:{//存放状态 state:{//存放状态
token:'token已生成', token:'token已生成',
userInfo:{}, userInfo:{},
ifAutoplay:false // 组件轮播是否自动播放 ifAutoplay:false ,// 组件轮播是否自动播放
fristIn:false
}, },
// Vuex中store数据改变的唯一方法就是mutations 不适合异步方法 // Vuex中store数据改变的唯一方法就是mutations 不适合异步方法
mutations: { mutations: {
setAutoplay(state,str) { setAutoplay(state,str) {
state.ifAutoplay = str; state.ifAutoplay = str;
} },
// 设置是否第一次进入
setFristIn(state,str) {
state.fristIn = str;
},
} }
} }