提交 0381f30d 编写于 作者: Java川's avatar Java川

全部提交

上级
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/
// const db = wx.cloud.database()
// const accountCollection = db.collection("location")
App({
data:{
shuju:'',
istoright: true,
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
list1: "",
shenhe1:'' ,//中间值
id:''
},
globalData:{
arrayprotop:'',
arraypro:'',
json:'',
arrayprojd:'',
arrayprokd:'',
arrayproxy:'',
arrayprojxl:'',
arrayprost:'',
arrayproqt:'',
list1:'',
screenHeight:'',
screenWidth:'',
global1:'',
globalzan:[],
areacount:'',
},
//渐入,渐出实现
show : function(that,param,opacity){
var animation = wx.createAnimation({
//持续时间1500ms
duration: 1500,
timingFunction: 'ease',
});
//var animation = this.animation
animation.opacity(opacity).step()
//将param转换为key
var json = '{"' + param + '":""}'
json = JSON.parse(json);
json[param] = animation.export()
//设置动画
that.setData(json)
},
//滑动渐入渐出
slideupshow:function(that,param,px,opacity){
var animation = wx.createAnimation({
duration: 800,
timingFunction: 'ease',
});
animation.translateY(px).opacity(opacity).step()
//将param转换为key
var json = '{"' + param + '":""}';
json = JSON.parse(json);
json[param] = animation.export()
//设置动画
that.setData(json)
},
//向上滑动渐入渐出
slideupshow1:function(that,param,px,opacity){
var animation = wx.createAnimation({
duration: 800,
timingFunction: 'ease',
});
animation.opacity(opacity).translateY(px).opacity(opacity).step()
//将param转换为key
var json = '{"' + param + '":""}';
json = JSON.parse(json);
json[param] = animation.export()
//设置动画
that.setData(json)
},
onLaunch: function () {
var that = this;
wx.getSystemInfo({
success: function(res) {
var screenWidth = res.windowWidth;
var screenHeight = res.windowHeight;
that.globalData.screenWidth = screenWidth;
that.globalData.screenHeight = screenHeight
}
});
if (wx.cloud) {
wx.cloud.init({
env: "chongyou-j5687",//云环境的名字,这里写云环境名对应的id;
traceUser: true, //用户跟踪,看谁使用了我的云环境
})
}
},
})
{
"pages": [
"pages/Cover/Cover",
"pages/admin/admin",
"pages/JingDian/JingDian",
"pages/ShiTang/ShiTang",
"pages/Other/Other",
"pages/editor/editor",
"pages/detail/detail",
"pages/XueYuan/XueYuan",
"pages/TeachBuild/TeachBuild",
"pages/KuaiDi/KuaiDi",
"pages/replace/replace",
"pages/jump/jump",
"pages/top/top",
"pages/map/map",
"pages/aboutus/aboutus",
"pages/introduce/introduce"
],
"window": {
"navigationBarBackgroundColor": "#45e2ad",
"navigationBarTitleText": "重邮指路牌",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": true,
"disableScroll": true
},
"tabBar": {
"color": "#a9b7b7",
"selectedColor": "#45e2ad",
"borderStyle": "black",
"list": [
{
"iconPath": "images/icons/index1.png",
"selectedIconPath": "images/icons/index2.png",
"text": "导航",
"pagePath": "pages/top/top"
},
{
"iconPath": "images/icons/navigate1.png",
"selectedIconPath": "images/icons/navigate2.png",
"text": "手绘地图",
"pagePath": "pages/map/map"
}
]
},
"plugins": {
"routePlan": {
"version": "1.0.6",
"provider": "wx50b5593e81dd937a"
}
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序定位"
}
},
"sitemapLocation": "sitemap33.json"
}
\ No newline at end of file
page,.page {
height: 100%;
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'Droid Sans Fallback', 'Microsoft Yahei', sans-serif;
background-color:#FFFAF0;
}
.page-bottom{
height: 100%;
width: 750rpx;
position: fixed;
background: white;
z-index: 0;
}
.wc{
color:black;
padding: 10rpx 0 40rpx 40rpx;
z-index: 0;
font-weight: bold;
}
.page-content{
top:330rpx;
position: fixed;
}
.background-icon{
height:229rpx;
width:100%;
position: absolute;
bottom:20%;
}
.page-top{
height: 113%;
position: fixed;
width: 750rpx;
background-color: rgb(247, 247, 247);
z-index: 0;
transition: All 0.4s ease;
-webkit-transition: All 0.4s ease;
border-top-left-radius: 15rpx;
border-bottom-left-radius: 15rpx;
}
.page-icon{
position: absolute;
width: 75rpx;
height: 58rpx;
left: 30rpx;
top: 15rpx;
}
.container{
-webkit-overflow-scrolling: touch;
position: absolute;
margin-top:25%;
top: 0;
bottom: 0;
display: flex;
flex-direction: row;
overflow: auto;
justify-content: space-between;
}
.item{
background-color: white;
color: black;
font-weight: bold;
vertical-align: center;
height:400rpx;
border-radius: 5%;
margin-bottom: 20rpx;
box-shadow:0px 2px 4px 2px #DDDDDD;
}
.left-container{
-webkit-box-orient: vertical;
width: 45%;
height: 3500rpx;
margin-left:20rpx;
margin-top:40px;
}
.right-container{
width: 45%;
height: 3500rpx;
margin-right: 20rpx;
margin-top:40px;
}
.container image{
height: 250rpx;
width: 100%;
border-top-left-radius:5%;
border-top-right-radius:5%;
overflow: hidden;
}
.icon{
position: absolute;
width: 68rpx;
height: 38rpx;
left: 20rpx;
top: 20rpx;
}
.c-state1{
transform: rotate(0deg) scale(1) translate(75%,0%);
-webkit-transform: rotate(0deg) scale(1) translate(75%,0%);
}
.c-state2{
transform: rotate(0deg) scale(.8) translate(75%,0%);
-webkit-transform: rotate(0deg) scale(.8) translate(75%,0%);
}
.text{
margin: auto;
margin-top: 20rpx;
margin-left: 120rpx;
vertical-align: middle;
color: black;
font-size: large;
font-weight: bold;
}
.bgimg{
width:1500rpx;
height:1500rpx;
position: absolute;
z-index:-10;
}
.icons{
width: 60rpx;
height: 60rpx;
margin-right: 30rpx;
}
.plus{
position: absolute;
left:600rpx;
top:65%;
height: 130rpx;
width: 130rpx;
z-index:3;
border-radius: 50%;
box-shadow:0px 0px 2px #616161;
}
/* 审核页面 */
.area{
text-align: center;
}
/* 搜索框 */
.scroll-view {
width: 75%;
position: absolute;
top: 170rpx;
left: 40rpx;
background-color: white;
-moz-box-shadow: 0px 0px 2px #e2e2e2;
-webkit-box-shadow: 0px 0px 2px #e2e2e2;
box-shadow: 0px 0px 2px #e2e2e2;
border-bottom-left-radius: 15rpx;
border-bottom-right-radius:15rpx;
z-index: 1;
}
.msg-item {
width: 100%;
z-index: 1;
}
.search_name {
width: 100%;
padding: 20rpx;
font-size: 33rpx;
font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
border-bottom: 1px solid #e2e2e2;
z-index: 1;
}
.search_left{
position: absolute;
display: flex;
flex-direction:row;
}
.search_wrap{
position: absolute;
background:#f5f5f5;
height:80rpx;
width:580rpx;
margin:0 20rpx;
border-radius: 10rpx;
padding-left: 20rpx;
align-items: center;
display: flex;
box-shadow:2px 2px 4px 2px #DDDDDD;
}
.search_input {
position: absolute;
height:65rpx;
width:400rpx;
margin-left:7%;
}
.search_icon {
position: absolute;
width: 30rpx;
height: 30rpx;
}
.search_right{
margin-left: 77%;
position: absolute;
display: flex;
flex-direction:column;
}
.search_cancel{
opacity:0;
margin-top:-10%;
margin-left:-52%;
width:100rpx;
height: 100rpx;
z-index: 2;
}
.search_cancel_img{
position: absolute;
top:40%;
margin-left:-10%;
width:40rpx;
height: 40rpx;
z-index: 1;
}
.search_submit{
position: absolute;
top: 30%;
right: -30%;
font-size:35rpx;
font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
color: #45e2ad;
}
.favorite{
display: flex;
flex-direction: column;
position: fixed;
left: 72%;
width: 50rpx;
z-index:3;
margin-top: -8%;
}
.favTimes{
position: absolute;
left:110%;
top:20%;
}
.describe{
text-overflow:ellipsis;
word-wrap:break-word;
font-size: small;
width: 80%;
margin-left: 5%;
margin-top: 1%;
}
.ns {
width: 100%;
height: 155rpx;
line-height: 225rpx;
font-size:36rpx;
color: black;
font-weight: 900;
background: -webkit-linear-gradient(left,#27a877,#45e2ad,#66FF99);
letter-spacing:5rpx;
}
.star1{
height: 20rpx;
width: 65%;
margin-top: 3%;
margin-left: 2%;
}
/* .conTimes{
position: absolute;
left: 85%;
z-index: 4;
top:-90%;
font-size: smaller;
}
.timesimg{
position: absolute;
left: 85%;
top:-100%;
} */
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()//目的:获取_openid
try {
return await db.collection("zan").add({
data: {
openid1:wxContext.OPENID,
flag:event.flag,
count:event.count
},
success: res => {
}, fail: err => {
}
})
} catch (e) {
console.log(e)
}
}
{
"name": "addzanjilu",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
// const MAX_LIMIT = 100
// // 云函数入口函数
exports.main = async (event, context) => {
// //先取出集合记录总数
return await db.collection("location").where({status_l:"1"}).get()
// // const countResult = await db.collection('locationn').count()
// // const total = countResult.total
// // // 计算需分几次取
// // const batchTimes = Math.ceil(total /20)
// // //承载所有读操作的 promise 的数组
// // const tasks = []
// // //for (let i = 0; i < batchTimes; i++) {
// // const promise = db.collection('locationn').aggregate().sort({count:1}).end()
// // tasks.push(promise)
// // // }
// // return (await Promise.all(tasks)).reduce((acc, cur) => {
// // return {
// // data: acc.data.concat(cur.data),
// // errMsg: acc.errMsg,
// // }
// // })
}
// // 云函数入口文件
// const cloud = require('wx-server-sdk')
// cloud.init()
// const db = cloud.database()
// const MAX_LIMIT = 100
// // 云函数入口函数
// exports.main = async (event, context) => {
// // 先取出集合记录总数
// const countResult = await db.collection('locationn').count()
// const total = countResult.total
// // 计算需分几次取
// const batchTimes = Math.ceil(total / 100)
// // 承载所有读操作的 promise 的数组
// console.log("需要查询的次数",batchTimes)
// const tasks = []
// for (let i = 0; i < batchTimes; i++) {
// const promise = db.collection('locationn').aggregate().sort({count:1}).end()
// tasks.push(promise)
// }
// // 等待所有
// return (await Promise.all(tasks)).reduce((acc, cur) => {
// return {
// data: acc.data.concat(cur.data),
// errMsg: acc.errMsg,
// }
// })
// }
\ No newline at end of file
{
"name": "cxdata",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
return {
event,
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
}
}
\ No newline at end of file
{
"name": "getOpenid",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.1"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
"security.msgSecCheck"
]
}
}
\ No newline at end of file
// 云函数入口文件 index.js
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
try {
const result = await cloud.openapi.security.msgSecCheck({
content: event.context
})
if (result && result.errCode.toString() === '87014'){
return { code: 500, msg: '内容含有违法违规内容', data: result }
}else{
return { code: 200, msg: 'ok', data: result }
}
} catch (err) {
// 错误处理
if (err.errCode.toString() === '87014') {
return { code: 500, msg: '内容含有违法违规内容', data: err }
}
return { code: 502, msg: '调用security接口异常', data: err }
}
}
\ No newline at end of file
{
"name": "guolve",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
"subscribeMessage.send"
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// event 就是小程序端调用云函数时传入的参数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
//地点上传时间
var date=new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year +''+ +month + '' + strDate+''; //审核通过的时间
var create_time='20xx年xx月xx日';
var res="地点创建成功";
var area=' ';
if(event.user[0].time!=null){
create_time=event.user[0].time;//创建上传地点时候的时间)
}
if(event.user[0].store_area!=null){
area=event.user[0].store_area; //上传的地点
}
if(event.type==1){
res=res;
}else if(event.type==2){
res="你上传的地点被管理员top推荐"
}else if(event.type==-1){
res="地点审核不通过,不符合要求"
}
try{
const result=await cloud.openapi.subscribeMessage.send({
touser:wxContext.OPENID, //接收者(用户)的 openid
page:'../../pages/top/top.wxml', //接收通知后进入详情页地址
data:{
'thing2':{
value:'上传新位置'+area
},
//地点创建上传时间
'date3':{
value:create_time,
},
//审核处理时间
'date4':{
value: currentdate
},
//审核处理结果
'thing19':{
value:res
}
},
templateId:'nawTg-Fg_vTPDH2-qzo8b6Xp4Az12ErOwjDP9cItDSk',//模板id
miniprogramState: 'developer' //跳转为正式版
})
return {result}
}catch(err){
return event
}
}
{
"name": "msgpost",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const MAX_LIMIT = 100
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
const countResult = await db.collection('zan').count()
const total = countResult.total
const batchTimes = Math.ceil(total / 100)
const tasks = []
for (let i = 0; i < batchTimes; i++) {
const promise = db.collection('zan').skip(i * MAX_LIMIT).limit(MAX_LIMIT).where({
openid1:wxContext.OPENID,
count:event.count
}).get()
tasks.push(promise)
}
return (await Promise.all(tasks)).reduce((acc, cur) => {
return {
data: acc.data.concat(cur.data),
errMsg: acc.errMsg,
}
})
}
\ No newline at end of file
{
"name": "querydata",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
return await db.collection('zan').doc(event._id).update({
data: {
flag:event.flag
}
})
}
// // 云函数入口文件
// const cloud = require('wx-server-sdk')
// cloud.init()
// const db = cloud.database()
// const MAX_LIMIT = 100
// // 云函数入口函数
// exports.main = async (event, context) => {
// const countResult = await db.collection('zan').count()
// const total = countResult.total
// const batchTimes = Math.ceil(total / 100)
// for (let i = 0; i < batchTimes; i++) {
// try {
// return await db.collection("zan").where({
// openid1:wxContext.OPENID,
// count:event.count}).update({
// data: {
// flag:event.flag
// }
// })
// } catch (e) {
// console.error(e)
// }
// }
// }
{
"name": "updatazan",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
//这里的update依据是event._id
return await db.collection('location').doc(event._id).update({
data: {
store_cmt:event.store_cmt
}
})
}
// // 云函数入口文件
// const cloud = require('wx-server-sdk')
// cloud.init()
// const db = cloud.database()
// const MAX_LIMIT = 100
// // 云函数入口函数
// exports.main = async (event, context) => {
// const countResult = await db.collection('zan').count()
// const total = countResult.total
// const batchTimes = Math.ceil(total / 100)
// for (let i = 0; i < batchTimes; i++) {
// try {
// return await db.collection("zan").where({
// openid1:wxContext.OPENID,
// count:event.count}).update({
// data: {
// flag:event.flag
// }
// })
// } catch (e) {
// console.error(e)
// }
// }
// }
{
"name": "updatecmt",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
{
"permissions": {
"openapi": [
]
}
}
\ No newline at end of file
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
return await db.collection('location').doc(event._id).update({
data: {
store_like:event.store_like
}
})
}
\ No newline at end of file
{
"name": "updatellike",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.1.2"
}
}
\ No newline at end of file
// pages/Cover/Cover.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Page({
data:{
text:"Page animation",
animation: '',
openid:'',
},
onLoad:function(options){
let that = this;
that.app = getApp();
that.isAdminShow();
var arraypro=[] // 定义空数据 用来存储之后的数据
var arrayprojd=[] //景点数据
var arrayprojxl=[]
var arrayprokd=[]
var arrayproxy=[]
var arrayprost=[]
var arrayproqt=[]
var arrayprotop=[]
var x=0
wx.cloud.callFunction({
name:"cxdata",
success(res){
var rs=res.result
//console.log("打印r1s",rs.data.length)
for(let j=0;j<rs.data.length;j++){
x++;
if(rs.data[j].status_l=="1"){
arraypro.push(rs.data[j])
if(rs.data[j]["type"]=='景点'){
arrayprojd.push(rs.data[j])
}
else if(rs.data[j]["type"]=='教学楼'){
arrayprojxl.push(rs.data[j])
}
else if(rs.data[j]["type"]=='快递点'){
arrayprokd.push(rs.data[j])
}
else if(rs.data[j]["type"]=='食堂'){
arrayprost.push(rs.data[j])
}
if(rs.data[j]["type"]=='其他'){
arrayproqt.push(rs.data[j])
}
if(rs.data[j]["type"]=='学院'){
arrayproxy.push(rs.data[j])
}
if(rs.data[j]["status_p1"]=='1'){
arrayprotop.push(rs.data[j])
}
if(x==rs.data.length-1){
var app=getApp()
app.globalData.arrayprotop=arrayprotop
app.globalData.arraypro=arraypro
app.globalData.arrayprojd=arrayprojd
app.globalData.arrayprokd=arrayprokd
app.globalData.arrayproxy=arrayproxy
app.globalData.arrayprojxl=arrayprojxl
app.globalData.arrayprost=arrayprost
app.globalData.arrayproqt=arrayproqt
var array = new Array();
for ( let a=0; a< arraypro.length;a++) {
var list1 = arraypro[a]["store_area"]
array.push(list1);
}
app.globalData.list1=array
}
}
}
}
})
var app=getApp()
var Delay1=setTimeout(function(){
that.app.slideupshow1(that, 'slide_up1', -200,1)
that.app.show(that, 'slide_show', 1)
},500)
setTimeout(function(){
this.app = getApp();
//添加记录
let that = this;
var app = getApp();
for(let i=0;i<app.globalData.arraypro.length;i++){
const db = wx.cloud.database();
wx.cloud.callFunction({
name: 'querydata',
data:{
openid1:" ",
count:app.globalData.arraypro[i].count,//传入的编号或位置
},
success:res=>{
if(res.result.data.length==0){
app.globalData.arraypro[i].status_z=0
const db = wx.cloud.database();
wx.cloud.callFunction({
name: 'addzanjilu',
data: {
count:app.globalData.arraypro[i].count,
flag:0,
}
,success: rs => {
const db = wx.cloud.database();
wx.cloud.callFunction({
name: 'querydata',
data:{
count:app.globalData.arraypro[i].count,//传入的编号或位置
}
,success: rs1 => {
app.globalData.globalzan.push(rs1.result.data[0])
},
fail: err => {
console.error
}
})
},
fail: err => {
console.error
}
})
}else{
app.globalData.globalzan.push(res.result.data[0]) //可能有点问题
app.globalData.arraypro[i].status_z=res.result.data[0].flag
}
},
fail: err => {
console.error
}
})
}
},3000)
var Delay = setTimeout(function () {
wx.switchTab({
url: '/pages/top/top',
})
},3500) //成功提交4000毫秒秒后条跳转
},
onShow: function () {
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow1(this, 'slide_up1',-200, 1)
this.app.show(this, 'slide_show', 1)
clearTimeout(Delay1)
clearTimeout(Delay)
},
//管理员就展示
isAdminShow:function(){
const that=this;
var app=getApp();
var adminList=[ "oNOI75AOmDSbeywdHhP7nZUOd6j8","oNOI75M3Am1weQ_UdZsXNvqHu2rU","oNOI75NyguKrA0gXWMUE_wt6V8Sk"]
//调用云函数getOpenid
wx.cloud.callFunction({
name:'getOpenid',
complete:res=>{
that.setData({
openid:res.result.openid
})
wx.setStorageSync('openid', res.result.openid) //存入缓存openid
for(let i=0;i<adminList.length;i++){
if(adminList[i]==that.data.openid) {
app.globalData.isAdmin=true
//console.log("是否是管理员",i,app.globalData.isAdmin)
break;
}
}
}
});
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/Cover/Cover.wxml-->
<view class='page-sum'>
<view class='pic' animation="{{slide_up1}}">
<image mode='aspectFit' src='../../images/cover.png'></image>
</view>
<view class='welcome' animation='{{slide_up1}}'>
<image mode='aspectFit' src='../../images/welcome.png'></image>
</view>
<image class='backpic' src='../../images/backpic.png' mode="aspectFill" animation="{{slide_show}}" ></image>
</view>
/* pages/Cover/Cover.wxss */
page{
height: 100%;
}
.pic{
position: absolute;
margin-top: 110%;
margin-left: 9%;
opacity: 0;
}
.welcome{
position: absolute;
margin-top: 160%;
margin-left:9%;
opacity: 0;
}
.backpic{
width: 100%;
height: 100%;
position:fixed;
background-size:100% 100%;
z-index: -1;
}
.page-sum{
padding: 0rpx;
}
// pages/JingDian/JingDian.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
imageHeight:'',
imageWidth:'',
imageHeight1:'',
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
isAdmin:false,//默认不是管理员
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
//图片点击进detail页面
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayprojd
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayprojd
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayprojd[i].store_like+=1
app.globalData.arrayprojd[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
success(res){
}, fail(err){
}
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprojd[i].store_like,
_id:app.globalData.arrayprojd[i]._id
},
success(res){
}, fail(err){
}
})
}else{
app.globalData.arrayprojd[i].store_like-=1
app.globalData.arrayprojd[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprojd[i].store_like,
_id:app.globalData.arrayprojd[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayprojd,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
console.log("input-----",e)
var value = e.detail.value
var that = this;
var app=getApp()
var list1=app.globalData.list1;
console.log("打印list1",list1)
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr =new Array();
//搜索值与后台匹配
wx.request({
url: 'https://ChongYouSign.zhangchuanjun.cn/ssuo/similarity/'+value,
method:"get",
data:{
didians:JSON.stringify(list1)
},
header:{'content-type': 'application/json',},
enableCache:true,
success(res){
for(let i=0;i<res.data.answer.length;i++){
// res返回有两个数据 一个xsd相似度 一个是地点名didian
var didian=res.data.answer[i].didian
console.log(didian,"相似度是:",res.data.answer[i].xsd)
arr.push(didian)
}
//控制显示
console.log(arr)
setTimeout(function(){
that.setData({
viewShowed: true,
carList: arr
});},500)
},
//后台连接失败就用另一种方式匹配
fail(res){
console.log("使用普通方法匹配搜索的值。。。")
for(let i=0;i<list1.length;i++){
if(list1[i].indexOf(value)>=0){
console.log(list1[i]);
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
})
}
})
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
},
onLoad: function (options) {
this.app = getApp();
let that = this;
var app=getApp();
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight,
isAdmin:app.globalData.isAdmin //管理员设置
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayprojd,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageHeight1:imageHeight-45,
imageHeight2:imageHeight-85,
imageWidth: imageWidth
});
},
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">景点</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/JingDian/JingDian.wxss */
// pages/KuaiDi/KuaiDi.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
//var app=getApp(),
data: {
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayprokd
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayprokd
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayprokd[i].store_like+=1
app.globalData.arrayprokd[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprokd[i].store_like,
_id:app.globalData.arrayprokd[i]._id
},
})
}else{
app.globalData.arrayprokd[i].store_like-=1
app.globalData.arrayprokd[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprokd[i].store_like,
_id:app.globalData.arrayprokd[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayprokd,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
var value = e.detail.value
var that = this;
var app=getApp()
var list1 = app.globalData.list1
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr = [];
for (var i = 0; i < list1.length; i++) {
if (list1[i].indexOf(value) >= 0) {
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
});
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
},
onLoad: function (options) {
this.app=getApp();
var app=getApp()
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayprokd,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageWidth: imageWidth
});
},
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">快递点</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/KuaiDi/KuaiDi.wxss */
\ No newline at end of file
// pages/Other/Other.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
//var app=getApp(),
data: {
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayproqt
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayproqt
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayproqt[i].store_like+=1
app.globalData.arrayproqt[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayproqt[i].store_like,
_id:app.globalData.arrayproqt[i]._id
},
})
}else{
app.globalData.arrayproqt[i].store_like-=1
app.globalData.arrayproqt[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayproqt[i].store_like,
_id:app.globalData.arrayproqt[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayproqt,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
var value = e.detail.value
var that = this;
var app=getApp()
var list1 = app.globalData.list1
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr = [];
for (var i = 0; i < list1.length; i++) {
if (list1[i].indexOf(value) >= 0) {
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
});
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
},
onLoad: function (options) {
this.app=getApp();
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayproqt,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageWidth: imageWidth
});
},
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">其他</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/Other/Other.wxss */
\ No newline at end of file
// pages/ShiTang/ShiTang.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
//var app=getApp(),
data: {
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayprost
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayprost
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayprost[i].store_like+=1
app.globalData.arrayprost[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprost[i].store_like,
_id:app.globalData.arrayprost[i]._id
},
})
}else{
app.globalData.arrayprost[i].store_like-=1
app.globalData.arrayprost[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprost[i].store_like,
_id:app.globalData.arrayprost[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayprost,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
var value = e.detail.value
var that = this;
var app=getApp()
var list1 = app.globalData.list1
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr = [];
for (var i = 0; i < list1.length; i++) {
if (list1[i].indexOf(value) >= 0) {
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
});
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
},
onLoad: function (options) {
this.app=getApp();
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayprost,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageWidth: imageWidth
});
},
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">食堂</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/ShiTang/ShiTang.wxss */
\ No newline at end of file
// pages/TeachBuild/TeachBuild.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
//var app=getApp(),
data: {
text:"Page animation",
animation: '',
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayprojxl
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayprojxl
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayprojxl[i].store_like+=1
app.globalData.arrayprojxl[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprojxl[i].store_like,
_id:app.globalData.arrayprojxl[i]._id
},
})
}else{
app.globalData.arrayprojxl[i].store_like-=1
app.globalData.arrayprojxl[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayprojxl[i].store_like,
_id:app.globalData.arrayprojxl[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayprojxl,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
console.log("input-----",e)
var value = e.detail.value
var that = this;
var app=getApp()
var list1=app.globalData.list1;
console.log("打印list1",list1)
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr =new Array();
//搜索值与后台匹配
wx.request({
url: 'https://ChongYouSign.zhangchuanjun.cn/ssuo/similarity/'+value,
method:"get",
data:{
didians:JSON.stringify(list1)
},
header:{'content-type': 'application/json',},
enableCache:true,
success(res){
for(let i=0;i<res.data.answer.length;i++){
// res返回有两个数据 一个xsd相似度 一个是地点名didian
var didian=res.data.answer[i].didian
console.log(didian,"相似度是:",res.data.answer[i].xsd)
arr.push(didian)
}
//控制显示
console.log(arr)
setTimeout(function(){
that.setData({
viewShowed: true,
carList: arr
});},500)
},
//后台连接失败就用另一种方式匹配
fail(res){
console.log("使用普通方法匹配搜索的值。。。")
for(let i=0;i<list1.length;i++){
if(list1[i].indexOf(value)>=0){
console.log(list1[i]);
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
})
}
})
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onLoad: function (options) {
this.app = getApp();
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayprojxl,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageWidth: imageWidth
});
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">教学楼</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/TeachBuild/TeachBuild.wxss */
\ No newline at end of file
// pages/XueYuan/XueYuan.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
//var app=getApp(),
data: {
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShowed: false, //显示结果view的状态
inputVal: "", // 搜索框值
catList: [], //搜索渲染推荐数据
// list1: "", //从云数据库存储的值
//list1: "",
// shenhe1:'' ,//中间值
id:''
},
/**
* 组件的方法列表
*/
methods: {
tap_ch: function (e) {
if (this.data.open) {
this.setData({
open: false
});
} else {
this.setData({
open: true
});
}
},
tap_start: function (e) {
// touchstart事件
this.data.mark = this.data.newmark = e.touches[0].pageX;
},
tap_drag: function (e) {
// touchmove事件
/*
* 手指从左向右移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
this.data.newmark = e.touches[0].pageX;
if (this.data.mark < this.data.newmark) {
this.istoright = true;
}
/*
* 手指从右向左移动
* @newmark是指移动的最新点的x轴坐标 , @mark是指原点x轴坐标
*/
if (this.data.mark > this.data.newmark) {
this.istoright = false;
}
this.data.mark = this.data.newmark;
},
tap_end: function (e) {
// touchend事件
this.data.mark = 0;
this.data.newmark = 0;
if (this.istoright) {
this.setData({
open: true
});
} else {
this.setData({
open: false
});
}
},
//点击搜索事件
goToDetail1: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arraypro
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
goToDetail: function (e) {
//获取携带data-id的数据
var that=this;
let area = e.currentTarget.dataset.area;
var app=getApp()
var didian=app.globalData.arrayproxy
for(let bb=0;bb<didian.length;bb++){
if(area==didian[bb].store_area)
{
wx.navigateTo({
url: '../detail/detail?id=' + didian[bb]["_id"],
})
break;
}
}
},
Favorite:function(e){
var count= e.currentTarget.dataset.count;
var app=getApp();
var top1=app.globalData.arrayproxy
var count1=count
let iddzan="xxx"
var idd=app.globalData.globalzan
for(let i=0;i<idd.length;i++){
if(count1==idd[i].count){
iddzan=idd[i]._id
}
}
for(let i=0;i<top1.length;i++){
if(count1==top1[i].count){
if(top1[i].status_z==0){
app.globalData.arrayproxy[i].store_like+=1
app.globalData.arrayproxy[i].status_z=1
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:1,
_id: iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayproxy[i].store_like,
_id:app.globalData.arrayproxy[i]._id
},
})
}else{
app.globalData.arrayproxy[i].store_like-=1
app.globalData.arrayproxy[i].status_z=0
wx.cloud.callFunction({
name:"updatazan",
data:{
flag:0,
_id:iddzan
},
})
//修改locationn
wx.cloud.callFunction({
name:"updatellike",
data:{
store_like:app.globalData.arrayproxy[i].store_like,
_id:app.globalData.arrayproxy[i]._id
},
})
}
this.setData({
shuju:app.globalData.arrayproxy,
})
}
}
var animation = wx.createAnimation({
duration: 50,
timingFunction: 'ease',
delay: 10
});
animation.scale(1, 2).step().rotate(30).step().rotate(0).step().scale(1,1).step()
this.setData({
animation:animation.export()
})
},
goToAdmin:function(e){
wx.navigateTo({
url: '/pages/jump/jump',
})
},
goToEditor:function(e){
wx.navigateTo({
url:'../editor/editor',
})
},
bindKeyInput: function (e) {
this.setData({
inputValue: e.detail.value
})
},
goToJingDian:function(e){
wx.reLaunch({
url: '/pages/JingDian/JingDian',
})
},
goToTeachBuild:function(e){
wx.reLaunch({
url: '/pages/TeachBuild/TeachBuild',
})
},
goToXueYuan:function(e){
wx.reLaunch({
url: '/pages/XueYuan/XueYuan',
})
},
goToKuaiDi:function(e){
wx.reLaunch({
url: '/pages/KuaiDi/KuaiDi',
})
},
goToShiTang:function(e){
wx.reLaunch({
url: '/pages/ShiTang/ShiTang',
})
},
goToOther:function(e){
wx.reLaunch({
url: '/pages/Other/Other',
})
},
goToTop:function(e){
wx.reLaunch({
url:"/pages/top/top",
})
},
// 隐藏搜索框样式
hideInput: function () {
this.setData({
inputVal: "",
viewShowed: false,
});
},
// 键盘抬起事件2
inputTyping: function(e) {
var value = e.detail.value
var that = this;
var app=getApp()
var list1 = app.globalData.list1
if (value == '') {
that.setData({
viewShowed: false,
});
} else {
if (e.detail.cursor) { //e.detail.cursor表示input值当前焦点所在的位置
var arr = [];
for (var i = 0; i < list1.length; i++) {
if (list1[i].indexOf(value) >= 0) {
arr.push(list1[i]);
}
}
that.setData({
viewShowed: true,
carList: arr
});
}
}
},
// 获取选中推荐列表中的值
name: function (res) {
var index = res.currentTarget.dataset.index
var that = this;
that.setData({
inputVal: that.data.carList[index],
viewShowed: false,
})
},
onShow: function () {
this.app.slideupshow(this,'slide_up1', -30,1)
},
//页面隐藏时,触发渐出动画
onHide: function () {
this.app.slideupshow(this,'slide_up1',30, 0)
},
onLoad: function (options) {
this.app=getApp();
let that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
var app=getApp()
this.setData({
shuju:app.globalData.arrayproxy,
})
var screenWidth = that.app.globalData.screenWidth;
var screenHeight = that.app.globalData.screenHeight;
var imageWidth = screenWidth;
var imageHeight = screenHeight;
this.setData({
imageHeight: imageHeight-120,
imageWidth: imageWidth
});
},
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
<!--pages/top/top.wxml-->
<view class='ns'><text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;重邮指路牌</text></view>
<view class="page">
<view class="page-bottom">
<!--背景部分 -->
<image class='bgimg' src='../../images/background.png'></image>
<scroll-view scroll-y='true' enable-flex='true' class="page-content">
<view class="wc">
<view bindtap='goToAdmin' hover-class="view-hover" ><image class='icons' src='../../images/icons/admin.png'></image>管理员</view>
</view>
<view class="wc">
<view bindtap='goToTop' hover-class="view-hover" ><image class='icons' src='../../images/icons/top.png'></image>校园必去Top10</view>
</view>
<view class="wc">
<view bindtap='goToTeachBuild' hover-class="view-hover"><image class='icons' src='../../images/icons/teachbuild.png'></image>教学楼</view>
</view>
<view class="wc">
<view bindtap='goToXueYuan' hover-class="view-hover"><image class='icons' src='../../images/icons/xueyuan.png'></image>学院</view>
</view>
<view class="wc">
<view bindtap='goToKuaiDi' hover-class="view-hover"><image class='icons' src='../../images/icons/kuaidi.png'></image>快递点</view>
</view>
<view class="wc">
<view bindtap='goToJingDian' hover-class="view-hover"><image class='icons' src='../../images/icons/view.png'></image>景点</view>
</view>
<view class="wc">
<view bindtap='goToShiTang' hover-class="view-hover"><image class='icons' src='../../images/icons/shitang.png'></image>食堂</view>
</view>
<view class="wc">
<view bindtap='goToOther' hover-class="view-hover"><image class='icons' src='../../images/icons/other.png'></image>其他</view>
</view>
</scroll-view>
</view>
<view bindtouchmove="tap_drag" bindtouchend="tap_end" bindtouchstart="tap_start" class="page-top {{open ? 'c-state2' : ''}}">
<image class='page-icon' bindtap="tap_ch" src="../../images/menu.png"></image>
<view class="text">学院</view>
<image class='background-icon' src='../../images/bc.png'></image>
<!-- 上传位置 -->
<image class='plus' z-index='100' src='../../images/plus.png' bindtap="goToEditor"></image>
<!-- 搜索框 -->
<view class='search' >
<scroll-view class='scroll-view' wx:if='{{viewShowed}}' scroll-y>
<view wx:for="{{carList}}" wx:key="{{index}}" class="msg-item ">
<view class='search_name' bindtap='name' data-index="{{index}}">{{item}}</view>
</view>
</scroll-view>
<view class='search_left' style="top:100rpx">
<view class='search_wrap'>
<icon class="search_icon" type="search" size='20'></icon>
<input type="text" class="search_input" placeholder="请输入地点名称(如三教等)" value="{{inputVal}}" bindinput="inputTyping" />
</view>
</view>
<view class='search_right' style="top:90rpx">
<button class="search_cancel" bindtap="hideInput"></button>
<image class="search_cancel_img" wx:if='{{viewShowed}}' src='../../images/close.png'></image>
<text class="search_submit" data-area="{{inputVal}}" bindtap="goToDetail1">搜索</text>
</view>
</view>
<!-- 获取用户openid -->
<!-- 主块 -->
<scroll-view scroll-y='true' style='height:{{scrollHeight}}px' class="container" enable-flex='true' >
<!-- 左块 -->
<view class='left-container' animation="{{slide_up1}}" >
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2==0}}' bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
<!-- 右块 -->
<view class='right-container' animation="{{slide_up1}}">
<view class='item' wx:for='{{shuju}}' wx:item='item' wx:key='key' wx:for-index="index" data-index="{{index}}" wx:if='{{index%2!=0}}'bindtap="goToDetail" data-area='{{item.store_area}}' >
<image mode='aspectFill' src='{{item.store_pics[0].path}}'></image>
<text style='align-items: center;display: flex;justify-content: center;' >{{item.store_area}}</text>
<view class='describe'>
<text>{{item.store_ms}}</text>
</view>
<!-- 加星 -->
<view class='star1'>
<image wx:if='{{0<=item.store_like && item.store_like<20}}' class='star' mode="widthFix" src='../../images/icons/star1.png'></image>
<image wx:elif='{{20<=item.store_like && item.store_like<40}}' class='star' mode="widthFix" src='../../images/icons/star2.png'></image>
<image wx:elif='{{40<=item.store_like && item.store_like<60}}' class='star' mode="widthFix" src='../../images/icons/star3.png'></image>
<image wx:elif='{{60<=item.store_like && item.store_like<80}}' class='star' mode="widthFix" src='../../images/icons/star4.png'></image>
<image wx:elif='{{80<=item.store_like && item.store_like<100}}' class='star' mode="widthFix" src='../../images/icons/star5.png'></image>
</view>
<!-- 点赞 -->
<view class='favorite'>
<!-- 点赞的图标 -->
<image catchtap="Favorite" src="{{item.status_z==0?'../../images/icons/favorite1.png':'../../images/icons/favorite2.png'}}" mode="widthFix" data-count="{{item.count}}"></image>
<!-- 总点赞的次数 -->
<text class='favTimes'>{{item.store_like}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/XueYuan/XueYuan.wxss */
// pages/aboutus/aboutus.js
Page({
/**
* 页面的初始数据
*/
data: {
},
goToMap:function(e){
wx.reLaunch({
url: '../map/map',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white",
"disableScroll": false
}
\ No newline at end of file
<!--pages/aboutus/aboutus.wxml-->
<view class='ns'><image catchtap="goToMap" class='back' src='../../images/icons/left.png'></image></view>
<view class='page-ab'>
<view class='backpic1'>关于我们</view>
<view>
<image class='sign' mode='aspectFill' src='../../images/sign.png'></image>
</view>
<view class='b5'>
<text>重邮指路牌</text>
</view>
<!-- 页面顶部 -->
<view class='page-top1' animation="{{slide_up1}}">
<!-- 关于我们 -->
<view class="b1">
<text decode="{{true}}">——&nbsp;&nbsp;&nbsp;&nbsp;关于我们&nbsp;&nbsp;&nbsp;&nbsp;——</text>
</view>
<view class='b6'>
<text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;《重邮指路牌》是一个为校园全体校园师生及游客提供精准地图导航并附有街景图,手绘彩色地图的校园导航小程序,让您轻松找到所去之处!</text>
</view>
<!-- 免责声明 -->
<view class="b3" >
<text decode="{{true}}">——&nbsp;&nbsp;&nbsp;&nbsp;免责声明&nbsp;&nbsp;&nbsp;&nbsp;——</text>
</view>
<view class='b6'>
<text decode="{{true}}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;《重邮指路牌》不收集任何用户数据并且完全免费,若有上传照片来自于网络侵犯了您的权益,请您联系我们删除,在此表示歉意。</text>
</view>
</view>
</view>
/* pages/aboutus/aboutus.wxss */
.ns {
width: 100%;
height: 155rpx;
line-height: 225rpx;
font-size:36rpx;
color: black;
font-weight: 900;
background: -webkit-linear-gradient(left,#27a877,#45e2ad,#66FF99);
letter-spacing:5rpx;
}
.backpic1{
width: 100%;
height:300rpx;
border-radius: 0% 0% 10% 10%;
background: -webkit-linear-gradient(left,#27a877,#45e2ad,#66FF99);
z-index: 0;
text-align: center;
font-size: 36px;
font-weight: bolder;
color: white;
line-height: 130rpx;
letter-spacing:20rpx;
}
.sign{
border-radius: 50%;
border:10px solid white;
position: absolute;
top:300rpx;
width: 250rpx;
height: 250rpx;
margin-left: 30%;
}
.page-top1{
display: flex;
flex-direction: column;
width:90%;
left: 5%;
margin-top:5%;
height: fit-content;
border-radius: 40rpx;
box-shadow:0px 2px 4px 2px #DDDDDD;
position: relative;
}
.b1{
position: relative;
display: flex;
top:0;
left: 0;
padding: 15px;
align-items: center;
padding-top: 20px;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
color: #45e2ad;
justify-content: center;
}
.b3{
position: relative;
display: flex;
top:0;
left: 0;
padding: 15px;
align-items: center;
padding-top: 20px;
border-bottom-right-radius: 20rpx;
border-bottom-left-radius: 20rpx;
color: #45e2ad;
justify-content: center;
}
.b6{
color: slategrey;
width: 90%;
margin-left: 5%;
margin-bottom: 5%;
}
.b5{
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 25%;
}
.back{
width: 50rpx;
height: 50rpx;
}
\ No newline at end of file
// pages/admin/admin.js
const db = wx.cloud.database()
const accountCollection = db.collection("location")
Page({
/**
* 页面的初始数据
*/
data: {
shuju:'',
istoright: true,
scrollHeight:'',
inputValue: '',
viewShow:''
},
No:function(e){
var id=e.currentTarget.dataset.id;
//删除消息服务通知
db.collection('location').where({
_id:id,
}).get({
success:function(res){
var user_id=res.data;
//发送审核失败消息
that.send(-1,user_id)
}
})
var that=this;
let tongguo=that.data.shuju
//console.log(tongguo)
var xiuyi1=that.data.shuju;
//var xiuyi11=that.data.shuju.store_pics
var total=60
const batchTimes = Math.ceil(total / 20)
for(let cc=0; cc<xiuyi1.length;cc++)
{
if(that.data.shuju[cc]["_id"]==id)
{
console.log("数据库id",that.data.shuju[cc]["_id"])
console.log("前端的id",id)
for(let pic=0; pic<that.data.shuju[cc].store_pics.length;pic++)
{
wx.cloud.deleteFile({
fileList:[that.data.shuju[cc].store_pics[pic].path],
}).then(res => {
}).catch(error => {
})
}
}
}
for(let j=0;j<tongguo.length;j++){
if(tongguo[j]["_id"]==id){
tongguo.splice(j,1)
}
}
this.setData({
shuju:tongguo
})
for(let i=0 ;i<batchTimes;i++){
accountCollection.skip(i*20).where({
_id:id
}).remove()
}
},
Yes:function(e){
var id=e.currentTarget.dataset.id;
var that=this;
let tongguo=that.data.shuju
that.slide_right;
console.log(tongguo)
for(let j=0;j<tongguo.length;j++){
if(tongguo[j]["_id"]==id){
tongguo.splice(j,1)
}
}
this.setData({
shuju:tongguo
})
var total=60
const batchTimes = Math.ceil(total / 20)
for(let i=0 ;i<batchTimes;i++){
accountCollection.skip(i*20).where({
_id:id
}).update({
data:{
status_l: '1',
}
})
that.app = getApp();
}
db.collection('location').where({
_id:id,
}).get({
success:function(res){
var user_id=res.data;
that.send(1,user_id)
}
})
},
//发送消息
send:function(type,user_id){
wx.cloud.callFunction({
name:'msgpost',
data:{
user:user_id,
type:type,
}
}).then(res=>{
console.log("发送消息成功",res)
}).catch(res=>{
console.log("推送消息发送失败",res)
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let that = this;
var total=60
const batchTimes = Math.ceil(total / 20)
console.log("需要查询次数",batchTimes) //获取需要获取几次
var arraypro=[]
var x=0 // 定义空数据 用来存储之后的数据
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollHeight: res.screenHeight
})
}
});
//查询全部
for(let i=0 ;i<batchTimes;i++){
x++
accountCollection.skip(i*20).where({
status_l: '0',
}).get().then(rs => {
for (let j = 0; j <rs.data.length; j++) {
arraypro.push(rs.data[j])
}
if(x==3){
this.setData({
shuju:arraypro
})
console.log("打印arraypro",arraypro)
}
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
clearTimeout(Delay1)
clearTimeout(Delay2)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"disableScroll": false
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册