Selaa lähdekoodia

Merge branch 'liuxiangxin' of MP/kailin_mp into branch_qxy_dev

qianxinyu 3 kuukautta sitten
vanhempi
sitoutus
2f496351cc

+ 28 - 0
pages.json

@@ -219,6 +219,34 @@
       "style": {
         "navigationBarTitleText": "抽奖"
       }
+    },
+    {
+    	"path" : "pages/article/index",
+    	"style" : 
+    	{
+    		"navigationBarTitleText" : "资讯列表"
+    	}
+    },
+    {
+    	"path" : "pages/article/detail",
+    	"style" : 
+    	{
+    		"navigationBarTitleText" : "文章详情"
+    	}
+    },
+    {
+    	"path" : "pages/video/index",
+    	"style" : 
+    	{
+    		"navigationBarTitleText" : "课程列表"
+    	}
+    },
+    {
+    	"path" : "pages/video/detail",
+    	"style" : 
+    	{
+    		"navigationBarTitleText" : "视频学习"
+    	}
     }
   ],
   "globalStyle": {

+ 261 - 0
pages/article/detail.vue

@@ -0,0 +1,261 @@
+<template>
+	<view>
+		<view class="article_title">{{articleInfo.title}}</view>
+		<view class="article_time">{{articleInfo.insert_time}}</view>
+		<view class="rich_text">
+			<rich-text :nodes="articleInfo.content"></rich-text>
+		</view>
+		<view class="article_poster" v-if="articleInfo.poster" >
+			<image class="poster_img" show-menu-by-longpress @click="navigatoPage()" :src="articleInfo.poster" mode="widthFix"></image>
+		</view>
+		<view class="read_total">阅读:{{articleInfo.read_count}}</view>
+		<view>&nbsp;</view>
+		<view class="handle_box">
+			<view class="click_box" @click.stop="updateEvent(2)">
+				<uni-icons :type="articleInfo.is_hand?'hand-up-filled':'hand-up'" :color="articleInfo.is_hand?'#e03519':'#333333'" size="20"></uni-icons>
+				<text>{{articleInfo.hand_count}}</text>
+			</view>
+			<button class="click_box" open-type="share">
+				<uni-icons type="upload" size="20"></uni-icons>
+				<text>{{articleInfo.share_count}}</text>
+			</button>
+			<view class="click_box" @click.stop="updateEvent(4)" >
+				<uni-icons :type="articleInfo.is_like?'heart-filled':'heart'" :color="articleInfo.is_like?'#e03519':'#333333'"  size="20"></uni-icons>
+				<text>{{articleInfo.like_count}}</text>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				articleInfo:{
+					'id':0,
+					'title':'',
+					'poster':'',
+					'content':'',
+					'read_count':0,
+					'hand_count':0,
+					'like_count':0,
+					'share_count':0,
+					'is_hand':0,
+					'is_like':0,
+					'path':'',
+					'appid':'',
+					'insert_time':'',
+				},
+				// 请求参数
+				requestParam: {
+				  id: 0
+				},
+				isReqing:false,
+			}
+		},
+		onLoad(param) {
+			// 参数接收
+			this.requestParam.id = param.id;
+			// #ifdef MP-WEIXIN
+			//分享按钮
+			uni.showShareMenu({
+			  withShareTicket: true,
+			  menus: ["shareAppMessage", "shareTimeline"],
+			});
+			// #endif
+		},
+		onShareAppMessage(obj) {
+			this.updateEvent(3);
+			  return {
+				title: `999智控终端平台\n${this.articleInfo.title}`,
+				path: "/pages/article/detail?id=" + this.articleInfo.id,
+				promise: new Promise((resolve, reject) => {
+				  this.$http.request("api/share_message/get_item", { item_id: this.articleInfo.id, pages: "/pages/article/detail" }).then((callback) => {
+					console.log(callback, "api/share_message/get_item");
+					let obj = {
+					  title: callback.data?.title == "" ? `999智控终端平台\n${this.articleInfo.title}` : callback.data.title,
+					  path: "/pages/article/detail?id=" + this.articleInfo.id,
+					};
+					if (callback.data?.image_url !== "") {
+					  obj.imageUrl = callback.data.image_url;
+					}
+					resolve(obj);
+				  });
+				}),
+		  };
+		},
+		onShow() {
+			// 如果存在产品ID的话
+			if (this.requestParam.id > 0) {
+			  // 请求详情
+			  this.$http.request("api/article/get_detail", this.requestParam).then((re) => {
+			    // 成功渲染数据
+			    if (re.code == "success") {
+			      // 刷新数据
+			      this.articleInfo = re.data;
+			    } else {
+			      if (re.code != "no_login") {
+			        uni.showModal({
+			          content: re.msg,
+			          showCancel: false,
+			        });
+			      }
+			    }
+			  });
+			}
+		},
+		methods: {
+			updateEvent(typeId){
+				
+				if( this.isReqing )  return ;
+				
+				this.isReqing		= true;
+				// 如果存在产品ID的话
+				if ( this.articleInfo.id > 0 ) {
+				  // 请求详情
+				  this.$http.request("api/article/update_event", {type_id:typeId,article_id:this.articleInfo.id}).then((re) => {
+					this.isReqing = false;
+				    // 成功渲染数据
+				    if (re.code == "success") {
+					  // 如果是点赞
+					  if( typeId == 2 ) {
+						this.articleInfo.is_hand ? this.articleInfo.hand_count -= 1 : this.articleInfo.hand_count += 1;
+						this.articleInfo.is_hand = this.articleInfo.is_hand ? 0 : 1;
+					  }
+					  // 如果是点赞
+					  if( typeId == 3 ) {
+						this.articleInfo.is_hand ? this.articleInfo.share_count -= 1 : this.articleInfo.share_count += 1;
+					  }
+					  // 如果是喜欢
+					  if( typeId == 4 ) {
+						this.articleInfo.is_like ? this.articleInfo.like_count -= 1 : this.articleInfo.like_count += 1;
+						this.articleInfo.is_like = this.articleInfo.is_like ? 0 : 1;
+					  }
+				    } else {
+				      if (re.code != "no_login") {
+				        uni.showModal({
+				          content: re.msg,
+				          showCancel: false,
+				        });
+				      }
+				    }
+				  });
+				}
+			},
+			navigatoPage(){
+				// 没有跳转路径
+				if( !this.articleInfo.path ) return '';
+				// 如果路径有http
+				let url 	= this.articleInfo.path;
+				
+				console.log(url);
+				
+				// 判断是不是小程序链接
+				if ( url.includes("http") ) {
+				  // 转码
+				  let link_url = encodeURIComponent(url);
+				  // 跳转到webview
+				  uni.redirectTo({
+				    url: `/pages/webview/index?link_url=${link_url}`,
+				  });
+				} else {
+					console.log(this.articleInfo.appid);
+				  // 是否有appid
+				  this.articleInfo.appid ? uni.navigateToMiniProgram({appId:this.articleInfo.appid,path:url}) : uni.navigateTo({url:url});
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.article_title{
+		width: 700rpx;
+		display: block;
+		font-size: 36rpx;
+		overflow: hidden;
+		font-weight: bold;
+		line-height: 60rpx;
+		padding: 0rpx 25rpx;
+		background-color: #FFFFFF;
+	}
+	.article_time{
+		width: 700rpx;
+		color: #999999;
+		display: block;
+		font-size: 26rpx;
+		overflow: hidden;
+		line-height: 40rpx;
+		padding: 0rpx 25rpx;
+		background-color: #FFFFFF;
+	}
+	.rich_text{
+		width: 700rpx;
+		display: block;
+		overflow: hidden;
+		font-size: 26rpx;
+		margin: 0rpx auto;
+		min-height: 50rpx;
+		line-height: 50rpx;
+		padding: 10rpx 25rpx;
+		background-color: #FFFFFF;
+		[alt] {
+		  //web_view图片
+		  max-width: 100%; // 避免图片超宽
+		  vertical-align: bottom; // 避免图片之间间隙
+		}
+	}
+	.article_poster{
+		width: 700rpx;
+		display: block;
+		overflow: hidden;
+		margin: 6rpx auto;
+		padding: 10rpx 25rpx;
+		background-color: #FFFFFF;
+		.poster_img{
+			width: 700rpx;
+			display: block;
+		}
+	}
+	.read_total{
+		width: 700rpx;
+		color: #999999;
+		display: block;
+		font-size: 26rpx;
+		overflow: hidden;
+		line-height: 60rpx;
+		padding: 0rpx 25rpx;
+		margin-bottom: 122rpx;
+		background-color: #FFFFFF;
+	}
+	.handle_box {
+	  left: 0rpx;
+	  width: 700rpx;
+	  height: 120rpx;
+	  display: block;
+	  position: fixed;
+	  overflow: hidden;
+	  padding: 20rpx 25rpx;
+	  background-color: #FFFFFF;
+	  bottom: var(--window-bottom);
+	  border-top: 2rpx solid #DDDDDD;
+	  .click_box{
+		  border: none;
+		  float: right;
+		  display: block;
+		  height: 120rpx;
+		  padding: 0rpx 0rpx;
+		  line-height: 120rpx;
+		  margin-right: 20rpx;
+		  font-size: 24rpx !important;
+		  background-color: transparent;
+		  .uni-icons{
+			  font-size: 36rpx !important;
+		  }
+	  }
+	  .click_box::after{
+		  border: none;
+		  background-color: transparent;
+	  }
+	}
+</style>

+ 171 - 0
pages/article/index.vue

@@ -0,0 +1,171 @@
+<template>
+	<view>
+		<view class="article_list">
+			<view class="article_item" v-for="(item,index) in articleList" @click.stop="goDetail(item.id)">
+				<image class="thumb_img" :src="item.thumb" mode="aspectFit"></image>
+				<view class="article_info">
+					<view class="article_title">{{item.title}}</view>
+					<view class="article_census">
+						<text class="">阅读:{{item.read_count}}</text> <text class="">点赞:{{item.hand_count}}</text>
+					</view>
+					<view class="article_time">{{item.insert_time}}</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+		  return {
+		    // 产品列表
+		    articleList: [],
+		    // 请求参数
+		    requestParam: {
+		      page: 1,
+		      status: 0,
+		    },
+		    // 是否最后一页
+		    isLast: false,
+		    // 是否请求中
+		    isReqing: false,
+		  };
+		},
+		onLoad() {},
+		onShow() {
+		  // 没有数据的话,或者请求中,不允许刷新
+		  if (this.isReqing) return;
+		  // 初始化页码为1
+		  this.requestParam.page = 1;
+		  // 是否是最后一页
+		  this.isLast = false;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/article/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      this.articleList = re.data.data;
+		    }
+		  });
+		},
+		onPullDownRefresh() {
+		  // 如果请求中,不允许请求,
+		  if (this.isReqing) return false;
+		  // 初始化页码为1
+		  this.requestParam.page = 1;
+		  // 是否是最后一页
+		  this.isLast = false;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/article/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      this.articleList = re.data.data;
+		    }
+		  });
+		  uni.stopPullDownRefresh();
+		},
+		onReachBottom() {
+		  // 如果页码是0,避免第一页重复
+		  if (this.requestParam.page < 1) return;
+		  // 最后一页不请求
+		  if (this.isLast) return;
+		  // 请求中,不再请求
+		  if (this.isReqing) return;
+		  // 增加一页
+		  this.requestParam.page = this.requestParam.page + 1;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/article/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+			  // 数据
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      // 追加数据
+		      this.articleList.push(...re.data.data);
+		    }
+		  });
+		},
+		methods: {
+			goDetail(id) {
+			  uni.navigateTo({
+			    url: "/pages/article/detail?id=" + id,
+			  });
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	.article_list{
+		float: left;
+		width: 750rpx;
+		display: block;
+		overflow: hidden;
+		.article_item{
+			display: block;
+			width: 700rpx;
+			height: 200rpx;
+			overflow: hidden;
+			margin-bottom: 10rpx;
+			padding: 20rpx 25rpx;
+			border-radius: 10rpx;
+			background-color: #FFFFFF;
+			.thumb_img{
+				float: left;
+				width: 200rpx;
+				height: 200rpx;
+				display: block;
+				border-radius: 10rpx;
+			}
+			.article_info{
+				float: right;
+				width: 480rpx;
+				display: block;
+				margin-left: 20rpx;
+				.article_title{
+					width: 480rpx;
+					display: block;
+					height: 120rpx;
+					font-size: 34rpx;
+					overflow: hidden;
+					font-weight: bold;
+					line-height: 40rpx;
+					text-overflow: ellipsis;
+				}
+				.article_census{
+					color: #999999;
+					width: 480rpx;
+					display: block;
+					height: 40rpx;
+					font-size: 26rpx;
+					line-height: 40rpx;
+					text:nth-child(2){
+						margin-left: 20rpx;
+					}
+				}
+				.article_time{
+					color: #999999;
+					width: 480rpx;
+					display: block;
+					height: 60rpx;
+					font-size: 26rpx;
+					text-align: right;
+					line-height: 60rpx;
+				}
+			}
+		}
+	}
+</style>

+ 5 - 4
pages/car/order.vue

@@ -416,10 +416,11 @@ export default {
             });
             return;
           } else {
-            uni.showToast({
-              title: re.msg,
-              icon: "none",
-            });
+			  uni.showModal({
+				title: re.msg,
+				showCancel: false,
+			  });
+            
           }
         });
     },

+ 19 - 20
pages/product/index.vue

@@ -101,8 +101,8 @@
       <navigator url="/pages/car/index" open-type="switchTab" class="to_car">
         <image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/car.png" class="car_icon"></image>
       </navigator>
-      <button class="show_order" data-eventsync="true" @click="showSpecPopup(1)">立即预约</button>
-      <button class="show_car" data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
+      <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">立即预约</button>
+      <button :class="productInfo.hide_orderbtn?'show_car hide_orderbtn ':'show_car'"  data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
     </view>
     <view class="to_bottom"> --- 到底了 --- </view>
     <uni-popup ref="specPopup" :show="true" type="bottom" class="popup" background-color="#FFFFFF" @change="popupChange">
@@ -297,6 +297,7 @@ export default {
         name: "",
         price: "0.00",
         market_price: "0.00",
+		hide_orderbtn:0,
         spec: "",
         stock: 0,
         thumb: "",
@@ -434,29 +435,21 @@ export default {
         if (re.code == "success") {
           // 刷新数据
           this.productInfo = re.data;
-
+		  // 
           if (this.productInfo.automatic_info.id) {
             this.regiment_id = this.productInfo.automatic_info.id;
           }
-          // // 如果有SKU
-          // if( this.productInfo.product_sku.length ){
-          // 	// 获取最低的SKU价格数据赋值
-          // 	for (let i in this.productInfo.product_sku) {
-          // 		if( this.productInfo.product_sku[i].price < this.productInfo.price ) {
-          // 			this.productInfo.price = this.productInfo.product_sku[i].price;
-          // 			if( this.productInfo.product_sku[i].market_price != 0 ) this.productInfo.market_price = this.productInfo.product_sku[i].market_price;
-          // 		}
-          // 	}
-          // }
-          if (this.productInfo.product_attr.length == 1) {
-            if (this.productInfo.product_attr[0].attr_list.length && this.productInfo.product_attr[0].attr_list.length > 0) {
-              this.productInfo.product_attr[0].attr_list[0].active = true;
+		  //设置默认sku
+		  this.sku_id = 0;
+		  // 显示图片
+		  this.sku_thumb = this.productInfo.thumb;
+		  // 如果只有一个SKU,默认选择一个
+          if ( this.productInfo.product_attr.length == 1) {
+			// 设置对应的属性已经选中
+            if ( this.productInfo.product_attr[0].attr_list.length == 1 ) {
+				this.attrChange(0,0);
             }
           }
-          //设置默认sku
-          this.sku_id = 0;
-          // 显示图片
-          this.sku_thumb = this.productInfo.thumb;
         } else {
           if (re.code != "no_login") {
             uni.showModal({
@@ -1404,6 +1397,12 @@ export default {
     border-top-left-radius: 20rpx;
     border-bottom-left-radius: 20rpx;
   }
+  
+  .show_car.hide_orderbtn{
+	  width: 580rpx;
+	  border-radius: 20rpx;
+	  margin-right: 35rpx;
+  }
 
   .to_car {
     float: left;

+ 4 - 7
pages/user/index.vue

@@ -51,13 +51,10 @@
         <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/score_gift.png" mode=""></image>
         <view class="navigator_title">拉新活动</view>
       </navigator>
-    </view>
-    <view class="navigator_list">
-		<navigator class="navigator_item" url="/pages/user/information">
-              <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/score_gift.png" mode=""></image>
-              <view class="navigator_title">拉新活动</view>
-        </navigator>
-      
+      <navigator class="navigator_item" url="/pages/article/index">
+        <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/article.png" mode=""></image>
+        <view class="navigator_title">资讯</view>
+      </navigator>
     </view>
     <view class="alter_info">本程序暂不提供在线交易以及支付功能,您所提交的预约,我们将验证您的购药资质并交由有售卖药品资质的商业公司与您联系确认并提供线下后续服务。</view>
     <view class="packet_content" v-if="show_packet">

+ 0 - 290
pages/user/information.vue

@@ -1,290 +0,0 @@
-<template>
-  <view>
-    <view class="alter_info">请选择您药店/诊所所在城市,选择后不可更改,请谨慎选择</view>
-    <view class="form"  >
-      <!-- 地区代表表单 -->
-      
-      <!-- 新增列表 -->
-      <view class="list-container">
-        <view class="list-item" v-for="(item, index) in articleList" :key="index">
-          <image :src="item.thumbnail" class="list-thumbnail" mode="aspectFit"></image>
-          <view class="list-content">
-            <view class="list-title">{{ item.title }}</view>
-            <view class="list-meta">
-              <text>阅读数: {{ item.readCount }}</text>
-              <text>点赞数: {{ item.likeCount }}</text>
-              <text>时间: {{ item.time }}</text>
-            </view>
-          </view>
-        </view>
-      </view>
-    </view>
-  </view>
-</template>
-
-<script>
-import {getProvinces,getMyCity} from "../../utils/city";
-
-export default {
-  data() {
-    return {
-      requestParam:{
-        province:"",
-        city:"",
-      },
-      cityArray: [[],[]],
-      cityValue: [0,0],
-      // 新增文章列表数据
-      articleList: [
-        {
-          thumbnail: 'https://example.com/thumbnail1.jpg',
-          title: '文章标题1',
-          readCount: 100,
-          likeCount: 20,
-          time: '2025-02-21'
-        },
-        {
-          thumbnail: 'https://example.com/thumbnail2.jpg',
-          title: '文章标题2',
-          readCount: 200,
-          likeCount: 30,
-          time: '2025-02-20'
-        }
-      ]
-    }
-  },
-  onLoad(){
-    // 替换对应的数据
-    this.cityArray.splice(0,1,getProvinces());
-    this.cityArray.splice(1,1,getMyCity(this.cityValue[0]));
-    // 默认地址
-    // this.requestParam.province 	= this.cityArray[0][this.cityValue[0]]
-    // this.requestParam.city 		= this.cityArray[1][this.cityValue[1]];
-  },
-  onShow(){
-    // 登录信息
-    if( !this.$checkAccess.alterLogin() ) return ;
-    // 授权成功以后,调用绑定
-    this.$http.request('api/custom/get_city',{},'get').then((re)=>{
-      // 成功的话
-      if( re.code != 'success' ){
-        // 跳转
-        uni.showToast({title: re.msg,icon:"none"});
-        return;
-      }
-      this.requestParam.province	= re.data.province;
-      this.requestParam.city 		= re.data.city;
-    });
-  },
-  methods: {
-    toApply(){
-      // 登录信息
-      if( !this.$checkAccess.alterLogin() ) return ;
-      // 提示信息
-      if( !this.requestParam.province ){
-        uni.showToast({
-          title:"请选择所在城市",
-          icon:"none"
-        })
-        return ;
-      }
-      // 提示信息
-      if( !this.requestParam.city ){
-        uni.showToast({
-          title:"请选择所在城市",
-          icon:"none"
-        })
-        return ;
-      }
-      // 请求状态
-      uni.showLoading({mask:true});
-      // 授权成功以后,调用绑定
-      this.$http.request('api/custom/set_city',this.requestParam,'post').then((re)=>{
-        // 关闭
-        uni.hideLoading();
-        // 成功的话
-        if( re.code != 'success' ){
-          // 跳转
-          uni.showToast({title: re.msg,icon:"none"});
-          return;
-        }
-        uni.switchTab({url: '/pages/user/index'});
-      });
-    },
-    cityChange(e){
-      // 替换三个选项
-      this.cityValue.splice(e.detail.column,1,e.detail.value);
-      // 下一级设置为0
-      if( e.detail.column == 0 ){
-        this.cityValue.splice(1,1,0);
-        this.cityValue.splice(2,1,0);
-      }
-      if( e.detail.column == 1 ){
-        this.cityValue.splice(2,1,0);
-      }
-      // 替换对应的数据
-      this.cityArray.splice(0,1,getProvinces());
-      this.cityArray.splice(1,1,getMyCity(this.cityValue[0]));
-    },
-    cityFinish(e){
-      this.requestParam.province 	= this.cityArray[0][this.cityValue[0]];
-      this.requestParam.city 		= this.cityArray[1][this.cityValue[1]];
-    },
-  }
-}
-</script>
-
-<style lang="less">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-.alter_info{
-  display: block;
-  color: #E03519;
-  font-size: 20rpx;
-  overflow: hidden;
-  margin: 20rpx auto;
-  background: #FFFFFF;
-  line-height: 40rpx;
-  padding: 35rpx 35rpx;
-  text-align: center;
-}
-.info_form{
-  display: block;
-  overflow: hidden;
-  padding: 20rpx 0rpx;
-  background: #FFFFFF;
-  .form_group{
-    display: block;
-    overflow: hidden;
-    line-height: 60rpx;
-    padding: 20rpx 35rpx;
-    .group_title{
-      float: left;
-      width: 160rpx;
-      display: block;
-      overflow: hidden;
-      font-size: 30rpx;
-      margin-right: 20rpx;
-    }
-    .group_box{
-      width: 480rpx;
-      float: left;
-      display: block;
-      .form_ctrl{
-        height: 56rpx;
-        font-size: 24rpx;
-        padding: 0rpx 20rpx;
-        line-height: 56rpx;;
-        border: 2rpx solid #DDDDDD;
-        .area_text{
-          width: 446rpx;
-          height: 56rpx;
-          font-size: 20rpx;
-          overflow: hidden;
-          white-space: nowrap;
-          line-height: 56rpx;
-          text-overflow: ellipsis;
-        }
-      }
-      .group_image{
-        width: 200rpx;
-        height: 200rpx;
-      }
-      .choose_image{
-        display: block;
-        width: 200rpx;
-        height: 200rpx;
-        font-size: 38rpx;
-        text-align: center;
-        line-height: 200rpx;
-        border: 2rpx solid #DDDDDD;
-      }
-    }
-  }
-  .submit_btn{
-    color: #FFFFFF;
-    width: 220rpx;
-    height: 80rpx;
-    display: block;
-    font-size: 30rpx;
-    padding: 0rpx 0rpx;
-    line-height: 80rpx;
-    margin: 50rpx auto;
-    background-color: forestgreen;
-  }
-}
-</style>

+ 209 - 0
pages/video/detail.vue

@@ -0,0 +1,209 @@
+<template>
+	<view>
+		<view class="video_play" v-if="videoInfo.video_src">
+			<video id="myVideo" class="video_control" :src="videoInfo.video_src" @timeupdate="timeUpdate" :enable-progress-gesture="false" :enable-play-gesture="true"></video>
+		</view>
+		<view class="video_title">{{videoInfo.name}}</view>
+		<view class="rich_text">
+			<rich-text :nodes="videoInfo.content"></rich-text>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				videoInfo:{
+					id:0,
+					name:"",
+					content:"",
+					video_src:""
+				},
+				// 请求参数
+				requestParam: {
+				  id: 0
+				},
+				isReqing:false,
+				videoContext:null,
+			}
+		},
+		onLoad(param) {
+			// 参数接收
+			this.requestParam.id = param.id;
+			// #ifdef MP-WEIXIN
+			//分享按钮
+			uni.showShareMenu({
+			  withShareTicket: true,
+			  menus: ["shareAppMessage", "shareTimeline"],
+			});
+			// #endif
+		},
+		onShareAppMessage(obj) {
+			return {
+				title: `999智控终端平台\n${this.videoInfo.title}`,
+				path: "/pages/video/detail?id=" + this.videoInfo.id,
+				promise: new Promise((resolve, reject) => {
+				  this.$http.request("api/share_message/get_item", { item_id: this.videoInfo.id, pages: "/pages/video/detail" }).then((callback) => {
+					console.log(callback, "api/share_message/get_item");
+					let obj = {
+					  title: callback.data?.title == "" ? `999智控终端平台\n${this.videoInfo.title}` : callback.data.title,
+					  path: "/pages/video/detail?id=" + this.videoInfo.id,
+					};
+					if (callback.data?.image_url !== "") {
+					  obj.imageUrl = callback.data.image_url;
+					}
+					resolve(obj);
+				  });
+				}),
+			};
+		},
+		onReady: function (res) {
+			
+		},
+		onShow() {
+			// 如果存在产品ID的话
+			if (this.requestParam.id > 0) {
+			  // 请求详情
+			  this.$http.request("api/video_course/get_detail", this.requestParam).then((re) => {
+			    // 成功渲染数据
+			    if (re.code == "success") {
+			      // 刷新数据
+			      this.videoInfo = re.data;
+				  // 获取视频容器的上下文
+				  this.videoContext = uni.createVideoContext('myVideo');
+				  // 暂停播放
+				  this.videoContext.stop();
+			    } else {
+			      if (re.code != "no_login") {
+			        uni.showModal({
+			          content: re.msg,
+			          showCancel: false,
+			        });
+			      }
+			    }
+			  });
+			}
+		},
+		methods: {
+			timeUpdate(event){
+				// 播放到对应的
+				if( event.detail.currentTime ){
+					
+					
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.video_play{
+		width: 750rpx;
+		display: block;
+		font-size: 36rpx;
+		overflow: hidden;
+		font-weight: bold;
+		line-height: 60rpx;
+		background-color: #FFFFFF;
+		.video_control{
+			width: 750rpx;
+			display: block;
+			font-size: 36rpx;
+			overflow: hidden;
+			font-weight: bold;
+			line-height: 60rpx;
+			background-color: #FFFFFF;
+		}
+	}
+	.video_title{
+		width: 700rpx;
+		display: block;
+		font-size: 36rpx;
+		overflow: hidden;
+		font-weight: bold;
+		line-height: 60rpx;
+		padding: 0rpx 25rpx;
+		padding-top: 60rpx;
+		background-color: #FFFFFF;
+	}
+	.video_time{
+		width: 700rpx;
+		color: #999999;
+		display: block;
+		font-size: 26rpx;
+		overflow: hidden;
+		line-height: 40rpx;
+		padding: 0rpx 25rpx;
+		background-color: #FFFFFF;
+	}
+	.rich_text{
+		width: 700rpx;
+		display: block;
+		overflow: hidden;
+		font-size: 26rpx;
+		margin: 0rpx auto;
+		min-height: 800rpx;
+		line-height: 50rpx;
+		padding: 10rpx 25rpx;
+		background-color: #FFFFFF;
+		[alt] {
+		  //web_view图片
+		  max-width: 100%; // 避免图片超宽
+		  vertical-align: bottom; // 避免图片之间间隙
+		}
+	}
+	.video_poster{
+		width: 700rpx;
+		display: block;
+		overflow: hidden;
+		margin: 6rpx auto;
+		padding: 10rpx 25rpx;
+		background-color: #FFFFFF;
+		.poster_img{
+			width: 700rpx;
+			display: block;
+		}
+	}
+	.read_total{
+		width: 700rpx;
+		color: #999999;
+		display: block;
+		font-size: 26rpx;
+		overflow: hidden;
+		line-height: 60rpx;
+		padding: 0rpx 25rpx;
+		margin-bottom: 122rpx;
+		background-color: #FFFFFF;
+	}
+	.handle_box {
+	  left: 0rpx;
+	  width: 700rpx;
+	  height: 120rpx;
+	  display: block;
+	  position: fixed;
+	  overflow: hidden;
+	  padding: 20rpx 25rpx;
+	  background-color: #FFFFFF;
+	  bottom: var(--window-bottom);
+	  border-top: 2rpx solid #DDDDDD;
+	  .click_box{
+		  border: none;
+		  float: right;
+		  display: block;
+		  height: 120rpx;
+		  padding: 0rpx 0rpx;
+		  line-height: 120rpx;
+		  margin-right: 20rpx;
+		  font-size: 24rpx !important;
+		  background-color: transparent;
+		  .uni-icons{
+			  font-size: 36rpx !important;
+		  }
+	  }
+	  .click_box::after{
+		  border: none;
+		  background-color: transparent;
+	  }
+	}
+</style>

+ 235 - 0
pages/video/index.vue

@@ -0,0 +1,235 @@
+<template>
+	<view>
+		<view class="video_list">
+			<view class="video_item" v-for="(item,index) in videoList" @click.stop="goDetail(item.id)">
+				<image class="thumb_img" :src="item.thumb" mode="aspectFit"></image>
+				<view class="video_info">
+					<view class="video_type">
+						<text class="type_name">{{item.type_name}}</text>
+						<button class="to_learn">开始学习</button>
+					</view>
+					<view class="video_title">{{item.name}}</view>
+					<view class="video_time">
+						<text class="time_info">{{item.end_time}} </text>
+						<button class="after_exam" v-if="item.learn_status > 0">课后评测</button>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="to_bottom" v-if="!videoList.length"> -----您还没有可学习课程-----</view>
+		<view class="contact_follow">
+			<button class="contact_btn" open-type="contact">
+				<uni-icons type="headphones" size="30" color="#FFFFFF"></uni-icons>
+			</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+		  return {
+		    // 产品列表
+		    videoList: [],
+		    // 请求参数
+		    requestParam: {
+		      page: 1,
+		      status: 0,
+		    },
+		    // 是否最后一页
+		    isLast: false,
+		    // 是否请求中
+		    isReqing: false,
+		  };
+		},
+		onLoad() {},
+		onShow() {
+		  // 没有数据的话,或者请求中,不允许刷新
+		  if (this.isReqing) return;
+		  // 初始化页码为1
+		  this.requestParam.page = 1;
+		  // 是否是最后一页
+		  this.isLast = false;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      this.videoList = re.data.data;
+		    }
+		  });
+		},
+		onPullDownRefresh() {
+		  // 如果请求中,不允许请求,
+		  if (this.isReqing) return false;
+		  // 初始化页码为1
+		  this.requestParam.page = 1;
+		  // 是否是最后一页
+		  this.isLast = false;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      this.videoList = re.data.data;
+		    }
+		  });
+		  uni.stopPullDownRefresh();
+		},
+		onReachBottom() {
+		  // 如果页码是0,避免第一页重复
+		  if (this.requestParam.page < 1) return;
+		  // 最后一页不请求
+		  if (this.isLast) return;
+		  // 请求中,不再请求
+		  if (this.isReqing) return;
+		  // 增加一页
+		  this.requestParam.page = this.requestParam.page + 1;
+		  // 设置请求中
+		  this.isReqing = true;
+		  // 请求列表
+		  this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+		    // 设置非请求中
+		    this.isReqing = false;
+		    // 成功结果
+		    if (re.code == "success") {
+			  // 数据
+		      if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		      // 追加数据
+		      this.videoList.push(...re.data.data);
+		    }
+		  });
+		},
+		methods: {
+			goDetail(id) {
+			  uni.navigateTo({
+			    url: "/pages/video/detail?id=" + id,
+			  });
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	.video_list{
+		float: left;
+		width: 750rpx;
+		display: block;
+		overflow: hidden;
+		.video_item{
+			display: block;
+			width: 700rpx;
+			height: 200rpx;
+			overflow: hidden;
+			margin-bottom: 10rpx;
+			padding: 20rpx 25rpx;
+			border-radius: 10rpx;
+			background-color: #FFFFFF;
+			.thumb_img{
+				float: left;
+				width: 200rpx;
+				height: 200rpx;
+				display: block;
+				border-radius: 10rpx;
+			}
+			.video_info{
+				float: right;
+				width: 480rpx;
+				display: block;
+				margin-left: 20rpx;
+				.video_type{
+					color: #999999;
+					width: 480rpx;
+					display: block;
+					height: 60rpx;
+					font-size: 26rpx;
+					line-height: 60rpx;
+					.to_learn{
+						color: #66b66A;
+						float: right;
+						border: none;
+						width: 140rpx;
+						height: 40rpx;
+						font-size: 26rpx;
+						margin-top: 10rpx;
+						line-height: 40rpx;
+						padding: 0rpx 0rpx;
+						text-align: center;
+						border-radius: 10rpx;
+						background-color: #E8F4E8;
+					}
+					.to_learn::after{
+						border: none;
+					}
+				}
+				.video_title{
+					width: 480rpx;
+					display: block;
+					height: 80rpx;
+					font-size: 32rpx;
+					overflow: hidden;
+					font-weight: bold;
+					line-height: 40rpx;
+					text-overflow: ellipsis;
+				}
+				.video_time{
+					color: #999999;
+					width: 480rpx;
+					display: block;
+					height: 60rpx;
+					font-size: 26rpx;
+					line-height: 60rpx;
+					.after_exam{
+						float: right;
+						border: none;
+						width: 140rpx;
+						height: 50rpx;
+						font-size: 26rpx;
+						margin-top: 5rpx;
+						line-height: 50rpx;
+						padding: 0rpx 0rpx;
+						text-align: center;
+						border-radius: 10rpx;
+						color: #66b66A;
+						background-color: #E8F4E8;
+					}
+					.after_exam::after{
+						border: none;
+					}
+				}
+			}
+		}
+	}
+	.contact_follow{
+		bottom: 30%;
+		right: 20rpx;
+		width: 100rpx;
+		height: 100rpx;
+		display: block;
+		position: fixed;
+		border-radius: 50%;
+		background-color: #1296DB;
+		.contact_btn{
+			border: none;
+			width: 100rpx;
+			color: #FFFFFF;
+			height: 100rpx;
+			padding: 0rpx 0rpx;
+			line-height: 100rpx;
+			text-align: center;
+			border-radius: 50%;
+			background-color: #1296DB;
+		}
+		.contact_btn::after{
+			border: none;
+		}
+	}
+</style>

BIN
static/icon/hand.png


BIN
static/icon/information.png


BIN
static/icon/no_hand.png


BIN
static/icon/no_like.png


BIN
static/icon/share.png