Browse Source

对视频搜索页面科室列表数据进行缓存

c4az6 4 years ago
parent
commit
d173f7a346

+ 1 - 1
components/public-videoList/public-videoList.vue

@@ -3,7 +3,7 @@
 		<view class="content-wrap"  v-if="videoList.length!==0">
 			<view class="public-card flex-col" v-for="item in videoList" :key="item" @tap="handleVideoClick(item.id)">
 				<view class="img-cover">
-					<image class="video-cover" :src="item.coverPhoto"  :lazy-load="true" mode="aspectFill"></image>
+					<image class="video-cover" :src="item.coverPhoto"  mode="aspectFill"></image>
 					<view class="icon-wrap" v-if="isShowPlayIcon">
 						<view>
 							<image src="../../static/images/play-icon.png" mode=""></image>

+ 5 - 1
pages/myLike/myLike.vue

@@ -6,7 +6,7 @@
 		</cu-custom>
 
 		<scroll-view class="content-wrap" :scroll-y="true" @scrolltolower="lower" enable-flex>
-			<publicVideoList :videoList="videoList" @onLower="handleLower" isShowDoctorName></publicVideoList>
+			<publicVideoList :videoList="videoList" @onLower="handleLower" @onVideoClick="handleVideoClick"  isShowDoctorName></publicVideoList>
 		</scroll-view>
 
 	</view>
@@ -32,6 +32,10 @@
 			};
 		},
 		methods: {
+			// 监听视频点击事件
+			handleVideoClick(e){
+				console.log(e)
+			},
 			// 获取视频列表数据
 			async getList() {
 				const response = await reqGetMyLikeList(this.payload)

+ 6 - 1
pages/search/search.vue

@@ -76,7 +76,7 @@
 				if(response.success===1 && response.message==='查询成功') {
 					this.picker = response.items.map(item=>item.departmentname)
 					this.picker.unshift('全部科室')
-					console.log("picker: ", this.picker)
+					uni.setStorageSync('departmentList', this.picker)
 				}else {
 					uni.showToast({
 						title: '科室数据获取失败,请重试...',
@@ -141,6 +141,11 @@
 		},
 		onShow() {
 			this.getList()
+			const departmentList = uni.getStorageSync('departmentList')
+			if(departmentList) {
+				this.picker = departmentList
+				return
+			}
 			this.getAllDepartments()
 		}
 	}

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/components/public-videoList/public-videoList.js.map


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/myLike/myLike.js.map


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/search/search.js.map


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/components/public-videoList/public-videoList.wxml


+ 4 - 0
unpackage/dist/dev/mp-weixin/pages/myLike/myLike.js

@@ -164,6 +164,10 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
 
   },
   methods: {
+    // 监听视频点击事件
+    handleVideoClick: function handleVideoClick(e) {
+      console.log(e);
+    },
     // 获取视频列表数据
     getList: function getList() {var _this = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var response;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return (
                   (0, _home.reqGetMyLikeList)(_this.payload));case 2:response = _context.sent;

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/myLike/myLike.wxml


+ 6 - 1
unpackage/dist/dev/mp-weixin/pages/search/search.js

@@ -208,7 +208,7 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
                 if (response.success === 1 && response.message === '查询成功') {
                   _this.picker = response.items.map(function (item) {return item.departmentname;});
                   _this.picker.unshift('全部科室');
-                  console.log("picker: ", _this.picker);
+                  uni.setStorageSync('departmentList', _this.picker);
                 } else {
                   uni.showToast({
                     title: '科室数据获取失败,请重试...',
@@ -273,6 +273,11 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
   },
   onShow: function onShow() {
     this.getList();
+    var departmentList = uni.getStorageSync('departmentList');
+    if (departmentList) {
+      this.picker = departmentList;
+      return;
+    }
     this.getAllDepartments();
   } };exports.default = _default;
 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))