1.提交代码 改版H5

yj-dev
杨杰 4 years ago
parent e894ce24f6
commit 9eee0ab595
  1. 12
      App.vue
  2. 9
      Utils/Api.js
  3. 1
      components/Authorize.vue
  4. 2
      components/uni-data-picker/components/uni-data-picker/keypress.js
  5. 3
      main.js
  6. 87
      manifest.json
  7. 21
      node_modules/vue-jsonp/LICENSE
  8. 153
      node_modules/vue-jsonp/README.md
  9. 73
      node_modules/vue-jsonp/dist/index.d.ts
  10. 8
      node_modules/vue-jsonp/dist/index.esm.js
  11. 8
      node_modules/vue-jsonp/dist/index.js
  12. 20
      node_modules/vue-jsonp/dist/utils/index.d.ts
  13. 80
      node_modules/vue-jsonp/package.json
  14. 11
      package-lock.json
  15. 28
      pages/tabBar/category/category.vue
  16. 94
      pages/tabBar/home/home.vue
  17. 14
      pages/tabBar/user/user.vue

@ -5,13 +5,13 @@
// brestUrl: 'http://192.168.3.4:9302/brest', // brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/', // imgUrl: 'https://192.168.3.4:9301/filesystem/',
// //
url: 'https://hsg.dctpay.com/crest', // url: 'https://hsg.dctpay.com/crest',
imgUrl: 'https://hsg.dctpay.com/filesystem/', // imgUrl: 'https://hsg.dctpay.com/filesystem/',
brestUrl : 'https://hsg.dctpay.com/brest', // brestUrl : 'https://hsg.dctpay.com/brest',
// //
// url: 'https://hsgcs.dctpay.com/crest', url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest', brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/', imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
userInfo: "", userInfo: "",
brestUserInfo : '', brestUserInfo : '',

@ -132,8 +132,13 @@ export const getStoreList = params => {
return POST('GET', `${base}/highMerchantStore/getStoreList`, params).then(res => res.data); return POST('GET', `${base}/highMerchantStore/getStoreList`, params).then(res => res.data);
} }
/**
* H5 获取用户信息
*/
//搜索门店
export const getH5UserInfo = params => {
return POST('GET', `${base}/wechat/getH5UserInfo`, params).then(res => res.data);
}
//**门店// //**门店//

@ -128,6 +128,7 @@
}, },
getH5userinfo(){ getH5userinfo(){
console.log('[=========]') console.log('[=========]')
location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_userinfo#wechat_redirect';
}, },
close() { close() {
uni.reLaunch({ uni.reLaunch({

@ -37,7 +37,7 @@ export default {
} }
document.addEventListener('keyup', listener) document.addEventListener('keyup', listener)
this.$once('hook:beforeDestroy', () => { this.$once('hook:beforeDestroy', () => {
document.removeEventListener('keyup', listener) // document.removeEventListener('keyup', listener)
}) })
}, },
render: () => {} render: () => {}

@ -1,9 +1,10 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App' import App from './App'
// import api from './Utils/Api.js' // import api from './Utils/Api.js'
import {VueJsonp} from 'vue-jsonp'
Vue.config.productionTip = false Vue.config.productionTip = false
// Vue.prototype.api = api; // Vue.prototype.api = api;
Vue.use(VueJsonp)
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({

@ -1,33 +1,33 @@
{ {
"name" : "嗨森逛", "name": "嗨森逛",
"appid" : "__UNI__E807B53", "appid": "__UNI__E807B53",
"description" : "", "description": "",
"versionName" : "1.2.0", "versionName": "1.2.0",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
"app-plus" : { "app-plus": {
"usingComponents" : true, //``true`` `template` "usingComponents": true, //``true`` `template`
"softinput" : { "softinput": {
"navBar" : "none" // "navBar": "none" //
}, },
/* 5+App */ /* 5+App */
"splashscreen" : { "splashscreen": {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender": true,
"waiting" : true, "waiting": true,
"autoclose" : true, "autoclose": true,
"delay" : 0 "delay": 0
}, },
"modules" : { "modules": {
"Share" : {}, "Share": {},
"OAuth" : {} "OAuth": {}
}, },
/* */ /* */
"distribute" : { "distribute": {
"orientation" : [ "portrait-primary" ], "orientation": ["portrait-primary"],
/* */ /* */
"android" : { "android": {
/* android */ /* android */
"permissions" : [ "permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
@ -52,43 +52,44 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
"ios" : {}, "ios": {},
/* ios */ /* ios */
"sdkConfigs" : {} "sdkConfigs": {}
} }
}, },
/* SDK */ /* SDK */
"quickapp" : {}, "quickapp": {},
/* */ /* */
"mp-weixin" : { "mp-weixin": {
/* */ /* */
"appid" : "wx8d49e2f83025229d", "appid": "wx8d49e2f83025229d",
"setting" : { "setting": {
"urlCheck" : true "urlCheck": true
}, },
"permission" : { "permission": {
"scope.userLocation" : { "scope.userLocation": {
"desc" : "你的位置信息将用于小程序定位" "desc": "你的位置信息将用于小程序定位"
} }
} }
}, },
"h5" : { "h5": {
"sdkConfigs" : { "sdkConfigs": {
"maps" : { "maps": {
"qqmap" : { "qqmap": {
"key" : "7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB" "key": "7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB"
} }
} }
}, },
"title" : "嗨森逛", "title": "嗨森逛",
"router" : { "router": {
"mode" : "hash" "mode": "hash",
"base": "/H5/"
}, },
"devServer" : { "devServer" : {
"port" : "", "port" : "",
"https" : false "https" : true
}, },
"domain" : "https://hsg.dctpay.com", "domain": "https://hsgcs.dctpay.com",
"template" : "" "template": ""
} }
} }

21
node_modules/vue-jsonp/LICENSE generated vendored

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 LancerComet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

153
node_modules/vue-jsonp/README.md generated vendored

@ -0,0 +1,153 @@
# Vue-jsonp
[![VueJsonp](https://github.com/LancerComet/vue-jsonp/workflows/Test/badge.svg)](https://github.com/LancerComet/vue-jsonp/actions)
A tiny library for handling JSONP request.
## Quick Start
As Vue plugin:
```ts
import { VueJsonp } from 'vue-jsonp'
// Vue Plugin.
Vue.use(VueJsonp)
// Now you can use this.$jsonp in Vue components.
const vm = new Vue()
vm.$jsonp('/some-jsonp-url', {
myCustomUrlParam: 'veryNice'
})
```
Use function directly:
```ts
import { jsonp } from 'vue-jsonp'
jsonp('/some-jsonp-url', {
myCustomUrlParam: 'veryNice'
})
```
## Send data and set query & function name
### Send data
```ts
// The request url will be "/some-jsonp-url?name=LancerComet&age=100&callback=jsonp_{RANDOM_STR}".
jsonp('/some-jsonp-url', {
name: 'LancerComet',
age: 100
})
```
### Custom query & function name
The url uniform is `/url?{callbackQuery}={callbackName}&...`, the default is `/url?callback=jsonp_{RANDOM_STRING}&...`.
And you can change it like this:
```ts
// The request url will be "/some-jsonp-url?name=LancerComet&age=100&cb=jsonp_func".
jsonp('/some-jsonp-url', {
callbackQuery: 'cb',
callbackName: 'jsonp_func',
name: 'LancerComet',
age: 100
})
```
## Module exports
- `VueJsonp: PluginObject<never>`
- `jsonp<T>: (url: string, param?: IJsonpParam, timeout?: number) => Promise<T>`
## API
### IJsonpParam
IJsonpParam is the type of param for jsonp function.
```ts
/**
* JSONP parameter declaration.
*/
interface IJsonpParam {
/**
* Callback query name.
* This param is used to define the query name of the callback function.
*
* @example
* // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
* jsonp('/some-url', {
* callbackQuery: 'myCallback',
* callbackName: 'jsonp_func',
* myCustomUrlParam: 'veryNice'
* })
*
* @default callback
*/
callbackQuery?: string
/**
* Callback function name.
* This param is used to define the jsonp function name.
*
* @example
* // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
* jsonp('/some-url', {
* callbackQuery: 'myCallback',
* callbackName: 'jsonp_func',
* myCustomUrlParam: 'veryNice'
* })
*
* @default jsonp_ + randomStr()
*/
callbackName?: string
/**
* Custom data.
*/
[key: string]: any
}
```
## Example
```ts
import Vue from 'vue'
import { VueJsonp } from 'vue-jsonp'
Vue.use(VueJsonp)
const vm = new Vue()
const { code, data, message } = await vm.$jsonp<{
code: number,
message: string,
data: {
id: number,
nickname: string
}
}>('/my-awesome-url', {
name: 'MyName', age: 20
})
assert(code === 0)
assert(message === 'ok')
assert(data.id === 1)
assert(data.nickname === 'John Smith')
```
```ts
import { jsonp } from 'vue-jsonp'
const result = await jsonp<string>('/my-awesome-url')
assert(result === 'such a jsonp')
```
## License
MIT

@ -0,0 +1,73 @@
/**
* Vue Jsonp.
* # Carry Your World #
*
* @author: LancerComet
* @license: MIT
*/
import { PluginObject } from 'vue/types/plugin';
declare module 'vue/types/vue' {
interface Vue {
$jsonp: typeof jsonp;
}
}
/**
* Vue JSONP.
*/
declare const VueJsonp: PluginObject<never>;
/**
* JSONP function.
*
* @param { string } url Target URL address.
* @param { IJsonpParam } param Querying params object.
* @param { number } timeout Timeout setting (ms).
*
* @example
* jsonp('/url', {
* callbackQuery: ''
* callbackName: '',
* name: 'LancerComet',
* age: 26
* }, 1000)
*/
declare function jsonp<T = any>(url: string, param?: IJsonpParam, timeout?: number): Promise<T>;
export { VueJsonp, jsonp };
/**
* JSONP parameter declaration.
*/
interface IJsonpParam {
/**
* Callback query name.
* This param is used to define the query name of the callback function.
*
* @example
* // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
* jsonp('/some-url', {
* callbackQuery: 'myCallback',
* callbackName: 'jsonp_func',
* myCustomUrlParam: 'veryNice'
* })
*
* @default callback
*/
callbackQuery?: string;
/**
* Callback function name.
* This param is used to define the jsonp function name.
*
* @example
* // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
* jsonp('/some-url', {
* callbackQuery: 'myCallback',
* callbackName: 'jsonp_func',
* myCustomUrlParam: 'veryNice'
* })
*
* @default jsonp_ + randomStr()
*/
callbackName?: string;
/**
* Custom data.
*/
[key: string]: any;
}

@ -0,0 +1,8 @@
function e(t,n){t=t.replace(/=/g,"");var o=[];switch(n.constructor){case String:case Number:case Boolean:o.push(encodeURIComponent(t)+"="+encodeURIComponent(n));break;case Array:n.forEach((function(n){o=o.concat(e(t+"[]=",n))}));break;case Object:Object.keys(n).forEach((function(r){var a=n[r];o=o.concat(e(t+"["+r+"]",a))}))}return o}function t(e){var n=[];return e.forEach((function(e){"string"==typeof e?n.push(e):n=n.concat(t(e))})),n}
/**
* Vue Jsonp.
* # Carry Your World #
*
* @author: LancerComet
* @license: MIT
*/var n={install:function(e){e.prototype.$jsonp=o}};function o(n,o,r){if(void 0===o&&(o={}),"string"!=typeof n)throw new Error('[Vue-jsonp] Type of param "url" is not string.');if("object"!=typeof o||!o)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return r="number"==typeof r?r:5e3,new Promise((function(a,c){var u="string"==typeof o.callbackQuery?o.callbackQuery:"callback",i="string"==typeof o.callbackName?o.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);o[u]=i,delete o.callbackQuery,delete o.callbackName;var s=[];Object.keys(o).forEach((function(t){s=s.concat(e(t,o[t]))}));var l=t(s).join("&"),f=function(){p(),clearTimeout(m),c({status:400,statusText:"Bad Request"})},p=function(){b.removeEventListener("error",f)},d=function(){document.body.removeChild(b),delete window[i]},m=null;r>-1&&(m=setTimeout((function(){p(),d(),c({statusText:"Request Timeout",status:408})}),r)),window[i]=function(e){clearTimeout(m),p(),d(),a(e)};var b=document.createElement("script");b.addEventListener("error",f),b.src=n+(/\?/.test(n)?"&":"?")+l,document.body.appendChild(b)}))}export{n as VueJsonp,o as jsonp};

@ -0,0 +1,8 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueJsonp={})}(this,(function(e){"use strict";function t(e,o){e=e.replace(/=/g,"");var n=[];switch(o.constructor){case String:case Number:case Boolean:n.push(encodeURIComponent(e)+"="+encodeURIComponent(o));break;case Array:o.forEach((function(o){n=n.concat(t(e+"[]=",o))}));break;case Object:Object.keys(o).forEach((function(r){var c=o[r];n=n.concat(t(e+"["+r+"]",c))}))}return n}function o(e){var t=[];return e.forEach((function(e){"string"==typeof e?t.push(e):t=t.concat(o(e))})),t}
/**
* Vue Jsonp.
* # Carry Your World #
*
* @author: LancerComet
* @license: MIT
*/var n={install:function(e){e.prototype.$jsonp=r}};function r(e,n,r){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error('[Vue-jsonp] Type of param "url" is not string.');if("object"!=typeof n||!n)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return r="number"==typeof r?r:5e3,new Promise((function(c,a){var i="string"==typeof n.callbackQuery?n.callbackQuery:"callback",s="string"==typeof n.callbackName?n.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);n[i]=s,delete n.callbackQuery,delete n.callbackName;var u=[];Object.keys(n).forEach((function(e){u=u.concat(t(e,n[e]))}));var f=o(u).join("&"),l=function(){p(),clearTimeout(b),a({status:400,statusText:"Bad Request"})},p=function(){m.removeEventListener("error",l)},d=function(){document.body.removeChild(m),delete window[s]},b=null;r>-1&&(b=setTimeout((function(){p(),d(),a({statusText:"Request Timeout",status:408})}),r)),window[s]=function(e){clearTimeout(b),p(),d(),c(e)};var m=document.createElement("script");m.addEventListener("error",l),m.src=e+(/\?/.test(e)?"&":"?")+f,document.body.appendChild(m)}))}e.VueJsonp=n,e.jsonp=r,Object.defineProperty(e,"__esModule",{value:!0})}));

@ -0,0 +1,20 @@
/**
* Generate random string.
*
* @return { string }
*/
declare function randomStr(): string;
/**
* Format params into querying string.
*
* @return {string[]}
*/
declare function formatParams(queryKey: string, value: any): string[];
/**
* Flat querys.
*
* @param {string[] | (string[])[]} array
* @returns
*/
declare function flatten(array: string[] | (string[])[]): string[];
export { formatParams, flatten, randomStr };

@ -0,0 +1,80 @@
{
"_from": "vue-jsonp",
"_id": "vue-jsonp@2.0.0",
"_inBundle": false,
"_integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA==",
"_location": "/vue-jsonp",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "vue-jsonp",
"name": "vue-jsonp",
"escapedName": "vue-jsonp",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
"_shasum": "3bfac56bb72941a2511c11e1a123b876f03427f7",
"_spec": "vue-jsonp",
"_where": "C:\\Users\\Administrator\\Documents\\high-mini",
"author": {
"name": "LancerComet",
"email": "chw644@hotmail.com"
},
"bugs": {
"url": "https://github.com/LancerComet/vue-jsonp/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A tiny library for handling JSONP request.",
"devDependencies": {
"@types/expect-puppeteer": "^4.4.3",
"@types/jest": "^26.0.14",
"@types/jest-environment-puppeteer": "^4.4.0",
"@types/puppeteer": "^3.0.2",
"jest": "^26.4.2",
"jest-puppeteer": "^4.4.0",
"puppeteer": "^5.3.1",
"rollup": "^2.28.2",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.27.3",
"ts-jest": "^26.4.1",
"tslint": "^6.1.3",
"typescript": "^4.0.3",
"vue": "^2.6.12"
},
"files": [
"dist/",
"index.d.ts",
"README.md"
],
"homepage": "https://github.com/LancerComet/vue-jsonp#readme",
"keywords": [
"Vue",
"JSONP"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"name": "vue-jsonp",
"repository": {
"type": "git",
"url": "git+https://github.com/LancerComet/vue-jsonp.git"
},
"scripts": {
"build": "rollup -c",
"prepublish": "npm run test",
"pretest": "npm run build",
"preversion": "npm run test",
"test": "jest"
},
"version": "2.0.0"
}

11
package-lock.json generated

@ -0,0 +1,11 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"vue-jsonp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
"integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
}
}
}

@ -98,7 +98,7 @@
methods: { methods: {
postionIng() { postionIng() {
uni.showLoading({ uni.showLoading({
title: '加载中'
}) })
let that = this; let that = this;
uni.getLocation({ uni.getLocation({
@ -106,6 +106,10 @@
success: function(res) { success: function(res) {
app.globalData.latitude = res.latitude; app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude; app.globalData.longitude = res.longitude;
// #ifdef H5
that.getUserLocation(res.longitude, res.latitude);
// #endif
// #ifdef MP
uni.request({ uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', ',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
@ -119,9 +123,31 @@
uni.hideLoading() uni.hideLoading()
} }
}) })
// #endif
} }
}) })
}, },
//
getUserLocation(long, lat) {
let vm = this;
let url = 'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
let locationObj = lat + ',' + long;
this.$jsonp(url, {
key: '7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
location: locationObj
})
.then(res => {
vm.city = res.result.address_component.city.replace(/市/g,
'');
app.globalData.cityId = res.result.ad_info.adcode;
vm.getMerchantList();
uni.hideLoading()
})
.catch(err => {
uni.hideLoading()
console.log(err);
});
},
// //
getMerchantList() { getMerchantList() {
uni.showLoading({ uni.showLoading({

@ -60,7 +60,7 @@
<view class="mart10">暂无数据</view> <view class="mart10">暂无数据</view>
</view> </view>
<view class="product-list"> <view class="product-list">
<view class="product" v-for="product in productList" :key="product.id" @tap="toGoods(product.id)"> <view class="product" v-for="product in productList" :key="product.id" @click="toGoods(product.id)">
<image mode="widthFix" :src="imageUrl+product.couponImg"></image> <image mode="widthFix" :src="imageUrl+product.couponImg"></image>
<view class="name">{{ product.couponName }}</view> <view class="name">{{ product.couponName }}</view>
<view class="info"> <view class="info">
@ -112,7 +112,8 @@
import { import {
HandleCode, HandleCode,
WXlogin, WXlogin,
getCouponList getCouponList,
getH5UserInfo
} from "../../../Utils/Api.js"; //api } from "../../../Utils/Api.js"; //api
let app = getApp(); let app = getApp();
export default { export default {
@ -161,35 +162,25 @@
}, },
//page.json"onReachBottomDistance" //page.json"onReachBottomDistance"
onReachBottom() { onReachBottom() {
// uni.showToast({
// title: ''
// });
// let len = this.productList.length;
// if (len >= 40) {
// this.loadingText = '';
// return false;
// }
// ,,ajax
// let end_goods_id = this.productList[len - 1].goods_id;
// for (let i = 1; i <= 10; i++) {
// let goods_id = end_goods_id + i;
// let p = {
// goods_id: goods_id,
// img: '/static/img/goods/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
// name: '100',
// price: '168',
// slogan: '1235'
// };
// this.productList.push(p);
// }
}, },
authColse() { authColse() {
},
onShow() {
// #ifdef H5
var arr1 = window.location.href;
var arr2 = arr1.split('=');
if (!app.globalData.userInfo && arr2[1] !=undefined) {
this.getH5UserInfo(arr2[1]);
}
// #endif
}, },
onLoad() { onLoad() {
// 1.wxcode // 1.wxcode
// #ifdef MP
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: function(loginRes) { success: function(loginRes) {
@ -205,6 +196,7 @@
}) })
}, },
}) })
// #endif
// //
this.postionIng(); this.postionIng();
uni.getStorage({ uni.getStorage({
@ -236,6 +228,8 @@
success: function(res) { success: function(res) {
app.globalData.latitude = res.latitude; app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude; app.globalData.longitude = res.longitude;
that.getUserLocation(res.longitude, res.latitude);
// #ifdef MP
uni.request({ uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude +
',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', ',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
@ -253,8 +247,62 @@
uni.hideLoading() uni.hideLoading()
} }
}) })
//#endif
}
})
},
//H5
getH5UserInfo(item) {
let params = {
code: item
}
getH5UserInfo(params).then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data
.object
.highUser;
app.globalData.token = res.return_data.uniqueCode;
that.isShowAuth = false
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data.uniqueCode
})
} else {
uni.showToast({
title: res.return_msg
})
} }
});
},
//
getUserLocation(long, lat) {
let vm = this;
let url =
'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
let locationObj = lat + ',' + long;
this.$jsonp(url, {
key: '7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB',
location: locationObj
}) })
.then(res => {
vm.city = res.result.address_component.city.replace(/市/g,
'');
app.globalData.cityId = res.result.ad_info.adcode;
vm.getCouponListArea();
vm.getCouponListgold();
uni.hideLoading()
})
.catch(err => {
uni.hideLoading()
console.log(err);
});
}, },
// //
toScan() { toScan() {

@ -1,9 +1,11 @@
<template> <template>
<view> <view>
<!-- #ifdef H5 -->
<view v-if="showHeader" class="status" :style="{position:headerPosition,top:statusTop}"></view> <view v-if="showHeader" class="status" :style="{position:headerPosition,top:statusTop}"></view>
<view v-if="showHeader" class="header" :style="{position:headerPosition,top:headerTop}"></view> <view v-if="showHeader" class="header" :style="{position:headerPosition,top:headerTop}"></view>
<!-- 占位 --> <!-- 占位 -->
<view v-if="showHeader" class="place"></view> <view v-if="showHeader" class="place"></view>
<!-- #endif -->
<view class="user"> <view class="user">
<!-- 头像 --> <!-- 头像 -->
<view class="left"> <view class="left">
@ -93,7 +95,7 @@
</view> </view>
<!-- 占位 --> <!-- 占位 -->
<view class="place-bottom"></view> <view class="place-bottom"></view>
<!-- <authorize></authorize> --> <authorize></authorize>
</view> </view>
</template> </template>
<script> <script>
@ -198,13 +200,9 @@
}, },
onLoad() { onLoad() {
this.statusHeight = 0; this.statusHeight = 0;
// #ifdef APP-PLUS // #ifdef H5
this.showHeader = false; this.showHeader = true;
this.statusHeight = plus.navigator.getStatusbarHeight(); // this.statusHeight = plus.navigator.getStatusbarHeight();
// #endif
// #ifdef MP
this.showHeader = false;
this.statusHeight = plus.navigator.getStatusbarHeight();
// #endif // #endif
}, },
onReady() { onReady() {

Loading…
Cancel
Save