适配Mac端
This commit is contained in:
parent
d0cb25240b
commit
ceaaf975e1
@ -1,7 +1,8 @@
|
||||
import { SERVER_HOST } from "config";
|
||||
|
||||
App({
|
||||
onShow: function () {},
|
||||
onShow: function () {
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.getSid();
|
||||
},
|
||||
|
||||
@ -12,10 +12,11 @@
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTitleText": "New Bing Bot 🤖",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"networkTimeout": {
|
||||
"request": 1800000
|
||||
}
|
||||
},
|
||||
"resizable": true
|
||||
}
|
||||
|
||||
@ -6,16 +6,22 @@
|
||||
<image class="avatar" src="{{item.avatarUrl}}" style="display: flex;" bindlongpress="clearChat" data-index="{{index}}"></image>
|
||||
<view class="chat-box" style="margin-left: 20rpx;">
|
||||
<text class="dt">{{item.dt}}</text>
|
||||
<view class="content bg-white" bindlongpress="copyContent" data-index="{{index}}"><view class="{{item.blink ? 'blinking': ''}}"><wemark md="{{item.originContent}}" link="{{false}}" highlight type="wemark" wx:if="{{tools.indexOf(item.originContent, '```') || tools.indexOf(item.originContent, '**')}}"></wemark><view wx:else>{{item.originContent}}</view></view></view>
|
||||
<view class="suggest" >
|
||||
<text class="suggest-item" bindtap="suggestSubmit" data-suggest="{{suggest}}" wx:for="{{item.suggests}}" wx:for-item="suggest">{{suggest}}</text>
|
||||
</view>
|
||||
<view class="content bg-white" bindlongpress="copyContent" data-index="{{index}}">
|
||||
<view class="{{item.blink ? 'blinking': ''}}">
|
||||
<wemark md="{{item.originContent}}" link="{{false}}" highlight type="wemark" wx:if="{{tools.indexOf(item.originContent, '```') || tools.indexOf(item.originContent, '**')}}">
|
||||
</wemark>
|
||||
<text user-select decode space wx:else>{{item.originContent}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="suggest">
|
||||
<text class="suggest-item" bindtap="suggestSubmit" data-suggest="{{suggest}}" wx:for="{{item.suggests}}" wx:for-item="suggest">{{suggest}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="chat-item right" wx:if="{{item.type == 'man' }}" id="msg-{{index}}">
|
||||
<view class="chat-box" style="margin-right: 20rpx;">
|
||||
<text class="dt" style="display: block;text-align: right">{{item.dt}}</text>
|
||||
<view class="content bg-green" bindlongpress="copyContent" data-index="{{index}}">{{item.originContent}}</view>
|
||||
<view class="content bg-green" bindlongpress="copyContent" data-index="{{index}}"><text user-select decode space>{{item.originContent}}</text></view>
|
||||
</view>
|
||||
<image class="avatar" src="{{item.avatarUrl}}" bindlongpress="clearChat" data-index="{{index}}"></image>
|
||||
</view>
|
||||
|
||||
@ -1,4 +1,14 @@
|
||||
import { SERVER_HOST } from "../../config";
|
||||
import {
|
||||
SERVER_HOST
|
||||
} from "../../config";
|
||||
|
||||
const systemInfo = wx.getSystemInfoSync()
|
||||
|
||||
function inputPop() {
|
||||
return systemInfo.platform == "ios" || systemInfo.platform == "android"
|
||||
}
|
||||
|
||||
const initHeight = inputPop() ? 20 : 2
|
||||
|
||||
Date.prototype.format = function (fmt) {
|
||||
var o = {
|
||||
@ -37,18 +47,21 @@ const personAvatar = "../../image/person.jpeg";
|
||||
|
||||
Page({
|
||||
data: {
|
||||
InputBottom: 24,
|
||||
InputBottom: initHeight,
|
||||
content: "",
|
||||
systemInfo: systemInfo
|
||||
},
|
||||
InputFocus(e) {
|
||||
this.setData({
|
||||
InputBottom: e.detail.height,
|
||||
});
|
||||
if (inputPop()) {
|
||||
this.setData({
|
||||
InputBottom: e.detail.height,
|
||||
});
|
||||
}
|
||||
},
|
||||
InputBlur(e) {
|
||||
this.setData({
|
||||
InputBottom: 24,
|
||||
});
|
||||
InputBottom: initHeight,
|
||||
});
|
||||
},
|
||||
processContent(content) {
|
||||
return content.replace(/\\n/g, "\n");
|
||||
@ -71,6 +84,8 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
submitContent: function (content) {
|
||||
var that = this;
|
||||
const cht = app.globalData.cht;
|
||||
@ -116,7 +131,7 @@ Page({
|
||||
}
|
||||
wx.request({
|
||||
url: SERVER_HOST + "/bing/chat",
|
||||
method: "POST",
|
||||
method: "POST",
|
||||
data: {
|
||||
q: content,
|
||||
t: new Date().getTime(),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<chat-box bindsuggestSubmit="onSuggestSubmit"></chat-box>
|
||||
<view style="bottom:{{InputBottom}}px; border-radius: 20rpx;margin-left: 1.5%;width: 97%;min-height: 88rpx;position: fixed;background-color: #f4f6f8;display: flex;">
|
||||
<textarea bindfocus="InputFocus" bindblur="InputBlur" model:value="{{content}}" adjust-position="{{false}}" focus="{{false}}" maxlength="2000" auto-height="{{true}}" cursor-spacing="10" bindconfirm="submit" fixed="{{true}}" show-confirm-bar="{{false}}" confirm-type="send" placeholder="请输入问题..." style="padding: 10rpx;flex: 8;" disable-default-padding="{{true}}" placeholder-style="color: #b4bbc4"></textarea>
|
||||
<!-- <button style="flex: 1;background-color: #f4f6f8;color: {{content ? black : '#b4bbc4'}};border-left: 1px dashed #b4bbc4;border-radius: 0 20rpx 20rpx 0;" bindtap="submit">发送</button> -->
|
||||
<view style="bottom:{{InputBottom}}px; border-radius: 20rpx;margin-left: 1.5%;width: 97%;min-height: 100rpx;position: fixed;background-color: #f4f6f8;display: flex;align-items:flex-start;">
|
||||
<textarea bindfocus="InputFocus" bindblur="InputBlur" model:value="{{content}}" adjust-position="{{false}}" focus="{{false}}" auto-focus="{{!(systemInfo.platform == 'ios' || systemInfo.platform == 'android')}}" maxlength="2000" auto-height="{{true}}" cursor-spacing="10" bindconfirm="submit" fixed="{{true}}" show-confirm-bar="{{false}}" confirm-type="send" placeholder="请输入问题..." style="padding: 10rpx;flex: 8;" disable-default-padding="{{true}}" placeholder-style="color: #b4bbc4"></textarea>
|
||||
<button style="flex: 1;background-color: #f4f6f8;color: {{content ? black : '#b4bbc4'}};border-left: 1px dashed #b4bbc4;border-radius: 0 20rpx 20rpx 0;" bindtap="submit" wx:if="{{systemInfo.platform != 'ios'}}">发送</button>
|
||||
</view>
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"appid": "wxee7496be5b68b740",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.12.3",
|
||||
"libVersion": "2.16.1",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
"compileHotReLoad": true,
|
||||
"urlCheck": false
|
||||
},
|
||||
"libVersion": "2.15.0"
|
||||
"libVersion": "2.16.1"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user