刘翔宇-旅管家 4 years ago
parent 77c99189be
commit dd1cefc098

@ -1,16 +1,16 @@
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
</style>
</style>
<script>
<script>
import util from "@/utils/util.js"
export default {
onLaunch: function() {
var that = this;
util.getOpenidInfo(function(res) {
console.log(res);
}, true)
}, true);
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
console.log(res.hasUpdate)
@ -58,7 +58,7 @@
.mpopup {
margin-top: 60rpx;
min-height: 600rpx;
min-width: 640rpx;
min-width: 540rpx;
margin-bottom: 20rpx;
}

@ -4,22 +4,22 @@
<image src="../../static/img/index_bg.jpg" class="index_bg"></image>
</view>
<view class="box-notice">
<u-notice-bar @click="openInfo" :text="list" direction="column" mode="link" color="#9E8F8B"></u-notice-bar>
<u-notice-bar @click="openInfo" :text="list" direction="column" color="#9E8F8B"></u-notice-bar>
</view>
<view class="box-body">
<view class="box-body-title">
<image src="../../static/img/index_name.png" class="box-body-title-img"></image>
<view class="box-body-sub-title">开馆时间周二周日 9:00-17:00 周一闭馆</view>
<view class="box-body-sub-title">开馆时间{{info.sub_title||""}}</view>
</view>
<view style="margin-top: 56rpx;">
<view class="box-row">
<view class="box-col" @click="openBook">
<view class="box-col" @click="handleBook(1)">
<image src="../../static/img/index_icon_1.png" class="box-body-icon"></image>
</view>
<view class="box-col" @click="openActivity">
<view class="box-col" @click="handleBook(2)">
<image src="../../static/img/index_icon_2.png" class="box-body-icon"></image>
</view>
<view class="box-col" @click="openPark">
<view class="box-col" @click="handleBook(3)">
<image src="../../static/img/index_icon_3.png" class="box-body-icon"></image>
</view>
</u-row>
@ -91,8 +91,6 @@
{{(currentTime.start_time||"")+"-"+(currentTime.end_time||"")}}
</view>
<view class="book-box-selectInfo-right">
<text class="book-box-selectInfo-righttxt">预约须知</text>
<u-icon name="arrow-right" color="#EF9525" size="20rpx"></u-icon>
</view>
</view>
<view class="mpopup-footer">
@ -108,16 +106,29 @@
<u-calendar ref="calendar" :show-confirm="false" :show="showCalendar" :minDate="minDate" :maxDate="maxDate"
color="#EF9525" round="20" defaultDate="2022-02-15" @confirm="handleSelectDate" @close="closecalendar">
</u-calendar>
<u-popup :show="showInfo" mode="center" @close="closeInfo" @open="openInfo" :round="10" closeable>
<u-popup :show="showInfo" mode="center" @close="closeInfo" :round="10" closeable>
<view class="mpopup">
<view class="mpopup-title">
通知
{{currentNotice.name}}
</view>
<view class="mpopup-content">
<text>人生若只如初见何事秋风悲画扇</text>
<view class="mpopup-content" style="padding: 40rpx 20rpx;">
<rich-text :nodes="currentNotice.content"></rich-text>
</view>
</view>
</u-popup>
<u-popup :show="showAuthorization" closeable mode="bottom" @close="closePhone" :round="10">
<view class="box">
<view class="box-title" style="text-align: center;padding: 20rpx 0;font-size: 32rpx;">
请授权您的手机号
</view>
<view class="box-content" style="padding: 20px;">
<u-button type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
</u-button>
</view>
</view>
</u-popup>
</view>
</template>
@ -135,28 +146,50 @@
minDate: `${year}-${month}-${date + 1}`,
maxDate: `${year}-${month}-${date + 7}`,
showCalendar: false,
list: [
'寒雨连江夜入吴',
'平明送客楚山孤',
'洛阳亲友如相问',
'一片冰心在玉壶'
],
list: ["暂无通知通告"],
info: {},
listDatePrice: [],
currentDate: {},
currentTime: {},
currentIndex: 0,
listCalendar: []
listCalendar: [],
listNotice: [],
currentNotice: {},
showAuthorization: false,
openType: 1
}
},
onLoad() {
this.loadInfo()
this.loadInfo();
this.loadNotice();
},
onReady() {
//
this.$refs.calendar.setFormatter(this.formatter)
},
methods: {
closePhone() {
this.showAuthorization = false
},
getPhoneNumber(e) {
var that = this;
this.util.request({
api: '/api/mobile/user/mobile',
data: {
code: e.detail.code
},
utilSuccess: function(res) {
that.util.getUserInfo(function(r) {
that.checkUser();
}, true)
},
utilFail: function(res) {
}
})
},
closecalendar() {
this.showCalendar = false;
},
@ -236,17 +269,44 @@
url: "/pages/park/index"
})
},
openInfo() {
openInfo(e) {
this.currentNotice = this.listNotice[e];
this.showInfo = true;
},
closeInfo() {
this.showInfo = false;
},
loadUser(cb) {
var that = this;
this.util.getOpenidInfo(function(res) {
that.util.getUserInfo(function(r) {
cb(r);
}, true)
}, true);
},
handleBook(type) {
this.openType = type;
uni.$u.throttle(this.checkUser, 1500)
},
checkUser() {
let type = this.openType;
var that = this;
that.loadUser(function(res) {
if (that.util.isNull(res.mobile)) {
that.showAuthorization = true;
} else {
that.showAuthorization = false;
if (type == 1) that.openBook();
else if (type == 2) that.openActivity()
else if (type == 3) that.openPark()
}
})
},
openBook() {
var that = this;
var sdate = this.$moment().format("yyyy-MM-DD");
this.showBook = true;
this.load3Day(sdate)
var sdate = that.$moment().format("yyyy-MM-DD");
that.showBook = true;
that.load3Day(sdate)
},
closeBook() {
this.showBook = false;
@ -262,7 +322,26 @@
this.util.request({
api: '/api/mobile/visit/introduce',
utilSuccess: function(res) {
console.log(res)
console.log(res);
that.info = res;
},
utilFail: function(res) {
}
})
},
loadNotice() {
var that = this;
this.util.request({
api: '/api/mobile/other/notice-index',
utilSuccess: function(res) {
let arr = [];
for (var m of res.data) {
arr.push(m.name)
}
that.listNotice = res.data;
that.list = arr;
},
utilFail: function(res) {

@ -1,6 +1,6 @@
<template>
<view>
<map style="width: 100%; height: 100vh;position: relative;" :latitude="latitude" :longitude="longitude"
<map style="width: 100%; height: 100vh;position: relative;" :latitude="info.latitude" :longitude="info.longitude"
:markers="covers"></map>
</view>
</template>
@ -9,29 +9,44 @@
export default {
data() {
return {
title: "苏州独立支部旧址",
address: "苏州独立支部旧址",
latitude: 31.299893,
longitude: 120.626022,
covers: [{
latitude: 31.302377,
longitude: 120.625826,
width: 70,
height: 70,
iconPath: '/static/img/location.png'
}],
info: {},
covers: [],
}
},
onLoad() {
uni.openLocation({
latitude: this.latitude,
longitude: this.longitude,
name: "",
address: ""
this.loadInfo(function(res) {
uni.openLocation({
latitude: res.latitude,
longitude: res.longitude,
name: res.name,
address: res.address
});
})
},
methods: {
loadInfo(cb) {
var that = this;
this.util.request({
api: '/api/mobile/visit/introduce',
utilSuccess: function(res) {
res.latitude = parseFloat(res.latitude);
res.longitude = parseFloat(res.longitude);
that.info = res;
that.covers.push({
latitude: res.latitude,
longitude: res.longitude,
width: 70,
height: 70,
iconPath: '/static/img/location.png'
});
cb(res);
},
utilFail: function(res) {
}
})
},
}
}
</script>

@ -12,14 +12,14 @@
<view class="mine-box">
<view class="mine-box-user">
<view class="user_avator">
<u-avatar :src="src" size="61"></u-avatar>
<u-avatar :src="info.headimgurl" size="61"></u-avatar>
</view>
<view class="user_info">
<view class="user_name">
刘翔宇
{{info.nickname||"暂未授权"}}
</view>
<view class="user_phone">
18550337240
{{info.mobile||"暂未设置"}}
</view>
</view>
</view>
@ -68,6 +68,17 @@
</view>
</view>
</view>
<u-popup :show="showAuthorization" mode="bottom" @close="closeInfo" :round="10">
<view class="box">
<view class="box-title" style="text-align: center;padding: 20rpx 0;font-size: 32rpx;">
请授权您的微信头像和昵称
</view>
<view class="box-content" style="padding: 20px;">
<u-button type="primary" @click="getUserProfile"></u-button>
</view>
</view>
</u-popup>
</view>
</template>
@ -75,16 +86,59 @@
export default {
data() {
return {
topimg: ""
topimg: "",
info: {},
showAuthorization: false
}
},
onReady() {
this.topimg = this.util.HOST + "/top_bg.png";
},
onLoad() {
onShow() {
var that = this;
this.loadInfo(function(res) {
if (that.util.isNull(res.headimgurl) || that.util.isNull(res.nickname)) {
that.showAuthorization = true;
} else {
that.showAuthorization = false;
}
});
},
methods: {
closeInfo() {
that.showAuthorization = false;
},
loadInfo(cb) {
var that = this;
this.util.getOpenidInfo(function(res) {
that.util.getUserInfo(function(r) {
cb(r);
}, true)
}, true);
},
getUserProfile() {
var that = this;
this.util.getUserProfile((res) => {
console.log(res)
that.util.request({
api: '/api/mobile/user/save',
method: 'POST',
data: {
headimgurl: res.avatarUrl,
nickname: res.nickName
},
utilSuccess: function(r) {
that.loadInfo(function() {
that.showAuthorization = false;
})
}
})
})
},
toPage(type) {
var url = "";
switch (type) {

@ -4,9 +4,9 @@
<u-icon name="checkmark-circle" size="90" color="#EF9525"></u-icon>
<view class="h3">您已经预约成功</view>
<view class="p"></view>
<view class="p">即将跳转到{{tips}}</view>
</view>
<view class="pinkBtn" @tap="goHome"></view>
<view class="pinkBtn" @click="goHome"></view>
</view>
</template>
@ -14,11 +14,37 @@
export default {
data() {
return {
tips: "参观预约"
}
},
onLoad(options) {
if (options.from && options.id) {
var url = "";
if (options.from == "visit") {
this.tips = "参观预约";
url = "/pages/order/visitorderinfo?id=" + options.id
} else if (options.from == "activity") {
this.tips = "活动预约";
url = "/pages/order/activityorderinfo?id=" + options.id
} else if (options.from == "park") {
this.tips = "车位预约";
url = "/pages/order/parkorderinfo?id=" + options.id
}
setTimeout(function() {
uni.navigateTo({
url: url
})
}, 5000)
}
},
methods: {
goHome() {
uni.switchTab({
url: "/pages/index/index"
})
}
}
}
</script>
@ -29,7 +55,7 @@
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
justify-content: center;
padding-top: 90px;
}

@ -276,6 +276,7 @@
currentIndex: 0,
listCalendar: [],
type: "user",
user: {},
cardList: [{
idx: 1,
name: '身份证'
@ -307,6 +308,11 @@
uni.setNavigationBarTitle({
title: (options.from == 'user' ? "个人预约" : "团队预约")
})
var that = this;
that.util.getUserInfo(function(r) {
that.user = r;
that.form.mobile = r.mobile;
}, true)
},
methods: {
closeInfo() {
@ -392,6 +398,7 @@
method: "POST",
data: this.form,
utilSuccess: function(res) {
console.log(res)
uni.showToast({
icon: "none",
title: "下单成功",

@ -15,7 +15,28 @@ const formatTime = date => {
return [year, month, day].map(formatNumber).join('-');
};
const user_info_key = "userInfo";
const user_info_key = "userInfo_token";
const user_key = "userInfo";
const getUserInfo = (cb, refresh) => {
cb = cb || function() {}
refresh = refresh || false
if (!refresh) {
let user_info = uni.getStorageSync(user_key)
if (!isNull(user_info)) {
cb(user_info)
return
}
}
request({
api: '/api/mobile/user/show',
utilSuccess: function(res) {
uni.setStorageSync(user_key, res)
cb(res)
},
utilFail: function(res) {}
})
}
const getOpenidInfo = (cb, refresh) => {
cb = cb || function() {}
@ -65,10 +86,6 @@ const getUserProfile = (cb) => {
const getUserInfoCache = () => {
return uni.getStorageSync(user_info_key)
}
const formatTimeAll = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
@ -513,5 +530,6 @@ module.exports = {
Base64: Base64,
orderStatusDic: orderStatusDic,
auditStatusDic: auditStatusDic,
getUserProfile: getUserProfile
getUserProfile: getUserProfile,
getUserInfo: getUserInfo
};

Loading…
Cancel
Save