首页和地图
This commit is contained in:
3
app.js
3
app.js
@@ -2,9 +2,6 @@
|
||||
App({
|
||||
onLaunch() {
|
||||
// 展示本地存储能力
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
|
||||
15
app.json
15
app.json
@@ -1,8 +1,21 @@
|
||||
{
|
||||
"pages":[
|
||||
"pages/index/index",
|
||||
"pages/logs/logs"
|
||||
"pages/ltjm/ltjm",
|
||||
"pages/liaotian/liaotian"
|
||||
],
|
||||
"tabBar":{
|
||||
"color": "#f00",
|
||||
"selectedColor": "#0f0",
|
||||
"backgroundColor": "#fff",
|
||||
"list":[{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页"
|
||||
},{
|
||||
"pagePath": "pages/liaotian/liaotian",
|
||||
"text": "聊天"
|
||||
}]
|
||||
},
|
||||
"window":{
|
||||
"backgroundTextStyle":"light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
|
||||
BIN
images/定位.png
Normal file
BIN
images/定位.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@vant/weapp": "^1.6.8"
|
||||
"@vant/weapp": "^1.6.8",
|
||||
"tim-wx-sdk": "^2.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,53 @@
|
||||
// index.js
|
||||
// 获取应用实例
|
||||
const app = getApp()
|
||||
|
||||
import im from "../../utils/im.js"
|
||||
Page({
|
||||
data: {
|
||||
longitude: "117.85",
|
||||
latitude: "36.3950",
|
||||
map: '',
|
||||
markes: [{
|
||||
id: 1,
|
||||
longitude: "117.85",
|
||||
latitude: "36.3950",
|
||||
iconPath: "../../images/定位.png",
|
||||
width:50,
|
||||
height: 50
|
||||
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
longitude: "117.86",
|
||||
latitude: "36.3950",
|
||||
iconPath: "../../images/定位.png",
|
||||
width:50,
|
||||
height: 50,
|
||||
callout:{
|
||||
content:"添加好友",
|
||||
color: "#fff",
|
||||
bgColor: "#f00",
|
||||
padding:5,
|
||||
display: 'ALWAYS'
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
longitude: "117.85",
|
||||
latitude: "36.3850",
|
||||
iconPath: "../../images/定位.png",
|
||||
width:50,
|
||||
height: 50
|
||||
|
||||
}]
|
||||
},
|
||||
onLoad() {
|
||||
// console.log("load")
|
||||
// this.setData({
|
||||
// map: wx.createMapContext('map')
|
||||
// })
|
||||
console.log(im)
|
||||
// console.log(this.data.map)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText":"首页"
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
.map{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
page{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -9,4 +5,8 @@ page{
|
||||
.container{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.map{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- index.wxml -->
|
||||
<view class="container">
|
||||
<map name="" class="map"></map>
|
||||
<map name="" id="map" class="map" longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markes}}"></map>
|
||||
</view>
|
||||
@@ -1,8 +1,3 @@
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -12,3 +7,8 @@ page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container .map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
7
pages/liaotian/liaotian.js
Normal file
7
pages/liaotian/liaotian.js
Normal file
@@ -0,0 +1,7 @@
|
||||
Page({
|
||||
tiaozhuan(){
|
||||
wx.navigateTo({
|
||||
url:"/pages/ltjm/ltjm"
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/liaotian/liaotian.json
Normal file
4
pages/liaotian/liaotian.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "聊天"
|
||||
}
|
||||
37
pages/liaotian/liaotian.scss
Normal file
37
pages/liaotian/liaotian.scss
Normal file
@@ -0,0 +1,37 @@
|
||||
page{
|
||||
}
|
||||
.box{
|
||||
width: 750rpx;
|
||||
padding: 23rpx;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
.user{
|
||||
box-sizing: border-box;
|
||||
width: 704rpx;
|
||||
height: 131rpx;
|
||||
// background-color: #0f0;
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
align-items: center;
|
||||
.head{
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 18rpx;
|
||||
background-color: #0f0;
|
||||
}
|
||||
.info{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
.name{
|
||||
font-size: 30rpx;
|
||||
color:#333;
|
||||
}
|
||||
.text{
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
pages/liaotian/liaotian.wxml
Normal file
9
pages/liaotian/liaotian.wxml
Normal file
@@ -0,0 +1,9 @@
|
||||
<view class="box">
|
||||
<view class="user" wx:for="{{10}}" bind:tap="tiaozhuan">
|
||||
<image class="head"></image>
|
||||
<view class="info">
|
||||
<text class="name">name</text>
|
||||
<text class="text">texttexttext</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
39
pages/liaotian/liaotian.wxss
Normal file
39
pages/liaotian/liaotian.wxss
Normal file
@@ -0,0 +1,39 @@
|
||||
.box {
|
||||
width: 750rpx;
|
||||
padding: 23rpx;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.box .user {
|
||||
box-sizing: border-box;
|
||||
width: 704rpx;
|
||||
height: 131rpx;
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.box .user .head {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 18rpx;
|
||||
background-color: #0f0;
|
||||
}
|
||||
|
||||
.box .user .info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.box .user .info .name {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.box .user .info .text {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// logs.js
|
||||
const util = require('../../utils/util.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
logs: []
|
||||
},
|
||||
onLoad() {
|
||||
this.setData({
|
||||
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||
return util.formatTime(new Date(log))
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "查看启动日志",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<!--logs.wxml-->
|
||||
<view class="container log-list">
|
||||
<block wx:for="{{logs}}" wx:for-item="log">
|
||||
<text class="log-item">{{index + 1}}. {{log}}</text>
|
||||
</block>
|
||||
</view>
|
||||
@@ -1,8 +0,0 @@
|
||||
.log-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40rpx;
|
||||
}
|
||||
.log-item {
|
||||
margin: 10rpx;
|
||||
}
|
||||
3
pages/ltjm/ltjm.js
Normal file
3
pages/ltjm/ltjm.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Page({
|
||||
|
||||
})
|
||||
4
pages/ltjm/ltjm.json
Normal file
4
pages/ltjm/ltjm.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "实时聊天"
|
||||
}
|
||||
0
pages/ltjm/ltjm.scss
Normal file
0
pages/ltjm/ltjm.scss
Normal file
8
pages/ltjm/ltjm.wxml
Normal file
8
pages/ltjm/ltjm.wxml
Normal file
@@ -0,0 +1,8 @@
|
||||
<view class="box">
|
||||
<view class="user">
|
||||
</view>
|
||||
<view class="laixin">
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -1,73 +1,80 @@
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": []
|
||||
},
|
||||
"setting": {
|
||||
"bundle": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"urlCheck": true,
|
||||
"scopeDataCheck": false,
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"compileHotReLoad": false,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"autoAudits": false,
|
||||
"newFeature": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"useIsolateContext": true,
|
||||
"nodeModules": false,
|
||||
"enhance": false,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"enableEngineNative": false,
|
||||
"minifyWXSS": true,
|
||||
"packNpmManually": true,
|
||||
"packNpmRelationList": [
|
||||
{
|
||||
"packageJsonPath": "./package.json",
|
||||
"miniprogramNpmDistDir": "./"
|
||||
}
|
||||
]
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.0.4",
|
||||
"appid": "wx932dd04d3a7e7341",
|
||||
"projectname": "%E6%88%BF%E8%BD%A6",
|
||||
"debugOptions": {
|
||||
"hidedInDevtools": []
|
||||
},
|
||||
"scripts": {},
|
||||
"staticServerOptions": {
|
||||
"baseURL": "",
|
||||
"servePath": ""
|
||||
},
|
||||
"isGameTourist": false,
|
||||
"condition": {
|
||||
"search": {
|
||||
"list": []
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": []
|
||||
},
|
||||
"conversation": {
|
||||
"list": []
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": false,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"coverView": true,
|
||||
"nodeModules": true,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"uglifyFileName": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": false,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"bundle": false,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": true,
|
||||
"packNpmRelationList": [
|
||||
{
|
||||
"packageJsonPath": "./package.json",
|
||||
"miniprogramNpmDistDir": "./"
|
||||
}
|
||||
],
|
||||
"minifyWXSS": true
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.0.4",
|
||||
"appid": "wx0ae1f549a7384633",
|
||||
"projectname": "%E6%88%BF%E8%BD%A6",
|
||||
"debugOptions": {
|
||||
"hidedInDevtools": []
|
||||
},
|
||||
"plugin": {
|
||||
"list": []
|
||||
"scripts": {},
|
||||
"staticServerOptions": {
|
||||
"baseURL": "",
|
||||
"servePath": ""
|
||||
},
|
||||
"gamePlugin": {
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"list": []
|
||||
"isGameTourist": false,
|
||||
"condition": {
|
||||
"search": {
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"list": []
|
||||
},
|
||||
"gamePlugin": {
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
utils/im.js
Normal file
11
utils/im.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import TIM from '../miniprogram_npm/tim-wx-sdk/index.js';
|
||||
let options = {
|
||||
SDKAppID: 0 // 接入时需要将0替换为您的即时通信 IM 应用的 SDKAppID
|
||||
};
|
||||
// 创建 SDK 实例,`TIM.create()`方法对于同一个 `SDKAppID` 只会返回同一份实例
|
||||
let tim = TIM.create(options); // SDK 实例通常用 tim 表示
|
||||
// 设置 SDK 日志输出级别,详细分级请参见 <a href="https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#setLogLevel">setLogLevel 接口的说明</a>
|
||||
tim.setLogLevel(0); // 普通级别,日志量较多,接入时建议使用
|
||||
// tim.setLogLevel(1); // release 级别,SDK 输出关键信息,生产环境时建议使用
|
||||
// 注册腾讯云即时通信 IM 上传插件
|
||||
export default tim;
|
||||
@@ -6,3 +6,8 @@
|
||||
version "1.6.8"
|
||||
resolved "https://registry.npmjs.org/@vant/weapp/-/weapp-1.6.8.tgz#948ae16fba07c5a2054c52783f22aaf6a04453e1"
|
||||
integrity sha512-CvRgAZdGUtJKEnd2wmjw3oaRYXBq/YqerFTmf19cTd3G9+vRR67nSXPMUNQEoPPSm7LZo6gF6Xk/5pYx4Q4C0Q==
|
||||
|
||||
tim-wx-sdk@^2.10.1:
|
||||
version "2.10.1"
|
||||
resolved "https://registry.npmjs.org/tim-wx-sdk/-/tim-wx-sdk-2.10.1.tgz#945a3e638239c856ea0cadb79b4374ed806d9fb0"
|
||||
integrity sha512-sf/dDupxwuRy6PiYFvTKvbJsAtw4JwF21i6wiV4LzSKqPebtGMh9RNk89D5YNneLaXY102gT6Uj1Z3qU8HbDkg==
|
||||
|
||||
Reference in New Issue
Block a user