Commit a09ab2cb by 李静静

首页换成webview里面放

/h5/app3/product/common?id=163链接
parent c5f7ebdc
//index.js
// pages/a/index.wxm.js
const app = getApp()
import {request} from "../../utils/request.js"
import {host} from "../../utils/request.js"
Page({
/**
* 页面的初始数据
*/
data: {
modal:false,
isLowerVersion:false
// group_list:[]
url:host+'/h5/app3/product/common?id='+163
},
compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
return 0
},
calVersion:function(){
const systemInfo = wx.getSystemInfoSync()
console.log(systemInfo)
const version = systemInfo.version
const system = systemInfo.system.toLowerCase()
if(system.indexOf("ios")>-1){
if(this.compareVersion(version, '8.0.6')<0){
// this.showServiceNoticMessage()
return true
}
}
if(system.indexOf("android")>-1){
if(this.compareVersion(version, '8.0.3')<0){
// this.showServiceNoticMessage()
return true
}
}
return false;
},
showServiceNoticMessage(content){
wx.showModal({
title: '',
content,
showCancel:false
})
},
onLoad: function() {
this.setData({
isLowerVersion:this.calVersion()
})
},
onShow:function(){
console.log(this)
this.getGroupList()
},
showModal:function(){
this.setData({
modal:true
})
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
getGroupList:function(){
console.log(request)
request({
url:"/h5/api/group/free_group_list",
success:(res)=>{
console.log(res.data)
if(res.data&&res.data.code===0){
console.log(res.data.data.list)
this.setData({
group_list:res.data.data.list,
picture_list:res.data.data.picture_list,
text:res.data.data.text,
btn_pic:res.data.data.btn_pic,
})
}
}
})
},
startmessage:function(res){
console.log("start",res)
},
wxShowModal:function(obj){
wx.showModal(obj)
},
chatGroupComplete:function(res){
this.completemessage(res,'入群方式已经通过“服务通知”的形式下发到你的微信')
},
contactComplete:function(res){
this.completemessage(res,'深蓝小助名片已通过“服务通知”形式下发你的微信')
},
completemessage:function(res,message){
console.log("complete",arguments,res.detail)
if(Number(res.detail.errcode)===-3004){
wxShowModal({
title: '用户信息授权失败',
})
return
}
if(res.detail&&Number(res.detail.notifytype)===0){
// this.showVersion()
if(!this.data.isLowerVersion){
this.showServiceNoticMessage(message)
}
}
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
modalClose:function(){
this.setData({
modal:false
})
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
noop:function(e){
//console.log(e)
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
gotoweiban:function(e){
console.log(e.target.id)
wx.navigateTo({
url: '/pages/weibanzhushou/index?id='+e.target.id,
})
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onShareTimeline: function () {
......
<!--index.wxml-->
<view class="container">
<!-- <view class="header">
<image src="../../images/logo.png" class="logo"/>
</view> -->
<!-- <view class="content">
<view class="content-h3">在专属社群你可以获得:</view>
<view class="content-item">
<image src="../../images/content-img-1.png" class="content-img" />
<view class="content-text-container">
<text class="content-item-h4">海量免费资料</text>
<text class="content-p">大量、系统、全阶段的法考资料免费送。</text>
</view>
</view>
<view class="content-item">
<image src="../../images/content-img-2.png" class="content-img" />
<view class="content-text-container">
<text class="content-item-h4">每日学习计划</text>
<text class="content-p">精准把握学习进度,稳扎稳打,逐步提升。</text>
</view>
</view>
<view class="content-item">
<image src="../../images/content-img-3.png" class="content-img" />
<view class="content-text-container">
<text class="content-item-h4">浓厚学习氛围</text>
<text class="content-p">群内特设每日一题,相互讨论,共同进步。</text>
</view>
</view>
<view class="content-item">
<image src="../../images/content-img-4.png" class="content-img" />
<view class="content-text-container">
<text class="content-item-h4">班主任强督导</text>
<text class="content-p">群内特设每日一题,相互讨论,共同进步。</text>
</view>
</view>
</view> -->
<view class="img_list">
<image
wx:for="{{picture_list}}"
src="{{item.url}}"
class="img_item"
style="height:{{item.height}}rpx"
></image>
</view>
<view wx:if="{{btn_pic}}" class="join-btn" bindtap="showModal">
<image src="{{btn_pic.url}}" class="join-btn-bg" />
<!-- <view class="join-btn-text" >加入专属备考群</view> -->
</view>
<view wx:if="{{modal}}" class="modal"
catch:touchmove="noop"
>
<view class="modal-content">
<view class="modal-close" bindtap="modalClose"></view>
<view class="modal-h4">{{text}}</view>
<view wx:if="{{isLowerVersion}}" class="modal-version-tips">
<view>检测到你的微信版本过低,可能造成无法加群,</view>
<view>建议升级微信最新版本</view>
</view>
<scroll-view class="modal-list" scroll-y="{{true}}"
show-scrollbar="{{false}}"
>
<view class="modal-item" wx:for="{{group_list}}" >
<!-- bindtap="showVersion" -->
<view class="modal-item-title">{{item.name}}</view>
<view class="modal-item-p">{{item.desc}}</view>
<view class="modal-item-after"></view>
<view class="modal-item-join">
<!-- url='https://work.weixin.qq.com/gm/24e84fe11d990cd99fa67ccd99f1aa4b'
url='https://work.weixin.qq.com/gm/{{item.uniq_code}}'
-->
<chatGroupCell
paddingStyle="80"
wx:if="{{item.type===1}}"
url='{{item.uniq_code}}'
bind:startmessage="startmessage"
bind:completemessage="chatGroupComplete"
/>
<contactCell
styleType="3"
paddingStyle="30"
isMask="{{1}}"
wx:if="{{item.type===2}}"
plugid='{{item.uniq_code}}'
bind:completemessage="contactComplete"
class="contact-cell"
/>
<view
wx:if="{{item.type===3}}"
class="weibanzhushou"
bindtap="gotoweiban"
id="{{item.id}}"
></view>
</view>
</view>
</scroll-view>
</view>
</view>
<web-view src="{{url}}"></web-view>
</view>
//const host='http://ljj.dev.neoteched.com' //开发
//const host='http://lxlsk.dev.neoteched.com' //开发
//const host='https://winterfell-alpha.neoteched.com' //测试
const host='https://sk2.shenlancity.com' //线上
export const host='https://sk2.shenlancity.com' //线上
export const request=({url,data,method,header,success,fail})=>{
if(!url){
......
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