dev
xiaowen 3 years ago
parent 9e4ae2fcd5
commit fab9737ee9

@ -7,6 +7,16 @@ export default function singleLine(dValue=[],dx=[]){
height: 126,
width: 265
},
tooltip: {
trigger: "axis",
backgroundColor: "#08182F",
color: "#fff",
borderColor: "#3373CC",
textStyle: {
color: "#fff", //设置文字颜色
fontSize: 9
}
},
yAxis: [
{
type: 'value',

@ -208,6 +208,12 @@ Page({
})
})
},
handlerHEvent(e) {
let row = e.currentTarget.dataset.row;
wx.navigateTo({
url: "/pages/insight/pages/eventInsight/index" + '?id=' + row.events_id
})
},
handlerCrisis(e) {
let row = e.currentTarget.dataset.row;
let id = row._id;

@ -106,7 +106,7 @@
</view>
<view class="brand-info">
<view class="bi-title">热点事件</view>
<view class="bi-i-item" style="margin-top: 10px;" wx:for="{{hotEventsList}}" wx:key="key">
<view class="bi-i-item" style="margin-top: 10px;" wx:for="{{hotEventsList}}" wx:key="key" data-row="{{item}}" bindtap="handlerHEvent">
<view class="biii-d1">
<view class="biii-d1-t1">{{item.events_title}}</view>
<view style="font-size: 14px;color: #333333;font-weight: 600;">{{item.count}}</view>

@ -7,66 +7,154 @@ Page({
* 页面的初始数据
*/
data: {
username: '',
password: '',
userName: '',
pwd: '',
openid: '',
img: '',
phoneCode: '',
phone: '',
nickName:''
unionID: '',
code: '',
nickName: '',
avatarUrl: ''
},
usernameInput: function (e) {
this.data.username = e.detail.value
this.setData({
userName: e.detail.value
})
},
passwordInput: function (e) {
this.data.password = e.detail.value
this.setData({
pwd: e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
async login() {
let {
userInfo,
rawData
} = await wx.getUserProfile({
desc: "需获取"
onLoad(options) {
this.initData()
},
// 微信用户初始化
initData() {
return new Promise((resolve, reject) => {
this.getUserCode().then(() => {
this.getOpenidByCode().then(() => {
resolve(true)
})
})
})
this.data.img = rawData.avatarUrl
this.data.name = userInfo.nickName
let {
code
} = await wx.login()
//获取openid
let {
openid,
unionID
} = await app.globalData.request({
action: 'getOpenidByCode',
code: code,
nickName: userInfo.nickName
}, 'http://cloud.sws010.com/api/WeiXinApp.ashx')
this.data.openid = openid
this.data.unionID = unionID
},
getPhoneNumber(e) {
//需要从后台获取手机号
console.log(e);
this.data.phoneCode = e.detail.code
app.globalData.request({
action:'logUser',
username:this.data.username,
pwd:this.data.password,
name:this.data.nickName,
img:this.data.img,
openid:this.openid,
unionID:this.data.unionID
}).then(res=>{
console.log(res);
// 微信授权获取用户信息
getUserCode() {
let that = this;
return new Promise((resolve, reject) => {
wx.login({
success (res) {
that.setData({
code: res.code
})
wx.getUserInfo({
success(data) {
let userInfo = data.userInfo;
that.setData({
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl
})
resolve(true)
},
fail() {
reject(false)
}
})
},
fail() {
reject(false)
}
})
})
},
// 获取openid
getOpenidByCode() {
let that = this;
return new Promise((resolve, reject) => {
let obj = {
action: 'getOpenidByCode',
code: this.data.code,
nickName: this.data.nickName,
version: "1",
avatarUrl: this.data.avatarUrl
}
wx.request({
url: 'http://cloud.sws010.com/api/WeiXinApp.ashx',
data: obj,
method: 'get',
success: function (res) {
//接口实际返回的内容在res.data中
if(res.data.Code == 1) {
let data = res.data.Data;
that.setData({
openid: data.openid,
unionID: data.unionid
})
resolve(true);
} else {
reject(false)
}
},
fail: function (err) {
reject(err);
}
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
login() {
if(!this.data.userName || !this.data.pwd) {
wx.showModal({
title: '提示',
content: '请输入账号或密码!',
})
return
}
this.initData().then(() => {
let obj = {
action: "logUser",
userName: this.data.userName,
pwd: this.data.pwd,
name: this.data.nickName,
img: this.data.avatarUrl,
openid: this.data.openid,
unionID: this.data.unionID
}
app.globalData.request(obj).then(res => {
wx.setStorageSync('token', res.toKen);
wx.setStorageSync('userInfo', res);
wx.setStorageSync('openid', this.data.openid);
wx.navigateBack({
delta: 1
});
}).catch(err => {
if(err.Code == 2) {
let data = err.Data;
wx.setStorageSync('token', data.toKen);
wx.setStorageSync('userInfo', data);
wx.showModal({
title: '提示',
content: '登录成功,但未关注公众号。',
success: function (r) {
if(r.confirm) {
wx.navigateBack({
delta: 1
});
} else {
console.log('取消')
}
}
})
} else {
wx.showModal({
title: '提示',
content: err.Msg,
})
}
})
})
}
})

@ -1,10 +1,10 @@
<!--pages/mine/pages/bindUser.wxml-->
<view class="bind_box" >
<view style="font-size:28rpx;font-weight:bolder;margin-left: 32rpx">硕为思账号</view>
<input placeholder="请输入账号" placeholder-class="placeholder-style" bindinput="usernameInput" ></input>
<input value="{{userName}}" placeholder="请输入账号" placeholder-class="placeholder-style" bindinput="usernameInput" ></input>
<view style="font-size:28rpx;font-weight:bolder;margin-top: 32rpx;margin-left: 32rpx"
>密码</view>
<input placeholder="请输入密码" placeholder-class="placeholder-style" type="password" bindinput="passwordInput"></input>
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"
<input value="{{pwd}}" placeholder="请输入密码" placeholder-class="placeholder-style" type="password" bindinput="passwordInput"></input>
<button bindtap="login"
class="bts" bindtap="login">立即绑定</button>
</view>

Loading…
Cancel
Save