lalala преди 6 години
родител
ревизия
bee397941e

+ 1 - 0
mobile-code/src/App.vue

@@ -8,6 +8,7 @@ export default {
 	globalData: {
 	globalData: {
 	},
 	},
 	onLaunch() {
 	onLaunch() {
+		uni.setStorageSync('source', 'mobile')
 		// this.getAllOptions()
 		// this.getAllOptions()
 		wxLoginFn()
 		wxLoginFn()
 		// #ifdef MP-WEIXIN
 		// #ifdef MP-WEIXIN

+ 18 - 18
mobile-code/src/components/App_uploader.vue

@@ -15,10 +15,10 @@
 						</li>
 						</li>
 				</div>
 				</div>
 				<div v-if='disableds'>
 				<div v-if='disableds'>
-					<li v-if="showImgList.length < num" class="uploadImg" 
+					<li v-if="showImgList.length < num" class="uploadImg"
 						:style="{ width: size + 'rpx', height: size + 'rpx' }">
 						:style="{ width: size + 'rpx', height: size + 'rpx' }">
 						<view class="iconfont">&#xe716;</view>
 						<view class="iconfont">&#xe716;</view>
-					</li>	
+					</li>
 				</div>
 				</div>
 				<!-- <li v-if="(showImgList.length < num)&&(disabled==false)" class="uploadImg" @click="chooseImage"
 				<!-- <li v-if="(showImgList.length < num)&&(disabled==false)" class="uploadImg" @click="chooseImage"
 					:style="{ width: size + 'rpx', height: size + 'rpx' }">
 					:style="{ width: size + 'rpx', height: size + 'rpx' }">
@@ -91,8 +91,8 @@ export default {
 		    showImgList: [],
 		    showImgList: [],
 			base64ImgList: [],
 			base64ImgList: [],
 			xssarr: ['data:', 'text', 'txt', 'html', 'js', 'css', 'json', 'exe', 'sql', 'xml', 'doc', 'docx'],
 			xssarr: ['data:', 'text', 'txt', 'html', 'js', 'css', 'json', 'exe', 'sql', 'xml', 'doc', 'docx'],
-			disableds:true,
-			http:this.$constant.formal
+			disableds: true,
+			http: this.$constant.formal
 		}
 		}
 	},
 	},
 	onLoad() {
 	onLoad() {
@@ -109,13 +109,13 @@ export default {
 			uni.removeStorageSync(this.saveStr)
 			uni.removeStorageSync(this.saveStr)
 		}
 		}
 		this.showImgList = [...this.imgList]
 		this.showImgList = [...this.imgList]
-		//this.showImgList = this.imgList
-		//console.log('组件',this.imgList)
+		// this.showImgList = this.imgList
+		// console.log('组件',this.imgList)
 	},
 	},
 	methods: {
 	methods: {
 		chooseImage: async function() {
 		chooseImage: async function() {
 			if (this.disabled) {
 			if (this.disabled) {
-				return 
+				return
 			}
 			}
 			let that = this
 			let that = this
 			let tempFilePaths = await that.getImage()
 			let tempFilePaths = await that.getImage()
@@ -134,7 +134,7 @@ export default {
 		    let base64ImgList = that.base64ImgList
 		    let base64ImgList = that.base64ImgList
 			let params = {}
 			let params = {}
 			if (base64ImgList.length === 1) {
 			if (base64ImgList.length === 1) {
-				//params['file[content]'] = base64ImgList[0]
+				// params['file[content]'] = base64ImgList[0]
 				params.coding = base64ImgList[0]
 				params.coding = base64ImgList[0]
 			} else {
 			} else {
 				base64ImgList.forEach((item, index) => {
 				base64ImgList.forEach((item, index) => {
@@ -157,15 +157,15 @@ export default {
 						that.showImgList.unshift(imgs)
 						that.showImgList.unshift(imgs)
 						let showing = that.showImgList
 						let showing = that.showImgList
 						let imgbox = []
 						let imgbox = []
-						showing.map((item,index)=>{
+						showing.map((item, index) => {
 							let imgs = {}
 							let imgs = {}
-							if(item.url){
-								imgs.url = item.url	
-								// imgs.urls = that.$constant.formal + item.url	
-							}else{
+							if (item.url) {
+								imgs.url = item.url
+								// imgs.urls = that.$constant.formal + item.url
+							} else {
 								imgs.url = item
 								imgs.url = item
-								// imgs.urls = that.$constant.formal +item	
-							}	
+								// imgs.urls = that.$constant.formal +item
+							}
 							imgbox.push(imgs)
 							imgbox.push(imgs)
 						})
 						})
 						that.showImgList = imgbox
 						that.showImgList = imgbox
@@ -292,7 +292,7 @@ export default {
 					// })
 					// })
 					continue
 					continue
 				}
 				}
-				//文件类型设置
+				// 文件类型设置
 				let spl = tempFiles[i].path.split('.')
 				let spl = tempFiles[i].path.split('.')
 				let fileType = spl[spl.length - 1]
 				let fileType = spl[spl.length - 1]
 				if (fileType && this.xssarr.indexOf(fileType) >= 0) {
 				if (fileType && this.xssarr.indexOf(fileType) >= 0) {
@@ -309,8 +309,8 @@ export default {
 			res.tempFiles = newtempFiles
 			res.tempFiles = newtempFiles
 			res.tempFilePaths = newtempFilePaths
 			res.tempFilePaths = newtempFilePaths
 			uni.showLoading({
 			uni.showLoading({
-					title: '图片上传中...',
-					mask: true
+				title: '图片上传中...',
+				mask: true
 			})
 			})
 			// console.log('过滤完了')
 			// console.log('过滤完了')
 		},
 		},

+ 72 - 0
mobile-code/src/components/app-swiper.vue

@@ -0,0 +1,72 @@
+<template>
+	<div class="swiper-wrap" :style="{'height': height}">
+		<swiper :indicator-dots="true" :autoplay="true" :interval="5000" :duration="150" class="tui-banner-swiper" :circular="true" indicator-color="#969696" indicator-active-color="#F04545">
+			<swiper-item v-for="(item, index) in data" :key="index" @tap.stop="detail">
+				<img src="./../static/images/swiper.png" class="tui-slide-image" mode="center" />
+			</swiper-item>
+		</swiper>
+	</div>
+</template>
+
+<script>
+export default {
+	name: 'app-swiper',
+	props: {
+		data: {
+			type: Array,
+			default: () => {
+				return [1, 2, 3]
+			}
+		},
+		height: {
+			type: String,
+			default: '200px'
+		}
+	},
+	data() {
+		return {
+
+		}
+	},
+	methods: {
+		detail(data) {
+			this.$emit('detail', data)
+		}
+	}
+}
+</script>
+
+<style lang="scss" scope>
+.swiper-wrap {
+	height: 480px;
+	.tui-banner-swiper {
+		height: 100%;
+	}
+	.tui-slide-image {
+		height: 100%;
+	}
+	/* #ifdef H5 */
+	/deep/.tui-banner-swiper .uni-swiper-dot {
+		width: 28rpx;
+		height: 8rpx;
+		display: inline-flex;
+		background: none;
+		justify-content: space-between;
+	}
+
+	/deep/.tui-banner-swiper .uni-swiper-dot::before {
+		content: '';
+		flex-grow: 1;
+		background: #969696;
+		border-radius: 16rpx;
+		overflow: hidden;
+	}
+
+	/deep/.tui-banner-swiper .uni-swiper-dot-active::before {
+		background: #F04545;
+	}
+
+	/* #endif */
+}
+
+</style>

+ 4 - 1
mobile-code/src/constant/index.js

@@ -2,7 +2,10 @@
 const envVal = {
 const envVal = {
 	imgUrl: 'https://wximg.meijiabang.com/hkds/miniapp/images/',
 	imgUrl: 'https://wximg.meijiabang.com/hkds/miniapp/images/',
 	env: process.env.NODE_ENV,
 	env: process.env.NODE_ENV,
-	formal: process.env.NODE_ENV == 'development' ? 'http://m.huaml.com' : `${window.location.protocol}//${window.location.host}`
+	// 本地连接地址
+	formal: process.env.NODE_ENV == 'development' ? 'http://m.huaml.com' : `${window.location.protocol}//${window.location.host}`,
+	// 请求接口地址
+	hostUrl: process.env.NODE_ENV == 'development' ? 'http://mobile.huaml.com' : `${window.location.protocol}//mobile.huaml.com`
 }
 }
 
 
 export default envVal
 export default envVal

+ 3 - 3
mobile-code/src/manifest.json

@@ -34,15 +34,15 @@
         "template" : "template.h5.html",
         "template" : "template.h5.html",
         "router" : {
         "router" : {
             // "mode" : "history",
             // "mode" : "history",
-            "base" : "/mobile",
-            "publicPath" : "/mobile"
+            "base" : "/",
+            "publicPath" : "/"
         },
         },
         "devServer": {
         "devServer": {
             "host": "bd.meijiabang.com",
             "host": "bd.meijiabang.com",
             "port": 80,
             "port": 80,
             "proxy": {
             "proxy": {
                 "/api": {
                 "/api": {
-                    "target": "http://m.huaml.com",
+                    "target": "http://mobile.huaml.com",
                     "secure": false,
                     "secure": false,
                     "changeOrigin": true,
                     "changeOrigin": true,
                     "pathRewrite": {
                     "pathRewrite": {

+ 22 - 8
mobile-code/src/pages/pay/index.vue

@@ -8,29 +8,34 @@
 <script>
 <script>
 import { getMiniAppUrl } from '@/utils/common'
 import { getMiniAppUrl } from '@/utils/common'
 import { getCheckLogin } from '@/utils/auth'
 import { getCheckLogin } from '@/utils/auth'
+import wexinPay from '@/utils/pay/wxPay'
 import { pay } from '@/api/pay'
 import { pay } from '@/api/pay'
 import { oauth } from '@/api/login'
 import { oauth } from '@/api/login'
 export default {
 export default {
 	name: 'pay',
 	name: 'pay',
 	data() {
 	data() {
 		return {
 		return {
+			constant: this.$constant,
 			option: '',
 			option: '',
-			amount: 0
+			amount: 10
 		}
 		}
 	},
 	},
 	onLoad(option) {
 	onLoad(option) {
-		this.option = option
-		console.log(getMiniAppUrl(option, true))
+		this.option = this.$util.isEmpty(option) || {
+			account: 12358,
+			shopId: 15680
+		}
 		this.init()
 		this.init()
 	},
 	},
 	methods: {
 	methods: {
 		init() {
 		init() {
 			getCheckLogin().then(res => {
 			getCheckLogin().then(res => {
 				if (!res) {
 				if (!res) {
-					let params = {
-						suffixUrl: getMiniAppUrl(this.option, true)
-					}
-					oauth(params).then(res => {})
+					// let params = {
+					// 	suffixUrl: getMiniAppUrl(this.option, true)
+					// }
+					// oauth(params).then(res => {})
+					location.href = `${this.constant.hostUrl}/auth/prepare?url=${encodeURIComponent(getMiniAppUrl(this.option, true))}`
 				}
 				}
 			})
 			})
 		},
 		},
@@ -38,12 +43,21 @@ export default {
 			let params = {
 			let params = {
 				prePrice: this.amount,
 				prePrice: this.amount,
 				sourceType: 1,
 				sourceType: 1,
-				shopId: 20
+				shopId: 15680
 			}
 			}
 			pay(params).then(res => {
 			pay(params).then(res => {
 				console.log(res)
 				console.log(res)
+				wexinPay(res.data, this.paySuccess, this.payFail)
+				console.log(wexinPay)
 				// window.location.href = res.data.pay_button.mweb_url
 				// window.location.href = res.data.pay_button.mweb_url
 			})
 			})
+		},
+		// 支付成功
+		paySuccess() {
+			alert('支付成功!')
+		},
+		payFail() {
+			alert('支付失败!')
 		}
 		}
 	}
 	}
 }
 }

+ 6 - 4
mobile-code/src/pages/shop/index.vue

@@ -1,16 +1,18 @@
 <template>
 <template>
 	<div class="app-content">
 	<div class="app-content">
-
-		<app-footer :activeIndex="2" />
+		<app-swiper />
+		<!-- <app-footer :activeIndex="2" /> -->
 	</div>
 	</div>
 </template>
 </template>
 
 
 <script>
 <script>
-import appFooter from '@/components/app-footer'
+// import appFooter from '@/components/app-footer'
+import AppSwiper from '@/components/app-swiper'
 export default {
 export default {
 	name: 'category',
 	name: 'category',
 	components: {
 	components: {
-		appFooter
+		// appFooter,
+		AppSwiper
 	},
 	},
 	data() {
 	data() {
 		return {}
 		return {}

+ 14 - 10
mobile-code/src/plugins/luch-request_0.0.7/request.js

@@ -14,10 +14,10 @@ const Base64 = require('js-base64').Base64
 class Request {
 class Request {
 	config = {
 	config = {
 		// #ifdef H5
 		// #ifdef H5
-		baseUrl: process.env.NODE_ENV == 'development' ? '/api' : constant.formal,
+		baseUrl: process.env.NODE_ENV == 'development' ? '/api' : constant.hostUrl,
 		// #endif
 		// #endif
 		// #ifdef MP-WEIXIN
 		// #ifdef MP-WEIXIN
-		baseUrl: constant.formal,
+		baseUrl: constant.hostUrl,
 		// #endif
 		// #endif
 		header: {
 		header: {
 			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
 			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
@@ -59,8 +59,11 @@ class Request {
 			console.error(e, '获取token异常')
 			console.error(e, '获取token异常')
 		}
 		}
 		config.header = {
 		config.header = {
-			...config.header,
-			token // 将token 放入header
+			...config.header
+		}
+		// 将token 放入header
+		if (token) {
+			config.header['token'] = token
 		}
 		}
 		// const token = uni.getStorageSync('token')
 		// const token = uni.getStorageSync('token')
 		// config.data = JSON.stringify(config.data);
 		// config.data = JSON.stringify(config.data);
@@ -84,7 +87,7 @@ class Request {
 		}
 		}
 		const source = uni.getStorageSync('source') || null
 		const source = uni.getStorageSync('source') || null
 		if (source) {
 		if (source) {
-			config.header['source'] = account
+			config.header['source'] = source
 		}
 		}
 		if (config.config.loading) {
 		if (config.config.loading) {
 			uni.showLoading({
 			uni.showLoading({
@@ -99,11 +102,11 @@ class Request {
 		if (response.config.config.loading) {
 		if (response.config.config.loading) {
 			uni.hideLoading()
 			uni.hideLoading()
 		}
 		}
-		const client_hash = response.header.client_hash || null
+		// const client_hash = response.header.client_hash || null
 		// console.log('X-Client-Hash', response.header['X-Client-Hash'])
 		// console.log('X-Client-Hash', response.header['X-Client-Hash'])
-		if (client_hash) {
-			uni.setStorageSync('client_hash', client_hash)
-		}
+		// if (client_hash) {
+		// 	uni.setStorageSync('client_hash', client_hash)
+		// }
 		return response
 		return response
 	}
 	}
 
 
@@ -136,7 +139,8 @@ class Request {
 					resolve(response.data)
 					resolve(response.data)
 				}
 				}
 				if (statusCode === 200) { // 成功
 				if (statusCode === 200) { // 成功
-					if (response.data.status === 'success') {
+					console.log('response', response)
+					if (response.data.code === 'A0001') {
 						resolve(response.data)
 						resolve(response.data)
 					} else {
 					} else {
 						// 无权限或者登录过期
 						// 无权限或者登录过期

BIN
mobile-code/src/static/images/swiper.png


+ 1 - 1
mobile-code/src/utils/common.js

@@ -66,7 +66,7 @@ export function getMiniAppUrl(data = {}, isPath = false) {
 	console.log(getCurPagesObj)
 	console.log(getCurPagesObj)
 	// let getRoute = getCurPagesObj.route + queryData(getCurPagesObj.options)
 	// let getRoute = getCurPagesObj.route + queryData(getCurPagesObj.options)
 	let getRoute = getCurPagesObj.route + queryData(data)
 	let getRoute = getCurPagesObj.route + queryData(data)
-	getRoute = isPath ? `#/${getRoute}` : getRoute
+	getRoute = isPath ? `${CONSTANT.formal}/#/${getRoute}` : getRoute
 
 
 	return getRoute
 	return getRoute
 }
 }