Forráskód Böngészése

部分代码重构,新增电影搜索功能,css优化

wyling 4 éve
szülő
commit
b30cd891fb

+ 7 - 4
src/App.vue

@@ -4,15 +4,18 @@
 <style>
 	@import "/wxcomponents/vant/common/index.wxss";
 	@import "@/common/css/animation.css";
+
 	/*每个页面公共css */
-	*{
+	* {
 		margin: 0;
 		padding: 0;
 	}
-	html{
+
+	html {
 		background-color: #F1F1F1;
 	}
-	.night{
+
+	.night {
 		filter: invert(1) hue-rotate(180deg);
 	}
-</style>
+</style>

+ 5 - 11
src/api/answer.js

@@ -1,15 +1,9 @@
 import request from '@/utils/request'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
-
-
 // 获取题库列表
 export function questionList(params) {
 	return request({
-		url: baseUrl + '/student/question/info/getQuestionInfoList',
+		url: '/student/question/info/getQuestionInfoList',
 		method: 'get',
 		params
 	})
@@ -18,7 +12,7 @@ export function questionList(params) {
 // 获取随机题库列表
 export function questionListRandom(params) {
 	return request({
-		url: baseUrl + '/student/question/info/getRandQuestionInfoList',
+		url: '/student/question/info/getRandQuestionInfoList',
 		method: 'get',
 		params
 	})
@@ -27,7 +21,7 @@ export function questionListRandom(params) {
 // 获取错题收藏列表
 export function questionErrorList(params) {
 	return request({
-		url: baseUrl + '/student/question/error/getQuestionErrorList',
+		url: '/student/question/error/getQuestionErrorList',
 		method: 'get',
 		params
 	})
@@ -36,7 +30,7 @@ export function questionErrorList(params) {
 // 新增错题
 export function questionErrorAdd(id) {
 	return request({
-		url: baseUrl + '/student/question/error',
+		url: '/student/question/error',
 		method: 'post',
 		data: {
 			questionId: id
@@ -47,7 +41,7 @@ export function questionErrorAdd(id) {
 // 删除错题
 export function questionErrorDel(ids) {
 	return request({
-		url: baseUrl + `/student/question/error/${ids}`,
+		url: `/student/question/error/${ids}`,
 		method: 'delete'
 	})
 }

+ 9 - 16
src/api/applist.js

@@ -1,16 +1,9 @@
 import request from '@/utils/request'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
-
-
-
 // 按品类查询商家列表
 export function getTypeAppList(id,params) {
 	return request({
-		url: baseUrl + `/student/applet/customer/getCustomerListByProductId/${id}`,
+		url: `/student/applet/customer/getCustomerListByProductId/${id}`,
 		method: 'get',
 		params
 	})
@@ -19,7 +12,7 @@ export function getTypeAppList(id,params) {
 // 查询用户收藏列表
 export function collectionList(params) {
 	return request({
-		url: baseUrl + '/student/applet/collection/collectionList',
+		url: '/student/applet/collection/collectionList',
 		method: 'get',
 		params
 	})
@@ -28,7 +21,7 @@ export function collectionList(params) {
 // 查询用户浏览记录
 export function getBrowseRecordInfoList(params) {
 	return request({
-		url: baseUrl + '/student/applet/record/info/getBrowseRecordInfoList',
+		url: '/student/applet/record/info/getBrowseRecordInfoList',
 		method: 'get',
 		params
 	})
@@ -37,7 +30,7 @@ export function getBrowseRecordInfoList(params) {
 // 查询品类列表
 export function typeList(params) {
 	return request({
-		url: baseUrl + '/student/applet/product/info/list',
+		url: '/student/applet/product/info/list',
 		method: 'get',
 		params
 	})
@@ -46,7 +39,7 @@ export function typeList(params) {
 // 收藏商家
 export function addFavorites(id) {
 	return request({
-		url: baseUrl + `/student/applet/collection/collectionBusiness/${id}`,
+		url: `/student/applet/collection/collectionBusiness/${id}`,
 		method: 'put'
 	})
 }
@@ -54,7 +47,7 @@ export function addFavorites(id) {
 // 删除收藏
 export function delFavorites(ids) {
 	return request({
-		url: baseUrl + `/student/applet/collection/cancelCollection/${ids}`,
+		url: `/student/applet/collection/cancelCollection/${ids}`,
 		method: 'delete'
 	})
 }
@@ -62,7 +55,7 @@ export function delFavorites(ids) {
 // 新增记录
 export function BrowseRecordAdd(id) {
 	return request({
-		url: baseUrl + `/student/applet/record/info/insertBrowseRecord/${id}`,
+		url: `/student/applet/record/info/insertBrowseRecord/${id}`,
 		method: 'put'
 	})
 }
@@ -70,7 +63,7 @@ export function BrowseRecordAdd(id) {
 // 删除记录
 export function BrowseRecordDel(ids) {
 	return request({
-		url: baseUrl + `/student/applet/record/info/${ids}`,
+		url: `/student/applet/record/info/${ids}`,
 		method: 'delete'
 	})
 }
@@ -78,7 +71,7 @@ export function BrowseRecordDel(ids) {
 // 查询轮播图列表
 export function getCarouselChartList() {
 	return request({
-		url: baseUrl + `/student/applet/homePage/getHomePageDataList`,
+		url: `/student/applet/homePage/getHomePageDataList`,
 		method: 'get'
 	})
 }

+ 0 - 3
src/api/baseurl.js

@@ -1,3 +0,0 @@
-// export const baseUrl = 'http://192.168.8.219:8080';
-// export const baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
-export const baseUrl = 'https://zzjs.zzxcx.net/prod-api';

+ 12 - 17
src/api/cinema.js

@@ -1,24 +1,19 @@
 import request from '@/utils/request'
 import qs from 'qs'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
 let fileCommonApiUrl='/student/film/order/fileCommonApi'
 
-
 // 获取电影后台折扣参数
 export function getFilmDiscount(data) {
 	return request({
-		url: baseUrl + `/system/config/configKey/film_discount`,
+		url: `/system/config/configKey/film_discount`,
 	})
 }
 
 // 获取即将上映电影列表
 export function getSoonList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-soon-list',
@@ -30,7 +25,7 @@ export function getSoonList(data) {
 // 包含某电影的日期
 export function getShowDate(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-show-date',
@@ -42,7 +37,7 @@ export function getShowDate(data) {
 // 获取正在热映电影列表
 export function getHotList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-hot-list',
@@ -54,7 +49,7 @@ export function getHotList(data) {
 // 获取城市列表
 export function getCityList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-city-list',
@@ -66,7 +61,7 @@ export function getCityList(data) {
 // 获取影院列表
 export function getCinemaList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-cinema-list',
@@ -78,7 +73,7 @@ export function getCinemaList(data) {
 // 包含某电影的影院
 export function getShowList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-show-list',
@@ -90,7 +85,7 @@ export function getShowList(data) {
 // 某电影在某影院的场次排期
 export function getScheduleList(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-schedule-list',
@@ -102,7 +97,7 @@ export function getScheduleList(data) {
 // 查账户余额
 export function getInfo(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'api/user/info',
@@ -114,7 +109,7 @@ export function getInfo(data) {
 // 根据订单查影票信息
 export function orderQuery(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'api/order/query',
@@ -126,7 +121,7 @@ export function orderQuery(data) {
 // 某次电影的座位
 export function getSeat(data) {
 	return request({
-		url: baseUrl + fileCommonApiUrl,
+		url: fileCommonApiUrl,
 		method: 'post',
 		data: {
 			url: 'movieapi/movie-info/get-seat',
@@ -138,7 +133,7 @@ export function getSeat(data) {
 // 获取电影票支付数据
 export function prepareOrder(data) {
 	return request({
-		url: baseUrl + '/student/wx/prepareOrder',
+		url: '/student/wx/prepareOrder',
 		method: 'post',
 		data
 	})

+ 1 - 7
src/api/home.js

@@ -1,16 +1,10 @@
 import request from '@/utils/request'
 import md5 from 'crypto-js/md5'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
-
-
 // 查询轮播图列表
 export function getHomePageDataList() {
 	return request({
-		url: baseUrl + `/student/applet/homePage/getHomePageDataList`,
+		url: `/student/applet/homePage/getHomePageDataList`,
 		method: 'get'
 	})
 }

+ 5 - 8
src/api/login.js

@@ -1,8 +1,5 @@
 import request from '@/utils/request'
-import {
-	baseUrl
-}
-from '@/api/baseurl'
+
 
 //微信小程序登录code
 async function wxlogin() {
@@ -14,7 +11,7 @@ async function wxlogin() {
 export async function login() {
 	let res = await wxlogin();
 	return request({
-		url: baseUrl + '/login/jscode',
+		url: '/login/jscode',
 		method: 'post',
 		params: {
 			jscode: res.code
@@ -28,7 +25,7 @@ export async function login() {
 // 更新用户信息
 export function updateUserInfo(data) {
 	return request({
-		url: baseUrl + '/student/user/info',
+		url: '/student/user/info',
 		method: 'post',
 		data
 	})
@@ -37,7 +34,7 @@ export function updateUserInfo(data) {
 // 获取用户详细信息
 export async function getInfo() {
 	return request({
-		url: baseUrl + '/getInfo',
+		url: '/getInfo',
 		method: 'get'
 	})
 }
@@ -53,7 +50,7 @@ export function logout() {
 // 绑定用户身份证信息
 export function bindUserCard(data) {
 	return request({
-		url: baseUrl + '/gzpt/userInfo/bind',
+		url: '/gzpt/userInfo/bind',
 		method: 'put',
 		data
 	})

+ 2 - 6
src/api/order.js

@@ -1,13 +1,9 @@
 import request from '@/utils/request'
-import {
-	baseUrl
-}
-from '@/api/baseurl'
 
 // 查询订单列表
 export function getOrderList(params) {
 	return request({
-		url: baseUrl + '/student/wx/order/list',
+		url: '/student/wx/order/list',
 		params
 	})
 }
@@ -15,6 +11,6 @@ export function getOrderList(params) {
 // 查询订单列表
 export function getWxOrder(path) {
 	return request({
-		url: baseUrl + `/student/wx/${path}`,
+		url: `/student/wx/${path}`,
 	})
 }

+ 1 - 8
src/api/pay.js

@@ -1,17 +1,10 @@
 import request from '@/utils/request'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
-
-
-
 
 // 微信支付获取订单接口
 export function getPayData(data) {
 	return request({
-		url: baseUrl + '/student/wx/prepareOrder',
+		url: '/student/wx/prepareOrder',
 		method: 'post',
 		data
 	})

+ 4 - 12
src/api/studytime.js

@@ -1,17 +1,9 @@
 import request from '@/utils/request'
 
-import {
-	baseUrl
-}
-from '@/api/baseurl'
-
-
-
-
 // 上传学时
 export function addTime(data) {
 	return request({
-		url: baseUrl + '/student/gzpt-train-record',
+		url: '/student/gzpt-train-record',
 		method: 'post',
 		data
 	})
@@ -20,7 +12,7 @@ export function addTime(data) {
 // 查询已完成科目学时
 export function getTime(data) {
 	return request({
-		url: baseUrl + '/student/gzpt-train-record/getTrainFinishKm',
+		url: '/student/gzpt-train-record/getTrainFinishKm',
 		method: 'get'
 	})
 }
@@ -28,7 +20,7 @@ export function getTime(data) {
 // 查询额定学时
 export function getTimeInfo(data) {
 	return request({
-		url: baseUrl + '/student/gzpt-train-record/getTrainSubjectCredit',
+		url: '/student/gzpt-train-record/getTrainSubjectCredit',
 		method: 'get'
 	})
 }
@@ -36,7 +28,7 @@ export function getTimeInfo(data) {
 // 获取学员详细信息
 export function getStudentInfo(data) {
 	return request({
-		url: baseUrl + '/student/gzpt/userInfo',
+		url: '/student/gzpt/userInfo',
 		method: 'get'
 	})
 }

+ 0 - 0
src/components/index.js


+ 0 - 0
src/components/skeleton/loadSke.vue → src/components/loadSke/loadSke.vue


+ 0 - 3
src/components/loading/loading.js

@@ -1,3 +0,0 @@
-import Vue from 'vue'
-import loading from './loading.vue'
-Vue.component('loading', loading)

+ 1 - 1
src/components/loading/loading.vue

@@ -35,7 +35,7 @@
 
 <style lang="scss">
 	.spinner {
-		margin: 100px auto;
+		margin: 10px auto;
 		width: 20px;
 		height: 20px;
 		position: relative;

+ 0 - 3
src/components/skeleton/loadSke.js

@@ -1,3 +0,0 @@
-import Vue from "vue";
-import loadSke from "./loadSke.vue";
-Vue.component("loadSke", loadSke);

+ 0 - 0
src/components/square/index.vue → src/components/square/square.vue


+ 0 - 3
src/components/topbar/topbar.js

@@ -1,3 +0,0 @@
-import Vue from 'vue'
-import topbar from './topbar.vue'
-Vue.component('topbar', topbar)

+ 3 - 30
src/main.js

@@ -2,43 +2,16 @@ import Vue from 'vue'
 import App from './App'
 //引入vuex
 import store from './store'
-import Toast from '@/wxcomponents/vant/toast/toast';
-import loadSke from '@/components/skeleton/loadSke.vue'
-Vue.component('loadSke', loadSke)
-
-import '@/components/topbar/topbar.js'
-// import '@/components/skeleton/loadSke.js'
-import '@/components/loading/loading.js'
-
-// let comArr = require.context('./components/loading', false, /\.vue$/)
-// console.log(comArr)
-
-import {
-	goMiniApp,
-	goPage,
-	clickJumpType,
-	wxPay,
-	getUTCDay,
-	getDay,
-	goPageGetData
-} from '@/utils/utils.js'
+//引入所有工具函数
 import utils from '@/utils/utils.js'
 
 Vue.config.productionTip = false
 App.mpType = 'app'
 
-Vue.prototype.goMiniApp = goMiniApp
-Vue.prototype.goPage = goPage
-Vue.prototype.Toast = Toast
-Vue.prototype.clickJumpType = clickJumpType
-Vue.prototype.wxPay = wxPay
-Vue.prototype.getUTCDay = getUTCDay
-Vue.prototype.getDay = getDay
-Vue.prototype.goPageGetData = goPageGetData
+//goPageGetData中存在this需要引用当前
+Vue.prototype.goPageGetData = utils.goPageGetData
 Vue.prototype.$utils = utils
 
-
-
 const app = new Vue({
 	store,
 	...App

+ 1 - 1
src/pages.json

@@ -29,7 +29,7 @@
 		{
 			"path": "pages/webview/webview",
 			"style": {
-				"navigationBarTitleText": "",
+				"navigationBarTitleText": "WEB页面",
 				"enablePullDownRefresh": false
 			}
 

+ 2 - 2
src/pages/cinema/cinemalist.vue

@@ -1,9 +1,9 @@
 <template>
 	<view>
 		<van-tabs :active='active' :swipe-threshold='3' animated sticky id='tabs'>
-			<van-tab :title="getDay(dateItem)+' '+dateItem.slice(5)" v-for='(dateItem,dateIndex) in showDate' :key='index'>
+			<van-tab :title="$utils.getDay(dateItem)+' '+dateItem.slice(5)" v-for='(dateItem,dateIndex) in showDate' :key='index'>
 				<loadSke :loading='cinemaLoading' :list='cinemaList[dateItem]'>
-					<view class="cinema-box" v-for="(item,index) in cinemaList[dateItem]" :key='index' @click='goPage(`/pages/cinema/schedulelist?cinemaId=${item.cinemaId}&filmId=${filmId}`)'>
+					<view class="cinema-box" v-for="(item,index) in cinemaList[dateItem]" :key='index' @click='$utils.goPage(`/pages/cinema/schedulelist?cinemaId=${item.cinemaId}&filmId=${filmId}`)'>
 						<view class="tit">
 							<text>{{item.cinemaName}}</text>
 							<text class="text-2">{{item.distance}}</text>

+ 1 - 1
src/pages/cinema/placeorder.vue

@@ -228,7 +228,7 @@
 					this.orderRes = res
 					let payRes = await wx.requestPayment(this.orderRes.data)
 					if (payRes.errMsg == 'requestPayment:ok') {
-						this.goPage(`/pages/cinema/orderdes?outTradeNo=${this.orderRes.data.outTradeNo}`, 'reLaunch')
+						this.$utils.goPage(`/pages/cinema/orderdes?outTradeNo=${this.orderRes.data.outTradeNo}`, 'reLaunch')
 					}
 					console.log(payRes)
 				})

+ 2 - 2
src/pages/cinema/schedulelist.vue

@@ -24,7 +24,7 @@
 
 			<view class="schedule-box">
 				<van-tabs :active='tabActive' :swipe-threshold='3' animated swipeable id="tabs" @change='tabsChange'>
-					<van-tab class='schedule-tab' :title="getDay(index)+' '+index.slice(5)" v-for='(item,index) in scheduleItem' :key='index'>
+					<van-tab class='schedule-tab' :title="$utils.getDay(index)+' '+index.slice(5)" v-for='(item,index) in scheduleItem' :key='index'>
 						<view v-for="(sonItem,sonIndex) in item" :key='sonItem.showId' class="schedule-des" @click="clickBuy(sonItem)">
 							<view class="left-box">
 								<view class="item-box">
@@ -93,7 +93,7 @@
 			clickBuy(item) {
 				let flag = this.discontinued(item.stopSellTime)
 				if (flag) {
-					this.goPage(`/pages/cinema/selectseat`, null, {
+					this.$utils.goPage(`/pages/cinema/selectseat`, null, {
 						showItem: item
 					})
 				}

+ 3 - 1
src/pages/cinema/selectseat.vue

@@ -67,7 +67,7 @@
 				<view class="left-box">
 					总共:{{seatResult.length}}张
 				</view>
-				<button v-if="seatResult.length>0" class="btn" type="default" @click="goPage(`/pages/cinema/placeorder`,null,{seatResult:seatResult,showItem:showItem})">下一步</button>
+				<button v-if="seatResult.length>0" class="btn" type="default" @click="$utils.goPage(`/pages/cinema/placeorder`,null,{seatResult:seatResult,showItem:showItem})">下一步</button>
 				<button v-else class="btn" style="background: linear-gradient(90deg, #c0c0c0, #c0c0c0, #c0c0c0);" type="default">下一步</button>
 			</view>
 		</view>
@@ -242,6 +242,7 @@
 		
 		.loveSeatLeft{
 			position: relative;
+			overflow: initial;
 			&::after{
 				content: '';
 				position: absolute;
@@ -257,6 +258,7 @@
 		
 		.loveSeatRight{
 			position: relative;
+			overflow: initial;
 			&::after{
 				content: '';
 				position: absolute;

+ 4 - 4
src/pages/index/components/applist.vue

@@ -23,7 +23,7 @@
 			</view>
 
 			<loadSke :loading='loading' :list='applist'>
-				<view class='list-item' v-for="(item, index) in applist" :key="index" @click="clickJumpType(item)">
+				<view class='list-item' v-for="(item, index) in applist" :key="index" @click="$utils.clickJumpType(item)">
 					<image class="avatar" mode="aspectFit" :src="item.appletLogoFileUrl || '/static/imgs/shmr.png'" />
 					<view class="top">
 						<van-icon class="icon" v-if="item.collectionStatus=='0'" @tap.stop='addSc(index)' name="star-o" color='#999999' />
@@ -220,7 +220,7 @@
 				addFavorites(this.applist[index].id).then(res => {
 					if (res.code == 200) {
 						this.$set(this.applist[index], 'collectionStatus', '1')
-						this.Toast('收藏成功!');
+						this.$utils.Toast('收藏成功!');
 					}
 				})
 			},
@@ -228,7 +228,7 @@
 				delFavorites(this.applist[index].id).then(res => {
 					if (res.code == 200) {
 						this.$set(this.applist[index], 'collectionStatus', '0')
-						this.Toast('取消收藏成功!');
+						this.$utils.Toast('取消收藏成功!');
 					}
 				})
 			},
@@ -236,7 +236,7 @@
 				this.showShare = false;
 			},
 			onSelect(event) {
-				this.Toast(event.detail.name);
+				this.$utils.Toast(event.detail.name);
 				this.onClose();
 			},
 			getAppList() {

+ 51 - 12
src/pages/index/components/cinema.vue

@@ -3,21 +3,21 @@
 		<view class='topbar'>
 			<topbar>
 				<view class="topbar-box">
-					<view class="left-box" @click="goPage(`/pages/cinema/citylist`,null,{cityList:cityList})">
+					<view class="left-box" @click="$utils.goPage(`/pages/cinema/citylist`,null,{cityList:cityList})">
 						<van-icon name="location" />
 						<text>{{address}}</text>
 						<van-icon name="arrow-down" />
 					</view>
-					<van-search class='top-search' shape="round" background="#fff" placeholder="请输入电影名称" @search="onSearch" @change='onSearchChange' />
+					<van-search shape="round" :placeholder="searchTitle" @search='onSearchChange' @change='onSearchChange' />
 				</view>
 			</topbar>
 		</view>
 		<view class="tabs-box">
-			<van-tabs :active='tabActive' animated sticky offset-top='87' @change='tabsChange'>
+			<van-tabs :active='tabActive' animated @change='tabsChange'>
 				<van-tab title="热映">
 					<loadSke :loading='hotLoading' :list='hotList'>
 						<view class="flex-box">
-							<view @click="goPage(`/pages/cinema/cinemalist?filmId=${item.filmId}&cityId=${cityId}&location=${location}`)"
+							<view @click="$utils.goPage(`/pages/cinema/cinemalist?filmId=${item.filmId}&cityId=${cityId}&location=${location}`)"
 							 class="film-box" v-for="(item) in hotList" :key='item.filmId'>
 								<image :src="item.pic" mode="scaleToFill" class="img" draggable></image>
 								<view class="bottom-box">
@@ -40,7 +40,7 @@
 				</van-tab>
 				<van-tab title="影院">
 					<loadSke :loading='cinemaLoading' :list='cinemaList'>
-						<view class="cinema-box" v-for="(item) in cinemaList" :key='item.cinemaId' @click='goPage(`/pages/cinema/schedulelist?cinemaId=${item.cinemaId}&filmId=${filmId}`)'>
+						<view class="cinema-box" v-for="(item) in cinemaList" :key='item.cinemaId' @click='$utils.goPage(`/pages/cinema/schedulelist?cinemaId=${item.cinemaId}&filmId=${filmId}`)'>
 							<view class="tit">
 								<text>{{item.cinemaName}}</text>
 								<text class="text-2">{{item.distance}}km</text>
@@ -103,8 +103,11 @@
 			location: [119.131390, 26.150210],
 			cityList: [],
 			address: '定位中',
-			cinemaList: {},
-			cinemaLoading: true
+			cinemaList: [],
+			cinemaLoading: true,
+			searchList: null,
+			searchType: 0,
+			searchTitle: '请输入电影名称',
 		}),
 		async mounted() {
 			this.setFilmDiscount()
@@ -126,14 +129,50 @@
 			}
 		},
 		methods: {
-			onSearch(e) {
-				console.log(e)
-			},
 			onSearchChange(e) {
-				console.log(e)
+				if (this.searchType == 0) {
+					this.searchList || (this.searchList = this.hotList)
+					this.hotList = this.searchList.filter(val => {
+						return val.name.includes(e.detail)
+					})
+				}
+				if (this.searchType == 1) {
+					this.searchList || (this.searchList = this.cinemaList)
+					this.cinemaList = this.searchList.filter(val => {
+						return val.cinemaName.includes(e.detail)
+					})
+				}
+				if (this.searchType == 2) {
+					this.searchList || (this.searchList = this.soonList)
+					this.soonList = {}
+					for (let key in this.searchList) {
+						let aDay = this.searchList[key].filter(val => {
+							return val.name.includes(e.detail)
+						})
+						aDay.length && (this.soonList[key] = aDay)
+					}
+				}
 			},
 			tabsChange(e) {
+				let listMap = new Map([
+					[0, ()=>this.hotList = this.searchList],
+					[1, ()=>this.cinemaList = this.searchList],
+					[2, ()=>this.soonList = this.searchList]
+				])
+				//切换搜索前复原数据
+				this.searchList && listMap.get(this.searchType)()
+				
 				this.tabActive = e.detail.index
+				this.searchType = e.detail.index
+				this.searchList = null
+				
+				let aMap = new Map([
+					[0, '请输入电影名称'],
+					[1, '请输入影院名称'],
+					[2, '请输入电影名称']
+				])
+				//修改搜索框提示
+				this.searchTitle = aMap.get(e.detail.index)
 			},
 			setFilmDiscount() {
 				getFilmDiscount().then(res => {
@@ -227,7 +266,7 @@
 		top: 0;
 		left: 0;
 		right: 0;
-		z-index: 1;
+		z-index: 10;
 		overflow: hidden;
 
 		.topbar-box {

+ 13 - 11
src/pages/index/components/home.vue

@@ -18,12 +18,12 @@
 			<loadSke :loading='topLoading' :list='bannerList'>
 				<swiper class="swiper-box" :current="current" autoplay circular indicator-dots>
 					<swiper-item v-for="(item,index) in bannerList" :key='index'>
-						<image @click="clickJumpType(item)" class="image" :src="item.fileUrl" mode="scaleToFill" :draggable="false" />
+						<image @click="$utils.clickJumpType(item)" class="image" :src="item.fileUrl" mode="scaleToFill" :draggable="false" />
 					</swiper-item>
 				</swiper>
 
 				<view class="eat-box">
-					<view class="eat" v-for="(item,index) in couponList" :key='index' @click="clickJumpType(item)">
+					<view class="eat" v-for="(item,index) in couponList" :key='index' @click="$utils.clickJumpType(item)">
 						<image :src="item.fileUrl" mode="scaleToFill" class="img"></image>
 						<view class="text-box">
 							<text class="text-1">{{item.pictureName}}</text>
@@ -34,7 +34,7 @@
 				</view>
 
 				<view class="menu-box">
-					<view class="menu" v-for="(item,index) in menuList" :key='index' @click="clickJumpType(item)">
+					<view class="menu" v-for="(item,index) in menuList" :key='index' @click="$utils.clickJumpType(item)">
 						<image :src="item.fileUrl" mode="scaleToFill" class="img"></image>
 						<text class="text-1">{{item.pictureName}}</text>
 						<text class="text-2">{{item.dataDescribe || '暂无描述'}}</text>
@@ -43,7 +43,7 @@
 			</loadSke>
 		</view>
 
-		<view class="bottom-ad" v-for="(item,index) in bottomAD" :key='index' @click="clickJumpType(item)">
+		<view class="bottom-ad" v-for="(item,index) in bottomAD" :key='index' @click="$utils.clickJumpType(item)">
 			<image style="width: 100%;" :src="item.fileUrl" mode="widthFix"></image>
 			<text>今日仅剩{{dynamicQuantity(index)}}个</text>
 			<button>免费领取</button>
@@ -56,7 +56,7 @@
 			</view>
 			<loadSke :loading='pddLoading' :list='pddList'>
 				<view class="flex-box">
-					<view class="film-box" v-for="(item,index) in pddList" :key='index' @click="goMiniApp(JSON.stringify({appId:item.we_app_info.app_id,path:item.we_app_info.page_path}))">
+					<view class="film-box" v-for="(item,index) in pddList" :key='index' @click="pddGoApp({appId:item.we_app_info.app_id,path:item.we_app_info.page_path})">
 						<image :src="item.goods_image_url" mode="widthFix" class="img" draggable></image>
 						<view class="bottom-box">
 							<view class="tit">
@@ -72,7 +72,7 @@
 						</view>
 					</view>
 					<view v-if="pddDataLoading" class="bottom-loading">
-						正在加载中...
+						<loading />
 					</view>
 				</view>
 			</loadSke>
@@ -96,12 +96,15 @@
 			pddLoading: true,
 			limit: 6,
 			page: 0,
-			pddDataLoading: false
+			pddDataLoading: false,
 		}),
 		mounted() {
 			this.init()
 		},
 		methods: {
+			pddGoApp(data) {
+				this.$utils.goMiniApp(JSON.stringify(data))
+			},
 			onBottom() {
 				if (this.pddDataLoading) return
 				this.pddDataLoading = true
@@ -148,10 +151,10 @@
 </script>
 
 <style scoped lang="scss">
-	.home{
+	.home {
 		height: 100%;
 	}
-	
+
 	.top-list {
 		padding: 30rpx;
 		padding-top: 0;
@@ -349,7 +352,6 @@
 			display: flex;
 			justify-content: center;
 			align-items: flex-start;
-			// flex-direction: column;
 			flex-wrap: wrap;
 			background-color: #F8F8F8;
 			padding-bottom: 20rpx;
@@ -426,7 +428,7 @@
 
 		}
 
-		.bottom-loading{
+		.bottom-loading {
 			margin-top: 5rpx;
 			padding: 10rpx;
 		}

+ 1 - 1
src/pages/index/components/login.vue

@@ -16,7 +16,7 @@ export default {
       if (loginRes.code == 200) {
         this.$emit("update:login", true);
       } else {
-        this.Toast("登录失败");
+        this.$utils.Toast("登录失败");
         this.$emit("update:login", true);
       }
     },

+ 4 - 8
src/pages/index/components/user.vue

@@ -27,7 +27,7 @@
         <button
           class="item-box"
           :plain="true"
-          @click="goPage('/pages/user/order')"
+          @click="$utils.goPage('/pages/user/order')"
         >
           <van-icon name="/static/imgs/order-icon.png" size="22px" />
           <text class="text">我的订单</text>
@@ -35,7 +35,7 @@
         <button
           class="item-box"
           :plain="true"
-          @click="goPage('/pages/user/collectionList')"
+          @click="$utils.goPage('/pages/user/collectionList')"
         >
           <van-icon name="/static/imgs/wdsc.png" size="22px" />
           <text class="text">我的收藏</text>
@@ -43,7 +43,7 @@
         <button
           class="item-box"
           :plain="true"
-          @click="goPage('/pages/user/browserecord')"
+          @click="$utils.goPage('/pages/user/browserecord')"
         >
           <van-icon name="/static/imgs/llzj.png" size="22px" />
           <text class="text">浏览足迹</text>
@@ -63,7 +63,7 @@
         title="我的设置"
         icon="/static/imgs/wdsz.png"
         is-link
-        @tap="goPage('/pages/user/set')"
+        @tap="$utils.goPage('/pages/user/set')"
       />
       <button class="server" open-type="contact" :plain="true">
         <van-cell title="联系客服" icon="/static/imgs/lxkf.png" is-link />
@@ -77,12 +77,8 @@
 </template>
 
 <script>
-import square from "@/components/square/index.vue";
 import { updateUserInfo } from "@/api/login.js";
 export default {
-  components: {
-    square,
-  },
   computed: {
     userData() {
       return this.$store.state.user.userInfo;

+ 88 - 99
src/pages/index/index.vue

@@ -1,109 +1,98 @@
 <template>
-  <view>
-    <login v-if="!login" :login.sync="login" />
-    <view v-else>
-      <swiper
-        class="swiper-box"
-        :current-item-id="active"
-        @change="swiperChange"
-        easing-function="easeInCubic"
-      >
-        <swiper-item class="swiper-item" item-id="home">
-          <home v-if="activeObj.home" ref="home" />
-        </swiper-item>
-        <swiper-item class="swiper-item" item-id="cinema">
-          <cinema v-if="activeObj.cinema" ref="cinema" />
-        </swiper-item>
-        <swiper-item class="swiper-item" item-id="applist">
-          <applist v-if="activeObj.applist" ref="applist" />
-        </swiper-item>
-        <swiper-item class="swiper-item" item-id="user">
-          <user v-if="activeObj.user" ref="user" />
-        </swiper-item>
-      </swiper>
+	<view>
+		<login v-if="!login" :login.sync="login" />
+		<view v-else>
+			<swiper class="swiper-box" :current-item-id="active" @change="swiperChange" easing-function="easeInCubic">
+				<swiper-item class="swiper-item" item-id="home">
+					<home v-if="activeObj.home" ref="home" />
+				</swiper-item>
+				<swiper-item class="swiper-item" item-id="cinema">
+					<cinema v-if="activeObj.cinema" ref="cinema" />
+				</swiper-item>
+				<swiper-item class="swiper-item" item-id="applist">
+					<applist v-if="activeObj.applist" ref="applist" />
+				</swiper-item>
+				<swiper-item class="swiper-item" item-id="user">
+					<user v-if="activeObj.user" ref="user" />
+				</swiper-item>
+			</swiper>
 
-      <van-tabbar
-        :active="active"
-        @change="onChange"
-        :placeholder="true"
-        active-color="#E31818"
-        inactive-color="#999999"
-      >
-        <van-tabbar-item name="home" icon="wap-home">
-          <!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
-          <!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
-          首页
-        </van-tabbar-item>
-        <van-tabbar-item name="cinema" icon="video">
-          <!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
-          <!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
-          电影
-        </van-tabbar-item>
-        <van-tabbar-item name="applist" icon="search">
-          <!-- <van-icon slot="icon" name="/static/imgs/zth.png" /> -->
-          <!-- <van-icon slot="icon-active" name="/static/imgs/zt.png" /> -->
-          发现
-        </van-tabbar-item>
-        <van-tabbar-item name="user" icon="manager">
-          <!-- <van-icon slot="icon" name="/static/imgs/wdh.png" /> -->
-          <!-- <van-icon slot="icon-active" name="/static/imgs/wd.png" /> -->
-          我的
-        </van-tabbar-item>
-      </van-tabbar>
-    </view>
+			<van-tabbar :active="active" @change="onChange" :placeholder="true" active-color="#E31818" inactive-color="#999999">
+				<van-tabbar-item name="home" icon="wap-home">
+					<!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
+					<!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
+					首页
+				</van-tabbar-item>
+				<van-tabbar-item name="cinema" icon="video">
+					<!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
+					<!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
+					电影
+				</van-tabbar-item>
+				<van-tabbar-item name="applist" icon="search">
+					<!-- <van-icon slot="icon" name="/static/imgs/zth.png" /> -->
+					<!-- <van-icon slot="icon-active" name="/static/imgs/zt.png" /> -->
+					发现
+				</van-tabbar-item>
+				<van-tabbar-item name="user" icon="manager">
+					<!-- <van-icon slot="icon" name="/static/imgs/wdh.png" /> -->
+					<!-- <van-icon slot="icon-active" name="/static/imgs/wd.png" /> -->
+					我的
+				</van-tabbar-item>
+			</van-tabbar>
+		</view>
 
-    <van-toast id="van-toast" />
-  </view>
+		<van-toast id="van-toast" />
+	</view>
 </template>
 
 <script>
-import applist from "./components/applist.vue";
-import user from "./components/user.vue";
-import login from "./components/login.vue";
-import home from "./components/home.vue";
-import cinema from "./components/cinema.vue";
-export default {
-  components: {
-    applist,
-    user,
-    login,
-    home,
-    cinema,
-  },
-  data() {
-    return {
-      login: false,
-      active: "home",
-      activeObj: {},
-    };
-  },
-  onLoad: function(option) {
-    if (option.active) {
-      this.active = option.active;
-    }
-    this.activeObj[this.active] = true;
-  },
-  onShareAppMessage: function() {},
-  methods: {
-    onChange(event) {
-      // event.detail 的值为当前选中项的索引
-      this.active = event.detail;
-      this.activeObj[this.active] = true;
-    },
-    swiperChange(event) {
-      this.active = event.detail.currentItemId;
-      this.activeObj[this.active] = true;
-    },
-  },
-};
+	import applist from "./components/applist.vue";
+	import user from "./components/user.vue";
+	import login from "./components/login.vue";
+	import home from "./components/home.vue";
+	import cinema from "./components/cinema.vue";
+	export default {
+		components: {
+			applist,
+			user,
+			login,
+			home,
+			cinema,
+		},
+		data() {
+			return {
+				login: false,
+				active: "home",
+				activeObj: {},
+			};
+		},
+		onLoad: function(option) {
+			if (option.active) {
+				this.active = option.active;
+			}
+			this.activeObj[this.active] = true;
+		},
+		onShareAppMessage: function() {},
+		methods: {
+			onChange(event) {
+				// event.detail 的值为当前选中项的索引
+				this.active = event.detail;
+				this.activeObj[this.active] = true;
+			},
+			swiperChange(event) {
+				this.active = event.detail.currentItemId;
+				this.activeObj[this.active] = true;
+			},
+		},
+	};
 </script>
 
 <style lang="scss">
-.swiper-box {
-  height: calc(100vh - 100rpx - env(safe-area-inset-bottom));
+	.swiper-box {
+		height: calc(100vh - 100rpx - env(safe-area-inset-bottom));
 
-  .swiper-item {
-    // overflow: auto;
-  }
-}
-</style>
+		.swiper-item {
+			// overflow: auto;
+		}
+	}
+</style>

+ 1 - 1
src/pages/recharge/index.vue

@@ -4,7 +4,7 @@
 		<swiper class="swiper-box" previous-margin='140rpx' next-margin='140rpx' indicator-dots>
 			<swiper-item class="swiper-item" v-for="(item,index) in 3" :key='index'>
 				<image class="swiper-img" src="../../static/imgs/shmr.png" mode="scaleToFill"></image>
-				<button class="swiper-btn" @click="goPage('/pages/recharge/placeorder')">立即充值</button>
+				<button class="swiper-btn" @click="$utils.goPage('/pages/recharge/placeorder')">立即充值</button>
 			</swiper-item>
 		</swiper>
 	</view>

+ 2 - 2
src/pages/user/browserecord.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		<loadSke :loading='loading' :list='applist'>
-			<view class='list-item' v-for="(item, index) in applist" :key="index" @click="goMiniApp({appId:item.appletAddress},item)">
+			<view class='list-item' v-for="(item, index) in applist" :key="index" @click="$utils.goMiniApp({appId:item.appletAddress},item)">
 				<image class="avatar" mode="aspectFill" :src="item.appletLogoFileUrl || '/static/imgs/shmr.png'">
 					<view class="item-right">
 						<view class="top">
@@ -71,7 +71,7 @@
 				BrowseRecordDel(this.applist[index].id).then(res => {
 					if (res.code == 200) {
 						this.$set(this.applist[index], 'collectionStatus', '0')
-						this.Toast('取消收藏成功!');
+						this.$utils.Toast('取消收藏成功!');
 						delete this.applist.splice(index, 1)
 					}
 				})

+ 2 - 2
src/pages/user/collectionList.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		<loadSke :loading='loading' :list='applist'>
-			<view class='list-item' v-for="(item, index) in applist" :key="index" @click="goMiniApp({appId:item.appletAddress},item)">
+			<view class='list-item' v-for="(item, index) in applist" :key="index" @click="$utils.goMiniApp({appId:item.appletAddress},item)">
 				<image class="avatar" mode="aspectFill" :src="item.appletLogoFileUrl || '/static/imgs/shmr.png'">
 					<view class="item-right">
 						<view class="top">
@@ -71,7 +71,7 @@
 				delFavorites(this.applist[index].customerId).then(res => {
 					if (res.code == 200) {
 						this.$set(this.applist[index], 'collectionStatus', '0')
-						this.Toast('取消收藏成功!');
+						this.$utils.Toast('取消收藏成功!');
 						delete this.applist.splice(index, 1)
 					}
 				})

+ 2 - 2
src/pages/user/order.vue

@@ -3,7 +3,7 @@
 		<van-tabs :active="active" @change="onChange" animated sticky>
 			<van-tab title="近7日订单">
 				<loadSke :loading='orderLoading'>
-					<view class="order-item" v-for="(item,index) in orderList" :key='item' @click="goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
+					<view class="order-item" v-for="(item,index) in orderList" :key='item' @click="$utils.goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
 						<image class="img" :src="item.goodsPictureUrl" mode="widthFix"></image>
 						<view class="des-box">
 							<text>订单名称:{{item.orderDataJson.cinemaData.filmName}}</text>
@@ -17,7 +17,7 @@
 			</van-tab>
 			<van-tab title="历史订单">
 				<loadSke :loading='orderLoading2'>
-					<view class="order-item ios-bottom" v-for="(item,index) in orderList2" :key='item' @click="goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
+					<view class="order-item ios-bottom" v-for="(item,index) in orderList2" :key='item' @click="$utils.goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
 						<image class="img" :src="item.goodsPictureUrl" mode="widthFix"></image>
 						<view class="des-box">
 							<text>订单名称:{{item.orderDataJson.cinemaData.filmName}}</text>

+ 3 - 3
src/pages/user/set.vue

@@ -86,12 +86,12 @@
 					password: md5(this.password).toString()
 				}).then((res) => {
 					if (res.code == 200) {
-						Toast.success('绑定成功');
+						this.$utils.Toast.success('绑定成功');
 						this.idCardShow = false
 					} else if (res.code == 502) {
-						Toast.fail(res.msg);
+						this.$utils.Toast.fail(res.msg);
 					} else {
-						Toast.fail('系统内部错误');
+						this.$utils.Toast.fail('系统内部错误');
 					}
 					this.loading = false
 				})

+ 0 - 1
src/utils/auth.js

@@ -1,4 +1,3 @@
-// import Cookies from 'js-cookie'
 import {
 	login
 } from '@/api/login.js'

+ 0 - 97
src/utils/request - 副本.js

@@ -1,97 +0,0 @@
-import {
-	getToken,
-	setToken,
-	removeToken,
-	refreshToken
-} from '@/utils/auth'
-import {
-	login
-} from '@/api/login.js'
-import errorCode from '@/utils/errorCode'
-
-
-/**
- * http请求封装
- */
-const myAxios = (req) => {
-
-	let query = ''
-	
-	req.params && Object.keys(req.params).map((key, index) => {
-		if (index) {
-			query += '&' + key + '=' + encodeURIComponent(req.params[key])
-		} else {
-			query += '?' + key + '=' + encodeURIComponent(req.params[key])
-		}
-	})
-
-	let reqData = {
-		url: req.baseURL ? req.baseURL : '' + req.url + query,
-		method: req.method,
-		data: {
-			...req.data
-		},
-		header: {
-			...req.headers
-		},
-		timeout: req.timeout || 10000
-	}
-
-	// 请求拦截器
-	async function reqMiddleware(config) {
-
-		if (config.headers.isLogin) {
-			return config
-		}
-		let token = await getToken()
-		config.headers['Authorization'] = 'Bearer ' + token // 让每个请求携带自定义token 请根据实际情况自行修改
-		return config
-	}
-
-	// 响应拦截器
-	async function resMiddleware(res) {
-
-		const code = res.data.code || 200;
-		// 获取错误信息
-		const msg = errorCode[code] || res.data.msg || errorCode['default']
-		//重置Authorization时间
-		if (code !== 401) refreshToken()
-		
-		if (code === 401) {
-			console.log('拦截器信息:' + msg)
-			// this.$store.dispatch('Login')
-		} else if (code === 500) {
-			console.log('拦截器信息:' + msg)
-		} else if (code === 502) {
-			console.log('拦截器信息:' + msg)
-		} else if (code !== 200) {
-			console.log('拦截器信息:' + msg)
-		}
-		return res.data
-	}
-	// 2. 函数内部返回Promise 对象
-	return new Promise(async (resolve, reject) => {
-		reqData = await reqMiddleware(reqData)
-		// 3.wx.request()  小程序发送请求
-		wx.request({
-			// 把调用axios时传过来的所有参数解构赋值
-			...reqData,
-			// 请求成功之后调用的函数
-			success: async (result) => {
-				result = await resMiddleware(result)
-				resolve(result)
-			},
-			// 请求失败之后调用的函数
-			fail: (error) => {
-				reject(error)
-			},
-			complete: () => {
-
-			}
-		});
-	});
-
-}
-
-
-export default myAxios

+ 4 - 0
src/utils/request.js

@@ -7,10 +7,14 @@ import axios from 'axios'
 import mpAdapter from 'axios-miniprogram-adapter'
 axios.defaults.adapter = mpAdapter
 
+// export const baseUrl = 'http://192.168.8.219:8080';
+// export const baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
+
 // 创建axios实例
 const service = axios.create({
 	// axios中请求配置有baseURL选项,表示请求URL公共部分
 	// baseURL: process.env.VUE_APP_BASE_API,
+	baseURL: 'https://zzjs.zzxcx.net/prod-api',
 	// 超时
 	// timeout: 10000
 })

+ 168 - 156
src/utils/utils.js

@@ -2,93 +2,180 @@ import {
 	BrowseRecordAdd
 } from '@/api/applist.js'
 import sha256 from 'crypto-js/sha256'
-
-//防抖函数
-export function debounce(func, fnThis, wait) {
-	var timer;
-	return () => {
-		timer && clearTimeout(timer);
-		timer = setTimeout(() => {
-			func.call(fnThis)
-			timer = null
-		}, wait);
-	};
-}
-
-//节流函数
-export function throttling(func, fnThis, wait) {
-	var timer;
-	return () => {
-		clearTimeout(timer);
-		timer = setTimeout(func.bind(fnThis), wait);
-	};
-}
+import Toast from '@/wxcomponents/vant/toast/toast';
 
 let goMiniAppFlag = false
-//跳转小程序
-export function goMiniApp(data, item) {
-
-	if (goMiniAppFlag) return
-	goMiniAppFlag = true
-
-	let myData = JSON.parse(data)
 
-	wx.navigateToMiniProgram({
-		...myData,
-		success: (res) => {
-			// 打开成功
-			goMiniAppFlag = false
-			item && BrowseRecordAdd(item.id)
-		},
-		fail: () => {
-			goMiniAppFlag = false
+const utils = {
+	//激励广告唤起函数
+	incentiveAd(){
+		// 在页面中定义激励视频广告
+		let videoAd = null
+		
+		// 在页面onLoad回调事件中创建激励视频广告实例
+		if (wx.createRewardedVideoAd) {
+		  videoAd = wx.createRewardedVideoAd({
+		    adUnitId: 'adunit-5be2b5bf54eae38e'
+		  })
+		  videoAd.onLoad(() => {})
+		  videoAd.onError((err) => {})
+		  videoAd.onClose((res) => {})
 		}
-	})
-}
-
-//跳转页面
-export function goPage(url, type, data) {
-	if (type == 'reLaunch') {
-		uni.reLaunch({
-			url
-		});
-		return
-	}
-	if (type == 'redirectTo') {
-		uni.redirectTo({
-			url
+		
+		// 用户触发广告后,显示激励视频广告
+		if (videoAd) {
+		  videoAd.show().catch(() => {
+		    // 失败重试
+		    videoAd.load()
+		      .then(() => videoAd.show())
+		      .catch(err => {
+		        console.log('激励视频 广告显示失败')
+		      })
+		  })
+		}
+	},
+	//vant通知组件调用函数
+	Toast,
+	//防抖函数
+	debounce(func, fnThis, wait) {
+		var timer;
+		return () => {
+			timer && clearTimeout(timer);
+			timer = setTimeout(() => {
+				func.call(fnThis)
+				timer = null
+			}, wait);
+		};
+	},
+	//节流函数
+	throttling(func, fnThis, wait) {
+		var timer;
+		return () => {
+			clearTimeout(timer);
+			timer = setTimeout(func.bind(fnThis), wait);
+		};
+	},
+	//跳转小程序
+	goMiniApp(data, item) {
+
+		if (goMiniAppFlag) return
+		goMiniAppFlag = true
+
+		let myData = JSON.parse(data)
+
+		wx.navigateToMiniProgram({
+			...myData,
+			success: (res) => {
+				// 打开成功
+				goMiniAppFlag = false
+				item && BrowseRecordAdd(item.id)
+			},
+			fail: () => {
+				goMiniAppFlag = false
+			}
+		})
+	},
+	//跳转页面
+	goPage(url, type, data) {
+		if (type == 'reLaunch') {
+			uni.reLaunch({
+				url
+			});
+			return
+		}
+		if (type == 'redirectTo') {
+			uni.redirectTo({
+				url
+			});
+			return
+		}
+		uni.navigateTo({
+			url,
+			success: function(res) {
+				// 通过eventChannel向被打开页面传送数据
+				res.eventChannel.emit('passParameters', data)
+			}
 		});
-		return
-	}
-	uni.navigateTo({
-		url,
-		success: function(res) {
-			// 通过eventChannel向被打开页面传送数据
-			res.eventChannel.emit('passParameters', data)
+	},
+	//页面接受参数
+	goPageGetData() {
+		return new Promise((res) => {
+			const eventChannel = this.getOpenerEventChannel()
+			eventChannel.on('passParameters', function(data) {
+				res(data)
+			})
+		})
+	},
+	//根据类型跳转
+	clickJumpType(item) {
+		if (item.jumpUrlType == 'goMiniApp') {
+			utils.goMiniApp(item.jumpUrl)
 		}
-	});
-}
-
-//接受参数
-export function goPageGetData() {
-	return new Promise((res) => {
-		const eventChannel = this.getOpenerEventChannel()
-		eventChannel.on('passParameters', function(data) {
-			res(data)
+		if (item.jumpUrlType == 'goPage') {
+			utils.goPage(item.jumpUrl)
+		}
+		if (item.jumpUrlType == 'goWebView') {
+			utils.goPage(`/pages/webview/webview?src=${item.jumpUrl}`)
+		}
+	},
+	//微信支付调起支付
+	wxPay(data) {
+		wx.requestPayment({
+			...data
 		})
-	})
-}
-
-//根据类型跳转
-export function clickJumpType(item) {
-	if (item.jumpUrlType == 'goMiniApp') {
-		goMiniApp(item.jumpUrl)
-	}
-	if (item.jumpUrlType == 'goPage') {
-		goPage(item.jumpUrl)
-	}
-	if (item.jumpUrlType == 'goWebView') {
-		goPage(`/pages/webview/webview?src=${item.jumpUrl}`)
+	},
+	//返回星期几
+	getUTCDay(date) {
+		let UTCDay = new Date(date).getUTCDay()
+		switch (UTCDay) {
+			case 0:
+				return '周天';
+			case 1:
+				return '周一';
+			case 2:
+				return '周二';
+			case 3:
+				return '周三';
+			case 4:
+				return '周四';
+			case 5:
+				return '周五';
+			case 6:
+				return '周六';
+		}
+	},
+	//返回今天明天后天周几
+	getDay(date) {
+		let UTCDay = new Date(date).getUTCDay()
+		let jetLag = new Date(date).getTime() - new Date().getTime()
+		let dayDif = jetLag / (1000 * 60 * 60 * 24)
+		if (dayDif < 2) {
+			if (dayDif < 0) {
+				return '今天'
+			}
+			if (dayDif < 1) {
+				return '明天'
+			}
+			if (dayDif < 2) {
+				return '后天'
+			}
+		}
+		switch (UTCDay) {
+			case 0:
+				return '周天';
+			case 1:
+				return '周一';
+			case 2:
+				return '周二';
+			case 3:
+				return '周三';
+			case 4:
+				return '周四';
+			case 5:
+				return '周五';
+			case 6:
+				return '周六';
+		}
 	}
 }
 
@@ -125,79 +212,4 @@ function base64_encode(str) {
 	return string
 }
 
-
-//微信支付调起支付
-export function wxPay(data) {
-
-	wx.requestPayment({
-		...data
-	})
-
-}
-
-//返回星期几
-export function getUTCDay(date) {
-	let UTCDay = new Date(date).getUTCDay()
-	switch (UTCDay) {
-		case 0:
-			return '周天';
-		case 1:
-			return '周一';
-		case 2:
-			return '周二';
-		case 3:
-			return '周三';
-		case 4:
-			return '周四';
-		case 5:
-			return '周五';
-		case 6:
-			return '周六';
-	}
-}
-
-//返回今天明天后天周几
-export function getDay(date) {
-	let UTCDay = new Date(date).getUTCDay()
-	let jetLag = new Date(date).getTime() - new Date().getTime()
-	let dayDif = jetLag / (1000 * 60 * 60 * 24)
-	if (dayDif < 2) {
-		if (dayDif < 0) {
-			return '今天'
-		}
-		if (dayDif < 1) {
-			return '明天'
-		}
-		if (dayDif < 2) {
-			return '后天'
-		}
-	}
-	switch (UTCDay) {
-		case 0:
-			return '周天';
-		case 1:
-			return '周一';
-		case 2:
-			return '周二';
-		case 3:
-			return '周三';
-		case 4:
-			return '周四';
-		case 5:
-			return '周五';
-		case 6:
-			return '周六';
-	}
-}
-
-export default {
-	goPageGetData,
-	clickJumpType,
-	debounce,
-	throttling,
-	goMiniApp,
-	goPage,
-	wxPay,
-	getUTCDay,
-	getDay
-}
+export default utils