|
@@ -19,7 +19,21 @@
|
|
|
<block v-else-if="detail.filetype == '音频'">
|
|
|
<my-audio :src="files[0].url" :title="files[0].document" />
|
|
|
</block>
|
|
|
+
|
|
|
+ <view class="collect" @click="loadings.collect ? '' : handleCollect(1, detail.iscollect)">
|
|
|
+ <u-loading-icon v-if="loadings.collect" />
|
|
|
+ <block v-else>
|
|
|
+ <view v-if="detail.iscollect" style="color: #FFC300;" class="iconfont icon-yishoucang" />
|
|
|
+ <view v-else style="color: #646566;" class="iconfont icon-weishoucang" />
|
|
|
+ <view class="text">
|
|
|
+ 收藏
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<My_listbox v-if="showListbox" :pullDown="false" boxBackground="#fff">
|
|
|
<view class="introduce">
|
|
|
<view class="detail-title">详情</view>
|
|
@@ -51,7 +65,10 @@ export default {
|
|
|
files: [],
|
|
|
showListbox: false,
|
|
|
speed: '1.0',
|
|
|
- speeds: ['0.5', '1.0', '1.5', '2.0']
|
|
|
+ speeds: ['0.5', '1.0', '1.5', '2.0'],
|
|
|
+ loadings: {
|
|
|
+ collect: false
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -89,6 +106,36 @@ export default {
|
|
|
if (!this.videoContext) this.videoContext = uni.createVideoContext('myVideo');
|
|
|
this.videoContext.playbackRate(speed - 0)
|
|
|
this.speed = speed;
|
|
|
+ },
|
|
|
+ handleCollect(type, value) {
|
|
|
+ if (type == 1) {
|
|
|
+ this.loadings.collect = true;
|
|
|
+ } else {
|
|
|
+ this.loadings.like = true;
|
|
|
+ }
|
|
|
+ this.$Http.basic({
|
|
|
+ "id": 20240416133702,
|
|
|
+ "content": {
|
|
|
+ "ownertable": "sat_coursewaredetail",
|
|
|
+ "ownerid": this.detail.sat_coursewaredetailid,
|
|
|
+ type
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log(value ? '取消' : '添加', type == 1 ? "收藏" : "喜欢", res)
|
|
|
+ if (type == 1) {
|
|
|
+ this.loadings.collect = false;
|
|
|
+ } else {
|
|
|
+ this.loadings.like = false;
|
|
|
+ }
|
|
|
+ if (this.cutoff(res.msg)) return;
|
|
|
+ if (type == 1) {
|
|
|
+ this.detail.iscollect = value ? 0 : 1
|
|
|
+ this.detail.collectcount = value ? this.detail.collectcount - 1 : this.detail.collectcount - 0 + 1
|
|
|
+ } else {
|
|
|
+ this.detail.islike = value ? 0 : 1
|
|
|
+ this.detail.likecount = value ? this.detail.likecount - 1 : this.detail.likecount - 0 + 1
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -96,6 +143,7 @@ export default {
|
|
|
|
|
|
<style lang="scss">
|
|
|
.head {
|
|
|
+ position: relative;
|
|
|
width: 100vw;
|
|
|
background: #fff;
|
|
|
margin-bottom: 10px;
|
|
@@ -145,8 +193,35 @@ export default {
|
|
|
height: 100px;
|
|
|
}
|
|
|
|
|
|
+ .collect {
|
|
|
+ position: absolute;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ top: 10px;
|
|
|
+ right: 10px;
|
|
|
+ width: 80px;
|
|
|
+ height: 24px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 12px;
|
|
|
+ border: 1px solid #CCCCCC;
|
|
|
+
|
|
|
+ .iconfont {
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .text {
|
|
|
+ font-family: PingFang SC, PingFang SC;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #333333;
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
.introduce {
|
|
|
padding: 10px;
|
|
|
|