页面对component的一些适配
This commit is contained in:
parent
ac49550d98
commit
35af24e31d
|
|
@ -35,7 +35,7 @@
|
|||
"scripts": {
|
||||
"prebuild": "ts-node ./scripts/buildBaseEntityDict && npm link ./src/base-app-domain",
|
||||
"build": "tsc",
|
||||
"test": "ts-node ./scripts/getAmapArea.ts",
|
||||
"get:area": "ts-node ./scripts/getAmapArea.ts",
|
||||
"clean:mp": "ts-node ./scripts/cleanDtsInWechatMp"
|
||||
},
|
||||
"main": "src/index"
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ async function main() {
|
|||
const { districts: provinces, adcode: countryCode } = country;
|
||||
|
||||
async function saveBelowProvinces(dest: FormCreateData<Area>[], limit?: number) {
|
||||
const provinces2 = limit ? provinces.slice(0, limit) : provinces;
|
||||
saveAreas(provinces2, countryCode, 1, dest);
|
||||
for (const dist of provinces) {
|
||||
const result2 = await acquireAmap(dist.name, 3);
|
||||
const { districts: cities, adcode: provinceCode } = result2.districts[0];
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@ Component({
|
|||
type: String,
|
||||
value: ''
|
||||
},
|
||||
autofocus: {
|
||||
focus: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
|
@ -41,20 +41,20 @@ Component({
|
|||
},
|
||||
|
||||
methods: {
|
||||
handleInputChange(event:any) {
|
||||
const { detail = {} } = event;
|
||||
const { value = '' } = detail;
|
||||
handleInputChange(event: WechatMiniprogram.Input) {
|
||||
const { detail } = event;
|
||||
const { value } = detail;
|
||||
this.setData({ value });
|
||||
|
||||
this.triggerEvent('change', event);
|
||||
this.triggerEvent('change', event.detail);
|
||||
},
|
||||
|
||||
handleInputFocus(event:any) {
|
||||
this.triggerEvent('focus', event);
|
||||
handleInputFocus(event: WechatMiniprogram.InputFocus) {
|
||||
this.triggerEvent('focus', event.detail);
|
||||
},
|
||||
|
||||
handleInputBlur(event:any) {
|
||||
this.triggerEvent('blur', event);
|
||||
handleInputBlur(event: WechatMiniprogram.InputBlur) {
|
||||
this.triggerEvent('blur', event.detail);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<view class="g-cell g-input {{ error ? 'g-input-error' : '' }} {{ mode === 'wrapped' ? 'g-input-wrapped' : '' }}">
|
||||
<view wx:if="{{ title }}" class="g-input-title">{{ title }}</view>
|
||||
<textarea wx:if="{{ type === 'textarea' }}" auto-height disabled="{{ disabled }}" focus="{{ autofocus }}" value="{{ value }}" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" class="g-input-input {{ right ? 'g-input-input-right' : '' }}" placeholder-class="g-input-placeholder" bindinput="handleInputChange" bindfocus="handleInputFocus" bindblur="handleInputBlur"></textarea>
|
||||
<input wx:else type="{{ type }}" disabled="{{ disabled }}" focus="{{ autofocus }}" value="{{ value }}" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" class="g-input-input g-cell-bd {{ right ? 'g-input-input-right' : '' }}" placeholder-class="g-input-placeholder" bindinput="handleInputChange" bindfocus="handleInputFocus" bindblur="handleInputBlur" />
|
||||
<view wx:if="{{ title }}" class="g-input-title {{ error ? 'g-input-error' : '' }}">{{ title }}</view>
|
||||
<textarea wx:if="{{ type === 'textarea' }}" auto-height disabled="{{ disabled }}" focus="{{ focus }}" value="{{ value }}" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" class="g-input-input {{ right ? 'g-input-input-right' : '' }}" placeholder-class="g-input-placeholder" bindinput="handleInputChange" bindfocus="handleInputFocus" bindblur="handleInputBlur"></textarea>
|
||||
<input wx:else type="{{ type }}" disabled="{{ disabled }}" focus="{{ focus }}" value="{{ value }}" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" class="g-input-input g-cell-bd {{ right ? 'g-input-input-right' : '' }}" placeholder-class="g-input-placeholder" bindinput="handleInputChange" bindfocus="handleInputFocus" bindblur="handleInputBlur" />
|
||||
</view>
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
"area-upsert": "../../../components/area/upsert/index",
|
||||
"g-btn": "../../../components/UI/g-btn/index",
|
||||
"g-input": "../../../components/UI/g-input/index",
|
||||
"g-icon": "../../../components/UI/g-icon/index",
|
||||
"g-panel": "../../../components/UI/g-panel/index"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
<!-- index.wxml -->
|
||||
<view class="page-body">
|
||||
<g-panel>
|
||||
<g-input class="{{oakFocused.name}}" oak:value="name" title="收货人" autofocus placeholder="姓名" confirm-type="done" bind:change="setUpdateData" />
|
||||
<g-input class="{{oakFocused.phone}}" oak:value="phone" title="手机号" autofocus placeholder="11位手机号码" confirm-type="done" bind:change="setUpdateData" />
|
||||
<g-input error="{{!!oakFocused.name}}" oak:value="name" title="收货人" placeholder="姓名" confirm-type="done" bind:change="setUpdateData" />
|
||||
<g-input error="{{!!oakFocused.phone}}" oak:value="phone" title="手机号" placeholder="11位手机号码" confirm-type="done" bind:change="setUpdateData" />
|
||||
<view class="g-cell {{oakFocused.areaId}}" hover-class="g-cell-hover" bindtap="callPicker" data-path="area" data-depth="{{3}}">
|
||||
<view class="g-input-title">所在地区</view>
|
||||
<view class="g-input-input" style="display: flex; flex: 1; align-items: center; justify-content:space-between">
|
||||
<text>{{areaText || '请选择'}}</text>
|
||||
<span class="material-icons" color="#495060">chevron_right</span>
|
||||
<g-icon name="chevron_right" />
|
||||
</view>
|
||||
</view>
|
||||
<g-input class="{{oakFocused.detail}}" oak:value="detail" title="详细地址" autofocus placeholder="精确到门牌号码" confirm-type="done" bind:change="setUpdateData" />
|
||||
<g-input error="{{!!oakFocused.detail}}" oak:value="detail" title="详细地址" placeholder="精确到门牌号码" confirm-type="done" bind:change="setUpdateData" />
|
||||
</g-panel>
|
||||
<g-btn type="primary" long="true" class="{{ oakExecuting ? 'g-btn-loading' : ''}} {{ !oakDirty ? 'g-btn-disabled' : ''}}" disabled="{{oakExecuting || !oakDirty}}" bind:tap="execute" data-then="afterUpsert">
|
||||
<view style="flex: 1" />
|
||||
<g-btn type="primary" long="true" class="{{ oakExecuting ? 'g-btn-loading' : ''}} {{ !oakDirty ? 'g-btn-disabled' : ''}}" disabled="{{oakExecuting || !oakDirty}}" bind:click="execute" data-then="afterUpsert">
|
||||
<view class="g-btn-loading-inner" wx:if="{{oakExecuting}}"></view>
|
||||
确定
|
||||
</g-btn>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/** index.wxss **/
|
||||
@import "../../../styles/base.less";
|
||||
@import "../../../styles/cell.less";
|
||||
|
||||
.page-body {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- index.wxml -->
|
||||
<view class="page-body">
|
||||
<view class="g-form" style="flex: 1" wx:for="{{arealist}}" wx:key="index">
|
||||
<view class="g-form-item" data-id="{{item.id}}" bindtap="onItemClicked">
|
||||
<text>{{item.name}}</text>
|
||||
<view class="g-panel" style="flex: 1" wx:for="{{arealist}}" wx:key="index">
|
||||
<view class="g-cell" data-id="{{item.id}}" bindtap="onItemClicked">
|
||||
<text class="g-cell-label">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<image class="avatar" src="{{avatar}}" mode="aspectFit" />
|
||||
</block>
|
||||
<block wx:else>
|
||||
<span class="material-icons avatar" style="width:auto">person_outline</span>
|
||||
<span class="material-symbols-rounded avatar" style="width:auto">person_outline</span>
|
||||
</block>
|
||||
<span class="nickname">{{ nickname || '未设置'}}</span>
|
||||
<block wx:if="{{isLoggedIn && !isPlayingAnother}}">
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<view wx:if="{{mobileCount > 1}}">{{mobileCount}}条手机号</view>
|
||||
<view wx:elif="{{mobileCount === 1}}">{{mobile}}</view>
|
||||
<view wx:else>未设置</view>
|
||||
<span class="material-icons" color="#495060">chevron_right</span>
|
||||
<span class="material-symbols-rounded" color="#495060">chevron_right</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="g-cell">
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
<view wx:if="{{isRoot}}" class="g-cell" bind:tap="goUserManage">
|
||||
<view class="g-cell-label">用户管理</view>
|
||||
<view class="g-cell-content-right">
|
||||
<span class="material-icons" color="#495060">chevron_right</span>
|
||||
<span class="material-symbols-rounded" color="#495060">chevron_right</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<image class="avatar" src="{{avatar}}" mode="aspectFit" />
|
||||
</block>
|
||||
<block wx:else>
|
||||
<span class="material-icons avatar" style="width:auto">person_outline</span>
|
||||
<span class="material-symbols-rounded avatar" style="width:auto">person_outline</span>
|
||||
</block>
|
||||
</view>
|
||||
<view class="info-panel" style="display:flex; flex-direction:column; flex: 1">
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ OakPage({
|
|||
goUserManageDetail(options: WechatMiniprogram.Touch) {
|
||||
const { id } = options.currentTarget.dataset;
|
||||
this.navigateTo({
|
||||
url: `detail/index?oakId=${id}`,
|
||||
url: `detail/index`,
|
||||
oakId: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,19 +7,19 @@
|
|||
<image class="avatar" src="{{item.avatar}}" mode="aspectFit" />
|
||||
</block>
|
||||
<block wx:else>
|
||||
<span class="material-icons avatar">person_outline</span>
|
||||
<span class="material-symbols-rounded avatar">person_outline</span>
|
||||
</block>
|
||||
<view class="g-cell-content">
|
||||
<view class="user-info">
|
||||
<view class="nickname">{{item.nickname || '未设置'}}</view>
|
||||
<view class="name">
|
||||
<span class="material-icons" style="font-size:28rpx;margin-right:8rpx" color="#495060">
|
||||
<span class="material-symbols-rounded" style="font-size:28rpx;margin-right:8rpx" color="#495060">
|
||||
tag_faces
|
||||
</span>
|
||||
{{item.name || '未设置'}}
|
||||
</view>
|
||||
<view class="mobile">
|
||||
<span class="material-icons" style="font-size:28rpx;margin-right:8rpx" color="#495060">
|
||||
<span class="material-symbols-rounded" style="font-size:28rpx;margin-right:8rpx" color="#495060">
|
||||
phone_android
|
||||
</span>
|
||||
{{item.mobile || '未设置'}}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<view class="user-state-{{item.userState}}">
|
||||
{{item.userState}}
|
||||
</view>
|
||||
<span class="material-icons" color="#495060">chevron_right</span>
|
||||
<span class="material-symbols-rounded" color="#495060">chevron_right</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue