Przeglądaj źródła

查看历史反馈信息

zs 1 rok temu
rodzic
commit
04463a3c82

+ 7 - 0
pages.json

@@ -93,6 +93,13 @@
 					"style": {
 						"navigationBarTitleText": "意见反馈"
 					}
+				},
+				{
+					"path": "opinion/list",
+					"style": {
+						"navigationBarTitleText": "历史反馈",
+						"enablePullDownRefresh": true
+					}
 				}
 			]
 		}

+ 7 - 1
pagesMy/opinion/index.vue

@@ -28,7 +28,7 @@
 				<button type="warn" size="mini" form-type="submit">保存</button>
 			</view>
 		</form>
-		<view class="view">查看历史反馈</view>
+		<view class="view" @click="toView">查看历史反馈</view>
 	</view>
 </template>
 
@@ -140,6 +140,12 @@
 			}
 		}
 	};
+	// 查看历史反馈
+	const toView = () => {
+		uni.navigateTo({
+			url: `/pagesMy/opinion/list`
+		})
+	}
 </script>
 <style lang="scss" scoped>
 	.content {

+ 180 - 0
pagesMy/opinion/list.vue

@@ -0,0 +1,180 @@
+<template>
+	<view class="content">
+		<view class="one">
+			<up-list @scrolltolower="scrolltolower">
+				<up-list-item v-for="(item, index) in list" :key="index">
+					<view class="list">
+						<view class="value">
+							<view class="title">问题类型:</view>
+							<view class="label">{{getDict(item.type,'type')}}</view>
+						</view>
+						<view class="value">
+							<view class="title">问题描述:</view>
+							<view class="label">{{item.brief||'暂无'}}</view>
+						</view>
+						<view class="value">
+							<view class="title">时间:</view>
+							<view class="label">{{item.time||'暂无'}}</view>
+						</view>
+						<view class="value">
+							<view class="title">状态:</view>
+							<view class="label" :class="[item.status=='0'?'red':'']">{{getDict(item.status,'status')}}
+							</view>
+						</view>
+					</view>
+				</up-list-item>
+			</up-list>
+		</view>
+		<view class="is_bottom" v-if="is_bottom">
+			<text>{{config.bottom_title||'没有更多了!'}}</text>
+		</view>
+	</view>
+</template>
+
+<script setup lang="ts">
+	import { inject, computed, ref } from 'vue';
+	//该依赖已内置不需要单独安装
+	import { onShow, onPullDownRefresh } from "@dcloudio/uni-app";
+	// 请求接口
+	const $api = inject('$api');
+	const $config = inject('$config');
+	// 基本信息
+	const config = ref({ logo: [], file: [] });
+	// 列表
+	const list = ref([]);
+	const total = ref(0);
+	const skip = ref(0);
+	const limit = ref(5);
+	const page = ref(0);
+	// 数据是否触底
+	const is_bottom = ref(false);
+	// 字典表
+	const typeList = ref([]);
+	const statusList = ref([]);
+	// user
+	const user = computed(() => {
+		return uni.getStorageSync('user');
+	})
+	onShow(async () => {
+		await searchConfig();
+		await searchOther();
+		await search();
+	})
+	onPullDownRefresh(async () => {
+		await clearPage();
+		await search();
+		uni.stopPullDownRefresh();
+	})
+	// config信息
+	const searchConfig = async () => {
+		config.value = uni.getStorageSync('config');
+	};
+	// 其他查询信息
+	const searchOther = async () => {
+		let res;
+		// 问题类型
+		res = await $api(`dictData`, 'GET', { code: 'opinionType', is_use: '0' });
+		if (res.errcode === 0) typeList.value = res.data;
+		// 问题状态
+		res = await $api(`dictData`, 'GET', { code: 'opinionStatus', is_use: '0' });
+		if (res.errcode === 0) statusList.value = res.data;
+	};
+	// 查询
+	const search = async () => {
+		const info = {
+			skip: skip.value,
+			limit: limit.value,
+			user: user.value._id
+		}
+		const res = await $api('opinion', 'GET', info);
+		if (res.errcode === 0) {
+			list.value = list.value.concat(res.data)
+			total.value = res.total
+		} else {
+			uni.showToast({
+				title: res.errmsg || '',
+				icon: 'error',
+			});
+		}
+	};
+	const getDict = (data, model) => {
+		let res
+		if (model == 'status') res = statusList.value.find((f) => f.value == data)
+		else if (model == 'type') res = typeList.value.find((f) => f.value == data)
+		return res.label || '暂无'
+	}
+	const scrolltolower = () => {
+		if (total.value > list.value.length) {
+			uni.showLoading({
+				title: '加载中',
+				mask: true
+			})
+			page.value = page.value + 1;
+			skip.value = page.value * limit.value;
+			search();
+			uni.hideLoading();
+		} else is_bottom.value = true
+	};
+	// 清空列表
+	const clearPage = () => {
+		list.value = []
+		skip.value = 0
+		limit.value = 6
+		page.value = 0
+	};
+</script>
+<style lang="scss" scoped>
+	.content {
+		display: flex;
+		flex-direction: column;
+		min-height: 100vh;
+		background-color: var(--f1Color);
+
+		.one {
+			margin: 0 2vw;
+			border-radius: 5px;
+
+			.list {
+				background-color: var(--mainColor);
+				border-bottom: 1px solid var(--f5Color);
+				margin: 2vw 0 0 0;
+				border-radius: 4px;
+				padding: 2vw;
+
+				.value {
+					display: flex;
+					padding: 1vw 2vw;
+
+					.title {
+						font-size: var(--font16Size);
+						font-weight: bold;
+						margin: 0 2vw 0 0;
+					}
+
+					.label {
+						width: 70%;
+						font-size: var(--font14Size);
+						color: var(--f85Color);
+					}
+
+					.red {
+						color: var(--ff0Color);
+					}
+				}
+			}
+
+		}
+
+		.is_bottom {
+			width: 100%;
+			text-align: center;
+
+			text {
+				padding: 2vw 0;
+				display: inline-block;
+				color: var(--f85Color);
+				font-size: var(--font12Size);
+			}
+		}
+	}
+</style>

+ 1 - 0
unpackage/dist/dev/mp-weixin/app.js

@@ -15,6 +15,7 @@ if (!Math) {
   "./pagesMy/follow/index.js";
   "./pagesMy/account/index.js";
   "./pagesMy/opinion/index.js";
+  "./pagesMy/opinion/list.js";
 }
 const _sfc_main = {
   onLaunch: function() {

+ 2 - 1
unpackage/dist/dev/mp-weixin/app.json

@@ -19,7 +19,8 @@
         "course/index",
         "follow/index",
         "account/index",
-        "opinion/index"
+        "opinion/index",
+        "opinion/list"
       ]
     }
   ],

+ 2 - 0
unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -10115,6 +10115,7 @@ const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
 };
 const onShow = /* @__PURE__ */ createHook(ON_SHOW);
 const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
+const onPullDownRefresh = /* @__PURE__ */ createHook(ON_PULL_DOWN_REFRESH);
 //! moment.js
 //! version : 2.30.1
 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -16223,6 +16224,7 @@ exports.mpMixin = mpMixin;
 exports.n = n;
 exports.o = o;
 exports.onLoad = onLoad;
+exports.onPullDownRefresh = onPullDownRefresh;
 exports.onShow = onShow;
 exports.openType = openType;
 exports.os = os;

+ 7 - 1
unpackage/dist/dev/mp-weixin/pagesMy/opinion/index.js

@@ -100,6 +100,11 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         }
       }
     };
+    const toView = () => {
+      common_vendor.index.navigateTo({
+        url: `/pagesMy/opinion/list`
+      });
+    };
     return (_ctx, _cache) => {
       return common_vendor.e({
         a: common_vendor.t(form.value.type_name || "请选择 >"),
@@ -122,7 +127,8 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           multiple: true,
           maxCount: 3
         }),
-        l: common_vendor.o(formSubmit)
+        l: common_vendor.o(formSubmit),
+        m: common_vendor.o(toView)
       });
     };
   }

Plik diff jest za duży
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesMy/opinion/index.wxml


+ 118 - 0
unpackage/dist/dev/mp-weixin/pagesMy/opinion/list.js

@@ -0,0 +1,118 @@
+"use strict";
+const common_vendor = require("../../common/vendor.js");
+if (!Array) {
+  const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item");
+  const _easycom_up_list2 = common_vendor.resolveComponent("up-list");
+  (_easycom_up_list_item2 + _easycom_up_list2)();
+}
+const _easycom_up_list_item = () => "../../node-modules/uview-plus/components/u-list-item/u-list-item.js";
+const _easycom_up_list = () => "../../node-modules/uview-plus/components/u-list/u-list.js";
+if (!Math) {
+  (_easycom_up_list_item + _easycom_up_list)();
+}
+const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
+  __name: "list",
+  setup(__props) {
+    const $api = common_vendor.inject("$api");
+    common_vendor.inject("$config");
+    const config = common_vendor.ref({ logo: [], file: [] });
+    const list = common_vendor.ref([]);
+    const total = common_vendor.ref(0);
+    const skip = common_vendor.ref(0);
+    const limit = common_vendor.ref(5);
+    const page = common_vendor.ref(0);
+    const is_bottom = common_vendor.ref(false);
+    const typeList = common_vendor.ref([]);
+    const statusList = common_vendor.ref([]);
+    const user = common_vendor.computed(() => {
+      return common_vendor.index.getStorageSync("user");
+    });
+    common_vendor.onShow(async () => {
+      await searchConfig();
+      await searchOther();
+      await search();
+    });
+    common_vendor.onPullDownRefresh(async () => {
+      await clearPage();
+      await search();
+      common_vendor.index.stopPullDownRefresh();
+    });
+    const searchConfig = async () => {
+      config.value = common_vendor.index.getStorageSync("config");
+    };
+    const searchOther = async () => {
+      let res;
+      res = await $api(`dictData`, "GET", { code: "opinionType", is_use: "0" });
+      if (res.errcode === 0)
+        typeList.value = res.data;
+      res = await $api(`dictData`, "GET", { code: "opinionStatus", is_use: "0" });
+      if (res.errcode === 0)
+        statusList.value = res.data;
+    };
+    const search = async () => {
+      const info = {
+        skip: skip.value,
+        limit: limit.value,
+        user: user.value._id
+      };
+      const res = await $api("opinion", "GET", info);
+      if (res.errcode === 0) {
+        list.value = list.value.concat(res.data);
+        total.value = res.total;
+      } else {
+        common_vendor.index.showToast({
+          title: res.errmsg || "",
+          icon: "error"
+        });
+      }
+    };
+    const getDict = (data, model) => {
+      let res;
+      if (model == "status")
+        res = statusList.value.find((f) => f.value == data);
+      else if (model == "type")
+        res = typeList.value.find((f) => f.value == data);
+      return res.label || "暂无";
+    };
+    const scrolltolower = () => {
+      if (total.value > list.value.length) {
+        common_vendor.index.showLoading({
+          title: "加载中",
+          mask: true
+        });
+        page.value = page.value + 1;
+        skip.value = page.value * limit.value;
+        search();
+        common_vendor.index.hideLoading();
+      } else
+        is_bottom.value = true;
+    };
+    const clearPage = () => {
+      list.value = [];
+      skip.value = 0;
+      limit.value = 6;
+      page.value = 0;
+    };
+    return (_ctx, _cache) => {
+      return common_vendor.e({
+        a: common_vendor.f(list.value, (item, index, i0) => {
+          return {
+            a: common_vendor.t(getDict(item.type, "type")),
+            b: common_vendor.t(item.brief || "暂无"),
+            c: common_vendor.t(item.time || "暂无"),
+            d: common_vendor.t(getDict(item.status, "status")),
+            e: common_vendor.n(item.status == "0" ? "red" : ""),
+            f: index,
+            g: "c9b53715-1-" + i0 + ",c9b53715-0"
+          };
+        }),
+        b: common_vendor.o(scrolltolower),
+        c: is_bottom.value
+      }, is_bottom.value ? {
+        d: common_vendor.t(config.value.bottom_title || "没有更多了!")
+      } : {});
+    };
+  }
+});
+const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c9b53715"], ["__file", "D:/project/学吧/learn_applet/pagesMy/opinion/list.vue"]]);
+wx.createPage(MiniProgramPage);

+ 8 - 0
unpackage/dist/dev/mp-weixin/pagesMy/opinion/list.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "历史反馈",
+  "enablePullDownRefresh": true,
+  "usingComponents": {
+    "up-list-item": "../../node-modules/uview-plus/components/u-list-item/u-list-item",
+    "up-list": "../../node-modules/uview-plus/components/u-list/u-list"
+  }
+}

Plik diff jest za duży
+ 1 - 0
unpackage/dist/dev/mp-weixin/pagesMy/opinion/list.wxml


+ 46 - 0
unpackage/dist/dev/mp-weixin/pagesMy/opinion/list.wxss

@@ -0,0 +1,46 @@
+/* 水平间距 */
+/* 水平间距 */
+.content.data-v-c9b53715 {
+  display: flex;
+  flex-direction: column;
+  min-height: 100vh;
+  background-color: var(--f1Color);
+}
+.content .one.data-v-c9b53715 {
+  margin: 0 2vw;
+  border-radius: 5px;
+}
+.content .one .list.data-v-c9b53715 {
+  background-color: var(--mainColor);
+  border-bottom: 1px solid var(--f5Color);
+  margin: 2vw 0 0 0;
+  border-radius: 4px;
+  padding: 2vw;
+}
+.content .one .list .value.data-v-c9b53715 {
+  display: flex;
+  padding: 1vw 2vw;
+}
+.content .one .list .value .title.data-v-c9b53715 {
+  font-size: var(--font16Size);
+  font-weight: bold;
+  margin: 0 2vw 0 0;
+}
+.content .one .list .value .label.data-v-c9b53715 {
+  width: 70%;
+  font-size: var(--font14Size);
+  color: var(--f85Color);
+}
+.content .one .list .value .red.data-v-c9b53715 {
+  color: var(--ff0Color);
+}
+.content .is_bottom.data-v-c9b53715 {
+  width: 100%;
+  text-align: center;
+}
+.content .is_bottom text.data-v-c9b53715 {
+  padding: 2vw 0;
+  display: inline-block;
+  color: var(--f85Color);
+  font-size: var(--font12Size);
+}