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

云开发环境集成

parent 067d504b
......@@ -7,21 +7,30 @@
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"path": "pages/photo/product",
"style": {
"navigationBarTitleText": "下单"
"navigationBarTitleText": "选择产品"
}
},
{
"path": "pages/photo/try",
"style": {
"navigationBarTitleText": "拍照"
}
},
{
"path": "pages/photo/product",
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "选择产品"
"navigationBarTitleText": "下单"
}
},
{
"path": "pages/photo/detail",
"style": {
......@@ -52,12 +61,7 @@
},
{
"path": "pages/photo/try",
"style": {
"navigationBarTitleText": "拍照"
}
},
......
......@@ -14,25 +14,37 @@
export default {
data() {
return {
code:'',
brandList:[]
}
},
onLoad(e) {
if(e && e.code){
this.code = e.code
}
this.getBrandList()
},
methods: {
getBrandList: function () {
this.brandList = [
{
'title':'广汽',
'id':0
},
{
'title':'比亚迪',
'id':1
this.$u.cloudApi.getBrand({product_code:this.code}).then(res =>{
console.log(res,"品牌")
}
]
)
// this.brandList = [
// {
// 'title':'广汽',
// 'id':0
// },
// {
// 'title':'比亚迪',
// 'id':1
// }
// ]
},
//选择 点击
......
......@@ -3,7 +3,7 @@
<text class="topTitle">选择产品</text>
<view class="">
<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>
......@@ -14,15 +14,42 @@
export default {
data() {
return {
productList:[]
productList:[],
code:'',
}
},
onLoad(e) {
this.getProductList()
},
methods: {
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 = [
{
'title':'新风机',
......@@ -33,12 +60,16 @@
'id':1
}
]
*/
},
//选择 点击
itemClick: function (item) {
if(item.code){
this.code = item.code
}
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