Browse Source

Merge branch 'activityCenter'

c4az6 4 years ago
parent
commit
c51924687f

+ 2 - 1
.env.development

@@ -3,5 +3,6 @@ VUE_APP_Host=''
 VUE_APP_DoctorUserLoginUrl='http://mem.360lj.com/ueapi1/api/Home/Login?identity=1&backurl=http://mem.360lj.com/ueapi1/dist/SignUp'
 VUE_APP_PartnerUserLoginUrl='http://mem.360lj.com/ueapi1/api/Home/Login?identity=2&backurl=http://mem.360lj.com/ueapi1/dist/SignUp'
 VUE_APP_PatientUserLoginUrl='http://mem.360lj.com/ueapi1/api/Home/Login?identity=0&backurl=http://mem.360lj.com/ueapi1/dist/PatientUser'
-VUE_APP_Url='http://mem.360lj.com/ueapi1'
+VUE_APP_Url='https://ue.360lj.com'
+VUE_APP_Url2='http://mem.360lj.com/ueapi1'
 VUE_APP_DoctorAPIUrl = '/ym1'

+ 36 - 3
src/App.vue

@@ -83,10 +83,11 @@
             }, 2000); */
     },
     async mounted() {
-      const { data: response } = await reqGetWeixinSign()
-      // console.log("response: ", response)
+      // const { data: response } = await reqGetWeixinSign()
+      const { data: response } = await this.$http.GetSing()
+      console.log("response: ", response)
       // if (response.success !== 1) return this.$toast('服务器异常,请稍后重试!')
-      wx.config({
+/*       wx.config({
         debug: false, // 是否开启调试模式
         appId: response.result.appId, //appid
         timestamp: response.result.timestamp, // 时间戳
@@ -110,6 +111,38 @@
       wx.ready(function () {
         console.log("JS-SDK配置成功")
       });
+      wx.error(function (res) {
+        // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名
+        console.log("配置错误: ", res)
+      }); */
+
+
+
+      /* ue.360lj.com 获取微信签名信息配置 */
+      wx.config({
+        debug: false, // 是否开启调试模式
+        appId: response.ResultObject.appId, //appid
+        timestamp: response.ResultObject.timestamp, // 时间戳
+        nonceStr: response.ResultObject.nonceStr, // 随机字符串
+        signature: response.ResultObject.signature, // 签名
+        jsApiList: [
+          "hideOptionMenu",
+          "onMenuShareTimeline",
+          "onMenuShareAppMessage",
+          "onMenuShareQQ",
+          "onMenuShareWeibo",
+          "onMenuShareQZone",
+          "openLocation",
+          "chooseWXPay"
+        ],
+        openTagList: [
+          'wx-open-launch-weapp',  //跳转小程序
+          'wx-open-launch-app'      //跳转app
+        ]
+      });
+      wx.ready(function () {
+        console.log("JS-SDK配置成功")
+      });
       wx.error(function (res) {
         // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名
         console.log("配置错误: ", res)

+ 4 - 0
src/api/ShortVideo/ShortVideo.js

@@ -70,6 +70,10 @@ export const getCommentList = (data) => {
 
 
 // 根据指定的ID获取视频
+/**
+ * 
+ * @param {string} ID - 视频的ID值 
+ */
 export const getVideoById = (data) => {
   return api.post('/api/Program/GetVideo', {
     ...data

+ 8 - 0
src/router.js

@@ -135,6 +135,14 @@ let partner = [
 
 /* 短视频路由 start */
 let shortVideo = [
+  {
+    path: "/oneVideoPlayer",
+    name: "OneVideoPlayer",
+    meta: {
+      title: "优医短视频"
+    },
+    component: () => import('./views/shortVideo/OneVideoPlayer.vue')
+  },
   {
     path: "/videoPlayerTest",
     name: "VideoPlayerTest",

BIN
src/static/imgs/home.png


+ 304 - 0
src/views/shortVideo/OneVideoPlayer.vue

@@ -0,0 +1,304 @@
+<template>
+  <div class="videoList-wrap">
+    <swiper :options="swiperOption">
+      <!-- 幻灯内容 -->
+      <swiper-slide v-for="(item, index) in videoList"
+                    :key="index">
+        <div>
+          <videos ref="videos"
+                  :videoList="item"
+                  :index="index"
+                  @addVideoCount="handleAddVideoCount"></videos>
+
+          <div class="jump-icon"
+               :style="userType!==1?'justify-content: flex-end':''">
+            <i @click="jumpUpload"
+               v-show="userType===1"><img src="../../static/imgs/home.png"
+                   alt=""></i>
+            <router-link to="/search"><img src="../../static/imgs/search-icon.png"
+                   alt=""></router-link>
+          </div>
+        </div>
+        <info-bar @addLike="handleAddLike"
+                  @showComment="handleShowComment"
+                  @addAttention="handleAttention"
+                  @cancelLike="handleCancelLike"
+                  :videoList="item"
+                  :isAttention="item.IsFollow"
+                  :isLike="item.IsLike"></info-bar>
+      </swiper-slide>
+    </swiper>
+    <comment @submitComment="onSubmitComment"
+             @closeComment="onCloseComment"
+             :showComment="showComment"
+             :commentList="commentList"
+             :totalItemCount="totalItemCount"></comment>
+    <van-overlay :show="show" />
+    <van-loading class="loading-btn"
+                 size=".24rpx"
+                 color="#fff"
+                 vertical
+                 v-show="isLoading">加载中...</van-loading>
+  </div>
+</template>
+
+<script>
+  import { Swiper, SwiperSlide } from "vue-awesome-swiper";
+  import videos from "../../components/shortVideo/Videos";
+  import infoBar from "../../components/shortVideo/InfoBar";
+  import comment from "../../components/shortVideo/Comment";
+  import {
+    addFollow,
+    cancelLike,
+    addLike,
+    addComment,
+    getCommentList,
+    addPlay,
+    getUserInfo,
+    getVideoById
+  } from "../../api/ShortVideo/ShortVideo";
+  export default {
+    data() {
+      return {
+        userType: '',   // 用户信息
+        show: false,    // 遮罩层
+        hasMoreVideo: true,   // 是否还有更多视频
+        isLoading: false,   // 是否显示加载按钮
+        totalItemCount: 0, // 评论数据总数
+        commentList: [], // 评论列表
+        commentParams: {
+          pageIndex: 0,
+          pageSize: 10,
+          id: ""
+        }, // 评论分页数据
+        videoCommentList: [], // 评论数据
+        showComment: false,
+        videoList: [],
+        page: 1,
+        swiperOption: {
+          direction: "vertical",
+          grabCursor: true,
+          setWrapperSize: true,
+          autoHeight: true, // 自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化
+          slidesPerView: 1,
+          mousewheel: true,
+          preventClicksPropagation: true,
+          mousewheelControl: true,
+          height: window.innerHeight, // 高度设置,占满设备高度
+          resistanceRatio: 0,
+          observeParents: true,
+          on: {
+            tap: () => {
+              this.playAction(this.page - 1);
+              event.stopPropagation();
+            }
+          }
+        }
+      };
+    },
+    components: {
+      Swiper,
+      SwiperSlide,
+      videos,
+      infoBar,
+      comment
+    },
+    mounted() {
+      this._getUserInfo();
+      //使用微信访问,获取代理
+      var ua = navigator.userAgent;
+      var version = "000000";
+      var key = "TBS/";
+      var start = ua.indexOf(key);
+      if (start !== -1) {
+        start = start + key.length;
+        version = ua.substr(start, ua.indexOf(" ", start) - start);
+      }
+      if (version.indexOf("000000") !== -1) {
+      } else {
+        this.$notify({
+          message: "您当前播放设置已影响了视频的观看,请修正设置。点击查看修正方法>>",
+          color: "#fff",
+          background: "#2f2f2f",
+          duration: 0,
+          onClick: _ => {
+            this.$notify.clear();
+            this.$router.push({ name: 'Explain' })
+          }
+        })
+      }
+      this.videoList = [];
+      this.getList();
+    },
+    methods: {
+      // 跳转上传视频页面
+      jumpUpload() {
+        // window.location.replace('http://ue.360lj.com/api/Home/Login?identity=2&backurl=http://ue.360lj.com/dist/uploadFile')
+        // window.location.replace('http://linyi.natapp1.cc/api/Home/Login?identity=2&backurl=http://linyi.natapp1.cc/dist/uploadFile')
+        // var doctorUserLoginUrl = process.env.VUE_APP_DoctorUserLoginUrl.replace('SignUp', 'uploadFile')
+        // console.log("uploadUrl: ", doctorUserLoginUrl)
+        // window.location.replace(doctorUserLoginUrl)
+        this.$router.push('/specialist')
+
+      },
+      // 获取用户基本信息
+      _getUserInfo() {
+        getUserInfo()
+          .then(({ data }) => {
+            if (data.IsSuccess) {
+              const { userRoles } = data.ResultObject
+              let findResult = userRoles.find(item => item.UserRoleType === 1)
+              this.userType = findResult.UserRoleType
+            } else {
+              this.$toast.fail(data.ResultMsg)
+            }
+          })
+          .catch(error => {
+            console.log(error)
+          })
+      },
+      // 新增视频播放次数
+      handleAddVideoCount(e) {
+        addPlay({ "ID": e.videoData.ID })
+      },
+
+      // 获取评论数据
+      getVideoCommentList() {
+        getCommentList({ ...this.commentParams })
+          .then(res => {
+            this.commentList = res.data.ResultObject;
+            this.totalItemCount = res.data.Pager.TotalItemCount;
+          })
+          .catch(error => { });
+      },
+      // 加载数据
+      async getList() {
+        /* 根据URL中的ID获取视频 */
+        const ID = this.getUrlParams('id')
+        console.log("传递过来的视频ID: ", ID)
+        console.log(getVideoById)
+        const { data: response } = await getVideoById({ ID })
+        console.log("response: ", response)
+        if (!response.IsSuccess) return this.$toast(response.ResultMsg)
+        this.videoList = [response.ResultObject]
+        console.log("this.videoList: ", this.videoList)
+      },
+
+      // 用户取消点赞
+      handleCancelLike(id) {
+        cancelLike({ ...id })
+          .then(res => { })
+          .catch(error => { });
+      },
+
+      // 用户点赞
+      handleAddLike(id) {
+        addLike({ ...id })
+          .then(res => { })
+          .catch(error => { });
+      },
+
+      // 关注用户
+      handleAttention(e) {
+        addFollow({ id: e.id })
+          .then(res => {
+            this.videoList = this.videoList.map((item) => {
+              if (item.DoctorID === e.id) {
+                item.IsFollow = true
+              }
+              return item;
+            })
+            console.log(this.videoList);
+          })
+          .catch(error => { });
+      },
+
+      // 用户点击后播放或者暂停视频
+      playAction(index) {
+        this.$refs.videos[index].playOrStop();
+      },
+      // 监听用户提交评论
+      onSubmitComment(e) {
+        addComment({ VideoId: this.commentParams.id, Content: e.content })
+          .then(res => {
+            this.$notify({
+              type: "success",
+              message: "评论成功",
+              duration: 1000
+            });
+            // 关闭评论窗口
+          })
+          .catch(error => { });
+        // 重新请求接口获取评论
+        setTimeout(() => {
+          this.getVideoCommentList();
+        }, 500);
+      },
+
+      // 监听用户关闭评论
+      onCloseComment(e) {
+        this.showComment = false;
+        // this.getVideoCommentList();
+        console.log("this.pageIndex: ", this.page - 1);
+        console.log(e.commentCount);
+        this.videoList[this.page - 1].CommentFrequency = e.commentCount;
+      },
+
+      handleShowComment(id) {
+        this.commentParams.id = id.id;
+        this.getVideoCommentList();
+        // 显示评论界面
+        this.showComment = true;
+      }
+    }
+  };
+</script>
+
+<style lang="less" scoped>
+  .videoList-wrap {
+    background-color: #1d1d1d;
+  }
+
+  /deep/ .vjs-custom-skin > .video-js {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    // width: 80%;
+  }
+
+  /deep/ .vjs-custom-skin > .video-js .vjs-big-play-button {
+    font-size: 2em;
+  }
+
+  /deep/ .video-js .vjs-tech {
+    height: 90%;
+  }
+
+  .loading-btn {
+    position: fixed;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    z-index: 99999;
+    .van-loading__text {
+      color: #fff;
+    }
+  }
+
+  .jump-icon {
+    position: absolute;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 0.2rem;
+    width: 100%;
+    top: 0;
+    z-index: 9999;
+    background-color: #333333;
+    img {
+      width: 0.64rem;
+      height: 0.64rem;
+    }
+  }
+</style>

+ 360 - 347
src/views/shortVideo/ShortVideo.vue

@@ -2,395 +2,408 @@
   <div class="videoList-wrap">
     <swiper :options="swiperOption">
       <!-- 幻灯内容 -->
-      <swiper-slide
-        v-for="(item, index) in videoList"
-        :key="index"
-      >
+      <swiper-slide v-for="(item, index) in videoList"
+                    :key="index">
         <div>
-          <videos
-            ref="videos"
-            :videoList="item"
-            :index="index"
-            @addVideoCount="handleAddVideoCount"
-          ></videos>
+          <videos ref="videos"
+                  :videoList="item"
+                  :index="index"
+                  @addVideoCount="handleAddVideoCount"></videos>
 
-          <div
-            class="jump-icon"
-            :style="userType!==1?'justify-content: flex-end':''"
-          >
-            <i
-              @click="jumpUpload"
-              v-show="userType===1"
-            ><img
-                src="../../static/imgs/upload-icon.png"
-                alt=""
-              ></i>
-            <router-link to="/searchVideo"><img
-                src="../../static/imgs/search-icon.png"
-                alt=""
-              ></router-link>
+          <div class="jump-icon"
+               :style="userType!==1?'justify-content: flex-end':''">
+            <i @click="jumpUpload"
+               v-show="userType===1"><img src="../../static/imgs/upload-icon.png"
+                   alt=""></i>
+            <router-link to="/searchVideo"><img src="../../static/imgs/search-icon.png"
+                   alt=""></router-link>
           </div>
         </div>
-        <info-bar
-          @addLike="handleAddLike"
-          @showComment="handleShowComment"
-          @addAttention="handleAttention"
-          @cancelLike="handleCancelLike"
-          :videoList="item"
-          :isAttention="item.IsFollow"
-          :isLike="item.IsLike"
-        ></info-bar>
+        <info-bar @addLike="handleAddLike"
+                  @showComment="handleShowComment"
+                  @addAttention="handleAttention"
+                  @cancelLike="handleCancelLike"
+                  :videoList="item"
+                  :isAttention="item.IsFollow"
+                  :isLike="item.IsLike"></info-bar>
       </swiper-slide>
     </swiper>
-    <comment
-      @submitComment="onSubmitComment"
-      @closeComment="onCloseComment"
-      :showComment="showComment"
-      :commentList="commentList"
-      :totalItemCount="totalItemCount"
-    ></comment>
+    <comment @submitComment="onSubmitComment"
+             @closeComment="onCloseComment"
+             :showComment="showComment"
+             :commentList="commentList"
+             :totalItemCount="totalItemCount"></comment>
     <van-overlay :show="show" />
-    <van-loading
-      class="loading-btn"
-      size=".24rpx"
-      color="#fff"
-      vertical
-      v-show="isLoading"
-    >加载中...</van-loading>
+    <van-loading class="loading-btn"
+                 size=".24rpx"
+                 color="#fff"
+                 vertical
+                 v-show="isLoading">加载中...</van-loading>
   </div>
 </template>
 
 <script>
-import { Swiper, SwiperSlide } from "vue-awesome-swiper";
-import videos from "../../components/shortVideo/Videos";
-import infoBar from "../../components/shortVideo/InfoBar";
-import comment from "../../components/shortVideo/Comment";
-import {
-  searchVideoList,
-  addFollow,
-  cancelLike,
-  addLike,
-  addComment,
-  getCommentList,
-  searchVideoListByHome,
-  addPlay,
-  getUserInfo
-} from "../../api/ShortVideo/ShortVideo";
-export default {
-  data() {
-    return {
-      userType: '',   // 用户信息
-      show: false,    // 遮罩层
-      hasMoreVideo: true,   // 是否还有更多视频
-      isLoading: false,   // 是否显示加载按钮
-      totalItemCount: 0, // 评论数据总数
-      commentList: [], // 评论列表
-      commentParams: {
-        pageIndex: 0,
-        pageSize: 10,
-        id: ""
-      }, // 评论分页数据
-      videoCommentList: [], // 评论数据
-      params: {
-        // 视频分页参数
-        pageIndex: 1,
-        pageSize: 5,
-        name: ""
-      },
-      showComment: false,
-      videoList: [],
-      page: 1,
-      swiperOption: {
-        direction: "vertical",
-        grabCursor: true,
-        setWrapperSize: true,
-        autoHeight: true, // 自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化
-        slidesPerView: 1,
-        mousewheel: true,
-        preventClicksPropagation: true,
-        mousewheelControl: true,
-        height: window.innerHeight, // 高度设置,占满设备高度
-        resistanceRatio: 0,
-        observeParents: true,
-        on: {
-          tap: () => {
-            this.playAction(this.page - 1);
-            event.stopPropagation();
-          },
-          // 下滑结束
-          slideNextTransitionStart: () => {
-            ++this.page;
-            this.nextVideo(this.page - 1);
-            event.stopPropagation();
-          },
-          // 上滑结束
-          slidePrevTransitionEnd: () => {
-            if (this.page > 1) {
-              --this.page;
-              this.preVideo(this.page - 1);
+  import { Swiper, SwiperSlide } from "vue-awesome-swiper";
+  import videos from "../../components/shortVideo/Videos";
+  import infoBar from "../../components/shortVideo/InfoBar";
+  import comment from "../../components/shortVideo/Comment";
+  import {
+    searchVideoList,
+    addFollow,
+    cancelLike,
+    addLike,
+    addComment,
+    getCommentList,
+    searchVideoListByHome,
+    addPlay,
+    getUserInfo
+  } from "../../api/ShortVideo/ShortVideo";
+  export default {
+    data() {
+      return {
+        userType: '',   // 用户信息
+        show: false,    // 遮罩层
+        hasMoreVideo: true,   // 是否还有更多视频
+        isLoading: false,   // 是否显示加载按钮
+        totalItemCount: 0, // 评论数据总数
+        commentList: [], // 评论列表
+        commentParams: {
+          pageIndex: 0,
+          pageSize: 10,
+          id: ""
+        }, // 评论分页数据
+        videoCommentList: [], // 评论数据
+        params: {
+          // 视频分页参数
+          pageIndex: 1,
+          pageSize: 5,
+          name: ""
+        },
+        showComment: false,
+        videoList: [],
+        page: 1,
+        swiperOption: {
+          direction: "vertical",
+          grabCursor: true,
+          setWrapperSize: true,
+          autoHeight: true, // 自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化
+          slidesPerView: 1,
+          mousewheel: true,
+          preventClicksPropagation: true,
+          mousewheelControl: true,
+          height: window.innerHeight, // 高度设置,占满设备高度
+          resistanceRatio: 0,
+          observeParents: true,
+          on: {
+            tap: () => {
+              this.playAction(this.page - 1);
+              event.stopPropagation();
+            },
+            // 下滑结束
+            slideNextTransitionStart: () => {
+              ++this.page;
+              this.nextVideo(this.page - 1);
               event.stopPropagation();
+            },
+            // 上滑结束
+            slidePrevTransitionEnd: () => {
+              if (this.page > 1) {
+                --this.page;
+                this.preVideo(this.page - 1);
+                event.stopPropagation();
+              }
+            },
+            // 滑块结束
+            slideChangeTransitionEnd: () => {
+              setTimeout(() => {
+                this.handleSlideChange(this.page);
+                this.customShare()
+              }, 100);
+              
             }
-          },
-          // 滑块结束
-          slideChangeTransitionEnd: () => {
-            setTimeout(() => {
-              this.handleSlideChange(this.page);
-            }, 100);
           }
         }
-      }
-    };
-  },
-  components: {
-    Swiper,
-    SwiperSlide,
-    videos,
-    infoBar,
-    comment
-  },
-  mounted() {
-    this._getUserInfo();
-    //使用微信访问,获取代理
-    var ua = navigator.userAgent;
-    var version = "000000";
-    var key = "TBS/";
-    var start = ua.indexOf(key);
-    if (start !== -1) {
-      start = start + key.length;
-      version = ua.substr(start, ua.indexOf(" ", start) - start);
-    }
-    if (version.indexOf("000000") !== -1) {
-    } else {
-      this.$notify({
-        message: "您当前播放设置已影响了视频的观看,请修正设置。点击查看修正方法>>",
-        color: "#fff",
-        background: "#2f2f2f",
-        duration: 0,
-        onClick: _ => {
-          this.$notify.clear();
-          this.$router.push({ name: 'Explain' })
-        }
-      })
-    }
-    this.params.pageIndex = 1;
-    this.videoList = [];
-    this.getList();
-  },
-  methods: {
-    // 跳转上传视频页面
-    jumpUpload() {
-      // window.location.replace('http://ue.360lj.com/api/Home/Login?identity=2&backurl=http://ue.360lj.com/dist/uploadFile')
-      // window.location.replace('http://linyi.natapp1.cc/api/Home/Login?identity=2&backurl=http://linyi.natapp1.cc/dist/uploadFile')
-      var doctorUserLoginUrl = process.env.VUE_APP_DoctorUserLoginUrl.replace('SignUp', 'uploadFile')
-      console.log("uploadUrl: ", doctorUserLoginUrl)
-      window.location.replace(doctorUserLoginUrl)
-
+      };
     },
-    // 获取用户基本信息
-    _getUserInfo() {
-      getUserInfo()
-        .then(({ data }) => {
-          if (data.IsSuccess) {
-            const {userRoles} = data.ResultObject
-            let findResult = userRoles.find(item=>item.UserRoleType===1)
-            this.userType = findResult.UserRoleType
-          } else {
-            this.$toast.fail(data.ResultMsg)
+    components: {
+      Swiper,
+      SwiperSlide,
+      videos,
+      infoBar,
+      comment
+    },
+    mounted() {
+      this._getUserInfo();
+      //使用微信访问,获取代理
+      var ua = navigator.userAgent;
+      var version = "000000";
+      var key = "TBS/";
+      var start = ua.indexOf(key);
+      if (start !== -1) {
+        start = start + key.length;
+        version = ua.substr(start, ua.indexOf(" ", start) - start);
+      }
+      if (version.indexOf("000000") !== -1) {
+      } else {
+        this.$notify({
+          message: "您当前播放设置已影响了视频的观看,请修正设置。点击查看修正方法>>",
+          color: "#fff",
+          background: "#2f2f2f",
+          duration: 0,
+          onClick: _ => {
+            this.$notify.clear();
+            this.$router.push({ name: 'Explain' })
           }
         })
-        .catch(error => {
-          console.log(error)
-        })
+      }
+      this.params.pageIndex = 1;
+      this.videoList = [];
+      this.getList();
     },
-    // 新增视频播放次数
-    handleAddVideoCount(e) {
-      addPlay({ "ID": e.videoData.ID })
-        .then(res => {
-        })
-        .catch(error => {
-        })
+    methods: {
+          // 自定义分享方法
+    customShare() {
+    /* 自定义分享部分 */
+    var that = this
+    wx.ready(function () {
+      wx.checkJsApi({
+        jsApiList: ['onMenuShareAppMessage'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
+        success: function (res) {
+          // 以键值对的形式返回,可用的api值true,不可用为false
+          // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
+          console.log("weixin sdk config:", res)
+        }
+      });
+      wx.onMenuShareAppMessage({
+        title: '亮健优医', // 分享标题
+        desc: that.videoList[that.page-1].VideoTitle, // 分享描述
+        link: `https://ue.360lj.com/api/Home/Login?identity=0&backurl=https://ue.360lj.com/dist/oneVideoPlayer?id=${that.videoList[that.page-1].ID}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+        imgUrl: 'https://image.360lj.com/userfiles/images/202005ymall/d5d11cda-826a-42fa-a1d0-78181de4a9cd.png', // 分享图标
+        type: '', // 分享类型,music、video或link,不填默认为link
+        dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+        success: function () {
+          console.log("weixin share ok...")
+        }
+      });
+    });
+    console.log("当前视频索引: ", this.page-1)
+    // console.log("current video id: ", this.videoList[this.page].ID, this.videoList[this.page].VideoTitle)
     },
+      // 跳转上传视频页面
+      jumpUpload() {
+        // window.location.replace('http://ue.360lj.com/api/Home/Login?identity=2&backurl=http://ue.360lj.com/dist/uploadFile')
+        // window.location.replace('http://linyi.natapp1.cc/api/Home/Login?identity=2&backurl=http://linyi.natapp1.cc/dist/uploadFile')
+        var doctorUserLoginUrl = process.env.VUE_APP_DoctorUserLoginUrl.replace('SignUp', 'uploadFile')
+        console.log("uploadUrl: ", doctorUserLoginUrl)
+        window.location.replace(doctorUserLoginUrl)
 
-    // 获取评论数据
-    getVideoCommentList() {
-      getCommentList({ ...this.commentParams })
-        .then(res => {
-          this.commentList = res.data.ResultObject;
-          this.totalItemCount = res.data.Pager.TotalItemCount;
-        })
-        .catch(error => { });
-    },
-    // 加载数据
-    getList() {
-      if (this.hasMoreVideo) {
-        this.isLoading = true;
-        this.show = true
-        searchVideoListByHome({ ...this.params })
-          .then(res => {
-            if (res.data.IsSuccess) {
-              if (res.data.ResultObject.length === 0) {
-                // 没有分页数据
-                this.$notify({
-                  type: "warning",
-                  message: "没有更多视频了",
-                  duration: 2000
-                });
-                this.hasMoreVideo = false
-                this.isLoading = false
-                this.show = false
-                return;
-              }
-              this.videoList = [...this.videoList, ...res.data.ResultObject];
-              this.params.pageIndex++;
-              this.isLoading = false
-              this.show = false
+      },
+      // 获取用户基本信息
+      _getUserInfo() {
+        getUserInfo()
+          .then(({ data }) => {
+            if (data.IsSuccess) {
+              const { userRoles } = data.ResultObject
+              let findResult = userRoles.find(item => item.UserRoleType === 1)
+              this.userType = findResult.UserRoleType
             } else {
-              this.hasMoreVideo = false;
-              this.isLoading = false;
-              this.show = false;
-              this.$toast.fail(res.data.ResultMsg)
+              this.$toast.fail(data.ResultMsg)
             }
           })
           .catch(error => {
-          });
-      } else {
-        return
-      }
-    },
+            console.log(error)
+          })
+      },
+      // 新增视频播放次数
+      handleAddVideoCount(e) {
+        addPlay({ "ID": e.videoData.ID })
+          .then(res => {
+          })
+          .catch(error => {
+          })
+      },
 
-    // 滑块结束
-    handleSlideChange(currentIndex) {
-      if (currentIndex === this.videoList.length - 1) {
-        // 用户滑动到倒数第一个视频,分页加载下一组视频
-        this.getList();
-      }
-    },
+      // 获取评论数据
+      getVideoCommentList() {
+        getCommentList({ ...this.commentParams })
+          .then(res => {
+            this.commentList = res.data.ResultObject;
+            this.totalItemCount = res.data.Pager.TotalItemCount;
+          })
+          .catch(error => { });
+      },
+      // 加载数据
+      getList() {
+        if (this.hasMoreVideo) {
+          this.isLoading = true;
+          this.show = true
+          searchVideoListByHome({ ...this.params })
+            .then(res => {
+              if (res.data.IsSuccess) {
+                if (res.data.ResultObject.length === 0) {
+                  // 没有分页数据
+                  this.$notify({
+                    type: "warning",
+                    message: "没有更多视频了",
+                    duration: 2000
+                  });
+                  this.hasMoreVideo = false
+                  this.isLoading = false
+                  this.show = false
+                  return;
+                }
+                this.videoList = [...this.videoList, ...res.data.ResultObject];
+                this.params.pageIndex++;
+                this.isLoading = false
+                this.show = false
+                this.customShare()
+              } else {
+                this.hasMoreVideo = false;
+                this.isLoading = false;
+                this.show = false;
+                this.$toast.fail(res.data.ResultMsg)
+              }
+            })
+            .catch(error => {
+            });
+        } else {
+          return
+        }
+      },
 
-    // 用户取消点赞
-    handleCancelLike(id) {
-      cancelLike({ ...id })
-        .then(res => { })
-        .catch(error => { });
-    },
+      // 滑块结束
+      handleSlideChange(currentIndex) {
+        if (currentIndex === this.videoList.length - 1) {
+          // 用户滑动到倒数第一个视频,分页加载下一组视频
+          this.getList();
+        }
+      },
 
-    // 用户点赞
-    handleAddLike(id) {
-      addLike({ ...id })
-        .then(res => { })
-        .catch(error => { });
-    },
+      // 用户取消点赞
+      handleCancelLike(id) {
+        cancelLike({ ...id })
+          .then(res => { })
+          .catch(error => { });
+      },
 
-    // 关注用户
-    handleAttention(e) {
-      addFollow({ id: e.id })
-        .then(res => {
-          this.videoList = this.videoList.map((item) => {
-            if (item.DoctorID === e.id) {
-              item.IsFollow = true
-            }
-            return item;
+      // 用户点赞
+      handleAddLike(id) {
+        addLike({ ...id })
+          .then(res => { })
+          .catch(error => { });
+      },
+
+      // 关注用户
+      handleAttention(e) {
+        addFollow({ id: e.id })
+          .then(res => {
+            this.videoList = this.videoList.map((item) => {
+              if (item.DoctorID === e.id) {
+                item.IsFollow = true
+              }
+              return item;
+            })
+            console.log(this.videoList);
           })
-          console.log(this.videoList);
-        })
-        .catch(error => { });
-    },
+          .catch(error => { });
+      },
 
-    // 用户点击后播放或者暂停视频
-    playAction(index) {
-      this.$refs.videos[index].playOrStop();
-    },
-    // 滑动到下一个视频
-    nextVideo(index) {
-      this.$refs.videos[index - 1].stop();
-      this.$refs.videos[index].play();
-    },
-    // 滑动到上一个视频
-    preVideo(index) {
-      this.$refs.videos[index + 1].stop();
-      this.$refs.videos[index].play();
-    },
-    // 监听用户提交评论
-    onSubmitComment(e) {
-      addComment({ VideoId: this.commentParams.id, Content: e.content })
-        .then(res => {
-          this.$notify({
-            type: "success",
-            message: "评论成功",
-            duration: 1000
-          });
-          // 关闭评论窗口
-        })
-        .catch(error => { });
-      // 重新请求接口获取评论
-      setTimeout(() => {
-        this.getVideoCommentList();
-      }, 500);
-    },
+      // 用户点击后播放或者暂停视频
+      playAction(index) {
+        this.$refs.videos[index].playOrStop();
+      },
+      // 滑动到下一个视频
+      nextVideo(index) {
+        this.$refs.videos[index - 1].stop();
+        this.$refs.videos[index].play();
+      },
+      // 滑动到上一个视频
+      preVideo(index) {
+        this.$refs.videos[index + 1].stop();
+        this.$refs.videos[index].play();
+      },
+      // 监听用户提交评论
+      onSubmitComment(e) {
+        addComment({ VideoId: this.commentParams.id, Content: e.content })
+          .then(res => {
+            this.$notify({
+              type: "success",
+              message: "评论成功",
+              duration: 1000
+            });
+            // 关闭评论窗口
+          })
+          .catch(error => { });
+        // 重新请求接口获取评论
+        setTimeout(() => {
+          this.getVideoCommentList();
+        }, 500);
+      },
 
-    // 监听用户关闭评论
-    onCloseComment(e) {
-      this.showComment = false;
-      // this.getVideoCommentList();
-      console.log("this.pageIndex: ", this.page - 1);
-      console.log(e.commentCount);
-      this.videoList[this.page - 1].CommentFrequency = e.commentCount;
-    },
+      // 监听用户关闭评论
+      onCloseComment(e) {
+        this.showComment = false;
+        // this.getVideoCommentList();
+        console.log("this.pageIndex: ", this.page - 1);
+        console.log(e.commentCount);
+        this.videoList[this.page - 1].CommentFrequency = e.commentCount;
+      },
 
-    handleShowComment(id) {
-      this.commentParams.id = id.id;
-      this.getVideoCommentList();
-      // 显示评论界面
-      this.showComment = true;
+      handleShowComment(id) {
+        this.commentParams.id = id.id;
+        this.getVideoCommentList();
+        // 显示评论界面
+        this.showComment = true;
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="less" scoped>
-.videoList-wrap {
-  background-color: #1d1d1d;
-}
+  .videoList-wrap {
+    background-color: #1d1d1d;
+  }
 
-/deep/ .vjs-custom-skin > .video-js {
-  position: absolute;
-  top: 50%;
-  left: 50%;
-  transform: translate(-50%, -50%);
-  // width: 80%;
-}
+  /deep/ .vjs-custom-skin > .video-js {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    // width: 80%;
+  }
 
-/deep/ .vjs-custom-skin > .video-js .vjs-big-play-button {
-  font-size: 2em;
-}
+  /deep/ .vjs-custom-skin > .video-js .vjs-big-play-button {
+    font-size: 2em;
+  }
 
-/deep/ .video-js .vjs-tech {
-  height: 90%;
-}
+  /deep/ .video-js .vjs-tech {
+    height: 90%;
+  }
 
-.loading-btn {
-  position: fixed;
-  top: 50%;
-  left: 50%;
-  transform: translate(-50%, -50%);
-  z-index: 99999;
-  .van-loading__text {
-    color: #fff;
+  .loading-btn {
+    position: fixed;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    z-index: 99999;
+    .van-loading__text {
+      color: #fff;
+    }
   }
-}
 
-.jump-icon {
-  position: absolute;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  padding: 0 0.2rem;
-  width: 100%;
-  top: 0;
-  z-index: 9999;
-  background-color: #333333;
-  img {
-    width: 0.64rem;
-    height: 0.64rem;
+  .jump-icon {
+    position: absolute;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 0.2rem;
+    width: 100%;
+    top: 0;
+    z-index: 9999;
+    background-color: #333333;
+    img {
+      width: 0.64rem;
+      height: 0.64rem;
+    }
   }
-}
 </style>

+ 31 - 1
src/views/shortVideo/VideoPlay.vue

@@ -89,7 +89,7 @@ export default {
       videoTotal: 0,    // 视频分页总数
       showComment: false,
       videoList: [],
-      page: this.$route.query.currentVideoIndex === 0 ? this.$route.query.currentVideoIndex : this.$route.query.currentVideoIndex - 1,
+      page: this.$route.query.currentVideoIndex === 0 ? this.$route.query.currentVideoIndex : this.$route.query.currentVideoIndex - 1,    // 当前视频索引位置
       swiperOption: {
         preventInteractionOnTransition : true,
         initialSlide: this.$route.query.currentVideoIndex,    // 设定初始化时slide的索引
@@ -131,6 +131,7 @@ export default {
           slideChangeTransitionEnd: () => {
             this.$nextTick(_ => {
               this.handleSlideChange(this.page)
+              this.customShare()
             })
           }
         }
@@ -155,8 +156,37 @@ export default {
     this.params.name = this.$route.query.userKey || "";
     this.videoList = this.$route.query.currentVideoList;
     this.params.accountid = this.$route.query.accountid || "";
+    this.customShare()
   },
   methods: {
+    // 自定义分享方法
+    customShare() {
+    /* 自定义分享部分 */
+    var that = this
+    wx.ready(function () {
+      wx.checkJsApi({
+        jsApiList: ['onMenuShareAppMessage'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
+        success: function (res) {
+          // 以键值对的形式返回,可用的api值true,不可用为false
+          // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
+          console.log("weixin sdk config:", res)
+        }
+      });
+      wx.onMenuShareAppMessage({
+        title: '亮健优医', // 分享标题
+        desc: that.videoList[that.page].VideoTitle, // 分享描述
+        link: `https://ue.360lj.com/api/Home/Login?identity=0&backurl=https://ue.360lj.com/dist/oneVideoPlayer?id=${that.videoList[that.page].ID}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+        imgUrl: 'https://image.360lj.com/userfiles/images/202005ymall/d5d11cda-826a-42fa-a1d0-78181de4a9cd.png', // 分享图标
+        type: '', // 分享类型,music、video或link,不填默认为link
+        dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+        success: function () {
+          console.log("weixin share ok...")
+        }
+      });
+    });
+    console.log("current video id: ", this.videoList[this.page].ID, this.videoList[this.page].VideoTitle)
+    },
+
     // 记录视频播放次数
     handleAddVideoCount(e){
       addPlay({ "ID": e.videoData.ID })

+ 2 - 2
vue.config.js

@@ -8,8 +8,8 @@ module.exports = {
     disableHostCheck: true,    // 关闭主机头检测
     proxy: {
       "/api": {
-        target: "http://mem.360lj.com/ueapi1", // 目标 API 地址 富勇电脑
-        // target: "http://ue.360lj.com", // 目标 API 地址 富勇电脑
+        // target: "http://mem.360lj.com/ueapi1", // 目标 API 地址 富勇电脑
+        target: "http://ue.360lj.com", // 目标 API 地址 富勇电脑
         ws: true,
         changeOrigin: true, // 是否跨域
         pathRewrite: {