对接不知情的接口
parent
08ce9d2038
commit
027d00edc4
2
App.vue
2
App.vue
|
@ -5,7 +5,7 @@
|
|||
projectname:'', // 项目名称
|
||||
lat:'', // 公司地址维度
|
||||
lng:'' ,// 公司地址经度
|
||||
hostapi:'https://chuanwujia.scdxtc.cn' // 域名配置
|
||||
hostapi:'https://chuanwujia.com' // 域名配置
|
||||
},
|
||||
// 优先于show方法
|
||||
onLaunch: ()=> {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="col9 fon24 disjcac pad-sx50" v-if="!dataList.length">暂无可用优惠券</view>
|
||||
</view>
|
||||
<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;">
|
||||
|
@ -82,7 +83,8 @@
|
|||
},
|
||||
// 查询是否选中
|
||||
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){
|
||||
this.dataList[exitIndex].ifcheck = true;
|
||||
this.setCoupon(true,exitIndex);
|
||||
|
@ -90,11 +92,13 @@
|
|||
},
|
||||
// 存储优惠券的值
|
||||
setCoupon(flag,index){
|
||||
if(this.dataList.length){
|
||||
this.couponIndex = index;
|
||||
this.dataList[index].ifcheck = flag;
|
||||
this.couponPrice = flag?this.dataList[index].amount:0;//选中优惠券金额
|
||||
this.couponId = flag?this.dataList[index].coupon_id:'';//选中优惠券id
|
||||
this.couponId = flag?this.dataList[index].id:'';//选中优惠券id
|
||||
this.couponCount = flag?1:0;//选中优惠券数量
|
||||
}
|
||||
},
|
||||
// 选择优惠券
|
||||
chooseCoupon(id,index){
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
export default {
|
||||
name:'status-nav',
|
||||
props:{
|
||||
|
@ -100,6 +101,11 @@
|
|||
netTimer:null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
fristIn: state => state.moduleA.fristIn
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
// 网络监测
|
||||
this.$toolAll.tools.networkStatus();
|
||||
|
@ -130,10 +136,16 @@
|
|||
},
|
||||
//返回事件
|
||||
backEv(){
|
||||
if(this.fristIn){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack({delta:1})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -5,7 +5,7 @@ export function uploadImg(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) {
|
||||
|
|
|
@ -46,6 +46,7 @@ const checkError = (e) => {
|
|||
case 5001:// xxx错误
|
||||
case 5050:// 服务器错误,请稍后重试
|
||||
case 5051:// 未知错误
|
||||
console.log(e,7777)
|
||||
uni.showToast({
|
||||
title:e.data.msg,
|
||||
icon:'none'
|
||||
|
@ -97,6 +98,7 @@ const request = (method, url, options) => {
|
|||
break;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log(`${url}的参数===>`,options);
|
||||
uni.request({
|
||||
url: `${getApp().globalData.hostapi}${url}`,
|
||||
method: methods,
|
||||
|
@ -153,6 +155,9 @@ const uploadFile = (url, options, type) => {
|
|||
if (temp.code == 0) {
|
||||
resolve(temp)
|
||||
}
|
||||
} else {
|
||||
// 接口返回错误信息
|
||||
checkError(res);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
/* 小程序特有相关 */
|
||||
"appid" : "wxa02e44170bc722cd",
|
||||
"appid" : "wxfda00ea49fc88f8f",
|
||||
"setting" : {
|
||||
"urlCheck" : true,
|
||||
"es6" : true,
|
||||
|
|
|
@ -205,6 +205,15 @@
|
|||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "upload-video/upload-video",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
city: ya.userInfo.city,//用户所在城市
|
||||
gender: ya.userInfo.gender,//用户性别
|
||||
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
|
||||
}
|
||||
this.$requst.post('/api/user/login',params).then(res => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<view>
|
||||
<status-container :ifReturn="false" titlet="课程列表">
|
||||
<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="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">
|
||||
|
@ -11,6 +11,8 @@
|
|||
</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>
|
||||
</view>
|
||||
<view class="pad-zy20">
|
||||
|
@ -48,7 +50,7 @@
|
|||
noMore:false,//是否没有更多
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
onShow() {
|
||||
// 调用获取分类列表
|
||||
this.getCourseCate();
|
||||
},
|
||||
|
@ -108,7 +110,7 @@
|
|||
// 去课程详情
|
||||
goDetail(id){
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/course-detail/course-detail?id=${id}`
|
||||
url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}`
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
@ -57,12 +57,11 @@
|
|||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight, // 状态栏高度
|
||||
newHeight:uni.getSystemInfoSync().screenHeight, // 窗口高度
|
||||
isLoading:false, //加载完成
|
||||
// {src:'/static/tabbar/icon-panh.png',title:'我的练习视频'},
|
||||
funList:[
|
||||
{src:'/static/tabbar/icon-set.png',title:'个人资料'},
|
||||
{src:'/static/tabbar/icon-course.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-score.png',title:'我的积分'},
|
||||
{src:'/static/tabbar/icon-address.png',title:'我的地址'},
|
||||
|
@ -97,12 +96,11 @@
|
|||
|
||||
// 导航跳转
|
||||
chooseFun(index){
|
||||
// '/pagesA/my-video/my-video',
|
||||
let list = [
|
||||
'/pagesA/my-data/my-data',
|
||||
'/pagesA/my-course/my-course',
|
||||
'/pagesA/my-order/my-order',
|
||||
|
||||
'/pagesA/my-video/my-video',
|
||||
'/pagesA/my-coupon/my-coupon',
|
||||
'/pagesA/my-integral/my-integral',
|
||||
'/pagesA/my-address/my-address',
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<span class="bold">¥{{item.price}}</span>
|
||||
<span class="fon20 colf8 mar-z20 tline-through">¥{{item.original_price}}</span>
|
||||
</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>
|
||||
|
@ -98,7 +98,15 @@
|
|||
// 关闭banner图自动轮播
|
||||
this.$store.commit('setAutoplay',false);
|
||||
},
|
||||
onLoad() {
|
||||
onShareAppMessage(res) {
|
||||
var shareObj = {
|
||||
title: ``, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ``//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(op) {
|
||||
// 调用获取分类列表
|
||||
this.getCourseCate();
|
||||
// 调用获取首页banner图
|
||||
|
@ -206,15 +214,15 @@
|
|||
},
|
||||
// 播放视频
|
||||
palyVideo(index){
|
||||
if(!this.videoList[index].src){
|
||||
if(this.videoList[index].type=="video_number"){
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openChannelsActivity({
|
||||
finderUserName:this.videoList[index].video_number,
|
||||
feedId:this.videoList[index].subtitle,
|
||||
feedId:this.videoList[index].video_id,
|
||||
success:(res)=>{
|
||||
reportRecord({id:this.videoList[index].id}).then(result=>{})
|
||||
},fail:()=>{
|
||||
this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
// this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
|
|
@ -91,11 +91,11 @@
|
|||
},
|
||||
// 播放视频
|
||||
palyVideo(index){
|
||||
if(!this.dataList[index].src){
|
||||
if(this.dataList[index].type=="video_number"){
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openChannelsActivity({
|
||||
finderUserName:this.dataList[index].video_number,
|
||||
feedId:this.dataList[index].subtitle,
|
||||
feedId:this.dataList[index].video_id,
|
||||
success:(res)=>{
|
||||
reportRecord({id:this.dataList[index].id}).then(result=>{
|
||||
if(result.code==0){
|
||||
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
})
|
||||
},fail:()=>{
|
||||
this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
// this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<nothingPage content="地址列表空荡荡滴"></nothingPage>
|
||||
</view>
|
||||
<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="fon26 mar-z10">新增收货地址</view>
|
||||
</view>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<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>
|
||||
<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 class="disac fon20 pad-s20" style="color: #747474;">
|
||||
<span @tap="lookDetail(index)">详细信息</span>
|
||||
|
@ -89,6 +89,14 @@
|
|||
this.getCouponList();
|
||||
},
|
||||
methods: {
|
||||
// 去使用事件
|
||||
goCourse(){
|
||||
if(this.status=='normal'){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/course/course'
|
||||
})
|
||||
}
|
||||
},
|
||||
// tab点击事件
|
||||
clickTab(index){
|
||||
this.dataList = [];
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</view>
|
||||
<view class="disjbac width100">
|
||||
<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>
|
||||
|
|
|
@ -162,6 +162,8 @@
|
|||
})
|
||||
},1000)
|
||||
}
|
||||
} else {
|
||||
this.flag = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -115,6 +115,11 @@
|
|||
this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('支付成功(*^▽^*)');
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/course/course'
|
||||
})
|
||||
},1500)
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
})
|
||||
},
|
||||
|
@ -125,6 +130,8 @@
|
|||
this.flag = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.flag = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -175,6 +175,8 @@
|
|||
})
|
||||
},1000)
|
||||
}
|
||||
} else {
|
||||
this.flag = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<view class="posAll disjc" v-if="ifLogin">
|
||||
<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>
|
||||
<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>
|
||||
</view>
|
||||
|
@ -68,13 +68,20 @@
|
|||
id:'', //课程id
|
||||
page:1, //页数
|
||||
size:1000, //条数
|
||||
courseList:[]
|
||||
courseList:[],
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
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.classId = op.category_id
|
||||
this.classId = op.category_id;
|
||||
// 获取课程详情
|
||||
this.getCouresDetail(op.id);
|
||||
}
|
||||
|
@ -82,7 +89,7 @@
|
|||
onShareAppMessage(res) {
|
||||
var shareObj = {
|
||||
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: ``//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
|
@ -123,6 +130,7 @@
|
|||
},
|
||||
// 立即购买
|
||||
goBuy(){
|
||||
if(uni.getStorageSync('is_active')){
|
||||
let params = {
|
||||
sku_list:this.courseList[0].sku_list
|
||||
};
|
||||
|
@ -135,6 +143,9 @@
|
|||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.ifLogin = true;
|
||||
}
|
||||
},
|
||||
// 获取课程推荐
|
||||
getCouresRecommend(){
|
||||
|
@ -145,7 +156,6 @@
|
|||
id:this.id
|
||||
}
|
||||
this.$requst.get('/api/spu/course-recommend',params).then(res=>{
|
||||
console.log(res,'课程推荐')
|
||||
if(res.code==0) {
|
||||
this.$refs.refcourse.list = res.data.list;
|
||||
}
|
||||
|
@ -160,25 +170,35 @@
|
|||
},
|
||||
// 播放视频
|
||||
playVideo(){
|
||||
if(!this.couresDetail[index].src){
|
||||
if(this.couresDetail.type=="video_number"){
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openChannelsActivity({
|
||||
finderUserName:this.couresDetail[index].video_number,
|
||||
feedId:this.couresDetail[index].subtitle,
|
||||
finderUserName:this.couresDetail.video_number,
|
||||
feedId:this.couresDetail.video_id,
|
||||
success:(res)=>{},fail:()=>{
|
||||
this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
// this.$toolAll.tools.showToast('视频已丢失或已删除')
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
if(uni.getStorageSync('is_active')){
|
||||
let newArr = [];
|
||||
newArr.push(this.couresDetail[index])
|
||||
newArr.push({src:this.couresDetail.video})
|
||||
uni.setStorageSync('videoList',newArr);
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/play-video/play-video?current=${index}`
|
||||
url:`/pagesB/play-video/play-video?current=${0}`
|
||||
})
|
||||
} else {
|
||||
this.ifLogin = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 去登录
|
||||
goLogin(){
|
||||
uni.navigateTo({
|
||||
url:`/pages/login/login`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -124,6 +124,8 @@
|
|||
})
|
||||
},1000)
|
||||
}
|
||||
} else {
|
||||
this.flag = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -88,7 +88,22 @@
|
|||
// 关闭banner图自动轮播
|
||||
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: ``//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
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.getDetail();
|
||||
|
|
|
@ -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>
|
|
@ -2,12 +2,17 @@ export default {
|
|||
state:{//存放状态
|
||||
token:'token已生成',
|
||||
userInfo:{},
|
||||
ifAutoplay:false // 组件轮播是否自动播放
|
||||
ifAutoplay:false ,// 组件轮播是否自动播放
|
||||
fristIn:false
|
||||
},
|
||||
// Vuex中store数据改变的唯一方法就是mutations 不适合异步方法
|
||||
mutations: {
|
||||
setAutoplay(state,str) {
|
||||
state.ifAutoplay = str;
|
||||
}
|
||||
},
|
||||
// 设置是否第一次进入
|
||||
setFristIn(state,str) {
|
||||
state.fristIn = str;
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue