zs 1 rok pred
rodič
commit
3be7f08dee

+ 1 - 1
pages/my/index.vue

@@ -70,11 +70,11 @@
 		onLoad: async function() {
 			const that = this;
 			await that.searchOther();
-			await that.search();
 		},
 		onShow: async function(e) {
 			const that = this;
 			that.searchToken();
+			await that.search();
 		},
 		methods: {
 			searchToken() {

+ 235 - 5
pagesIndex/collect/index.vue

@@ -1,20 +1,250 @@
 <template>
 	<view class="main">
-		系统首页
+		<view class="one">
+			<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+				<view class="list-scroll-view">
+					<!-- 瀑布流布局列表 -->
+					<view class="pubuBox">
+						<view class="pubuItem">
+							<view class="list" v-for="(item, index) in list" :key="index" @tap="toInfo(item)">
+								<image :src="item.file&&item.file.length>0?item.file[0].url:''" mode="widthFix">
+								</image>
+								<view class="title"> <!-- 这是没有高度的父盒子(下半部分) -->
+									<view class="title_1">{{ item.title }}</view>
+									<view class="title_2">
+										<view class="left">
+											{{item.contact_name||'暂无昵称'}}
+										</view>
+										<view class="right" @tap.stop="toLike(item)">
+											<text class="iconfont icon-shoucang"></text>
+											{{item.collect_num||'0'}}
+										</view>
+									</view>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view class="is_bottom" v-if="is_bottom">
+						<text>{{config.bottom_title}}</text>
+					</view>
+				</view>
+			</scroll-view>
+		</view>
 	</view>
 </template>
 
 <script>
 	export default {
 		data() {
-			return {}
+			return {
+				searchInfo: {},
+				config: {},
+				user: {},
+				list: [],
+				total: 0,
+				skip: 0,
+				limit: 6,
+				page: 0,
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
+			}
+		},
+		onLoad: async function(e) {
+			const that = this;
+			that.searchToken();
+			that.searchConfig();
+			await that.searchOther();
+		},
+		onShow: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
-
+			searchToken() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('token');
+					if (res) that.$set(that, `user`, res);
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
+			searchConfig() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('config');
+					if (res) that.$set(that, `config`, res);
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
+			async search() {
+				const that = this;
+				if (!that.user._id) return
+				let info = {
+					skip: that.skip,
+					limit: that.limit,
+					user: that.user._id,
+					type: '1'
+				}
+				const res = await that.$api(`/like/article`, 'GET', {
+					...info,
+					...that.searchInfo
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+					});
+				}
+			},
+			// 查看详情
+			toInfo(item) {
+				uni.navigateTo({
+					url: `/pagesHome/article/index?id=${item.id||item._id}`
+				})
+			},
+			// 取消收藏
+			async toLike(item) {
+				const that = this;
+				let res;
+				res = await that.$api(`/like/${item.collect}`, 'DELETE', {})
+				if (res.errcode == '0') {
+					that.clearPage();
+					that.search()
+				}
+			},
+			async searchOther() {
+				const that = this;
+				let res;
+			},
+			// 分页
+			toPage(e) {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			}
 		}
 	}
 </script>
 
-<style>
-	.main {}
+<style lang="scss" scoped>
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			position: relative;
+			flex-grow: 1;
+			background-color: var(--f9Color);
+			margin: 2vw 0 0 0;
+
+			.pubuBox {
+				padding: 2vw;
+			}
+
+			.pubuItem {
+				column-count: 2;
+				column-gap: 2vw;
+			}
+
+			.list {
+				box-sizing: border-box;
+				border-radius: 2vw;
+				overflow: hidden;
+				background-color: var(--mainColor);
+				break-inside: avoid;
+				/*避免在元素内部插入分页符*/
+				box-sizing: border-box;
+				margin-bottom: 2vw;
+			}
+
+			.list image {
+				width: 100%;
+			}
+
+			.title {
+				padding: 2vw;
+
+				.title_1 {
+					font-size: var(--font14Size);
+					line-height: 4vw;
+					text-overflow: -o-ellipsis-lastline;
+					overflow: hidden;
+					text-overflow: ellipsis;
+					display: -webkit-box;
+					-webkit-line-clamp: 2;
+					line-clamp: 2;
+					-webkit-box-orient: vertical;
+					min-height: 6vw;
+					max-height: 20vw;
+				}
+
+				.title_2 {
+					display: flex;
+					justify-content: space-between;
+					font-size: var(--font12Size);
+					color: var(--f69Color);
+					padding: 1vw 0;
+
+					.right {
+						display: flex;
+						align-items: center;
+
+						text:first-child {
+							padding: 0 1vw 0 0;
+						}
+					}
+				}
+			}
+		}
+	}
 </style>

+ 235 - 5
pagesIndex/like/index.vue

@@ -1,20 +1,250 @@
 <template>
 	<view class="main">
-		系统首页
+		<view class="one">
+			<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+				<view class="list-scroll-view">
+					<!-- 瀑布流布局列表 -->
+					<view class="pubuBox">
+						<view class="pubuItem">
+							<view class="list" v-for="(item, index) in list" :key="index" @tap="toInfo(item)">
+								<image :src="item.file&&item.file.length>0?item.file[0].url:''" mode="widthFix">
+								</image>
+								<view class="title"> <!-- 这是没有高度的父盒子(下半部分) -->
+									<view class="title_1">{{ item.title }}</view>
+									<view class="title_2">
+										<view class="left">
+											{{item.contact_name||'暂无昵称'}}
+										</view>
+										<view class="right" @tap.stop="toLike(item)">
+											<text class="iconfont icon-aixin1"></text>
+											{{item.like_num||'0'}}
+										</view>
+									</view>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view class="is_bottom" v-if="is_bottom">
+						<text>{{config.bottom_title}}</text>
+					</view>
+				</view>
+			</scroll-view>
+		</view>
 	</view>
 </template>
 
 <script>
 	export default {
 		data() {
-			return {}
+			return {
+				searchInfo: {},
+				config: {},
+				user: {},
+				list: [],
+				total: 0,
+				skip: 0,
+				limit: 6,
+				page: 0,
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
+			}
+		},
+		onLoad: async function(e) {
+			const that = this;
+			that.searchToken();
+			that.searchConfig();
+			await that.searchOther();
+		},
+		onShow: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
-
+			searchToken() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('token');
+					if (res) that.$set(that, `user`, res);
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
+			searchConfig() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('config');
+					if (res) that.$set(that, `config`, res);
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
+			async search() {
+				const that = this;
+				if (!that.user._id) return
+				let info = {
+					skip: that.skip,
+					limit: that.limit,
+					user: that.user._id,
+					type: '0'
+				}
+				const res = await that.$api(`/like/article`, 'GET', {
+					...info,
+					...that.searchInfo
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+					});
+				}
+			},
+			// 查看详情
+			toInfo(item) {
+				uni.navigateTo({
+					url: `/pagesHome/article/index?id=${item.id||item._id}`
+				})
+			},
+			// 取消点赞
+			async toLike(item) {
+				const that = this;
+				let res;
+				res = await that.$api(`/like/${item.like}`, 'DELETE', {})
+				if (res.errcode == '0') {
+					that.clearPage();
+					that.search()
+				}
+			},
+			async searchOther() {
+				const that = this;
+				let res;
+			},
+			// 分页
+			toPage(e) {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			}
 		}
 	}
 </script>
 
-<style>
-	.main {}
+<style lang="scss" scoped>
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			position: relative;
+			flex-grow: 1;
+			background-color: var(--f9Color);
+			margin: 2vw 0 0 0;
+
+			.pubuBox {
+				padding: 2vw;
+			}
+
+			.pubuItem {
+				column-count: 2;
+				column-gap: 2vw;
+			}
+
+			.list {
+				box-sizing: border-box;
+				border-radius: 2vw;
+				overflow: hidden;
+				background-color: var(--mainColor);
+				break-inside: avoid;
+				/*避免在元素内部插入分页符*/
+				box-sizing: border-box;
+				margin-bottom: 2vw;
+			}
+
+			.list image {
+				width: 100%;
+			}
+
+			.title {
+				padding: 2vw;
+
+				.title_1 {
+					font-size: var(--font14Size);
+					line-height: 4vw;
+					text-overflow: -o-ellipsis-lastline;
+					overflow: hidden;
+					text-overflow: ellipsis;
+					display: -webkit-box;
+					-webkit-line-clamp: 2;
+					line-clamp: 2;
+					-webkit-box-orient: vertical;
+					min-height: 6vw;
+					max-height: 20vw;
+				}
+
+				.title_2 {
+					display: flex;
+					justify-content: space-between;
+					font-size: var(--font12Size);
+					color: var(--f69Color);
+					padding: 1vw 0;
+
+					.right {
+						display: flex;
+						align-items: center;
+
+						text:first-child {
+							padding: 0 1vw 0 0;
+						}
+					}
+				}
+			}
+		}
+	}
 </style>

+ 12 - 19
pagesMy/article/index.vue

@@ -27,7 +27,7 @@
 												</view>
 												<view class="right" @tap.stop="toLike(item)">
 													<text v-if="item.is_like" class="iconfont icon-aixin1"></text>
-													<text else class="iconfont icon-aixin"></text>
+													<text v-else class="iconfont icon-aixin"></text>
 													{{item.like_num||'0'}}
 												</view>
 											</view>
@@ -74,9 +74,6 @@
 				// 数据是否触底
 				is_bottom: false,
 				scrollTop: 0,
-				// 字典表
-				is_useList: [],
-				statusList: [],
 			}
 		},
 		onLoad: async function(e) {
@@ -125,25 +122,18 @@
 			},
 			async search() {
 				const that = this;
-				let id = that.id;
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
 					contact: that.user._id,
 					status: that.tabs.active
 				}
-				const res = await that.$api(`/article`, 'GET', {
+				const res = await that.$api(`/article/article`, 'GET', {
 					...info,
 					...that.searchInfo
 				})
 				if (res.errcode == '0') {
 					let list = [...that.list, ...res.data];
-					for (let val of list) {
-						let is_use = that.is_useList.find(i => i.value == val.is_use)
-						if (is_use) val.zhUser = is_use.label;
-						let status = that.statusList.find(i => i.value == val.status)
-						if (status) val.zhStatus = status.label;
-					}
 					that.$set(that, `list`, list)
 					that.$set(that, `total`, res.total)
 				} else {
@@ -184,6 +174,16 @@
 					url: `/pagesMy/article/add?id=${e._id}`
 				})
 			},
+			// 取消点赞
+			async toLike(item) {
+				const that = this;
+				let res;
+				res = await that.$api(`/like/${item.like}`, 'DELETE', {})
+				if (res.errcode == '0') {
+					that.clearPage();
+					that.search()
+				}
+			},
 			// 删除
 			async toDel(e) {
 				const that = this;
@@ -209,19 +209,12 @@
 			async searchOther() {
 				const that = this;
 				let res;
-				//是否使用
-				res = await that.$api('/dictData', 'GET', {
-					type: 'is_use',
-					is_use: '0'
-				})
-				if (res.errcode == '0') that.$set(that, `is_useList`, res.data);
 				//状态
 				res = await that.$api('/dictData', 'GET', {
 					type: 'exam_status',
 					is_use: '0'
 				})
 				if (res.errcode == '0') {
-					that.$set(that, `statusList`, res.data);
 					const menu = res.data.map((item) => {
 						return {
 							title: item.label,

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/index.js.map


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesIndex/collect/index.js.map


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesIndex/like/index.js.map


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/article/index.js.map


+ 3 - 4
unpackage/dist/dev/mp-weixin/pages/my/index.js

@@ -255,9 +255,6 @@ var _default = {
               _context.next = 3;
               return that.searchOther();
             case 3:
-              _context.next = 5;
-              return that.search();
-            case 5:
             case "end":
               return _context.stop();
           }
@@ -278,7 +275,9 @@ var _default = {
             case 0:
               that = this;
               that.searchToken();
-            case 2:
+              _context2.next = 4;
+              return that.search();
+            case 4:
             case "end":
               return _context2.stop();
           }

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 318 - 30
unpackage/dist/dev/mp-weixin/pagesIndex/collect/index.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesIndex/collect/index.wxml


+ 68 - 2
unpackage/dist/dev/mp-weixin/pagesIndex/collect/index.wxss

@@ -1,3 +1,69 @@
-
-.main {}
+@charset "UTF-8";
+/* 水平间距 */
+/* 水平间距 */
+.main.data-v-5dd57b4c {
+  display: flex;
+  flex-direction: column;
+  width: 100vw;
+  height: 100vh;
+}
+.main .one.data-v-5dd57b4c {
+  position: relative;
+  flex-grow: 1;
+  background-color: var(--f9Color);
+  margin: 2vw 0 0 0;
+}
+.main .one .pubuBox.data-v-5dd57b4c {
+  padding: 2vw;
+}
+.main .one .pubuItem.data-v-5dd57b4c {
+  -webkit-column-count: 2;
+          column-count: 2;
+  -webkit-column-gap: 2vw;
+          column-gap: 2vw;
+}
+.main .one .list.data-v-5dd57b4c {
+  box-sizing: border-box;
+  border-radius: 2vw;
+  overflow: hidden;
+  background-color: var(--mainColor);
+  -webkit-column-break-inside: avoid;
+          break-inside: avoid;
+  /*避免在元素内部插入分页符*/
+  box-sizing: border-box;
+  margin-bottom: 2vw;
+}
+.main .one .list image.data-v-5dd57b4c {
+  width: 100%;
+}
+.main .one .title.data-v-5dd57b4c {
+  padding: 2vw;
+}
+.main .one .title .title_1.data-v-5dd57b4c {
+  font-size: var(--font14Size);
+  line-height: 4vw;
+  text-overflow: -o-ellipsis-lastline;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  line-clamp: 2;
+  -webkit-box-orient: vertical;
+  min-height: 6vw;
+  max-height: 20vw;
+}
+.main .one .title .title_2.data-v-5dd57b4c {
+  display: flex;
+  justify-content: space-between;
+  font-size: var(--font12Size);
+  color: var(--f69Color);
+  padding: 1vw 0;
+}
+.main .one .title .title_2 .right.data-v-5dd57b4c {
+  display: flex;
+  align-items: center;
+}
+.main .one .title .title_2 .right text.data-v-5dd57b4c:first-child {
+  padding: 0 1vw 0 0;
+}
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 318 - 30
unpackage/dist/dev/mp-weixin/pagesIndex/like/index.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesIndex/like/index.wxml


+ 68 - 2
unpackage/dist/dev/mp-weixin/pagesIndex/like/index.wxss

@@ -1,3 +1,69 @@
-
-.main {}
+@charset "UTF-8";
+/* 水平间距 */
+/* 水平间距 */
+.main.data-v-394fef7d {
+  display: flex;
+  flex-direction: column;
+  width: 100vw;
+  height: 100vh;
+}
+.main .one.data-v-394fef7d {
+  position: relative;
+  flex-grow: 1;
+  background-color: var(--f9Color);
+  margin: 2vw 0 0 0;
+}
+.main .one .pubuBox.data-v-394fef7d {
+  padding: 2vw;
+}
+.main .one .pubuItem.data-v-394fef7d {
+  -webkit-column-count: 2;
+          column-count: 2;
+  -webkit-column-gap: 2vw;
+          column-gap: 2vw;
+}
+.main .one .list.data-v-394fef7d {
+  box-sizing: border-box;
+  border-radius: 2vw;
+  overflow: hidden;
+  background-color: var(--mainColor);
+  -webkit-column-break-inside: avoid;
+          break-inside: avoid;
+  /*避免在元素内部插入分页符*/
+  box-sizing: border-box;
+  margin-bottom: 2vw;
+}
+.main .one .list image.data-v-394fef7d {
+  width: 100%;
+}
+.main .one .title.data-v-394fef7d {
+  padding: 2vw;
+}
+.main .one .title .title_1.data-v-394fef7d {
+  font-size: var(--font14Size);
+  line-height: 4vw;
+  text-overflow: -o-ellipsis-lastline;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  line-clamp: 2;
+  -webkit-box-orient: vertical;
+  min-height: 6vw;
+  max-height: 20vw;
+}
+.main .one .title .title_2.data-v-394fef7d {
+  display: flex;
+  justify-content: space-between;
+  font-size: var(--font12Size);
+  color: var(--f69Color);
+  padding: 1vw 0;
+}
+.main .one .title .title_2 .right.data-v-394fef7d {
+  display: flex;
+  align-items: center;
+}
+.main .one .title .title_2 .right text.data-v-394fef7d:first-child {
+  padding: 0 1vw 0 0;
+}
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 58 - 70
unpackage/dist/dev/mp-weixin/pagesMy/article/index.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesMy/article/index.wxml