提交 be829878 编写于 作者: yma16's avatar yma16

code copy img click qr scan

上级 2ebba9e6
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="14febd48-e5b8-4a4f-b997-f51453650c39" name="Default Changelist" comment=""> <list default="true" id="14febd48-e5b8-4a4f-b997-f51453650c39" name="Default Changelist" comment="feat:可视化部分">
<change beforePath="$PROJECT_DIR$/miniprogram/app.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/app.wxss" afterDir="false" /> <change beforePath="$PROJECT_DIR$/miniprogram/pages/future/future.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/future/future.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/components/base/blockInfo/blockInfo.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/components/base/blockInfo/blockInfo.wxml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/miniprogram/pages/future/future.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/future/future.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/components/base/blockInfo/blockInfo.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/components/base/blockInfo/blockInfo.wxss" afterDir="false" /> <change beforePath="$PROJECT_DIR$/miniprogram/pages/home/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/home/home.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/components/visualComponent/geoMap/geoMap.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/components/visualComponent/geoMap/geoMap.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/components/visualComponent/lineChart/lineChart.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/components/visualComponent/lineChart/lineChart.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/components/visualComponent/lineChart/lineChart.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/components/visualComponent/lineChart/lineChart.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/pages/blog/blog.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/blog/blog.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/pages/future/future.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/future/future.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/pages/home/home.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/home/home.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/pages/homeContent/homeContent.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/homeContent/homeContent.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/miniprogram/pages/homeContent/homeContent.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/homeContent/homeContent.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/miniprogram/pages/life/life.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/life/life.wxss" afterDir="false" /> <change beforePath="$PROJECT_DIR$/miniprogram/pages/index/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/miniprogram/pages/index/index.js" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
...@@ -25,7 +19,7 @@ ...@@ -25,7 +19,7 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/miniprogram/pages/home/home.js"> <entry file="file://$PROJECT_DIR$/miniprogram/pages/home/home.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342"> <state relative-caret-position="342">
...@@ -37,6 +31,15 @@ ...@@ -37,6 +31,15 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/miniprogram/pages/future/future.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="301" column="26" lean-forward="true" selection-start-line="301" selection-start-column="26" selection-end-line="301" selection-end-column="26" />
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
...@@ -46,6 +49,7 @@ ...@@ -46,6 +49,7 @@
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/miniprogram/pages/home/home.js" /> <option value="$PROJECT_DIR$/miniprogram/pages/home/home.js" />
<option value="$PROJECT_DIR$/miniprogram/pages/future/future.js" />
</list> </list>
</option> </option>
</component> </component>
...@@ -61,10 +65,9 @@ ...@@ -61,10 +65,9 @@
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="260" /> <option name="x" value="-8" />
<option name="y" value="25" /> <option name="width" value="1935" />
<option name="width" value="1400" /> <option name="height" value="1057" />
<option name="height" value="1000" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView"> <component name="ProjectView">
...@@ -72,6 +75,7 @@ ...@@ -72,6 +75,7 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Scope" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
...@@ -95,6 +99,20 @@ ...@@ -95,6 +99,20 @@
<item name="miniprogram" type="462c0819:PsiDirectoryNode" /> <item name="miniprogram" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" /> <item name="pages" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="yma16_program" type="b2602c69:ProjectViewProjectNode" />
<item name="yma16_program" type="462c0819:PsiDirectoryNode" />
<item name="miniprogram" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="blog" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="yma16_program" type="b2602c69:ProjectViewProjectNode" />
<item name="yma16_program" type="462c0819:PsiDirectoryNode" />
<item name="miniprogram" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="future" type="462c0819:PsiDirectoryNode" />
</path>
<path> <path>
<item name="yma16_program" type="b2602c69:ProjectViewProjectNode" /> <item name="yma16_program" type="b2602c69:ProjectViewProjectNode" />
<item name="yma16_program" type="462c0819:PsiDirectoryNode" /> <item name="yma16_program" type="462c0819:PsiDirectoryNode" />
...@@ -106,10 +124,10 @@ ...@@ -106,10 +124,10 @@
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="true" /> <property name="WebServerToolWindowFactoryState" value="true" />
<property name="WebServerToolWindowPanel.toolwindow.highlight.mappings" value="true" /> <property name="WebServerToolWindowPanel.toolwindow.highlight.mappings" value="true" />
<property name="WebServerToolWindowPanel.toolwindow.highlight.symlinks" value="true" /> <property name="WebServerToolWindowPanel.toolwindow.highlight.symlinks" value="true" />
...@@ -147,6 +165,7 @@ ...@@ -147,6 +165,7 @@
<updated>1665923387310</updated> <updated>1665923387310</updated>
<workItem from="1665923390899" duration="1623000" /> <workItem from="1665923390899" duration="1623000" />
<workItem from="1666014780446" duration="183000" /> <workItem from="1666014780446" duration="183000" />
<workItem from="1680446465011" duration="1019000" />
</task> </task>
<task id="LOCAL-00001" summary="feat:可视化部分"> <task id="LOCAL-00001" summary="feat:可视化部分">
<created>1665930867783</created> <created>1665930867783</created>
...@@ -159,12 +178,12 @@ ...@@ -159,12 +178,12 @@
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="1806000" /> <option name="totallyTimeSpent" value="2825000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" /> <frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2553305" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
...@@ -175,18 +194,28 @@ ...@@ -175,18 +194,28 @@
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" /> <window_info anchor="bottom" id="Docker" order="7" />
<window_info anchor="bottom" id="Version Control" order="8" /> <window_info active="true" anchor="bottom" id="Version Control" order="8" visible="true" weight="0.34251103" />
<window_info anchor="bottom" id="Terminal" order="9" /> <window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" /> <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info active="true" anchor="right" id="Remote Host" visible="true" weight="0.32995737" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Remote Host" order="3" weight="0.32995737" />
</layout> </layout>
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="Vcs.Log.History.Properties">
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="2" />
<option value="3" />
<option value="1" />
</list>
</option>
</component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="feat:可视化部分" /> <MESSAGE value="feat:可视化部分" />
<option name="LAST_COMMIT_MESSAGE" value="feat:可视化部分" /> <option name="LAST_COMMIT_MESSAGE" value="feat:可视化部分" />
...@@ -202,5 +231,12 @@ ...@@ -202,5 +231,12 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/miniprogram/pages/future/future.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="301" column="26" lean-forward="true" selection-start-line="301" selection-start-column="26" selection-end-line="301" selection-end-column="26" />
</state>
</provider>
</entry>
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -42,7 +42,21 @@ App({ ...@@ -42,7 +42,21 @@ App({
useText: '使用', useText: '使用',
returnText: '返回介绍', returnText: '返回介绍',
sendText: '发送', sendText: '发送',
searchText: '关键词查询' searchText: '关键词查询',
reportText: '复制数据',
copyText: '复制',
pasteText: '粘贴',
upText: "",
downText: "",
errorMsg: 'openai的服务器异常!',
emptyText: '欢迎',
storageKey: 'openAiOptionsConfig',
permissionTitle: '很抱歉您没有权限!',
permissionContent: '请联系微信号:cse-yma16\r\n 需要1元开通权限\r\n1元可支持100条消息!',
wxInfoImg: 'https://yongma16.xyz/staticFile/common/img/userInfo.png',
limitMsgCount: 10,
confirmText: '添加微信',
cancelText: '返回'
} }
}, },
aboutPageConfig: { aboutPageConfig: {
...@@ -66,6 +80,31 @@ App({ ...@@ -66,6 +80,31 @@ App({
}, },
// 引入`towxml3.0`解析方法 // 引入`towxml3.0`解析方法
towxml: require('/towxml/index'), towxml: require('/towxml/index'),
/**
* 转换text
* @param {string} text
*/
changeMrkdownText(text) {
const markdownText = this.towxml(text, 'markdown', {
theme: 'light', //主题 dark 黑色,light白色,不填默认light
events:{
tap:(e)=>{
console.log('e',e)
if(e&&e.target&&e.target.dataset.data){
const {attrs,tag}=e.target.dataset.data
if(tag==='img'){
const {src}=attrs
wx.previewImage({
current: src, // 当前显示图片的http链接
urls: [src] // 需要预览的图片http链接列表
})
}
}
}
}
});
return markdownText
},
getUserProfile: function (e) { getUserProfile: function (e) {
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 // 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
...@@ -83,6 +122,9 @@ App({ ...@@ -83,6 +122,9 @@ App({
console.log('onLaunch', options) console.log('onLaunch', options)
// 获取配置项目 // 获取配置项目
const that = this const that = this
wx.showLoading({
title: '加载配置中',
})
wx.request({ wx.request({
url: 'https://yongma16.xyz/api/dictModel/index/', url: 'https://yongma16.xyz/api/dictModel/index/',
method: 'POST', method: 'POST',
...@@ -90,13 +132,41 @@ App({ ...@@ -90,13 +132,41 @@ App({
kind: 'wxConfig' kind: 'wxConfig'
}, success: function (res) { }, success: function (res) {
console.log('res', res) console.log('res', res)
if (res.data.data) { wx.hideLoading({
console.log('JSON.parse(res.data.data)', JSON.parse(res.data.data[0].option)) success: (loadRes) => { console.log(loadRes) },
})
if (res.data.data && res.data.data[0].option) {
that.wxProgramConfig = JSON.parse(res.data.data[0].option) that.wxProgramConfig = JSON.parse(res.data.data[0].option)
wx.navigateTo({
url: 'pages/index/index',
success: function (res) {
// 通过 eventChannel 向被打开页面传送数据
console.log('res', res)
}
});
}
else {
wx.navigateTo({
url: 'pages/index/index',
success: function (res) {
// 通过 eventChannel 向被打开页面传送数据
console.log('res', res)
}
});
} }
}, },
fail: function (r) { fail: function (r) {
console.log('r', r) console.log('r', r)
wx.hideLoading({
success: (loadRes) => { console.log(loadRes) },
})
wx.navigateTo({
url: 'pages/index/index',
success: function (res) {
// 通过 eventChannel 向被打开页面传送数据
console.log('res', res)
}
});
} }
}) })
if (!wx.cloud) { if (!wx.cloud) {
...@@ -111,13 +181,7 @@ App({ ...@@ -111,13 +181,7 @@ App({
traceUser: true, traceUser: true,
}); });
wx.removeStorageSync('currentUserInfo'); wx.removeStorageSync('currentUserInfo');
wx.navigateTo({
url: 'pages/index/index',
success: function (res) {
// 通过 eventChannel 向被打开页面传送数据
console.log('res', res)
}
});
const currentUserInfo = wx.getStorageSync('currentUserInfo') const currentUserInfo = wx.getStorageSync('currentUserInfo')
if (currentUserInfo && currentUserInfo.nickName) { if (currentUserInfo && currentUserInfo.nickName) {
console.log('success') console.log('success')
......
...@@ -72,9 +72,7 @@ Component({ ...@@ -72,9 +72,7 @@ Component({
} }
}) })
const articleStr=data&&data.article&&data.article[0] const articleStr=data&&data.article&&data.article[0]
const markdownText = app.towxml(articleStr,'markdown',{ const markdownText = app.changeMrkdownText(articleStr)
       theme:'light', //主题 dark 黑色,light白色,不填默认light
});
that.setData({ that.setData({
isLoading:false, isLoading:false,
currentTitle:articleTitle&&articleTitle[0].title, currentTitle:articleTitle&&articleTitle[0].title,
......
...@@ -21,12 +21,14 @@ ...@@ -21,12 +21,14 @@
width: 100vw; width: 100vw;
height: calc(100vh - 110px); height: calc(100vh - 110px);
overflow: auto; overflow: auto;
user-select: text;
} }
.blog-container{ .blog-container{
margin-top:100px; margin-top:100px;
width: 100vw; width: 100vw;
height: auto; height: auto;
margin-bottom:10px; margin-bottom:10px;
user-select: text;
} }
.blog-title{ .blog-title{
text-align: center; text-align: center;
...@@ -38,4 +40,8 @@ ...@@ -38,4 +40,8 @@
padding: 10px; padding: 10px;
width: 100%; width: 100%;
min-height: 20px; min-height: 20px;
box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
}
.blog-title:active,.blog-title:hover{
color:#fff;
} }
\ No newline at end of file
...@@ -27,14 +27,18 @@ Component({ ...@@ -27,14 +27,18 @@ Component({
*组件的初始数据 *组件的初始数据
*/ */
data: { data: {
currenTime: "",
scrollTop: 0, scrollTop: 0,
mode: baseMode, mode: baseMode,
article: {}, article: {},
articleId: baseArticleId, articleId: baseArticleId,
isShowOenAi: false, isShowOenAi: true,
baseUrl: 'https://yongma16.xyz/api/', baseUrl: 'https://yongma16.xyz/api/',
baseCloudUrl: 'https://yongma16.xyz/cloudApi/', baseCloudUrl: 'https://yongma16.xyz/cloudApi/',
baseCloudPath: 'openAiRecord/add', baseCloudAddRecordPath: 'openAiRecord/add',
baseCloudUpdateUserPath: 'userModel/update',
baseCloudgetUserPath: 'userModel/info',
baseCloudGetRecordCountPath: 'openAiRecord/count',
path: 'article/blog/', path: 'article/blog/',
currentUserInfo: { currentUserInfo: {
nickName: '', nickName: '',
...@@ -50,13 +54,16 @@ Component({ ...@@ -50,13 +54,16 @@ Component({
reportText: '', reportText: '',
// questions,answer,index // questions,answer,index
chatObjConfig: { chatObjConfig: {
option: [{ option: [
question: '', // {
answer: '', // question: '',
isEdit: true, // answer: '',
createTime: '' // isEdit: true,
}], // createTime: ''
currentIndex: 0 // }
],
currentIndex: 0,
errorMsg: 'openai的服务器异常!'
}, },
layoutConfig: { layoutConfig: {
introduceText: 'api介绍', introduceText: 'api介绍',
...@@ -65,8 +72,23 @@ Component({ ...@@ -65,8 +72,23 @@ Component({
sendText: '发送', sendText: '发送',
searchText: '关键词查询', searchText: '关键词查询',
reportText: '复制数据', reportText: '复制数据',
copyText: '复制' copyText: '复制',
} pasteText: '粘贴',
upText: "",
downText: "",
errorMsg: 'openai的服务器异常!',
emptyText: '欢迎',
storageKey: 'openAiOptionsConfig',
permissionTitle: '很抱歉您没有权限!',
permissionContent: '请联系微信号:cse-yma16\r\n 需要1元开通权限\r\n1元可支持100条消息!',
wxInfoImg:'https://yongma16.xyz/staticFile/common/img/userInfo.png',
limitMsgCount:10,
confirmText:'添加微信',
cancelText:'返回'
},
msgCount: 0,
isVip: false,
modalVisible: false
}, },
observers: { observers: {
mode: function (newVal, oldVal) { mode: function (newVal, oldVal) {
...@@ -89,18 +111,34 @@ Component({ ...@@ -89,18 +111,34 @@ Component({
lifetimes: { lifetimes: {
// 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名 // 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名
attached: function () { attached: function () {
this.getUserInfo()
this.getRemoteArticle(this.data.articleId) this.getRemoteArticle(this.data.articleId)
const openAiOptions = wx.getStorageSync('openAiOptions') this.setData({
if (openAiOptions) { currenTime: this.getCurrentTime()
})
const key = app.wxProgramConfig.apiPageConfig.layoutConfig.storageKey
const openAiOptionsConfig = wx.getStorageSync(key)
if (openAiOptionsConfig) {
// if (openAiOptionsConfig.option) {
// openAiOptionsConfig.option.forEach(item => {
// item.answerMarkdown = app.changeMrkdownText(item.answer)
// })
// }
const lauoutConfig=app.wxProgramConfig.apiPageConfig.layoutConfig
this.setData( this.setData(
{ {
chatObjConfig: openAiOptions, chatObjConfig: openAiOptionsConfig,
mode: app.wxProgramConfig.apiPageConfig.mode, mode: app.wxProgramConfig.apiPageConfig.mode,
layoutConfig: app.wxProgramConfig.apiPageConfig.layoutConfig, layoutConfig:lauoutConfig,
isShowOenAi:lauoutConfig.isShowOenAi
} }
) )
this.refreshOptions()
} }
const currentUserInfo = wx.getStorageSync('currentUserInfo') const currentUserInfo = wx.getStorageSync('currentUserInfo')
if (currentUserInfo && currentUserInfo.nickName) { if (currentUserInfo && currentUserInfo.nickName) {
console.log('currentUserInfo', currentUserInfo) console.log('currentUserInfo', currentUserInfo)
...@@ -109,19 +147,113 @@ Component({ ...@@ -109,19 +147,113 @@ Component({
currentUserInfo: currentUserInfo currentUserInfo: currentUserInfo
} }
) )
this.setData({
isShowOenAi: true
})
} }
}, },
moved: function () { }, moved: function () { },
// 销毁前
detached: function () { detached: function () {
wx.setStorageSync('openAiOptions', this.data.chatObjConfig) const key = app.wxProgramConfig.apiPageConfig.layoutConfig.storageKey
wx.setStorageSync(key, this.data.chatObjConfig)
this.getUserReadCount()
}, },
}, },
methods: { methods: {
previewImage(e){
console.log('click png',e)
const url=e.target.dataset.url
wx.previewImage({
current: url, // 当前显示图片的http链接
urls: [url] // 需要预览的图片http链接列表
})
},
// 获取用户
getUserInfo() {
const headers = { 'Content-Type': 'application/json;charset=UTF-8' }
const openId = wx.getStorageSync('currentOpenid')
const wxOpenId = openId && openId.openid
const params = {
wx_open_id: wxOpenId
}
const thisBack = this
wx.request({
url: this.data.baseCloudUrl + this.data.baseCloudgetUserPath,
headers: headers,
data: params,
method: 'POST',
success: (res => {
console.log('cloud res userInfo', res)
if (res && res.data && res.data) {
thisBack.setData({
// 默认十条消息
msgCount: res.data.data[0].send_msg_count || 10,
isVip: res.data.data[0].is_vip || 0
})
}
}),
fail: r => {
console.log('cloud r', r)
}
})
},
// 更新用户使用信息
updateUserInfo() {
const headers = { 'Content-Type': 'application/json;charset=UTF-8' }
const openId = wx.getStorageSync('currentOpenid')
const wxOpenId = openId && openId.openid
const params = {
wx_open_id: wxOpenId,
send_msg_count: this.data.msgCount
}
const thisBack = this
wx.request({
url: this.data.baseCloudUrl + this.data.baseCloudUpdateUserPath,
headers: headers,
data: params,
method: 'PUT',
success: (res => {
console.log('cloud res update', res)
}),
fail: r => {
console.log('cloud r', r)
}
})
},
// 获取用户使用次数
getUserReadCount() {
const headers = { 'Content-Type': 'application/json;charset=UTF-8' }
const openId = wx.getStorageSync('currentOpenid')
const wxOpenId = openId && openId.openid
const params = {
wx_open_id: wxOpenId
}
const thisBack = this
wx.request({
url: this.data.baseCloudUrl + this.data.baseCloudGetRecordCountPath,
headers: headers,
data: params,
method: 'POST',
success: (res => {
console.log('cloud res count', res)
if (res.data.code === 0) {
// 0
thisBack.setData({
msgCount: 0
})
} else {
thisBack.setData({
msgCount: res.data.data[0].send_msg_count
})
}
// 更新用户
thisBack.updateUserInfo()
}),
fail: r => {
console.log('cloud r', r)
}
})
},
upper(e) { upper(e) {
console.log('upper e', e) console.log('upper e', e)
}, },
...@@ -129,12 +261,15 @@ Component({ ...@@ -129,12 +261,15 @@ Component({
console.log('lower e', e) console.log('lower e', e)
}, },
scroll(e) { scroll(e) {
console.log('scroll e', e) // console.log('scroll e', e)
}, },
createOpenRecord(params) { createOpenRecord(params) {
const headers = { 'Content-Type': 'application/json;charset=UTF-8' } const headers = { 'Content-Type': 'application/json;charset=UTF-8' }
const openId = wx.getStorageSync('currentOpenid')
const wxOpenId = openId && openId.openid
params.wx_open_id = wxOpenId
wx.request({ wx.request({
url: this.data.baseCloudUrl + this.data.baseCloudPath, url: this.data.baseCloudUrl + this.data.baseCloudAddRecordPath,
headers: headers, headers: headers,
data: params, data: params,
method: 'POST', method: 'POST',
...@@ -146,6 +281,15 @@ Component({ ...@@ -146,6 +281,15 @@ Component({
} }
}) })
}, },
upBtn() {
const index = 0
this.setData({
toView: `chat-mode${index}`
})
},
downBtn() {
this.scrollToBottom()
},
scrollToBottom() { scrollToBottom() {
const index = this.data.chatObjConfig.option.length - 1 const index = this.data.chatObjConfig.option.length - 1
this.setData({ this.setData({
...@@ -184,18 +328,7 @@ Component({ ...@@ -184,18 +328,7 @@ Component({
success: (res) => { success: (res) => {
const data = res.data const data = res.data
const articleStr = data && data.article && data.article const articleStr = data && data.article && data.article
const markdownText = app.towxml(articleStr, 'markdown', { const markdownText = app.changeMrkdownText(articleStr);
theme: 'light', //主题 dark 黑色,light白色,不填默认light
base: baseUrl + path,
events: { //为元素绑定的事件方法
tap: e => {
console.log('tap', e);
},
change: e => {
console.log('todo', e);
}
}
});
that.setData({ that.setData({
isLoading: false, isLoading: false,
article: markdownText article: markdownText
...@@ -210,13 +343,34 @@ Component({ ...@@ -210,13 +343,34 @@ Component({
mode: mode mode: mode
}) })
}, },
refreshOptions() {
const option = this.data.chatObjConfig.option
const currentIndex = this.data.chatObjConfig.currentIndex
while (option && option.length > 100) {
option.shift()
}
const chatObjConfig = {
option: option,
currentIndex: currentIndex
}
this.setData(
{
chatObjConfig: chatObjConfig
}
)
},
bindKeyInput(e) { bindKeyInput(e) {
this.setData({ this.setData({
searchOpenAiText: e.detail.value searchOpenAiText: e.detail.value
}) })
}, },
reportAnswerData() { reportAnswerData() {
const data=this.data.chatObjConfig.option const data = this.data.chatObjConfig.option
wx.setClipboardData({ wx.setClipboardData({
data: JSON.stringify(data) data: JSON.stringify(data)
}) })
...@@ -239,7 +393,53 @@ Component({ ...@@ -239,7 +393,53 @@ Component({
}, },
})) }))
}, },
pasteBtn(e) {
const thisBack = this
wx.getClipboardData({
success: (option) => {
console.log('option', option)
thisBack.setData({
searchOpenAiText: option.data
})
},
})
},
clearBtn() {
this.setData({
searchOpenAiText: ''
})
},
modalConfirm() {
const url=this.data.layoutConfig.wxInfoImg
wx.previewImage({
current: url, // 当前显示图片的http链接
urls: [url] // 需要预览的图片http链接列表
})
},
modalCandel() {
this.setData({
modalVisible: false
})
},
search(e) { search(e) {
if (this.data.layoutConfig.permissionStatus) {
const isNotAllow = !(this.data.isVip || this.data.msgCount <= this.data.layoutConfig.limitMsgCount)
console.log('this.data.isVip', this.data.isVip)
console.log('this.data.msgCount', this.data.msgCount)
console.log('isNotAllow', isNotAllow)
if (isNotAllow) {
return this.setData({
modalVisible: true
})
// return wx.showModal({
// cancelColor: 'cancelColor',
// title: this.data.layoutConfig.permissionTitle,
// content: this.data.layoutConfig.permissionContent
// })
}
}
this.scrollToBottom() this.scrollToBottom()
if (!this.data.searchOpenAiText) { if (!this.data.searchOpenAiText) {
wx.showModal({ wx.showModal({
...@@ -270,33 +470,20 @@ Component({ ...@@ -270,33 +470,20 @@ Component({
console.log(res, 'res') console.log(res, 'res')
const data = res.data.data const data = res.data.data
const option = thisBack.data.chatObjConfig.option const option = thisBack.data.chatObjConfig.option
const currentIndex = thisBack.data.chatObjConfig.currentIndex const errorMsg = thisBack.data.layoutConfig.errorMsg
const choices = data.choices const choices = data.choices
console.log('choices', choices) const answer = choices ? choices.map(choicesItem => { return choicesItem.text }).join('\n') : errorMsg
const answer = choices ? choices.map(choicesItem => { return choicesItem.text }).join('\n') : '。。。未知' option.push({
option.some((item, index) => { question: params.text,
if (currentIndex === index) { answer: answer,
item.answer = answer answerMarkdown: app.changeMrkdownText(answer),
item.question = params.text createTime: this.getCurrentTime(),
item.createTime = this.getCurrentTime() isEdit: false,
item.isEdit = false
return true
}
return false
}) })
// // 只保留30 条 缓存
// if(option.length&&option.length>30){
// option.shift()
// }
const chatObjConfig = { const chatObjConfig = {
option: option, option: option
currentIndex: currentIndex + 1
} }
// option.push({
// question: '',
// answer: '',
// isEdit: true
// })
thisBack.setData( thisBack.setData(
{ {
isLoading: false, isLoading: false,
...@@ -315,6 +502,8 @@ Component({ ...@@ -315,6 +502,8 @@ Component({
search_response: answer search_response: answer
}) })
}, 10) }, 10)
console.log('thisBack.data.chatObjConfig.option', thisBack.data.chatObjConfig.option)
thisBack.refreshOptions()
}, },
fail: error => { fail: error => {
thisBack.setData({ thisBack.setData({
......
<!--pages/future/future.wxml--> <!--pages/future/future.wxml-->
<view class="container-future"> <view class="container-future">
<view class="form-container-introduce" wx:if="{{mode==='introduce'}}"> <view class="form-container-introduce" wx:if="{{mode==='introduce'}}">
<view class="header-box" style="display: flex;"> <view class="header-box" style="width: 100%;">
<view style="width: {{isShowOenAi? '50%':'100%'}}"> <view wx:if="{{isShowOenAi}}" style="width: 50%;" >
<button style="width: 100%;" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">{{layoutConfig.introduceText}} <button style="width: 100%;" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">{{layoutConfig.introduceText}}
</button> </button>
</view>
<view style="width:50%" wx:if="{{isShowOenAi}}">
<button style="width: 100%;" type="primary" style="background: rgb(0, 114, 221);" bindtap="changeMode" loading="{{isLoading}}" data-mode='openAiUse'>{{layoutConfig.useText}}</button> <button style="width: 100%;" type="primary" style="background: rgb(0, 114, 221);" bindtap="changeMode" loading="{{isLoading}}" data-mode='openAiUse'>{{layoutConfig.useText}}</button>
</view> </view>
<view wx:else style="width:100%;height: 43px;line-height: 43px;text-align: center;font-weight: bold;">
<view style="width:100%;position: relative" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">{{layoutConfig.introduceText}}
</view>
</view>
</view> </view>
<view class="loading" wx:if="{{isLoading}}"> <view class="loading" wx:if="{{isLoading}}">
<view class="loader-child" /> <view class="loader-child" />
...@@ -20,17 +23,14 @@ ...@@ -20,17 +23,14 @@
</view> </view>
</view> </view>
<view class="form-container-api" wx:if="{{mode==='openAiUse'}}"> <view class="form-container-api" wx:if="{{mode==='openAiUse'}}">
<view style="display: flex;justify-content: space-between;"> <view class="shadow" style="display: flex;justify-content: space-between;width:100%">
<button style="width: 50%;background-color: #0758c1;" type="primary" bindtap="changeMode" loading="{{isLoading}}" data-mode='introduce'>{{layoutConfig.returnText}}</button> <button style="flex:1;background-color: #0758c1;" type="primary" bindtap="changeMode" loading="{{isLoading}}" data-mode='introduce'>{{layoutConfig.returnText}}</button>
<button style="width: 50%;" type="primary" style="background: rgb(0, 114, 221);" bindtap="reportAnswerData" loading="{{isLoading}}" data-mode='openAiUse'>{{layoutConfig.reportText}}</button> <button wx:if="{{layoutConfig.isShowCopyAll}}" style="flex:1;" type="primary" style="background: rgb(0, 114, 221);" bindtap="reportAnswerData" loading="{{isLoading}}" data-mode='openAiUse'>{{layoutConfig.reportText}}</button>
</view> </view>
<view class="chat-container" id="chat-container-id" style="width: 100%;"> <view class="chat-container" id="chat-container-id" style="width: 100%;">
<view style="float: right;position: absolute;right:0;z-index: 10px"> <scroll-view scroll-y="true" class="scroll-answer" scroll-with-animation bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}" wx:if="{{ chatObjConfig.option&&chatObjConfig.option.length>0 }}">
</view>
<scroll-view scroll-y="true" class="scroll-answer" scroll-with-animation bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}">
<view wx:for="{{ chatObjConfig.option }}" wx:for-index="index" wx:for-item="item" wx:key="index" id="chat-mode{{index}}"> <view wx:for="{{ chatObjConfig.option }}" wx:for-index="index" wx:for-item="item" wx:key="index" id="chat-mode{{index}}">
<view style="width: 100%;border-radius: 2px;text-align: center;color:rgb(255, 255, 255);background: rgb(0, 114, 221);width: fit-content;margin:5px auto"> <view class="create-time">
{{item.createTime}} {{item.createTime}}
</view> </view>
<view class="form-request"> <view class="form-request">
...@@ -62,29 +62,66 @@ ...@@ -62,29 +62,66 @@
</view> </view>
<view class="form-response-box-poly"> <view class="form-response-box-poly">
</view> </view>
<view class='form-response-box'> <view class='form-response-box' style="overflow: auto;">
{{item.answer}} <towxml wx:key="index" nodes="{{item.answerMarkdown}}" style="position: relative;background: transparent;user-select: text;" />
</view> </view>
</view> </view>
<view style="display: flex;width: 100%;box-sizing: border-box;"> <view style="display: flex;width: 100%;box-sizing: border-box;">
<view style="width: 70%;"> <view style="width: 70%;">
</view> </view>
<view style="width: 30%;"> <view style="width: 30%;text-align: center;">
<button style="background-color: #0758c1;width:fit-content;border-radius: 10px;margin:5px 2px;" type="primary" bindtap="copyBtn" data-response=" {{item.answer}}">{{layoutConfig.copyText}}</button> <button class="copy-btn" size="mini" bindtap="copyBtn" data-response=" {{item.answer}}">{{layoutConfig.copyText}}</button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="form-submit" wx:if="{{mode==='openAiUse'}}" style="width: 100%;"> <view class="form-submit" wx:if="{{mode==='openAiUse'}}" style="width: 100%;">
</view> </view>
</scroll-view> </scroll-view>
<view wx:else class="scroll-answer">
<view class="create-time">
{{currenTime}}
</view>
<view style="display: flex;">
<view style="line-height: 50px;">
<view class='form-response-user'>
<image class="ai-image" src="{{aiConfig.avatarUrl}}"></image>
<!-- {{aiConfig.nickName}} -->
</view>
</view>
<view class="form-response-box-poly">
</view>
<view class="form-response-box" style="padding: 0 10px;">
{{layoutConfig.emptyText}}
</view>
</view>
</view>
<view class="paste-container">
<button class="paste-btn" size="mini" bindtap="pasteBtn" data-response=" {{item.answer}}">{{layoutConfig.pasteText}}</button>
<button class="paste-btn" size="mini" bindtap="clearBtn" data-response=" {{item.answer}}">{{layoutConfig.clearText}}</button>
<view> <view>
<input class='send-btn' bindinput="bindKeyInput" placeholder="{{layoutConfig.searchText}}" bindconfirm="search" value="{{searchOpenAiText}}" disabled="{{isLoading}}" /> <button class="paste-btn-up" size="mini" bindtap="upBtn" data-response=" {{item.answer}}">{{layoutConfig.upText}}</button>
<button class="paste-btn-down" size="mini" bindtap="downBtn" data-response=" {{item.answer}}">{{layoutConfig.downText}}</button>
</view> </view>
<button style="width: 100%;;background-color: #0758c1;" type="primary" bindtap="search" loading="{{isLoading}}">{{layoutConfig.sendText}}</button>
</view> </view>
<view style="display: flex;width: 100%;">
<view class='submit-input'>
<textarea class='send-input' bindinput="bindKeyInput" placeholder="{{layoutConfig.searchText}}" bindconfirm="search" value="{{searchOpenAiText}}" disabled="{{isLoading||isTruth}}" />
</view>
<view class='send-btn' type="primary" bindtap="search" loading="{{isLoading}}">{{layoutConfig.sendText}}</view>
</view>
</view>
</view>
<modal wx:if="{{modalVisible}}" hidden="{{!modalVisible}}" bindconfirm="modalConfirm" confirmText="{{layoutConfig.confirmText}}" cancelText="{{layoutConfig.cancelText}}" bindcancel="modalCandel" style="padding: 0;">
<view style="text-align: center;font-weight: bold;margin:0;padding: 0;">
{{layoutConfig.permissionTitle}}
</view>
<view>
<image class="image" style="height: 230px;background-repeat: no-repeat;background-size: cover;" src="{{layoutConfig.wxInfoImg}}" data-url="{{layoutConfig.wxInfoImg}}" bindtap="previewImage"></image>
</view> </view>
<view>{{ layoutConfig.permissionContent}}</view>
</modal>
</view> </view>
\ No newline at end of file
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
position: relative; position: relative;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background: linear-gradient(to right, rgba(1, 41, 116, 0.1) 1px, transparent 1px), linear-gradient(to bottom, rgba(1, 41, 116, 0.1) 1px, transparent 1px); background: rgb(245, 245, 245);
/* background: linear-gradient(to right, rgba(1, 41, 116, 0.1) 1px, transparent 1px), linear-gradient(to bottom, rgba(1, 41, 116, 0.1) 1px, transparent 1px);
background-repeat: repeat; background-repeat: repeat;
background-size: 10px 10px; background-size: 10px 10px; */
/* background-image: url('https://yongma16.xyz/media/editor/wallhaven-we1xx7_20230331165330942057.jpg'); */ /* background-image: url('https://yongma16.xyz/media/editor/wallhaven-we1xx7_20230331165330942057.jpg');
/* background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; */ background-size: cover; */
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
color: #262626; color: #262626;
margin: 0; margin: 0;
padding: 0; padding: 0;
box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
} }
.title { .title {
...@@ -78,6 +80,34 @@ button { ...@@ -78,6 +80,34 @@ button {
} }
.create-time {
width: 100%;
text-align: center;
color: rgb(255, 255, 255);
background: rgb(218, 218, 218);
margin: 5px auto;
}
.header-box {
position: relative;
width: 100%;
box-shadow: 0 1rpx 5rpx 5rpx #c8c3c3;
z-index: 999;
display: flex;
}
.copy-btn {
background: rgb(0, 114, 221);
color: #ffffff;
border-radius: 5px;
margin-top: 5px;
}
.copy-btn:hover {
border: none;
background: rgb(221, 0, 66);
}
.btn-default { .btn-default {
color: #262626; color: #262626;
...@@ -87,6 +117,8 @@ button { ...@@ -87,6 +117,8 @@ button {
background-color: #ffffff; background-color: #ffffff;
} }
.actived { .actived {
color: #ffffff; color: #ffffff;
flex: 1; flex: 1;
...@@ -100,12 +132,16 @@ button { ...@@ -100,12 +132,16 @@ button {
width: 100%; width: 100%;
} }
.shadow {
box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
}
.form-request { .form-request {
display: block; display: block;
width: 100%; width: 100%;
color: #fff; color: #fff;
background-color: rgba(37, 0, 97,0); background-color: rgba(37, 0, 97, 0);
line-height: 50px; line-height: 50px;
} }
...@@ -116,19 +152,19 @@ button { ...@@ -116,19 +152,19 @@ button {
display: block; display: block;
margin-bottom: 10px; margin-bottom: 10px;
color: #fff; color: #fff;
background-color: rgba(0, 72, 94,0); background-color: rgba(0, 72, 94, 0);
box-sizing: border-box; box-sizing: border-box;
min-height: 60px; min-height: 60px;
} }
.form-response-user{ .form-response-user {
background-color: rgba(0, 72, 94,0); background-color: rgba(0, 72, 94, 0);
color:#fff; color: #fff;
} }
.form-request-user{ .form-request-user {
background-color: rgba(37, 0, 97,0); background-color: rgba(37, 0, 97, 0);
color:#fff; color: #fff;
} }
.form-class-submit { .form-class-submit {
...@@ -144,15 +180,20 @@ button { ...@@ -144,15 +180,20 @@ button {
height: calc(100vh - 60px); height: calc(100vh - 60px);
} }
.container-box-article{ .container-box-article {
position: relative; position: relative;
padding-top:0px;
width: 100%; width: 100%;
height: calc(100vh - 100px); height: calc(100vh - 88px);
box-shadow: inset 5px 5px #262626;
overflow: auto; overflow: auto;
user-select: text;
} }
.scroll-answer{
height: calc(100vh - 140px); .scroll-answer {
height: calc(100vh - 180px);
} }
.chat-container { .chat-container {
width: 100%; width: 100%;
height: calc(100vh - 40px); height: calc(100vh - 40px);
...@@ -161,6 +202,18 @@ button { ...@@ -161,6 +202,18 @@ button {
position: relative; position: relative;
} }
.paste-btn {
background: rgb(0, 114, 221);
color: #ffffff;
/* transform: scale(.7); */
border-radius: 5px;
}
.paste-btn:hover {
border: none;
background: rgb(221, 0, 66);
}
.user-image-box { .user-image-box {
width: 200px; width: 200px;
height: 140px; height: 140px;
...@@ -182,60 +235,153 @@ button { ...@@ -182,60 +235,153 @@ button {
border-radius: 50%; border-radius: 50%;
} }
.questioned-box-container{ .questioned-box-container {
display: flex; display: flex;
} }
.questioned-box{
.questioned-box {
position: relative; position: relative;
max-width: calc(100vw - 90px); max-width: calc(100vw - 90px);
height: auto; height: auto;
overflow-x: auto; overflow-x: auto;
background-color:rgb(0, 114, 221); background-color: rgb(255, 255, 255);
border-radius: 10px; border-radius: 10px;
right: -5px; right: -5px;
padding:0 10px; padding: 0 10px;
z-index: 999; z-index: 999;
color: #333;
font-family: PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
font-weight: 300;
font-size: 32rpx;
user-select: text;
} }
.questioned-box-poly{
.questioned-box-poly {
position: relative; position: relative;
top:15px; top: 15px;
width: 0; width: 0;
height: 0; height: 0;
border-radius: 5px; border-radius: 5px;
border-top: 10px solid transparent; border-top: 10px solid transparent;
border-bottom: 10px solid transparent; border-bottom: 10px solid transparent;
border-left: 12px solid rgb(0, 114, 221); border-left: 12px solid rgb(255, 255, 255);
}
.clear-paste-btn{
width:70%;
display: flex;
}
.submit-input {
box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
width: 70%;
}
.send-input {
height: 60px;
background: rgba(255, 255, 255, .8);
width: 100%;
height: 100px;
position: relative;
text-indent: 8px;
/* padding-left: 5px; */
color: rgb(0, 114, 221);
}
.up-down-btn{
width:30%;
} }
.send-btn{ .send-btn {
height: 60px;background: rgba(255,255,255,.8); box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
color:rgb(0, 114, 221); width: 30%;
padding-left: 10px; background-color: #0758c1;
height: 100px;
line-height: 100px;
text-align: center;
} }
.form-response-box{ .empty-reponse-msg {
position: relative; position: relative;
max-width: calc(100vw - 90px); max-width: calc(100vw - 90px);
word-break:keep-all;
height: auto; height: auto;
overflow-x: auto; overflow-x: auto;
background-color: rgb(0, 114, 221); background-color: rgb(255, 255, 255);
border-radius: 10px;
left: -5px;
padding: 0 10px;
z-index: 999;
color: #333;
font-family: PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
font-weight: 300;
font-size: 32rpx;
user-select: text;
}
.form-response-box {
position: relative;
max-width: calc(100vw - 50px);
/* word-break:keep-all; */
/* white-space: pre-wrap; */
white-space: pre-line;
height: auto;
overflow-x: auto;
background-color: rgb(255, 255, 255);
border-radius: 10px; border-radius: 10px;
color: #333;
font-family: PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
font-weight: 300;
font-size: 32rpx;
left: -5px; left: -5px;
padding:0 10px;
box-sizing: content-box; box-sizing: content-box;
z-index: 999; z-index: 999;
user-select: text;
} }
.form-response-box-poly{ .form-response-box-poly {
position: relative; position: relative;
top:15px; top: 15px;
width: 0; width: 0;
height: 0; height: 0;
border-radius: 5px; border-radius: 5px;
border-top: 10px solid transparent; border-top: 10px solid transparent;
border-bottom: 10px solid transparent; border-bottom: 10px solid transparent;
border-right: 12px solid rgb(0, 114, 221); border-right: 12px solid rgb(255, 255, 255);
}
.paste-container {
display: flex;
border: 1px solid rgb(0, 114, 221);
padding: 4px;
}
.paste-btn-up {
background: rgb(0, 114, 221);
color: #ffffff;
width: 30px !important;
height: 30px !important;
line-height: 30px !important;
text-align: center !important;
border-radius: 100%;
}
.paste-btn-up:hover {
border: none;
background: rgb(221, 0, 66);
}
.paste-btn-down:hover {
border: none;
background: rgb(221, 0, 66);
}
.paste-btn-down {
margin-left: 2px;
background: rgb(0, 114, 221);
color: #ffffff;
width: 30px !important;
height: 30px !important;
line-height: 30px !important;
text-align: center !important;
border-radius: 100%;
} }
/* .loader-child:nth-of-type(1) { /* .loader-child:nth-of-type(1) {
......
...@@ -208,6 +208,7 @@ Page({ ...@@ -208,6 +208,7 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
const eventChannel = this.getOpenerEventChannel() const eventChannel = this.getOpenerEventChannel()
const thisBack=this
if (eventChannel.emit) { if (eventChannel.emit) {
eventChannel.emit('acceptDataFromOpenedPage', { data: 'test' }); eventChannel.emit('acceptDataFromOpenedPage', { data: 'test' });
eventChannel.emit('someEvent', { data: 'test' }); eventChannel.emit('someEvent', { data: 'test' });
...@@ -216,6 +217,9 @@ Page({ ...@@ -216,6 +217,9 @@ Page({
// 监听 acceptDataFromOpenerPage 事件,获取上一页面通过 eventChannel 传送到当前页面的数据 // 监听 acceptDataFromOpenerPage 事件,获取上一页面通过 eventChannel 传送到当前页面的数据
eventChannel.on('setHomePageData', function (data) { eventChannel.on('setHomePageData', function (data) {
console.log('setHomePageData', data) console.log('setHomePageData', data)
thisBack.setData({
isShowBottom:data.isShowBottom
})
}) })
} }
this.setData({ this.setData({
......
...@@ -4,6 +4,10 @@ page { ...@@ -4,6 +4,10 @@ page {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
bottom: 0; bottom: 0;
background: #fff;
/* background-image: url('https://yongma16.xyz/staticFile/common/img/scene.png');
background-repeat: no-repeat;
background-size: cover; */
overflow: hidden; overflow: hidden;
} }
.container{ .container{
...@@ -114,6 +118,8 @@ page { ...@@ -114,6 +118,8 @@ page {
height:150px; height:150px;
width: 100vw; width: 100vw;
background-color: rgb(49, 28, 3); background-color: rgb(49, 28, 3);
box-shadow: 0 2rpx 5rpx 5rpx #c8c3c3;
z-index: 999;
} }
.swiper-item{ .swiper-item{
position: relative; position: relative;
...@@ -147,6 +153,7 @@ page { ...@@ -147,6 +153,7 @@ page {
.container-content{ .container-content{
position: relative; position: relative;
height: 50vh; height: 50vh;
box-sizing: border-box;
} }
.home-content-class{ .home-content-class{
position: relative; position: relative;
...@@ -168,8 +175,10 @@ page { ...@@ -168,8 +175,10 @@ page {
flex-wrap: nowrap; flex-wrap: nowrap;
width:100vw; width:100vw;
background-color: white; background-color: white;
border-top:2px solid rgba(0, 183, 255,.5); /* border-top:3px solid rgba(0, 183, 255, 1); */
z-index: 999;
bottom:0; bottom:0;
box-shadow: 0 3rpx 5rpx 5rpx #c8c3c3;
} }
.default-btn{ .default-btn{
position: relative; position: relative;
...@@ -180,6 +189,7 @@ page { ...@@ -180,6 +189,7 @@ page {
/* border-right:1px solid rgb(255, 136, 0); */ /* border-right:1px solid rgb(255, 136, 0); */
text-align: center; text-align: center;
height:60px; height:60px;
border-radius: 5px;
line-height: 60px; line-height: 60px;
} }
.default-btn:active,default-btn:active:hover{ .default-btn:active,default-btn:active:hover{
...@@ -190,7 +200,6 @@ page { ...@@ -190,7 +200,6 @@ page {
color:#ffffff; color:#ffffff;
font-weight: bold; font-weight: bold;
background-color: rgb(8, 183, 252); background-color: rgb(8, 183, 252);
border:1px solid rgb(8, 183, 252);
box-shadow: 0 5px 5px 5px rgba(8, 183, 252,.5); box-shadow: 0 5px 5px 5px rgba(8, 183, 252,.5);
} }
...@@ -208,19 +217,19 @@ page { ...@@ -208,19 +217,19 @@ page {
left: 0%; left: 0%;
top: 0%; top: 0%;
animation: rotate-one 1.15s linear infinite; animation: rotate-one 1.15s linear infinite;
border-bottom: 3px solid #1c92d2; border-bottom: 3px solid rgba(8, 183, 252);
} }
.loader-child:nth-of-type(2) { .loader-child:nth-of-type(2) {
right: 0%; right: 0%;
top: 0%; top: 0%;
animation: rotate-two 1.15s linear infinite; animation: rotate-two 1.15s linear infinite;
border-right: 3px solid #1c92d2; border-right: 3px solid rgba(8, 183, 252);
} }
.loader-child:nth-of-type(3) { .loader-child:nth-of-type(3) {
right: 0%; right: 0%;
bottom: 0%; bottom: 0%;
animation: rotate-three 1.15s linear infinite; animation: rotate-three 1.15s linear infinite;
border-top: 3px solid #1c92d2; border-top: 3px solid rgba(8, 183, 252);
} }
@keyframes rotate-one { @keyframes rotate-one {
0% { 0% {
......
...@@ -27,7 +27,7 @@ Component({ ...@@ -27,7 +27,7 @@ Component({
}, },
observers:{ observers:{
mode:function(val){ mode:function(val){
console.log('val',val) console.log('val mode',val)
} }
}, },
lifetimes: { lifetimes: {
...@@ -74,18 +74,7 @@ Component({ ...@@ -74,18 +74,7 @@ Component({
success: (res) => { success: (res) => {
const data=res.data const data=res.data
const articleStr=data&&data.article&&data.article const articleStr=data&&data.article&&data.article
const markdownText = app.towxml(articleStr,'markdown',{ const markdownText = app.changeMrkdownText(articleStr)
       theme:'light', //主题 dark 黑色,light白色,不填默认light
       base: baseUrl+path,
events:{ //为元素绑定的事件方法
tap:e => {
console.log('tap',e);
},
change:e => {
console.log('todo',e);
}
}
});
that.setData({ that.setData({
isLoading:false, isLoading:false,
article:markdownText article:markdownText
......
...@@ -20,10 +20,13 @@ ...@@ -20,10 +20,13 @@
.container-box{ .container-box{
position: relative; position: relative;
height: calc(100vh - 212px); height: calc(100vh - 214px);
overflow: auto; overflow: auto;
} }
.container-box-content{
position: relative;
}
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
const app = getApp() const app = getApp()
Page({ Page({
data: { data: {
baseUrl: app.remoteConfig.baseUrl,
baseLoginCloudPath: 'userModel/register',
detailInfo: '关于:code笔记', detailInfo: '关于:code笔记',
title: "yma16博客", title: "yma16博客",
userImageUrl: "https://yongma16.xyz/staticFile/common/img/aiTop.jpg", userImageUrl: "https://yongma16.xyz/staticFile/common/img/aiTop.jpg",
...@@ -16,7 +18,7 @@ Page({ ...@@ -16,7 +18,7 @@ Page({
hasUserInfo: false, hasUserInfo: false,
isloading: true, isloading: true,
isOldVersion: false, isOldVersion: false,
isShowBottom:true isShowBottom: true
}, },
getUserInfoBtn: function (info) { getUserInfoBtn: function (info) {
wx.showLoading({ wx.showLoading({
...@@ -50,26 +52,117 @@ Page({ ...@@ -50,26 +52,117 @@ Page({
userImageUrl: avatarUrl, userImageUrl: avatarUrl,
}) })
}, },
joinProfile(e) {
const userInfo = { getOpenid(resolve, reject) {
nickName: this.data.userName, wx.showLoading({
avatarUrl: this.data.userImageUrl title: '微信登录中',
})
const baseUrl = this.data.baseUrl
wx.login({
success(res) {
if (res.code) {
//发起网络请求
const path = '/common-api/wxProgramLogin/'
wx.request({
url: baseUrl + path,
method: 'GET',
data: {
code: res.code
},
success: (res => {
console.log('res', res)
console.log('res.data', res.data.data)
wx.setStorageSync('currentOpenid', res && res.data ? res.data.data : null)
resolve && resolve()
wx.hideLoading()
}),
fail: r => {
console.log('cloud r', r)
wx.hideLoading()
reject && reject()
} }
if(!this.data.userName){
wx.showModal({
cancelColor: 'cancelColor',
title: '昵称不能为空!'
}) })
return } else {
console.log('登录失败!' + res.errMsg)
wx.hideLoading()
reject && reject()
} }
console.log('userInfo', userInfo) },
wx.setStorageSync('currentUserInfo', userInfo) fail: r => {
console.log('r', r)
wx.hideLoading()
reject && reject()
// wx.hideLoading()
}
})
},
// 登录
loginSpringCloud() {
const openId = wx.getStorageSync('currentOpenid')
const wxOpenId = openId && openId.openid
const headers = { 'Content-Type': 'application/json;charset=UTF-8' }
const params = {
wx_open_id: wxOpenId,
wx_name: this.data.userName,
wx_img: this.data.userImageUrl
}
const baseCloudUrl = 'https://yongma16.xyz/cloudApi/'
const baseLoginCloudPath = 'userModel/register'
wx.request({
url: baseCloudUrl + baseLoginCloudPath,
headers: headers,
data: params,
method: 'POST',
success: (res => {
console.log('springcloud res login', res)
}),
fail: r => {
console.log('cloud login error', r)
}
})
},
// 进入
joinProfile(info) {
const thisBack = this
console.log('userinfo', info)
this.getOpenid((info) => {
console.log('spring登录')
thisBack.loginSpringCloud()
if (info && info.detail) {
const rowData = info.detail.rawData ? JSON.parse(info.detail.rawData) : { nickName: '', avatarUrl: '' }
this.setData({ this.setData({
userImageUrl: rowData.avatarUrl || thisBack.data.userImageUrl,
userName: rowData.nickName || thisBack.data.userName,
userInfo: rowData
})
const userInfo = {
nickName: rowData.nickName || thisBack.data.userName,
avatarUrl: rowData.avatarUrl || thisBack.data.userImageUrl,
userInfo: rowData
}
thisBack.setData({
userInfo: userInfo, userInfo: userInfo,
hasUserInfo: true hasUserInfo: true
}) })
wx.setStorageSync('currentUserInfo', userInfo)
console.log('rowData', rowData)
}
thisBack.jumpTohome()
}, () => {
wx.setStorageSync('currentUserInfo', null)
return wx.showModal({
cancelColor: 'cancelColor',
title: thisBack.data.loginErrorTitle || '登录失败',
content: thisBack.data.loginErrorContent || '请检查网络或联系微信cse-yma16'
})
// thisBack.jumpTohome()
})
// wx.hideLoading();
// 跳转到home // 跳转到home
this.jumpTohome() // this.jumpTohome()
}, },
getUserProfile(e) { getUserProfile(e) {
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 // 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
...@@ -126,7 +219,9 @@ Page({ ...@@ -126,7 +219,9 @@ Page({
designPlaceholder: authorPageConfig.designPlaceholder, designPlaceholder: authorPageConfig.designPlaceholder,
isOldVersion: authorPageConfig.isOldVersion, isOldVersion: authorPageConfig.isOldVersion,
joinTitle: authorPageConfig.joinTitle, joinTitle: authorPageConfig.joinTitle,
isShowBottom: authorPageConfig.isShowBottom isShowBottom: authorPageConfig.isShowBottom,
loginErrorTitle: authorPageConfig.loginErrorTitle,
loginErrorContent: authorPageConfig.loginErrorContent
}) })
// this.jumpTohome() // this.jumpTohome()
// 页面创建时执行 // 页面创建时执行
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<view class="login-container"> <view class="login-container">
<button type="primary" plain="true" bindtap="getUserProfile" class="user-login" bindgetuserinfo="getUserInfoBtn" wx:if="{{isOldVersion}}">{{loginTitle}}</button> <button type="primary" plain="true" bindtap="getUserProfile" class="user-login" bindgetuserinfo="getUserInfoBtn" wx:if="{{isOldVersion}}">{{loginTitle}}</button>
<button type="primary" plain="true" bindtap="joinProfile" class="user-login" wx:else>{{joinTitle}}</button> <button type="primary" plain="true" bindtap="getUserProfile" bindtap="joinProfile" class="user-login" wx:else>{{joinTitle}}</button>
</view> </view>
</view> </view>
<view class="loading-container"> <view class="loading-container">
......
...@@ -114,18 +114,7 @@ Component({ ...@@ -114,18 +114,7 @@ Component({
console.log('res',res) console.log('res',res)
const data=res.data const data=res.data
const articleStr=data&&data.article&&data.article const articleStr=data&&data.article&&data.article
const markdownText = app.towxml(articleStr,'markdown',{ const markdownText = app.changeMrkdownText(articleStr)
       theme:'light', //主题 dark 黑色,light白色,不填默认light
       base: baseUrl+path,
events:{ //为元素绑定的事件方法
tap:e => {
console.log('tap',e);
},
change:e => {
console.log('todo',e);
}
}
});
that.setData({ that.setData({
isLoading:false, isLoading:false,
article:markdownText article:markdownText
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
position: relative; position: relative;
width: 100vw; width: 100vw;
height:calc(100vh - 60px); height:calc(100vh - 60px);
color:#ff00aa; /* color:#ff00aa; */
background: #fff; /* fallback for old browsers */ background: #fff; /* fallback for old browsers */
overflow: hidden; overflow: hidden;
animation-name:backdiv; /* animation-name:backdiv;
animation-duration: 6s; animation-duration: 6s;
animation-iteration-count: infinite; animation-iteration-count: infinite; */
box-sizing: border-box; box-sizing: border-box;
} }
.container-box{ .container-box{
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
width: 100vw; width: 100vw;
height: calc(100vh - 60px); height: calc(100vh - 60px);
overflow: auto; overflow: auto;
user-select: text;
} }
.blog-container{ .blog-container{
width: 100vw; width: 100vw;
...@@ -71,7 +72,6 @@ ...@@ -71,7 +72,6 @@
} }
.container-life-right{ .container-life-right{
position: relative; position: relative;
padding-right:20px; padding-right:20px;
} }
.container-life-right-font{ .container-life-right-font{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册