Browse Source

init

master
橙橙楊 3 years ago committed by 潘啟华
parent
commit
69f39539ef
  1. 1
      .gitignore
  2. 5
      package.json
  3. 2
      postcss.config.js
  4. 5
      src/App.vue
  5. 1447
      src/common/uni.css
  6. 2
      src/manifest.json
  7. 57
      src/pages.json
  8. 10
      src/pages/index/index.vue
  9. 62
      src/pages/waste_sorting/baike.vue
  10. 75
      src/pages/waste_sorting/query.vue
  11. 91
      src/pages/waste_sorting/question.vue
  12. BIN
      src/static/photo.png
  13. BIN
      src/static/uni.ttf
  14. 34
      src/uni.scss
  15. 30
      yarn.lock

1
.gitignore vendored

@ -21,3 +21,4 @@ yarn-error.log* @@ -21,3 +21,4 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
/package-lock.json

5
package.json

@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
"@dcloudio/uni-mp-weixin": "^2.0.0-23320190923002",
"@dcloudio/uni-stat": "^2.0.0-23320190923002",
"flyio": "^0.6.2",
"mpvue-weui": "^1.0.13",
"regenerator-runtime": "^0.12.1",
"vue": "^2.6.10",
"vuex": "^3.0.1"
@ -46,8 +47,8 @@ @@ -46,8 +47,8 @@
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-23320190923002",
"@dcloudio/webpack-uni-mp-loader": "^2.0.0-23320190923002",
"@dcloudio/webpack-uni-pages-loader": "^2.0.0-23320190923002",
"@types/html5plus": "*",
"@types/uni-app": "*",
"@types/html5plus": "^1.0.0",
"@types/uni-app": "^1.4.0",
"@vue/cli-plugin-babel": "3.5.1",
"@vue/cli-service": "^3.12.0",
"babel-plugin-import": "^1.11.0",

2
postcss.config.js

@ -5,6 +5,6 @@ module.exports = { @@ -5,6 +5,6 @@ module.exports = {
require('autoprefixer')({
remove: process.env.UNI_PLATFORM !== 'h5'
}),
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
require('@dcloudio/vue-cli-plugin-uni/packages/postcss'),
]
}

5
src/App.vue

@ -14,4 +14,9 @@ @@ -14,4 +14,9 @@
<style>
/*每个页面公共css */
/* #ifndef APP-PLUS-NVUE */
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
@import './common/uni.css';
@import '../node_modules/mpvue-weui/src/style/weui.css';
</style>

1447
src/common/uni.css

File diff suppressed because it is too large Load Diff

2
src/manifest.json

@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
},
"mp-weixin": { /* */
"appid": "",
"appid": "wx3f63b0c4127278ac",
"setting": {
"urlCheck": false
},

57
src/pages.json

@ -1,16 +1,45 @@ @@ -1,16 +1,45 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
"pages": [
//pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/waste_sorting/query",
"style": {
"navigationBarTitleText": "查询"
}
},
{
"path": "pages/waste_sorting/baike",
"style": {
"navigationBarTitleText": "百科"
}
},
{
"path": "pages/waste_sorting/question",
"style": {
"navigationBarTitleText": "测验"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"list": [
{
"pagePath": "pages/waste_sorting/query",
"text": "查询"
},
{
"pagePath": "pages/waste_sorting/baike",
"text": "百科"
},
{
"pagePath": "pages/waste_sorting/question",
"text": "测验"
}
]
}
}

10
src/pages/index/index.vue

@ -26,17 +26,17 @@ @@ -26,17 +26,17 @@
<style>
.content {
text-align: center;
height: 400upx;
height: 400rpx;
}
.logo {
height: 200upx;
width: 200upx;
margin-top: 200upx;
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
}
.title {
font-size: 36upx;
font-size: 36rpx;
color: #8f8f94;
}
</style>

62
src/pages/waste_sorting/baike.vue

@ -0,0 +1,62 @@ @@ -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>

75
src/pages/waste_sorting/query.vue

@ -0,0 +1,75 @@ @@ -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>

91
src/pages/waste_sorting/question.vue

@ -0,0 +1,91 @@ @@ -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>

BIN
src/static/photo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
src/static/uni.ttf

Binary file not shown.

34
src/uni.scss

@ -39,38 +39,38 @@ $uni-border-color:#c8c7cc; @@ -39,38 +39,38 @@ $uni-border-color:#c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm:24upx;
$uni-font-size-base:28upx;
$uni-font-size-lg:32upx;
$uni-font-size-sm:24rpx;
$uni-font-size-base:28rpx;
$uni-font-size-lg:32rpx;
/* 图片尺寸 */
$uni-img-size-sm:40upx;
$uni-img-size-base:52upx;
$uni-img-size-lg:80upx;
$uni-img-size-sm:40rpx;
$uni-img-size-base:52rpx;
$uni-img-size-lg:80rpx;
/* Border Radius */
$uni-border-radius-sm: 4upx;
$uni-border-radius-base: 6upx;
$uni-border-radius-lg: 12upx;
$uni-border-radius-sm: 4rpx;
$uni-border-radius-base: 6rpx;
$uni-border-radius-lg: 12rpx;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 20upx;
$uni-spacing-row-lg: 30upx;
$uni-spacing-row-base: 20rpx;
$uni-spacing-row-lg: 30rpx;
/* 垂直间距 */
$uni-spacing-col-sm: 8upx;
$uni-spacing-col-base: 16upx;
$uni-spacing-col-lg: 24upx;
$uni-spacing-col-sm: 8rpx;
$uni-spacing-col-base: 16rpx;
$uni-spacing-col-lg: 24rpx;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:40upx;
$uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36upx;
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30upx;
$uni-font-size-paragraph:30rpx;

30
yarn.lock

@ -862,10 +862,10 @@ @@ -862,10 +862,10 @@
"@types/minimatch" "*"
"@types/node" "*"
"@types/html5plus@*":
"@types/html5plus@^1.0.0":
version "1.0.0"
resolved "https://registry.npm.taobao.org/@types/html5plus/download/@types/html5plus-1.0.0.tgz#a88600fc9de85b785959754aea403c0a8d0714ba"
integrity sha1-qIYA/J3oW3hZWXVK6kA8Co0HFLo=
resolved "https://registry.yarnpkg.com/@types/html5plus/-/html5plus-1.0.0.tgz#a88600fc9de85b785959754aea403c0a8d0714ba"
integrity sha512-kTL4Ik+pTXEAhzDS0jUp0x1kEEY025LQzqEKN1ggnQwWgRHQzAf3tY2ZCYr57jPz9TypN0z1Tf/XY6xQbSPSDw==
"@types/minimatch@*":
version "3.0.3"
@ -887,10 +887,10 @@ @@ -887,10 +887,10 @@
resolved "https://registry.npm.taobao.org/@types/q/download/@types/q-1.5.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fq%2Fdownload%2F%40types%2Fq-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
integrity sha1-aQoUdbhPKohP0HzXl8APXzE1bqg=
"@types/uni-app@*":
"@types/uni-app@^1.4.0":
version "1.4.0"
resolved "https://registry.npm.taobao.org/@types/uni-app/download/@types/uni-app-1.4.0.tgz#83b910384733c19b1947e285ac07924bbdb074a6"
integrity sha1-g7kQOEczwZsZR+KFrAeSS72wdKY=
resolved "https://registry.yarnpkg.com/@types/uni-app/-/uni-app-1.4.0.tgz#83b910384733c19b1947e285ac07924bbdb074a6"
integrity sha512-qRrNTzPOVTIDzDQWJ4zXhKxfnk4LfQwkf5HVBMWL/d0ke039eHbmlhZJCm7kIxa0fa/mNgREkWDgvzs2Uz2y3A==
dependencies:
vue "^2.6.8"
@ -5054,6 +5054,24 @@ move-concurrently@^1.0.1: @@ -5054,6 +5054,24 @@ move-concurrently@^1.0.1:
rimraf "^2.5.4"
run-queue "^1.0.3"
mpvue-citypicker@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/mpvue-citypicker/-/mpvue-citypicker-1.0.6.tgz#861b9d4b1ed2245ad860d7e29dd2872d8fa7c74a"
integrity sha512-V8TuUILYw7pFV0ii02tXKUtLmoa+mTxxJS85dEIc4sp85dVTLNi2GmXqBoz9MkT+QwKeOf3fPvFZzoucERz5rA==
mpvue-picker@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/mpvue-picker/-/mpvue-picker-2.1.6.tgz#e4e423bf66e063e3ab17076094601e847f670798"
integrity sha512-qm4sAw8uFfwIl6CBSyKWij8OcAcLntag3acqeYJy4TgNjaANOrZMx8UaA9dY+NZOrLmFJL/rZwxWKd3rg3O7dA==
mpvue-weui@^1.0.13:
version "1.0.13"
resolved "https://registry.yarnpkg.com/mpvue-weui/-/mpvue-weui-1.0.13.tgz#d4b42a42f7b73fa32526deb54f3d48dc6e776c7d"
integrity sha512-zgIQ0LqOVywaASOLJptgI3MAEiTcO9cwKO2NTO0dBBF3kFwbopAGMROOd+lRqQFuC9+46huYxjqijVbNMfkejg==
dependencies:
mpvue-citypicker "^1.0.6"
mpvue-picker "^2.1.6"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

Loading…
Cancel
Save