Commit 84d0ff86 authored by 和慭琛's avatar 和慭琛

云开发环境集成

parent 067d504b
...@@ -7,21 +7,30 @@ ...@@ -7,21 +7,30 @@
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/photo/product",
"style": { "style": {
"navigationBarTitleText": "下单" "navigationBarTitleText": "选择产品"
} }
}, },
{
"path": "pages/photo/try",
"style": {
"navigationBarTitleText": "拍照"
}
},
{ {
"path": "pages/photo/product", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "选择产品" "navigationBarTitleText": "下单"
} }
}, },
{ {
"path": "pages/photo/detail", "path": "pages/photo/detail",
"style": { "style": {
...@@ -52,12 +61,7 @@ ...@@ -52,12 +61,7 @@
}, },
{
"path": "pages/photo/try",
"style": {
"navigationBarTitleText": "拍照"
}
},
......
...@@ -14,25 +14,37 @@ ...@@ -14,25 +14,37 @@
export default { export default {
data() { data() {
return { return {
code:'',
brandList:[] brandList:[]
} }
}, },
onLoad(e) { onLoad(e) {
if(e && e.code){
this.code = e.code
}
this.getBrandList() this.getBrandList()
}, },
methods: { methods: {
getBrandList: function () { getBrandList: function () {
this.brandList = [
{ this.$u.cloudApi.getBrand({product_code:this.code}).then(res =>{
'title':'广汽', console.log(res,"品牌")
'id':0
},
{
'title':'比亚迪',
'id':1
} }
] )
// this.brandList = [
// {
// 'title':'广汽',
// 'id':0
// },
// {
// 'title':'比亚迪',
// 'id':1
// }
// ]
}, },
//选择 点击 //选择 点击
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<text class="topTitle">选择产品</text> <text class="topTitle">选择产品</text>
<view class=""> <view class="">
<view class="itemView u-m-t-80" v-for="(item,ikey) in productList":key="ikey"> <view class="itemView u-m-t-80" v-for="(item,ikey) in productList":key="ikey">
<text class="itemTitle" @click="itemClick(item)">{{item.title}}</text> <text class="itemTitle" @click="itemClick(item)">{{item.name}}</text>
</view> </view>
</view> </view>
...@@ -14,15 +14,42 @@ ...@@ -14,15 +14,42 @@
export default { export default {
data() { data() {
return { return {
productList:[] productList:[],
code:'',
} }
}, },
onLoad(e) { onLoad(e) {
this.getProductList() this.getProductList()
}, },
methods: { methods: {
getProductList: function(){ getProductList: function(){
let that = this
this.$u.cloudApi.getAllProduct().then(res =>{
console.log('获取产品数据:')
console.log(res)
if(res.result.data){
that.productList = res.result.data
}
})
/*
const db = uniCloud.database({
spaceId: 'tcb-nikbzhlwnpd5n913e1c5e-50f4bbo'
})
const collection = db.collection("config").where({type: "brand"}).get()
console.log('collection:')
console.log(collection)
this.productList = [ this.productList = [
{ {
'title':'新风机', 'title':'新风机',
...@@ -33,12 +60,16 @@ ...@@ -33,12 +60,16 @@
'id':1 'id':1
} }
] ]
*/
}, },
//选择 点击 //选择 点击
itemClick: function (item) { itemClick: function (item) {
if(item.code){
this.code = item.code
}
uni.navigateTo({ uni.navigateTo({
url:'/pages/photo/brand' url:'/pages/photo/brand' + '?code=' + this.code
}) })
}, },
......
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