暂存代码

This commit is contained in:
何江明
2025-05-23 18:03:45 +08:00
parent 8217069b9a
commit a2c87e47bf
313 changed files with 6157 additions and 1102 deletions
+188
View File
@@ -0,0 +1,188 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_enumUtils = require("../../utils/enumUtils.js");
const api_common = require("../../api/common.js");
const api_news = require("../../api/news.js");
const utils_index = require("../../utils/index.js");
const Header = () => "../../components/header.js";
const _sfc_main = {
components: { Header },
data() {
return {
titleList: utils_enumUtils.NEWS_TYPE,
swiperList: [],
currentNum: 0,
form: {
keywork: null,
type: 1,
page: 1,
pageSize: 15
},
inputCss: {
"height": "68rpx",
"background": "#FFFFFF",
"border-radius": "16rpx",
"border": "0rpx",
"padding": "0 0 0 16px"
},
newsList: [],
newsListTotal: 0,
loading: false
};
},
onLoad(option) {
this.getCarouselImage();
this.loadData();
},
methods: {
formatDate: utils_index.formatDate,
// 查询轮播图
async getCarouselImage() {
const params = {
pageUi: utils_enumUtils.APP_PAGE_TYPE.NEWS
};
const resp = await api_common.getCarouselImage(params);
if (resp && resp.bizcode === 100) {
const data = resp.data || [];
this.swiperList = data.length !== 0 ? data.map((obj) => obj.carouselImage) : [];
}
},
headerClick(item) {
this.form.type = item.key;
this.searchTap();
},
// 搜索
searchTap() {
this.newsList = [];
this.form.page = 1;
this.loadData();
},
// 加载数据的方法
async loadData() {
if (this.loading)
return;
this.loading = true;
try {
const newData = await this.fetchData(this.form.page, this.form.pageSize);
if (newData.entitys && newData.entitys.length !== 0) {
this.newsList = [...this.newsList, ...newData.entitys];
this.form.page++;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/news/news.vue:147", "加载数据失败:", error);
} finally {
this.loading = false;
}
},
// 模拟获取数据的方法,实际应用中应该替换为你的数据获取逻辑,例如从服务器获取数据
async fetchData(page, pageSize) {
const form = this.form;
const params = {
page,
pageSize,
type: form.type
};
if (form.keywork) {
params.keywork = form.keywork;
}
const data = await api_news.getNewsList(params);
if (data && data.bizcode === 100 && data.data) {
return data.data;
} else {
return [];
}
},
// 当滚动到底部时触发的方法
loadMore() {
this.loadData();
},
/**
* 跳转到详情
* @param {Object} item
*/
jumpInfo(item) {
common_vendor.index.navigateTo({
url: "/pages/news_info/news_info?id=" + item.id
});
}
}
};
if (!Array) {
const _component_Header = common_vendor.resolveComponent("Header");
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
(_component_Header + _easycom_up_swiper2 + _easycom_up_input2 + _easycom_up_image2)();
}
const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
if (!Math) {
(_easycom_up_swiper + _easycom_up_input + _easycom_up_image)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.p({
leftTitle: "商学院",
["left-path-type"]: "switchTab",
["left-path"]: "/pages/mine/mine"
}),
b: common_vendor.f($data.titleList, (item, k0, i0) => {
return {
a: common_vendor.t(item.value),
b: item.key,
c: common_vendor.n($data.form.type === item.key ? "heder_item_sel heder_item" : "heder_item"),
d: common_vendor.o(($event) => $options.headerClick(item), item.key)
};
}),
c: common_vendor.t($data.currentNum + 1),
d: common_vendor.t($data.swiperList.length),
e: common_vendor.o((e) => $data.currentNum = e.current),
f: common_vendor.p({
list: $data.swiperList,
height: "120",
radius: "10",
bgColor: "#ffffff00"
}),
g: common_vendor.o((...args) => $options.searchTap && $options.searchTap(...args)),
h: common_vendor.o(($event) => $data.form.keywork = $event),
i: common_vendor.p({
placeholder: "搜索关键字",
prefixIcon: "search",
prefixIconStyle: "font-size: 22px;color: #909399",
customStyle: $data.inputCss,
modelValue: $data.form.keywork
}),
j: $data.newsList && $data.newsList.length !== 0
}, $data.newsList && $data.newsList.length !== 0 ? {
k: common_vendor.f($data.newsList, (item, k0, i0) => {
return {
a: common_vendor.t(item.title),
b: item.content,
c: common_vendor.t($options.formatDate(item.ctdate)),
d: "24bc9d41-3-" + i0,
e: common_vendor.t(item.browses),
f: item.id,
g: common_vendor.o(($event) => $options.jumpInfo(item), item.id)
};
}),
l: common_vendor.p({
src: "/static/login/show.png",
width: "20",
height: "20",
bgColor: "#f1f6ff00"
})
} : {
m: common_vendor.p({
src: "/static/common/not_order.png",
width: "80",
height: "80",
bgColor: "#f1f6ff00"
})
}, {
n: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args))
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-24bc9d41"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/news/news.js.map
+9
View File
@@ -0,0 +1,9 @@
{
"navigationBarTitleText": "",
"usingComponents": {
"header": "../../components/header",
"up-swiper": "../../uni_modules/uview-plus/components/u-swiper/u-swiper",
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image"
}
}
+1
View File
@@ -0,0 +1 @@
<view class="news_warp data-v-24bc9d41"><header wx:if="{{a}}" class="data-v-24bc9d41" style="background-color:#FFFFFF" u-i="24bc9d41-0" bind:__l="__l" u-p="{{a}}"/><view class="news_content_warp data-v-24bc9d41"><view class="heder_ data-v-24bc9d41"><view wx:for="{{b}}" wx:for-item="item" wx:key="b" class="{{['data-v-24bc9d41', item.c]}}" bindtap="{{item.d}}">{{item.a}}</view></view><view class="data-v-24bc9d41" style="padding:20rpx 0"><up-swiper wx:if="{{f}}" class="data-v-24bc9d41" u-s="{{['indicator']}}" bindchange="{{e}}" u-i="24bc9d41-1" bind:__l="__l" u-p="{{f}}"><view class="indicator-num data-v-24bc9d41" slot="indicator"><text class="indicator-num__text data-v-24bc9d41">{{c}}/{{d}}</text></view></up-swiper></view></view><view class="content_ data-v-24bc9d41"><scroll-view class="data-v-24bc9d41" scroll-y="true" bindscrolltolower="{{n}}" style="height:calc(100vh - 560rpx)"><up-input wx:if="{{i}}" class="data-v-24bc9d41" u-s="{{['suffix']}}" u-i="24bc9d41-2" bind:__l="__l" bindupdateModelValue="{{h}}" u-p="{{i}}"><view bindtap="{{g}}" class="search_but data-v-24bc9d41" slot="suffix"> 搜索 </view></up-input><block wx:if="{{j}}"><view wx:for="{{k}}" wx:for-item="item" wx:key="f" class="news_content_item data-v-24bc9d41" bindtap="{{item.g}}"><view class="news_content_item_title data-v-24bc9d41">{{item.a}}</view><view class="news_content_item_content data-v-24bc9d41"><rich-text class="data-v-24bc9d41" nodes="{{item.b}}"/></view><view class="news_content_item_info data-v-24bc9d41"><view class="data-v-24bc9d41">{{item.c}}</view><view class="browses_ data-v-24bc9d41"><view class="data-v-24bc9d41"><up-image wx:if="{{l}}" class="data-v-24bc9d41" u-i="{{item.d}}" bind:__l="__l" u-p="{{l}}"></up-image></view><view class="data-v-24bc9d41" style="margin-left:8rpx">{{item.e}}</view></view></view></view></block><view wx:else class="not_order_warp data-v-24bc9d41"><up-image wx:if="{{m}}" class="data-v-24bc9d41" u-i="24bc9d41-4" bind:__l="__l" u-p="{{m}}"></up-image><view class="not_order_msg_warp data-v-24bc9d41">还未发布新闻哦~</view></view></scroll-view></view></view>
+89
View File
@@ -0,0 +1,89 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/* uni.scss */
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
.news_warp.data-v-24bc9d41 {
overflow: hidden;
}
.news_warp .news_content_warp.data-v-24bc9d41 {
padding: 0 30rpx 30rpx;
}
.news_warp .heder_.data-v-24bc9d41 {
display: flex;
align-items: center;
}
.news_warp .heder_ .heder_item.data-v-24bc9d41 {
font-weight: 500;
font-size: 32rpx;
color: #666666;
margin-right: 30rpx;
}
.news_warp .heder_ .heder_item_sel.data-v-24bc9d41 {
font-weight: bold;
font-size: 36rpx;
color: #000000;
}
.news_warp .content_.data-v-24bc9d41 {
padding: 30rpx;
background: #F5F5F5FF;
border-radius: 30rpx 30rpx 0rpx 0rpx;
}
.news_warp .content_ .search_but.data-v-24bc9d41 {
line-height: 68rpx;
background: #FF7C41;
border-radius: 16rpx;
font-size: 24rpx;
color: #FFFFFF;
padding: 0 40rpx;
}
.news_warp .content_ .news_content_item.data-v-24bc9d41 {
background: #FFFFFF;
padding: 30rpx;
margin-top: 20rpx;
}
.news_warp .content_ .news_content_item_title.data-v-24bc9d41 {
font-weight: 800;
font-size: 36rpx;
color: #000000;
}
.news_warp .content_ .news_content_item_content.data-v-24bc9d41 {
font-weight: 500;
font-size: 24rpx;
color: #666666;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
margin-top: 10rpx;
}
.news_warp .content_ .news_content_item_info.data-v-24bc9d41 {
margin-top: 30rpx;
display: flex;
justify-content: space-between;
font-weight: 500;
font-size: 28rpx;
color: #666666;
}
.news_warp .content_ .news_content_item_info .browses_.data-v-24bc9d41 {
display: flex;
}