微信小程序发布试用版本

This commit is contained in:
zhonghua1
2026-01-31 21:10:40 +08:00
parent 4ebeec45bc
commit 80d6d46182
338 changed files with 5767 additions and 6091 deletions

View File

@@ -0,0 +1,191 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const db = common_vendor.tr.database();
const readNewsLog = db.collection("read-news-log");
const _sfc_main = {
data() {
return {
// 当前显示 _id
id: "",
title: "title",
// 数据表名
// 查询字段,多个字段用 , 分割
// field: 'user_id.nickname,user_id._id,avatar,excerpt,last_modify_date,comment_count,like_count,title,content',
formData: {
noData: '<p style="text-align:center;color:#666">详情加载中...</p>'
}
};
},
computed: {
uniStarterConfig() {
return getApp().globalData.config;
},
where() {
return `_id =="${this.id}"`;
},
colList() {
return [
db.collection("opendb-news-articles").where(this.where).field("user_id,_id,avatar,excerpt,last_modify_date,comment_count,like_count,title,content").getTemp(),
db.collection("uni-id-users").field("_id,nickname").getTemp()
];
}
},
onLoad(event) {
if (event.id) {
this.id = event.id;
}
if (event.title) {
this.title = event.title;
common_vendor.index.setNavigationBarTitle({
title: event.title
});
}
},
onReady() {
if (this.id) {
this.$refs.detail.loadData();
} else {
common_vendor.index.showToast({
icon: "none",
title: this.$t("listDetail.newsErr")
});
}
},
onNavigationBarButtonTap(event) {
if (event.type == "share") {
this.shareClick();
}
},
methods: {
$log(...args) {
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:136", "args", ...args, this.id);
},
setReadNewsLog() {
let item = {
"article_id": this.id,
"last_time": Date.now()
}, readNewsLog2 = common_vendor.index.getStorageSync("readNewsLog") || [], index = -1;
readNewsLog2.forEach(({ article_id }, i) => {
if (article_id == item.article_id) {
index = i;
}
});
if (index === -1) {
readNewsLog2.push(item);
} else {
readNewsLog2.splice(index, 1, item);
}
common_vendor.index.setStorageSync("readNewsLog", readNewsLog2);
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:156", readNewsLog2);
},
setFavorite() {
if (common_vendor.tr.getCurrentUserInfo().tokenExpired < Date.now()) {
return common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:160", "未登录用户");
}
let article_id = this.id, last_time = Date.now();
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:164", { article_id, last_time });
readNewsLog.where(`"article_id" == "${article_id}" && "user_id"==$env.uid`).update({ last_time }).then(({ result: { updated } }) => {
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:168", "updated", updated);
if (!updated) {
readNewsLog.add({ article_id }).then((e) => {
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:171", e);
}).catch((err) => {
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:173", err);
});
}
}).catch((err) => {
common_vendor.index.__f__("log", "at pages-subpackage/list/detail.vue:177", err);
});
},
loadData(data) {
if (this.title == "" && data[0].title) {
this.title = data[0].title;
common_vendor.index.setNavigationBarTitle({
title: data[0].title
});
}
this.setReadNewsLog();
},
/**
* followClick
* 点击关注
*/
followClick() {
common_vendor.index.showToast({
title: this.$t("listDetail.follow"),
icon: "none"
});
}
/**
* 分享该文章
*/
}
};
if (!Array) {
const _easycom_uni_dateformat2 = common_vendor.resolveComponent("uni-dateformat");
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
const _easycom_unicloud_db2 = common_vendor.resolveComponent("unicloud-db");
(_easycom_uni_dateformat2 + _easycom_uni_list_item2 + _easycom_uni_list2 + _easycom_unicloud_db2)();
}
const _easycom_uni_dateformat = () => "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.js";
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
const _easycom_unicloud_db = () => "../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db.js";
if (!Math) {
(_easycom_uni_dateformat + _easycom_uni_list_item + _easycom_uni_list + _easycom_unicloud_db)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.t($data.title),
b: common_vendor.w(({
data,
loading,
error,
options
}, s0, i0) => {
return common_vendor.e({
a: !loading && data
}, !loading && data ? {
b: common_vendor.t(data.user_id && data.user_id[0] && data.user_id[0].nickname || "未知"),
c: "91d600e9-3-" + i0 + "," + ("91d600e9-2-" + i0),
d: common_vendor.p({
date: data.last_modify_date,
format: "yyyy-MM-dd hh:mm",
threshold: [6e4, 2592e6]
}),
e: "91d600e9-2-" + i0 + "," + ("91d600e9-1-" + i0),
f: common_vendor.p({
thumbSize: "lg",
thumb: data.image
}),
g: "91d600e9-1-" + i0 + ",91d600e9-0",
h: common_vendor.p({
border: false
}),
i: data.avatar,
j: common_vendor.t(data.excerpt),
k: data.content
} : {}, {
l: i0,
m: s0
});
}, {
name: "d",
path: "b",
vueId: "91d600e9-0"
}),
c: common_vendor.sr("detail", "91d600e9-0"),
d: common_vendor.o($options.loadData),
e: common_vendor.p({
options: $data.formData,
collection: $options.colList,
getone: true,
manual: true,
foreignKey: "opendb-news-articles.user_id"
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-91d600e9"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages-subpackage/list/detail.js.map

View File

@@ -0,0 +1,9 @@
{
"navigationBarTitleText": "文章详情",
"usingComponents": {
"uni-dateformat": "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat",
"uni-list-item": "../../uni_modules/uni-list/components/uni-list-item/uni-list-item",
"uni-list": "../../uni_modules/uni-list/components/uni-list/uni-list",
"unicloud-db": "../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db"
}
}

View File

@@ -0,0 +1 @@
<view class="article data-v-91d600e9"><view class="article-title data-v-91d600e9">{{a}}</view><unicloud-db wx:if="{{e}}" class="r data-v-91d600e9" u-s="{{['d']}}" u-r="detail" bindload="{{d}}" u-i="91d600e9-0" bind:__l="__l" u-p="{{e}}"><view wx:for="{{b}}" wx:for-item="v0" wx:key="l" slot="{{v0.m}}"><block wx:if="{{v0.a}}"><uni-list wx:if="{{v0.h}}" class="data-v-91d600e9" u-s="{{['d']}}" u-i="{{v0.g}}" bind:__l="__l" u-p="{{v0.h}}"><uni-list-item wx:if="{{v0.f}}" class="data-v-91d600e9" u-s="{{['body','footer']}}" u-i="{{v0.e}}" bind:__l="__l" u-p="{{v0.f}}"><view class="header-content data-v-91d600e9" slot="body"><view class="uni-title data-v-91d600e9">{{v0.b}}</view></view><view class="footer data-v-91d600e9" slot="footer"><view class="uni-note data-v-91d600e9">更新于 <uni-dateformat wx:if="{{v0.d}}" class="data-v-91d600e9" u-i="{{v0.c}}" bind:__l="__l" u-p="{{v0.d}}"/></view></view></uni-list-item></uni-list><view class="banner data-v-91d600e9"><image class="banner-img data-v-91d600e9" src="{{v0.i}}" mode="widthFix"></image><view class="banner-title data-v-91d600e9"><text class="uni-ellipsis data-v-91d600e9">{{v0.j}}</text></view></view><view class="article-content data-v-91d600e9"><rich-text class="data-v-91d600e9" nodes="{{v0.k}}"></rich-text></view></block></view></unicloud-db></view>

View File

@@ -0,0 +1,78 @@
.header-content.data-v-91d600e9 {
flex: 1;
display: flex;
flex-direction: column;
font-size: 14px;
}
/* 标题 */
.uni-title.data-v-91d600e9 {
display: flex;
margin-bottom: 5px;
font-size: 14px;
font-weight: bold;
color: #3b4144;
}
/* 描述 额外文本 */
.uni-note.data-v-91d600e9 {
color: #999;
font-size: 12px;
display: flex;
flex-direction: row;
align-items: center;
}
.footer.data-v-91d600e9 {
display: flex;
align-items: center;
}
.footer-button.data-v-91d600e9 {
display: flex;
align-items: center;
font-size: 12px;
height: 30px;
color: #fff;
background-color: #ff5a5f;
}
.banner.data-v-91d600e9 {
position: relative;
margin: 0 15px;
height: 180px;
overflow: hidden;
}
.banner-img.data-v-91d600e9 {
position: absolute;
width: 100%;
}
.banner-title.data-v-91d600e9 {
display: flex;
align-items: center;
position: absolute;
padding: 0 15px;
width: 100%;
bottom: 0;
height: 30px;
font-size: 14px;
color: #fff;
background: rgba(0, 0, 0, 0.4);
overflow: hidden;
box-sizing: border-box;
}
.uni-ellipsis.data-v-91d600e9 {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.article-title.data-v-91d600e9 {
padding: 20px 15px;
padding-bottom: 0;
}
.article-content.data-v-91d600e9 {
padding: 15px;
font-size: 15px;
overflow: hidden;
}

View File

@@ -0,0 +1,189 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const uni_modules_jsonGps_js_sdk_gps = require("../../uni_modules/json-gps/js_sdk/gps.js");
let cdbRef;
const statusBar = () => "../../uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.js";
const gps = new uni_modules_jsonGps_js_sdk_gps.Gps(), db = common_vendor.tr.database();
const _sfc_main = {
components: {
statusBar
},
computed: {
inputPlaceholder(e) {
if (common_vendor.index.getStorageSync("CURRENT_LANG") == "en") {
return "Please enter the search content";
} else {
return "请输入搜索内容";
}
},
colList() {
return [
db.collection("opendb-news-articles").where(this.where).field("avatar,title,last_modify_date,user_id").getTemp(),
db.collection("uni-id-users").field("_id,nickname").getTemp()
];
}
},
data() {
return {
where: '"article_status" == 1',
keyword: "",
showRefresh: false,
listHight: 0
};
},
watch: {
keyword(keyword, oldValue) {
let where = '"article_status" == 1 ';
if (keyword) {
this.where = where + `&& /${keyword}/.test(title)`;
} else {
this.where = where;
}
}
},
async onReady() {
this.listHight = "auto";
cdbRef = this.$refs.udb;
},
async onShow() {
this.keyword = getApp().globalData.searchText;
getApp().globalData.searchText = "";
await gps.getLocation({
geocode: true
});
},
methods: {
searchClick(e) {
common_vendor.index.hideKeyboard();
common_vendor.index.navigateTo({
url: "/pages/list/search/search",
animationType: "fade-in"
});
},
retry() {
this.refresh();
},
refresh() {
cdbRef.loadData({
clear: true
}, () => {
common_vendor.index.stopPullDownRefresh();
common_vendor.index.__f__("log", "at pages-subpackage/list/list.nvue:157", "end");
});
common_vendor.index.__f__("log", "at pages-subpackage/list/list.nvue:159", "refresh");
},
loadMore() {
cdbRef.loadMore();
},
onqueryerror(e) {
common_vendor.index.__f__("error", "at pages-subpackage/list/list.nvue:165", e);
},
onpullingdown(e) {
common_vendor.index.__f__("log", "at pages-subpackage/list/list.nvue:168", e);
this.showRefresh = true;
if (e.pullingDistance > 100) {
this.refresh();
}
}
},
onPullDownRefresh() {
this.refresh();
},
onReachBottom() {
this.loadMore();
}
};
if (!Array) {
const _component_statusBar = common_vendor.resolveComponent("statusBar");
const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
const _easycom_uni_dateformat2 = common_vendor.resolveComponent("uni-dateformat");
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
const _easycom_uni_load_state2 = common_vendor.resolveComponent("uni-load-state");
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
const _easycom_unicloud_db2 = common_vendor.resolveComponent("unicloud-db");
(_component_statusBar + _easycom_uni_search_bar2 + _easycom_uni_dateformat2 + _easycom_uni_list_item2 + _easycom_uni_load_state2 + _easycom_uni_list2 + _easycom_unicloud_db2)();
}
const _easycom_uni_search_bar = () => "../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
const _easycom_uni_dateformat = () => "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.js";
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
const _easycom_uni_load_state = () => "../../components/uni-load-state/uni-load-state.js";
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
const _easycom_unicloud_db = () => "../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db.js";
if (!Math) {
(_easycom_uni_search_bar + _easycom_uni_dateformat + _easycom_uni_list_item + _easycom_uni_load_state + _easycom_uni_list + _easycom_unicloud_db)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.sr("searchBar", "9ed7da74-1"),
b: common_vendor.o(($event) => $data.keyword = $event),
c: common_vendor.p({
radius: "100",
cancelButton: "none",
disabled: true,
placeholder: $options.inputPlaceholder,
modelValue: $data.keyword
}),
d: common_vendor.o((...args) => $options.searchClick && $options.searchClick(...args)),
e: common_vendor.w(({
data,
pagination,
hasMore,
loading,
error,
options
}, s0, i0) => {
return {
a: common_vendor.f(data, (item, index, i1) => {
return {
a: item.avatar,
b: common_vendor.t(item.title),
c: common_vendor.t(item.user_id[0] ? item.user_id[0].nickname : ""),
d: "9ed7da74-5-" + i0 + "-" + i1 + "," + ("9ed7da74-4-" + i0 + "-" + i1),
e: common_vendor.p({
date: item.last_modify_date,
format: "yyyy-MM-dd",
threshold: [6e4, 2592e6]
}),
f: index,
g: "9ed7da74-4-" + i0 + "-" + i1 + "," + ("9ed7da74-3-" + i0),
h: common_vendor.p({
to: "/pages/list/detail?id=" + item._id + "&title=" + item.title
})
};
}),
b: "9ed7da74-6-" + i0 + "," + ("9ed7da74-3-" + i0),
c: common_vendor.p({
state: {
data,
pagination,
hasMore,
loading,
error
}
}),
d: "9ed7da74-3-" + i0 + ",9ed7da74-2",
e: i0,
f: s0
};
}, {
name: "d",
path: "e",
vueId: "9ed7da74-2"
}),
f: common_vendor.o($options.refresh),
g: common_vendor.o($options.loadMore),
h: $data.listHight,
i: common_vendor.p({
border: false
}),
j: common_vendor.sr("udb", "9ed7da74-2"),
k: common_vendor.o($options.onqueryerror),
l: common_vendor.p({
collection: $options.colList,
["page-size"]: 10
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ed7da74"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages-subpackage/list/list.js.map

View File

@@ -0,0 +1,13 @@
{
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"usingComponents": {
"status-bar": "../../uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar",
"uni-search-bar": "../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar",
"uni-dateformat": "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat",
"uni-list-item": "../../uni_modules/uni-list/components/uni-list-item/uni-list-item",
"uni-load-state": "../../components/uni-load-state/uni-load-state",
"uni-list": "../../uni_modules/uni-list/components/uni-list/uni-list",
"unicloud-db": "../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db"
}
}

View File

@@ -0,0 +1 @@
<view class="pages data-v-9ed7da74"><status-bar class="data-v-9ed7da74" u-i="9ed7da74-0" bind:__l="__l"></status-bar><view class="uni-search-box data-v-9ed7da74"><uni-search-bar wx:if="{{c}}" class="r data-v-9ed7da74" u-r="searchBar" u-i="9ed7da74-1" bind:__l="__l" bindupdateModelValue="{{b}}" u-p="{{c}}"/><view class="cover-search-bar data-v-9ed7da74" bindtap="{{d}}"></view></view><unicloud-db wx:if="{{l}}" class="r data-v-9ed7da74" u-s="{{['d']}}" u-r="udb" binderror="{{k}}" u-i="9ed7da74-2" bind:__l="__l" u-p="{{l}}"><view wx:for="{{e}}" wx:for-item="v0" wx:key="e" slot="{{v0.f}}"><uni-list wx:if="{{i}}" u-s="{{['d']}}" class="uni-list data-v-9ed7da74" style="{{'height:' + h}}" u-i="{{v0.d}}" bind:__l="__l" u-p="{{i}}"><uni-list-item wx:for="{{v0.a}}" wx:for-item="item" wx:key="f" class="data-v-9ed7da74" u-s="{{['header','body']}}" u-i="{{item.g}}" bind:__l="__l" u-p="{{item.h}}"><image class="avatar data-v-9ed7da74" src="{{item.a}}" mode="aspectFill" slot="header"></image><view class="main data-v-9ed7da74" slot="body"><text class="title data-v-9ed7da74">{{item.b}}</text><view class="info data-v-9ed7da74"><text class="author data-v-9ed7da74">{{item.c}}</text><uni-dateformat wx:if="{{item.e}}" class="last_modify_date data-v-9ed7da74" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e}}"/></view></view></uni-list-item><uni-load-state wx:if="{{v0.c}}" class="load-state data-v-9ed7da74" bindnetworkResume="{{f}}" bindloadMore="{{g}}" u-i="{{v0.b}}" bind:__l="__l" u-p="{{v0.c}}"></uni-load-state></uni-list></view></unicloud-db></view>

View File

@@ -0,0 +1,56 @@
@import "../../nvue.wxss";
view.data-v-9ed7da74 {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
.pages.data-v-9ed7da74 {
background-color: #FFFFFF;
}
.avatar.data-v-9ed7da74 {
width: 200rpx;
height: 200rpx;
margin-right: 10rpx;
}
.main.data-v-9ed7da74 {
justify-content: space-between;
flex: 1;
}
.title.data-v-9ed7da74 {
font-size: 16px;
}
.info.data-v-9ed7da74 {
flex-direction: row;
justify-content: space-between;
}
.author.data-v-9ed7da74,
.last_modify_date.data-v-9ed7da74 {
font-size: 14px;
color: #999999;
}
.uni-search-box.data-v-9ed7da74 {
background-color: #FFFFFF;
position: -webkit-sticky;
position: sticky;
height: 50px;
top: 0;
left: 0;
z-index: 9;
width: 580rpx;
}
.cover-search-bar.data-v-9ed7da74 {
height: 50px;
position: relative;
top: -50px;
margin-bottom: -50px;
z-index: 999;
}
.load-state.data-v-9ed7da74{
justify-content: center;
width: 750rpx;
}

View File

@@ -0,0 +1,338 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const searchLogDbName = "opendb-search-log";
const mallGoodsDbName = "opendb-news-articles";
const associativeSearchField = "title";
const associativeField = "_id,title";
const localSearchListKey = "__local_search_history";
const arrUnique = (arr) => {
for (let i = arr.length - 1; i >= 0; i--) {
const curIndex = arr.indexOf(arr[i]);
const lastIndex = arr.lastIndexOf(arr[i]);
curIndex != lastIndex && arr.splice(lastIndex, 1);
}
return arr;
};
function debounce(fn, interval, isFirstAutoRun) {
var _self = fn;
var timer = null;
var first = true;
if (isFirstAutoRun) {
_self();
}
return function() {
var args = arguments;
var _me = this;
if (first) {
first = false;
_self.apply(_me, args);
}
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(function() {
clearTimeout(timer);
timer = null;
_self.apply(_me, args);
}, interval || 200);
};
}
const _sfc_main = {
data() {
return {
mallGoodsDbName,
searchLogDbName,
statusBarHeight: "0px",
localSearchList: common_vendor.index.getStorageSync(localSearchListKey),
localSearchListDel: false,
netHotListIsHide: false,
searchText: "",
iconColor: "#999999",
associativeList: [],
keyBoardPopup: false,
hotWorld: "DCloud",
// 搜索热词,如果没有输入即回车,则搜索热词,但是不会加入搜索记录
focus: true,
// 是否自动聚焦
speechEngine: "iFly"
// 语音识别引擎 iFly 讯飞 baidu 百度
};
},
created() {
this.db = common_vendor.tr.database();
this.searchLogDb = this.db.collection(this.searchLogDbName);
this.mallGoodsDb = this.db.collection(this.mallGoodsDbName);
common_vendor.index.onKeyboardHeightChange((res) => {
this.keyBoardPopup = res.height !== 0;
});
this.searchText = getApp().globalData.searchText;
},
computed: {
associativeShow() {
return this.searchText && this.associativeList.length;
}
},
onLoad() {
},
methods: {
clear(res) {
common_vendor.index.__f__("log", "at pages-subpackage/list/search/search.nvue:172", "res: ", res);
},
confirm(res) {
this.search(res.value);
},
cancel(res) {
common_vendor.index.hideKeyboard();
this.searchText = "";
this.loadList();
},
search(value) {
if (!value && !this.hotWorld) {
return;
}
if (value) {
if (this.searchText !== value) {
this.searchText = value;
}
this.localSearchListManage(value);
this.searchLogDbAdd(value);
} else if (this.hotWorld) {
this.searchText = this.hotWorld;
}
common_vendor.index.hideKeyboard();
this.loadList(this.searchText);
},
localSearchListManage(word) {
let list = common_vendor.index.getStorageSync(localSearchListKey);
if (list.length) {
this.localSearchList.unshift(word);
arrUnique(this.localSearchList);
if (this.localSearchList.length > 10) {
this.localSearchList.pop();
}
} else {
this.localSearchList = [word];
}
common_vendor.index.setStorageSync(localSearchListKey, this.localSearchList);
},
LocalSearchListClear() {
common_vendor.index.showModal({
content: "确认清空搜索历史吗",
confirmText: "删除",
confirmColor: "red",
cancelColor: "#808080",
success: (res) => {
if (res.confirm) {
this.localSearchListDel = false;
this.localSearchList = [];
common_vendor.index.removeStorageSync(localSearchListKey);
}
}
});
},
LocalSearchlistItemClick(word, index) {
if (this.localSearchListDel) {
this.localSearchList.splice(index, 1);
common_vendor.index.setStorageSync(localSearchListKey, this.localSearchList);
if (!this.localSearchList.length) {
this.localSearchListDel = false;
}
return;
}
this.search(word);
},
searchHotRefresh() {
this.$refs.udb.refresh();
},
speech() {
},
searchLogDbAdd(value) {
this.getDeviceId().then((device_id) => {
this.searchLogDb.add({
// user_id: device_id,
device_id,
content: value,
create_date: Date.now()
});
});
},
getDeviceId() {
return new Promise((resolve, reject) => {
const uniId = common_vendor.index.getStorageSync("uni_id");
if (!uniId) {
resolve(common_vendor.index.getSystemInfoSync().system + "_" + Math.random().toString(36).substr(2));
} else {
resolve(uniId);
}
});
},
associativeClick(item) {
common_vendor.index.__f__("log", "at pages-subpackage/list/search/search.nvue:297", "associativeClick: ", item);
this.loadList(item.title);
},
loadList(text = "") {
getApp().globalData.searchText = text;
common_vendor.index.switchTab({
url: "/pages/list/list"
});
},
backPage() {
common_vendor.index.navigateBack();
}
},
watch: {
searchText: debounce(function(value) {
if (value) {
this.mallGoodsDb.where({
[associativeSearchField]: new RegExp(value, "gi")
}).field(associativeField).get().then((res) => {
this.associativeList = res.result.data;
});
} else {
this.associativeList.length = 0;
getApp().globalData.searchText = "";
}
}, 100)
}
};
if (!Array) {
const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_unicloud_db2 = common_vendor.resolveComponent("unicloud-db");
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
(_easycom_uni_search_bar2 + _easycom_uni_icons2 + _easycom_unicloud_db2 + _easycom_uni_list_item2 + _easycom_uni_list2)();
}
const _easycom_uni_search_bar = () => "../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
const _easycom_uni_icons = () => "../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_unicloud_db = () => "../../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db.js";
const _easycom_uni_list_item = () => "../../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
const _easycom_uni_list = () => "../../../uni_modules/uni-list/components/uni-list/uni-list.js";
if (!Math) {
(_easycom_uni_search_bar + _easycom_uni_icons + _easycom_unicloud_db + _easycom_uni_list_item + _easycom_uni_list)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.sr("searchBar", "d9f44979-0"),
b: common_vendor.o($options.clear),
c: common_vendor.o($options.confirm),
d: common_vendor.o($options.cancel),
e: common_vendor.o(($event) => $data.searchText = $event),
f: common_vendor.p({
radius: "100",
focus: $data.focus,
placeholder: $data.hotWorld,
clearButton: "auto",
cancelButton: "always",
modelValue: $data.searchText
}),
g: $data.localSearchList.length
}, $data.localSearchList.length ? common_vendor.e({
h: !$data.localSearchListDel
}, !$data.localSearchListDel ? {
i: common_vendor.o(($event) => $data.localSearchListDel = true),
j: common_vendor.p({
color: $data.iconColor,
size: "18",
type: "trash"
})
} : {
k: common_vendor.o((...args) => $options.LocalSearchListClear && $options.LocalSearchListClear(...args)),
l: common_vendor.o(($event) => $data.localSearchListDel = false)
}, {
m: common_vendor.f($data.localSearchList, (word, index, i0) => {
return common_vendor.e({
a: common_vendor.t(word),
b: word
}, $data.localSearchListDel ? {
c: "d9f44979-2-" + i0,
d: common_vendor.p({
size: "12",
type: "closeempty"
})
} : {}, {
e: index,
f: common_vendor.o(($event) => $options.LocalSearchlistItemClick(word, index), index)
});
}),
n: $data.localSearchListDel
}) : {}, {
o: !$data.netHotListIsHide
}, !$data.netHotListIsHide ? {
p: common_vendor.o($options.searchHotRefresh),
q: common_vendor.p({
color: $data.iconColor,
size: "14",
type: "reload"
})
} : {}, {
r: common_vendor.o(($event) => $data.netHotListIsHide = !$data.netHotListIsHide),
s: common_vendor.p({
color: $data.iconColor,
size: "18",
type: $data.netHotListIsHide ? "eye-slash" : "eye"
}),
t: common_vendor.w(({
data,
loading,
error,
options
}, s0, i0) => {
return common_vendor.e({
a: loading && !$data.netHotListIsHide
}, loading && !$data.netHotListIsHide ? {} : common_vendor.e({
b: !$data.netHotListIsHide
}, !$data.netHotListIsHide ? common_vendor.e({
c: error
}, error ? {
d: common_vendor.t(error.message)
} : {
e: common_vendor.f(data, (word, index, i1) => {
return {
a: common_vendor.t(word.content),
b: index,
c: common_vendor.o(($event) => $options.search(word.content), index)
};
})
}) : {}), {
f: i0,
g: s0
});
}, {
name: "d",
path: "t",
vueId: "d9f44979-5"
}),
v: common_vendor.sr("udb", "d9f44979-5"),
w: common_vendor.p({
field: "content",
collection: "opendb-search-hot",
orderby: "create_date desc,count desc",
["page-data"]: "replace",
["page-size"]: 10
}),
x: $options.associativeShow
}, $options.associativeShow ? {
y: common_vendor.f($data.associativeList, (item, index, i0) => {
return {
a: item._id,
b: common_vendor.o(($event) => $options.associativeClick(item), item._id),
c: "d9f44979-7-" + i0 + ",d9f44979-6",
d: common_vendor.p({
ellipsis: 1,
title: item.name,
["show-extra-icon"]: true,
clickable: true,
["extra-icon"]: {
size: 18,
color: $data.iconColor,
type: "search"
}
})
};
})
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d9f44979"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages-subpackage/list/search/search.js.map

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "搜索",
"usingComponents": {
"uni-search-bar": "../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar",
"uni-icons": "../../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"unicloud-db": "../../../node-modules/@dcloudio/uni-components/lib/unicloud-db/unicloud-db",
"uni-list-item": "../../../uni_modules/uni-list/components/uni-list-item/uni-list-item",
"uni-list": "../../../uni_modules/uni-list/components/uni-list/uni-list"
}
}

View File

@@ -0,0 +1 @@
<view class="container data-v-d9f44979"><view class="search-container data-v-d9f44979"><view class="search-container-bar data-v-d9f44979"><uni-search-bar wx:if="{{f}}" class="r data-v-d9f44979" u-r="searchBar" style="flex:1" bindclear="{{b}}" bindconfirm="{{c}}" bindcancel="{{d}}" u-i="d9f44979-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"/></view></view><view class="search-body data-v-d9f44979"><view wx:if="{{g}}" class="word-container data-v-d9f44979"><view class="word-container_header data-v-d9f44979"><text class="word-container_header-text data-v-d9f44979">搜索历史</text><uni-icons wx:if="{{h}}" bindclick="{{i}}" class="search-icons data-v-d9f44979" style="padding-right:0" u-i="d9f44979-1" bind:__l="__l" u-p="{{j}}"></uni-icons><view wx:else class="flex-center flex-row data-v-d9f44979" style="font-weight:500;justify-content:space-between"><text class="data-v-d9f44979" style="font-size:22rpx;color:#666;padding-top:4rpx;padding-bottom:4rpx;padding-right:20rpx" bindtap="{{k}}">全部删除</text><text class="data-v-d9f44979" style="font-size:22rpx;color:#c0402b;padding-top:4rpx;padding-bottom:4rpx;padding-left:20rpx" bindtap="{{l}}">完成</text></view></view><view class="word-container_body data-v-d9f44979"><view wx:for="{{m}}" wx:for-item="word" wx:key="e" class="flex-center flex-row word-container_body-text data-v-d9f44979" bindtap="{{word.f}}"><text class="word-display data-v-d9f44979" key="{{word.b}}">{{word.a}}</text><uni-icons wx:if="{{n}}" class="data-v-d9f44979" u-i="{{word.c}}" bind:__l="__l" u-p="{{word.d}}"/></view></view></view><view class="word-container data-v-d9f44979"><view class="word-container_header data-v-d9f44979"><view class="flex-center flex-row data-v-d9f44979"><text class="word-container_header-text data-v-d9f44979">搜索发现</text><uni-icons wx:if="{{o}}" class="search-icons data-v-d9f44979" bindclick="{{p}}" u-i="d9f44979-3" bind:__l="__l" u-p="{{q}}"></uni-icons></view><uni-icons wx:if="{{s}}" class="search-icons data-v-d9f44979" style="padding-right:0" bindclick="{{r}}" u-i="d9f44979-4" bind:__l="__l" u-p="{{s}}"></uni-icons></view><unicloud-db wx:if="{{w}}" class="r data-v-d9f44979" u-s="{{['d']}}" u-r="udb" u-i="d9f44979-5" bind:__l="__l" u-p="{{w}}"><view wx:for="{{t}}" wx:for-item="v0" wx:key="f" slot="{{v0.g}}"><text wx:if="{{v0.a}}" class="word-container_body-info data-v-d9f44979">正在加载...</text><view wx:else class="word-container_body data-v-d9f44979"><block wx:if="{{v0.b}}"><text wx:if="{{v0.c}}" class="word-container_body-info data-v-d9f44979">{{v0.d}}</text><block wx:else><text wx:for="{{v0.e}}" wx:for-item="word" wx:key="b" class="word-container_body-text data-v-d9f44979" bindtap="{{word.c}}">{{word.a}}</text></block></block><view wx:else class="data-v-d9f44979" style="flex:1"><text class="word-container_body-info data-v-d9f44979">当前搜索发现已隐藏</text></view></view></view></unicloud-db></view></view><view wx:if="{{x}}" class="search-associative data-v-d9f44979"><uni-list class="data-v-d9f44979" u-s="{{['d']}}" u-i="d9f44979-6" bind:__l="__l"><uni-list-item wx:for="{{y}}" wx:for-item="item" wx:key="a" class="data-v-d9f44979" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d}}"></uni-list-item></uni-list></view></view>

View File

@@ -0,0 +1,141 @@
@import "../../../nvue.wxss";
page {
height: 100%;
flex: 1;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.status-bar.data-v-d9f44979 {
background-color: #fff;
}
.container.data-v-d9f44979 {
height: 100%;
flex: 1;
background-color: #f7f7f7;
}
.search-body.data-v-d9f44979 {
background-color: #fff;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.flex-center.data-v-d9f44979 {
display: flex;
justify-content: center;
align-items: center;
}
.flex-row.data-v-d9f44979 {
display: flex;
flex-direction: row;
}
.uni-searchbar__box.data-v-d9f44979 {
border-width: 0;
}
.uni-input-placeholder.data-v-d9f44979 {
font-size: 28rpx;
}
.search-container.data-v-d9f44979 {
height: 52px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
background-color: #fff;
}
.search-container-bar.data-v-d9f44979 {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
}
.search-associative.data-v-d9f44979 {
overflow-y: auto;
position: absolute;
top: 52px;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
margin-top: 10rpx;
padding-left: 10rpx;
padding-right: 10rpx;
}
.search-icons.data-v-d9f44979 {
padding: 16rpx;
}
.word-display.data-v-d9f44979 {
font-size: 26rpx;
color: #666;
}
.word-container.data-v-d9f44979 {
padding: 20rpx;
}
.word-container_header.data-v-d9f44979 {
display: flex;
height: 72rpx;
line-height: 72rpx;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.word-container_header-text.data-v-d9f44979 {
color: #3e3e3e;
font-size: 30rpx;
font-weight: bold;
}
.word-container_body.data-v-d9f44979 {
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.word-container_body-text.data-v-d9f44979 {
display: flex;
font-size: 26rpx;
color: #666;
justify-content: center;
align-items: center;
background-color: #f6f6f6;
padding: 10rpx 20rpx;
margin: 20rpx 30rpx 0 0;
border-radius: 30rpx;
box-sizing: border-box;
text-align: center;
}
.word-container_body-info.data-v-d9f44979 {
display: block;
flex: 1;
text-align: center;
font-size: 26rpx;
color: #808080;
margin-top: 20rpx;
}