Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyucoding committed Aug 13, 2018
1 parent 00ab14b commit db73cb9
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
Expand Down
122 changes: 62 additions & 60 deletions examples/hello-uniapp/manifest.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
{
"name": "hello uni-app",
"appid": "__UNI__123213213",
"description": "应用描述",
"versionName": "1.0.0",
"versionCode": "100",
"app-plus": {/* 5+App特有相关 */
"modules": {
"OAuth": {},
"Payment": {},
"Push": {},
"Share": {},
"Speech": {}
},
"distribute": {/* 应用发布信息 */
"android": {/* android打包配置 */
"permissions": [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_MOCK_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.GET_TASKS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.READ_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.SEND_SMS\"/>",
"<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\"/>"
]
},
"ios": {},/* ios打包配置 */
"sdkConfigs": {},/* SDK配置 */
"orientation": ["portrait-primary"]
}
},

"quickapp": {},/* 快应用特有相关 */
"mp-weixin": {}/* 小程序特有相关 */
"name" : "hello uni-app",
"appid" : "__UNI__123213213",
"description" : "应用描述",
"versionName" : "1.0.0",
"versionCode" : "100",
"app-plus" : {
/* 5+App特有相关 */
"modules" : {
"OAuth" : {},
"Payment" : {},
"Push" : {},
"Share" : {},
"Speech" : {},
"VideoPlayer" : {}
},
"distribute" : {
/* 应用发布信息 */
"android" : {
/* android打包配置 */
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_MOCK_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.GET_TASKS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.READ_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.SEND_SMS\"/>",
"<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\"/>"
]
},
"ios" : {}, /* ios打包配置 */
"sdkConfigs" : {}, /* SDK配置 */
"orientation" : [ "portrait-primary" ]
}
},
"quickapp" : {}, /* 快应用特有相关 */
"mp-weixin" : {} /* 小程序特有相关 */
}

9 changes: 8 additions & 1 deletion examples/hello-uniapp/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
"style": {
"navigationBarTitleText": "文件"
}
},{
}, {
"path": "pages/API/get-location/get-location",
"style": {
"navigationBarTitleText": "获取位置"
Expand Down Expand Up @@ -432,6 +432,13 @@
"style": {
"navigationBarTitleText": "问题反馈"
}
}, {
"path": "pages/template/product-list/product-list",
"style": {
"navigationBarTitleText": "商品列表",
"enablePullDownRefresh": true,
"onReachBottomDistance": 20
}
}
],
"globalStyle": {
Expand Down
111 changes: 84 additions & 27 deletions examples/hello-uniapp/pages/API/share/share.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
<textarea class="textarea" v-model="shareText" />
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view class="page-section-title">分享链接</view>
<view class="page-section">
<view class="textarea-wrp">
<input class="uni-input" type="text" v-model="href">
</view>
</view>
<!-- #endif -->
<view class="page-section-title">分享图片:</view>
<view class="page-section">
<view class="uni-uploader-body">
Expand All @@ -24,9 +16,28 @@
</view>
</view>
<!-- #ifdef APP-PLUS -->
<view class="page-section-title">分享类型:</view>
<view class="page-section">
<view class="uni-uploader-body">
<radio-group @change="radioChange">
<label class="radio">
<radio value="1" checked="true"/>文字
</label>
<label class="radio">
<radio value="2" />图片
</label>
<label class="radio">
<radio value="0" />图文
</label>
<label class="radio">
<radio value="5" />小程序
</label>
</radio-group>
</view>
</view>
<view class="btn-area" v-if="providerList.length > 0">
<block v-for="(value,index) in providerList" :key="index">
<button type="primary" v-if="value" @tap="share(value)">{{value.name}}</button>
<button type="primary" v-if="value" :disabled="shareType === 5 && value.name !== '分享到微信好友'" @tap="share(value)">{{value.name}}</button>
</block>
</view>
<!-- #endif -->
Expand All @@ -49,6 +60,7 @@
shareText: 'uni-app可以同时发布成原生App、微信小程序,邀请你一起体验!',
href:"https://uniapp.dcloud.io",
image: '',
shareType:1,
providerList: []
}
},
Expand All @@ -64,7 +76,6 @@
this.href = "https://uniapp.dcloud.io",
this.image='';
},
// #ifdef APP-PLUS
onLoad: function () {
uni.getProvider({
service: "share",
Expand Down Expand Up @@ -117,17 +128,30 @@
}
});
},
// #endif
methods: {
async share(e) {
console.log("分享通道:", e.id);
console.log("分享通道:"+ e.id +"; 分享类型:" + this.shareType);
if(!this.shareText && (this.shareType === 1 || this.shareType === 0)){
uni.showModal({
content:"分享内容不能为空",
showCancel:false
})
return;
}
if(!this.image && (this.shareType === 2 || this.shareType === 0)){
uni.showModal({
content:"分享图片不能为空",
showCancel:false
})
return;
}
let shareOPtions = {
provider: e.id,
scene: e.type && e.type === 'WXSenceTimeline' ? 'WXSenceTimeline' : "WXSceneSession", //WXSceneSession”分享到聊天界面,“WXSenceTimeline”分享到朋友圈,“WXSceneFavorite”分享到微信收藏
type: this.image && this.href ? 0 : (this.image ? 2 : 1),
title: "欢迎体验uniapp",
summary:this.shareText,
imageUrl: this.image,
type: this.shareType,
success: (e) => {
console.log("success", e);
uni.showModal({
Expand All @@ -146,21 +170,47 @@
console.log("分享操作结束!")
}
}
if(e.id === 'qq' && !this.image){
uni.showModal({
content:"分享到qq必须包含图片",
showCancel:false
})
return;
}
if(this.href){
shareOPtions.href = this.href;
switch (this.shareType){
case 0:
shareOPtions.summary = this.shareText;
shareOPtions.imageUrl = this.image;
shareOPtions.title = "欢迎体验uniapp";
shareOPtions.href = "http://uniapp.dcloud.io";
break;
case 1:
shareOPtions.summary = this.shareText;
break;
case 2:
shareOPtions.imageUrl = this.image;
break;
case 5:
shareOPtions.imageUrl = this.image ? this.image : 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/app/share-logo@3.png'
shareOPtions.title = "欢迎体验uniapp";
shareOPtions.miniProgram = {
id:"gh_33446d7f7a26",
path:"/pages/component/component",
webUrl:"http://uniapp.dcloud.io",
type:0
};
break;
default:
break;
}
if(shareOPtions.type === 0 && plus.os.name === 'iOS'){//如果是图文分享,且是ios平台,则压缩图片
if(shareOPtions.type === 0 && plus.os.name === 'iOS'){//如果是图文分享,且是ios平台,则压缩图片
shareOPtions.imageUrl = await this.compress();
}
if(shareOPtions.type === 1 && shareOPtions.provider === 'qq'){//如果是分享文字到qq,则必须加上href和title
shareOPtions.href = "http://uniapp.dcloud.io";
shareOPtions.title = "欢迎体验uniapp";
}
uni.share(shareOPtions);
},
radioChange(e){
console.log("type:" + e.detail.value);
this.shareType = parseInt(e.detail.value);
},
chooseImage() {
uni.chooseImage({
count: 1,
Expand Down Expand Up @@ -229,7 +279,7 @@
.textarea {
border: 2px solid #D8D8D8;
padding: 10px;
height: 100px;
height: 90px;
width: 690px;
}
.uni-input{
Expand All @@ -241,4 +291,11 @@
display: flex;
justify-content: center;
}
radio-group{
box-sizing: border-box;
width: 100%;
padding: 0 30px;
display: flex;
justify-content: space-between;
}
</style>
8 changes: 6 additions & 2 deletions examples/hello-uniapp/pages/component/form/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<view class="page-section">
<view class="page-section-title">input</view>
<view class="uni-list">
<view class="uni-list-cell uni-list-cell-pd">
<input name="input" placeholder="这是一个输入框" />
<view class="uni-list-cell">
<input class="uni-input" name="input" placeholder="这是一个输入框" />
</view>
</view>
</view>
Expand Down Expand Up @@ -100,4 +100,8 @@
background-color: #007aff;
color: #ffffff;
}
.uni-input{
width: 100%;
padding-left: 30px;
}
</style>
4 changes: 2 additions & 2 deletions examples/hello-uniapp/pages/component/view/view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<view class="text">横向布局-居右</view>
<view class="text">横向布局-居右</view>
</view>
<view class="uni-flex uni-row">
<view class="uni-flex uni-row">
<view class="text" style="flex: 1;">横向布局-平均分布</view>
<view class="text" style="flex: 1;">横向布局-平均分布</view>
</view>
<view class="uni-row" style="justify-content: space-between;">
<view class="uni-flex uni-row" style="justify-content: space-between;">
<view class="text">横向布局-两端对齐</view>
<view class="text">横向布局-两端对齐</view>
</view>
Expand Down
Loading

0 comments on commit db73cb9

Please sign in to comment.