index.vue 5.2 KB

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