index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="container">
  3. <view style="background-color: #FFFFFF;width: 750rpx;height: 72px;">
  4. <image src="../../static/touxiang.png" class="touxiang"></image>
  5. <view class="username">{{name}}</view>
  6. <text class="phone">{{phone}}</text>
  7. <image src="../../static/share.png" class="share" @click="share"></image>
  8. <image src="../../static/loginout.png" class="loginout" @click="loginout"></image>
  9. </view>
  10. <!-- 项目列表 -->
  11. <view class="list-item" v-for="(item,index) in list" :key="index">
  12. <view class="list-title">快乐体操</view>
  13. <view class="list-icon"></view>
  14. <view class="list-title2">学习视频</view>
  15. <!-- 视频 -->
  16. <view style="margin-left: 40px;height: 104px;margin-top: 10px;">
  17. <image class="video" @click="playVideo(item)" :src="item.pictureUrl"></image>
  18. <view class="jieshao">{{item.videoName}}</view>
  19. <view class="xiang">{{item.videoDescription}}</view>
  20. </view>
  21. <view class="list-icon"></view>
  22. <view class="list-title2">学习资料</view>
  23. <!-- 资料 -->
  24. <view style="width: 690rpx;margin-left: 40px;margin-top: 10px;" v-for="(item,index) in item.videoElseList" :key="index">
  25. <view class="ziliao">{{item.videoElesName}}</view>
  26. <image src="../../static/xiazai.png" class="xiazai" @click="download(item)"></image>
  27. </view>
  28. <view style="height:20px"></view>
  29. <!-- <view style="width: 690rpx;margin-left: 40px;margin-top: 10px;">
  30. <view class="ziliao">资料2</view>
  31. <image src="../../static/xiazai.png" class="xiazai"></image>
  32. </view> -->
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. name:'xxx',//用户名
  41. phone:'xxxxxxxxxxx',//手机号
  42. fileUrl:'https://chuanghai-tech.com/video/txt.pdf',//下载链接
  43. list:[],//当前页面数组数据
  44. list2:[],//下载的东西2
  45. token:'',//缓存token
  46. resultDecodeN:'',//解密后数据
  47. }
  48. },
  49. onLoad() {
  50. if(wx.getStorageSync('userName')!='' || wx.getStorageSync('telPhone')!=''){
  51. this.name=wx.getStorageSync('userName')
  52. this.phone=wx.getStorageSync('telPhone')
  53. }
  54. this.token=wx.getStorageSync('token')
  55. this.getList()
  56. },
  57. methods: {
  58. //列表
  59. getList(){
  60. this.$axios.get('/shareVideo/api/video/video',
  61. {
  62. headers:{
  63. 'token':this.token
  64. }
  65. }
  66. ).then(res => {
  67. if (res.data.success) {
  68. console.log(res.data)
  69. var shu=res.data.data
  70. // 开始解密
  71. this.resultDecodeN = this.$fns.rsaDecode(shu[0])+
  72. this.$fns.rsaDecode(shu[1])+this.$fns.rsaDecode(shu[2])+
  73. this.$fns.rsaDecode(shu[3])+this.$fns.rsaDecode(shu[4])+
  74. this.$fns.rsaDecode(shu[5])+this.$fns.rsaDecode(shu[6])+
  75. this.$fns.rsaDecode(shu[7])+this.$fns.rsaDecode(shu[8])+
  76. this.$fns.rsaDecode(shu[9])+this.$fns.rsaDecode(shu[10])
  77. //解析
  78. console.log(JSON.parse(this.resultDecodeN));
  79. //获取数组
  80. JSON.parse(this.resultDecodeN).forEach(data => {
  81. this.list.push(data)
  82. // this.list2.push(data.videoElseList)
  83. })
  84. } else {
  85. uni.showToast({ title: res.data.message, icon: 'none' });
  86. }
  87. }).catch(res =>{
  88. });
  89. },
  90. //跳转播放视频
  91. playVideo(item){
  92. uni.navigateTo({
  93. url:'/pages/video/video?id='+item.id
  94. })
  95. },
  96. //下载文件
  97. download(item) {
  98. if(this.isIos()){
  99. uni.navigateTo({
  100. url:'/pages/IOSDownLoad/IOSDownLoad?url='+item.videoElesUrl
  101. })
  102. }else{
  103. //直接在浏览器中打开
  104. window.location.href = 'http://139.199.2.142:8081//img'+item.videoElesUrl;
  105. }
  106. },
  107. //判断是否ios
  108. isIos() {
  109. let u = navigator.userAgent
  110. let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
  111. if (isIOS) {
  112. return true
  113. } else {
  114. return false
  115. }
  116. },
  117. //分享链接
  118. share(){
  119. wx.setClipboardData({
  120. data: uni.getStorageSync('url'),
  121. success: function(res) {
  122. wx.showToast({
  123. title: '复制'+uni.getStorageSync('url')+'成功',
  124. icon: "none",
  125. mask: "true"
  126. })
  127. }
  128. })
  129. },
  130. //退出登录
  131. loginout(){
  132. uni.navigateTo({
  133. url:'/pages/login/login'
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style>
  140. .container {
  141. padding: 10px 20px 20px 0px;
  142. font-size: 16px;
  143. line-height: 24px;
  144. }
  145. .touxiang{
  146. width: 100rpx;
  147. height: 100rpx;
  148. padding: 10px 10px 10px 10px;
  149. }
  150. .username{
  151. margin-left: 70px;
  152. margin-top: -65px;
  153. }
  154. .phone{
  155. margin-left: 70px;
  156. font-size: 14px;
  157. }
  158. .share{
  159. width: 50rpx;
  160. height: 50rpx;
  161. /* position: absolute; */
  162. margin-left: 140px;
  163. margin-top: -15px;
  164. }
  165. .loginout{
  166. width: 50rpx;
  167. height: 50rpx;
  168. /* position: absolute; */
  169. margin-left: 10px;
  170. margin-top: -15px;
  171. }
  172. /* 项目列表 */
  173. .list-item{
  174. margin-top: 10px;
  175. width: 750rpx;
  176. height: auto;
  177. border-radius: 15rpx;
  178. background-color: #FFFFFF;
  179. }
  180. .list-title{
  181. padding-top: 20px;
  182. font-size: 27px;
  183. text-align: center;
  184. }
  185. .list-icon{
  186. margin-left: 20px;
  187. margin-top: 20rpx;
  188. width: 8rpx;
  189. height: 32rpx;
  190. opacity: 1;
  191. border-radius: 33rpx;
  192. background: #1E7DFB;
  193. }
  194. .list-title2{
  195. margin-top: -20px;
  196. margin-left: 30px;
  197. }
  198. /* 视频 */
  199. .video{
  200. width: 394rpx;
  201. height: 200rpx;
  202. background-color: antiquewhite;
  203. /* float: left; */
  204. }
  205. .jieshao{
  206. margin-top: -100px;
  207. margin-left: 220px;
  208. }
  209. .xiang{
  210. margin-left: 220px;
  211. margin-top: 10px;
  212. }
  213. /* 资料 */
  214. .ziliao{
  215. width: 170px;
  216. line-height: 40rpx;
  217. font-size: 32rpx;
  218. float: left;
  219. }
  220. .xiazai{
  221. width: 40rpx;
  222. height: 40rpx;
  223. margin-left: 120px;
  224. /* float: right; */
  225. }
  226. </style>