Commit e8c31a8e by 李嘉林

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents be7aa12c 09b7fa38
...@@ -11,9 +11,9 @@ export default { ...@@ -11,9 +11,9 @@ export default {
process.env.NODE_ENV == "production" || process.env.NODE_ENV == "production" ||
JSON.stringify(extConfig) == "{}" JSON.stringify(extConfig) == "{}"
) { ) {
// extConfig = { mixid: "jordan", shopid: 471 }; extConfig = { mixid: "antgood", shopid: 67 };
extConfig = { "mixid":"xyyx", // extConfig = { "mixid":"xyyx",
"shopid":133 }; // "shopid":133 };
} }
console.log("1444444444", extConfig); console.log("1444444444", extConfig);
this.$store.commit("setExtConfig", extConfig.mixid); this.$store.commit("setExtConfig", extConfig.mixid);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<banner :datas="item"></banner> <banner :datas="item"></banner>
</div> </div>
<div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;"> <div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;">
<goods-list class="goodsListItem" :datas="item"></goods-list> <goods-list :class="'goodsListItem' + index" :datas="item"></goods-list>
</div> </div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1"> <div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation> <area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<share-picture :datas="item"></share-picture> <share-picture :datas="item"></share-picture>
</div> </div>
<div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1"> <div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1">
<merchants-list class="goodsListItem" :datas="item"></merchants-list> <merchants-list :class="'merchants-list' +index" :datas="item"></merchants-list>
</div> </div>
<div v-if="item.componentCode == 'spell-group' && item.componentInfo.visible == 1"> <div v-if="item.componentCode == 'spell-group' && item.componentInfo.visible == 1">
<spell-group :datas="item"></spell-group> <spell-group :datas="item"></spell-group>
...@@ -262,9 +262,12 @@ export default { ...@@ -262,9 +262,12 @@ export default {
}, },
scrolls(el){ scrolls(el){
// this.setFooterShow(el); // this.setFooterShow(el);
if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){ // if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
this.$mp.page.selectComponent(".goodsListItem").getScroll(el); // this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
} // }
// if(this.$mp.page && this.$mp.page.selectComponent(".merchants-list")){
// this.$mp.page.selectComponent(".merchants-list").getScroll(el);
// }
if (this.pageData) { if (this.pageData) {
for (let i = 0; i < this.pageData.length; i++) { for (let i = 0; i < this.pageData.length; i++) {
const element = this.pageData[i] const element = this.pageData[i]
...@@ -272,6 +275,15 @@ export default { ...@@ -272,6 +275,15 @@ export default {
let com=this.$mp.page.selectComponent(".time-limited-discount"+i) ; let com=this.$mp.page.selectComponent(".time-limited-discount"+i) ;
com && com.getScroll(el); com && com.getScroll(el);
} }
if(element.componentCode=="goods-list"){
let com=this.$mp.page.selectComponent(".goodsListItem"+i) ;
com && com.getScroll(el);
}
if(element.componentCode=="merchants-list"){
let com=this.$mp.page.selectComponent(".merchants-list"+i) ;
com && com.getScroll(el);
}
} }
......
...@@ -82,13 +82,16 @@ export default { ...@@ -82,13 +82,16 @@ export default {
this.options = options; this.options = options;
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
let op=wx.getStorageSync("openid")
if (op) {
this.params += '&open_id='+wx.getStorageSync("openid");
this.withoutScene = true; this.withoutScene = true;
}else{
//获取openId //获取openId
wx.login({ wx.login({
success: res => { success: res => {
this.code = res.code; this.code = res.code;
login.miniLogin({ code: this.code}).then(res1 => { login.miniLogin({ code: this.code}).then(res1 => {
console.log(res1,555555)
if (res1.data.code == 200) { if (res1.data.code == 200) {
wx.setStorage({ wx.setStorage({
key: "openid", key: "openid",
...@@ -96,10 +99,11 @@ export default { ...@@ -96,10 +99,11 @@ export default {
}); });
} }
this.params += '&open_id='+wx.getStorageSync("openid"); this.params += '&open_id='+wx.getStorageSync("openid");
console.log(this.code,77777,this.params) this.withoutScene = true;
}) })
}, },
}) })
}
// 移除重复参数 // 移除重复参数
if (options.params) { if (options.params) {
let params=decodeURIComponent(options.params) let params=decodeURIComponent(options.params)
......
...@@ -20,7 +20,10 @@ export let themeColor = { ...@@ -20,7 +20,10 @@ export let themeColor = {
// 获取link 中页面地址(link兼容 有object或者string) // 获取link 中页面地址(link兼容 有object或者string)
export function getUrlofLink(data) { export function getUrlofLink(data) {
return data.link return data.link.split('?')[0]
}
export function getUrlofQuery(data) {
return data.link.split('?')[1] || ''
} }
// 全局跳转 data:link数据 option:是否为底部栏触发 // 全局跳转 data:link数据 option:是否为底部栏触发
......
...@@ -162,34 +162,57 @@ Component({ ...@@ -162,34 +162,57 @@ Component({
}, },
getScroll(el) { getScroll(el) {
let _this = this let _this = this
this.createSelectorQuery().select("#ItemModule0").boundingClientRect(function(res){ let query = wx.createSelectorQuery().in(this)
let { windowHeight } = wx.getSystemInfoSync()
query.select("#ItemModule0").boundingClientRect(function(res){
if(res){ if(res){
let scrollTop = parseInt(el.scrollTop); // let scrollTop = parseInt(el.scrollTop);
let domHeight = parseInt(res.height); // let domHeight = parseInt(res.height);
if ( if (res.top < windowHeight && res.top + res.height > 0 && _this.data.finished == false) {
scrollTop + _this.data.clientHeight >= domHeight - 150 &&
_this.data.finished == false
) {
_this.loadHandle(2); _this.loadHandle(2);
} }
// if (
// scrollTop + _this.data.clientHeight >= domHeight - 150 &&
// _this.data.finished == false
// ) {
// console.log(scrollTop + _this.data.clientHeight, '44444444444')
// _this.loadHandle(2);
// }
} }
}).exec() }).exec()
query.select("#ItemModule1").boundingClientRect(function (res) {
this.createSelectorQuery().select("#ItemModule1").boundingClientRect(function(res){
if (res) { if (res) {
// let scrollTop = parseInt(el.scrollTop);
let scrollTop = parseInt(el.scrollTop); // let domHeight = parseInt(res.height);
let domHeight = parseInt(res.height); if (res.top < windowHeight && res.top + res.height > 0 && _this.data.finished == false) {
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if (
scrollTop + _this.data.clientHeight >= domHeight - 150 &&
_this.data.finished == false
) {
_this.loadHandle(2); _this.loadHandle(2);
} }
// if (
// scrollTop + _this.data.clientHeight >= domHeight - 150 &&
// _this.data.finished == false
// ) {
// console.log(scrollTop + _this.data.clientHeight, '44444444444')
// _this.loadHandle(2);
// }
} }
}).exec() }).exec()
// wx.createSelectorQuery().in(this).select("#ItemModule1").boundingClientRect(function(res){
// if (res) {
// let scrollTop = parseInt(el.scrollTop);
// let domHeight = parseInt(res.height);
// // 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
// if (
// scrollTop + _this.data.clientHeight >= domHeight - 150 &&
// _this.data.finished == false
// ) {
// _this.loadHandle(2);
// }
// }
// }).exec()
}, },
scrolltolower(){ scrolltolower(){
if(this.data.finished == false){ if(this.data.finished == false){
......
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
import { openType } from '../mixins/open-type';
VantComponent({
mixins: [button, openType],
props: {
show: Boolean,
title: String,
cancelText: String,
description: String,
round: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 100,
},
actions: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
closeOnClickAction: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
methods: {
onSelect(event) {
const { index } = event.currentTarget.dataset;
const item = this.data.actions[index];
if (item && !item.disabled && !item.loading) {
this.$emit('select', item);
if (this.data.closeOnClickAction) {
this.onClose();
}
}
},
onCancel() {
this.$emit('cancel');
},
onClose() {
this.$emit('close');
},
onClickOverlay() {
this.$emit('click-overlay');
this.onClose();
},
},
});
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index"
}
}
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">
{{ title }}
<van-icon
name="cross"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
</view>
<view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom">
{{ description }}
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bind:tap="onSelect"
bindgetuserinfo="bindGetUserInfo"
bindcontact="bindContact"
bindgetphonenumber="bindGetPhoneNumber"
binderror="bindError"
bindlaunchapp="bindLaunchApp"
bindopensetting="bindOpenSetting"
lang="{{ lang }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
>
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view>
</block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="22px" />
</button>
</view>
<slot />
<block wx:if="{{ cancelText }}">
<view class="van-action-sheet__gap" />
<view
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
{{ cancelText }}
</view>
</block>
</van-popup>
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{padding:14px 16px;text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:22px;line-height:var(--action-sheet-item-line-height,22px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:#646566;color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{display:block;height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-top:8px;margin-top:var(--padding-xs,8px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#969799;color:var(--action-sheet-subname-color,#969799);line-height:20px;line-height:var(--action-sheet-subname-line-height,20px)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:48px;line-height:var(--action-sheet-header-height,48px)}.van-action-sheet__description{text-align:center;padding:20px 16px;padding:20px var(--padding-md,16px);color:#969799;color:var(--action-sheet-description-color,#969799);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 16px;padding:var(--action-sheet-close-icon-padding,0 16px);font-size:22px!important;font-size:var(--action-sheet-close-icon-size,22px)!important;color:#c8c9cc;color:var(--action-sheet-close-icon-color,#c8c9cc)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important}
\ No newline at end of file
/// <reference types="miniprogram-api-typings" />
import { Weapp } from './weapp';
declare type RecordToAny<T> = {
[K in keyof T]: any;
};
export declare type CombinedComponentInstance<Data, Props, Methods> = Methods &
WechatMiniprogram.Component.TrivialInstance &
Weapp.FormField & {
data: Data & RecordToAny<Props>;
};
export interface VantComponentOptions<Data, Props, Methods, Instance> {
data?: Data;
field?: boolean;
classes?: string[];
mixins?: string[];
props?: Props & Weapp.PropertyOption;
relation?: Weapp.RelationOption<Instance> & {
type: 'ancestor' | 'descendant';
name: string;
current: string;
};
relations?: {
[componentName: string]: Weapp.RelationOption<Instance>;
};
methods?: Methods & Weapp.MethodOption<Instance>;
beforeCreate?: (this: Instance) => void;
created?: (this: Instance) => void;
mounted?: (this: Instance) => void;
destroyed?: (this: Instance) => void;
}
export {};
/// <reference types="miniprogram-api-typings" />
export declare namespace Weapp {
export interface FormField {
data: {
name: string;
value: any;
};
}
/**
* relation定义,miniprogram-api-typings缺少this定义
*/
export interface RelationOption<Instance> {
/** 目标组件的相对关系 */
type: 'parent' | 'child' | 'ancestor' | 'descendant';
/** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */
linked?(
this: Instance,
target: WechatMiniprogram.Component.TrivialInstance
): void;
/** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */
linkChanged?(
this: Instance,
target: WechatMiniprogram.Component.TrivialInstance
): void;
/** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */
unlinked?(
this: Instance,
target: WechatMiniprogram.Component.TrivialInstance
): void;
/** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */
target?: string;
}
/**
* obverser定义,miniprogram-api-typings缺少this定义
*/
type Observer<Instance, T> = (
this: Instance,
newVal: T,
oldVal: T,
changedPath: Array<string | number>
) => void;
/**
* methods定义,miniprogram-api-typings缺少this定义
*/
export interface MethodOption<Instance> {
[name: string]: (this: Instance, ...args: any[]) => any;
}
export interface ComputedOption<Instance> {
[name: string]: (this: Instance) => any;
}
type PropertyType =
| StringConstructor
| NumberConstructor
| BooleanConstructor
| ArrayConstructor
| ObjectConstructor
| FunctionConstructor
| null;
export interface PropertyOption {
[name: string]:
| PropertyType
| PropertyType[]
| {
/** 属性类型 */
type: PropertyType | PropertyType[];
/** 属性初始值 */
value?: any;
/** 属性值被更改时的响应函数 */
observer?:
| string
| Observer<WechatMiniprogram.Component.TrivialInstance, any>;
/** 属性的类型(可以指定多个) */
optionalTypes?: PropertyType[];
};
}
export {};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment