作者 李芳银

新建webview页面

... ... @@ -44,6 +44,10 @@ App({
}
})
}
let token = wx.getStorageSync('token')
if (token) {
this.getCommon()
}
},
onShow: function (res) {
console.log(res);
... ... @@ -117,6 +121,28 @@ App({
})
return
},
async getCommon() {
let that = this
wx.login({
success(res) {
console.log(res);
request({
url: 'api/common/getUnionid',
method: "POST",
data: {
code: res.code
}
})
.then(res => {
console.log(res, 'api/common/getUnionid');
console.log('新出的接口', res);
}).catch(err => {
console.log(err);
console.log('新出的接口出错', err);
})
}
})
},
tipsFun(item) {
wx.showToast({
title: item,
... ...
... ... @@ -112,7 +112,8 @@
"pages/VSpikeMall/VSpikeMall",
"pages/VtuanOrderDetail/VtuanOrderDetail",
"pages/Vnew4Sstore/Vnew4Sstore",
"pages/carDetails/carDetails"
"pages/carDetails/carDetails",
"pages/webview/webview"
],
"window": {
"backgroundTextStyle": "dark",
... ... @@ -121,7 +122,6 @@
"navigationBarTextStyle": "black",
"enablePullDownRefresh": false
},
"tabBar": {
"color": "#8C9198",
"backgroundColor": "#fff",
... ... @@ -159,12 +159,11 @@
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"permission":{
"scope.userLocation" :{
"desc":"车唛优选小程序请求获取您的位置信息"
"permission": {
"scope.userLocation": {
"desc": "车唛优选小程序请求获取您的位置信息"
}
}
}
\ No newline at end of file
... ...
... ... @@ -30,6 +30,29 @@ Page({
goback() {
wx.navigateBack()
},
async common() {
let that = this
try {
const {
data: {
data
}
} = await request({
url: 'api/my2/myGuan',
method: 'POST', //
data: {
id: that.data.id
}
})
console.log(data);
that.setData({
commonList: data,
})
} catch (err) {
console.log(err);
that.popTest(err.msg)
}
},
async getmoreList() { //获取
let that = this
try {
... ...
... ... @@ -67,6 +67,7 @@ Page({
}
})
},
getPhoneNumber(e) { //手机号授权
let that = this
if (e.detail.errMsg == "getPhoneNumber:ok") {
... ...
... ... @@ -70,6 +70,11 @@ Page({
url: '/pages/Vmore4SList/Vmore4SList?home=1'
})
},
linkWebview() {
wx.navigateTo({
url: '/pages/webview/webview?url=' + 'http://h5.goorcar.com/'
})
},
addLoveCared() { // 去添加车辆
let that = this
let token = wx.getStorageSync("token")
... ...
... ... @@ -70,7 +70,7 @@
<swiper class="banner" indicator-color="{{indicator}}" indicator-active-color="{{indicatorActive}}" circular='{{circular}}' indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}">
<swiper-item wx:for="{{homeLoop}}" wx:key="index" wx:for-index="index" wx:for-item="item">
<navigator class="ims" hover-class="none">
<image src="{{item.img}}" />
<image src="{{item.img}}" bindtap="linkWebview" />
</navigator>
</swiper-item>
</swiper>
... ...
... ... @@ -36,6 +36,7 @@ Page({
is_id: '',
nomore: false,
},
onLoad: function (options) {
let that = this
... ... @@ -296,13 +297,15 @@ Page({
that.setData({
groomAList: that.data.groomAList.concat(data.data),
})
}
that.setData({
that.setData({
totalA: data.total,
current_page: data.current_page,
last_page: data.last_page,
})
console.log(this.data.groomAList);
wx.hideLoading()
} catch (err) {
... ...
... ... @@ -412,7 +412,6 @@ page {
padding: 0 14rpx 0;
box-sizing: border-box;
.list_masonry_a {
width: 100%;
... ...
// pages/webview/webview.js
Page({
/**
* 页面的初始数据
*/
data: {
waiUrl: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
waiUrl: options.url
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<web-view src="{{waiUrl}}" />
\ No newline at end of file
... ...
/* pages/webview/webview.wxss */
\ No newline at end of file
... ...
... ... @@ -100,6 +100,12 @@
{
"name": "pages/addcars/addcars",
"pathName": "pages/addcars/addcars",
"query": "",
"scene": null
},
{
"name": "pages/homeNoLogin2/homeNoLogin2",
"pathName": "pages/homeNoLogin2/homeNoLogin2",
"scene": null
}
]
... ...
// 导出一个封装好的异步请求
export const request = (params) => {
wx.showNavigationBarLoading()
const baseUrl = "https://car.goorcar.com/"
return new Promise((resolve, reject) => {
let header = {
// 'XX-Device-Type': 'wxapp',
'token': wx.getStorageSync("token") || ''
}
header = Object.assign(header)
... ... @@ -21,24 +19,9 @@ export const request = (params) => {
} else {
reject(res.data)
}
},
fail: (err) => {
reject(err)
wx.showNavigationBarLoading()
// wx.hideLoading();
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: '请求超时,请重新进入',
// // success: function () {
// // wx.redirectTo({
// // url: '../scan/scan'
// // })
// // }
// })
},
complete: function () {
wx.hideNavigationBarLoading()
... ... @@ -46,5 +29,4 @@ export const request = (params) => {
})
})
}
\ No newline at end of file
... ...