parent
56365eb730
commit
69f39539ef
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,62 @@ |
||||
<template> |
||||
<view> |
||||
<view class="uni-padding-wrap uni-common-mt"> |
||||
<view class="uni-form-item uni-column"> |
||||
|
||||
<view class="weui-cells weui-cells_after-title" v-for="(group,index) in groups" :key="index"> |
||||
<button url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active" @click="loadGroup(group)"> |
||||
<view class="weui-cell__bd">{{group.name}}</view> |
||||
<view class="weui-cell__ft weui-cell__ft_in-access"></view> |
||||
</button> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "baike", |
||||
data:function () { |
||||
return { |
||||
title:"垃圾分类百科", |
||||
groups:[ |
||||
{ |
||||
name:"可回收垃圾", |
||||
icon:"", |
||||
type:1 |
||||
}, |
||||
{ |
||||
name:"有害垃圾", |
||||
icon:"", |
||||
type:2 |
||||
}, |
||||
{ |
||||
name:"湿垃圾", |
||||
icon:"", |
||||
type:4 |
||||
}, |
||||
{ |
||||
name:"干垃圾", |
||||
icon:"", |
||||
type:8 |
||||
}, |
||||
{ |
||||
name:"大件垃圾", |
||||
icon:"", |
||||
type:16 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
methods:{ |
||||
loadGroup:function (group) { |
||||
console.info("选中"+group.name) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,75 @@ |
||||
<template> |
||||
<view> |
||||
<view class="uni-padding-wrap uni-common-mt"> |
||||
|
||||
<view class="uni-form-item uni-column"> |
||||
|
||||
<text class="title uni-center">从文本框输入垃圾关键字查询</text> |
||||
<view class="weui-cells weui-cells_after-title"> |
||||
<view class="weui-cell "> |
||||
<view class="weui-cell__bd"> |
||||
<input class="weui-input" v-model="textValue" placeholder="请输入垃圾关键字" @input="changeTextQuery" /> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="uni-flex uni-column"> |
||||
<text class="title uni-center">点击图标拍照查询</text> |
||||
<view class="flex-item flex-item-V uni-center"> |
||||
<image class="photo" @click="chooseImage"></image> |
||||
</view> |
||||
</view> |
||||
|
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "query", |
||||
data:function(){ |
||||
return { |
||||
title:"垃圾分类查询", |
||||
textValue:"" |
||||
} |
||||
}, |
||||
methods:{ |
||||
changeTextQuery:function () { |
||||
console.info("文本查询值:"+this.textValue) |
||||
}, |
||||
chooseImage:function () { |
||||
console.info("拍照查询") |
||||
uni.authorize({ |
||||
scope:"scope.camera", |
||||
success:function () { |
||||
console.info("摄像头调用成功") |
||||
uni.chooseImage({ |
||||
sourceType:["camera"], |
||||
success:function (obj) { |
||||
console.info("拍照成功,照片路径"+obj.tempFilePaths[0]) |
||||
}, |
||||
fail:function () { |
||||
console.error("拍照失败") |
||||
} |
||||
}) |
||||
}, |
||||
fail:function () { |
||||
console.error("授权摄像头权限失败,请刷新页面重新授权") |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.photo{ |
||||
background-image:url("~@/static/photo.png"); |
||||
background-size: 100% 100%; |
||||
width: 100%; |
||||
} |
||||
text{ |
||||
font-size: 15px; |
||||
} |
||||
</style> |
@ -0,0 +1,91 @@ |
||||
<template> |
||||
<view> |
||||
<view class="uni-padding-wrap uni-common-mt" v-if="isLoad"> |
||||
|
||||
<view v-for="(question,q_index) in questions" :key="q_index" class="question uni-flex uni-column"> |
||||
<text class="title uni-center">{{question.question}}</text> |
||||
<radio-group> |
||||
<label class="uni-list-cell uni-list-cell-pd" v-for="(answer,a_index) in question.answers" :key="a_index"> |
||||
<view> |
||||
<radio :value="a_index"/> |
||||
</view> |
||||
<view>{{answer}}</view> |
||||
</label> |
||||
</radio-group> |
||||
</view> |
||||
|
||||
<view class="uni-flex uni-row button-group question"> |
||||
<view class="flex-item"> |
||||
<button type="primary" @click="submit">提交答卷</button> |
||||
</view> |
||||
<view class="flex-item"> |
||||
<button type="primary" class="reset" @click="reset">重置答卷</button> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "question", |
||||
data: function () { |
||||
return { |
||||
title: "垃圾百科测验", |
||||
questions:[], |
||||
isLoad:false |
||||
} |
||||
}, |
||||
methods:{ |
||||
reset:function () { |
||||
uni.reLaunch({ |
||||
url: 'question' |
||||
}); |
||||
}, |
||||
submit:function () { |
||||
console.info("提交答卷") |
||||
} |
||||
}, |
||||
onShow:function(){ |
||||
console.info("加载试题中") |
||||
uni.showLoading({ |
||||
title:"加载试题中" |
||||
}) |
||||
let _this=this |
||||
console.info(_this) |
||||
setTimeout(function () { |
||||
_this.questions=[ |
||||
{ |
||||
question: "测试问题?", |
||||
answers: ["答案1", "答案2", "答案3", "答案4"] |
||||
}, |
||||
{ |
||||
question: "测试问题?", |
||||
answers: ["答案1", "答案2", "答案3", "答案4"] |
||||
}, |
||||
{ |
||||
question: "测试问题?", |
||||
answers: ["答案1", "答案2", "答案3", "答案4"] |
||||
} |
||||
] |
||||
_this.isLoad=true |
||||
uni.hideLoading() |
||||
},1000) |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.uni-list-cell { |
||||
justify-content: flex-start |
||||
} |
||||
.question{ |
||||
margin-top:10px; |
||||
} |
||||
.reset{ |
||||
margin-left: 20px; |
||||
} |
||||
.button-group{ |
||||
justify-content: center; |
||||
} |
||||
</style> |
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Loading…
Reference in new issue