This commit is contained in:
xiangheng
2024-11-19 00:06:05 +08:00
parent 1b7ccf6468
commit 7b27141d1f
8 changed files with 59 additions and 59 deletions

View File

@@ -207,6 +207,10 @@ export default {
captchaType: captchaType.value
}
reqGet(data).then((res) => {
if (!res) {
text.value = '网络错误'
return
}
if (res.repCode == '0000') {
pointBackImgBase.value =
'data:image/png;base64,' + res.repData.originalImageBase64

View File

@@ -1,14 +1,14 @@
<script setup lang="ts">
// import { onUnmounted } from 'vue'
// import { XErr, XErrWeb } from '../../../../x_err_sdk/web/index'
// // { XErr, XErrWeb }
// const xErr = new XErr(
// import { Base, Web } from '../../../../x_err_sdk/web/index'
// // { XErr, Web }
// const xErr = new Base(
// {
// Dns: 'http://localhost:5174/api',
// Pid: 'e19e3be20de94f49b68fafb4c30668bc',
// Uid: '10'
// },
// new XErrWeb()
// new Web()
// )
// onUnmounted(() => {
// xErr.unListen()

View File

@@ -93,15 +93,15 @@ const formData = reactive({
Status: null
})
const code = computed(() => {
return `import { XErr, XErrWeb } from '../../x_err_sdk/web/index'
new XErr(
return `import { Base, Web } from '../../x_err_sdk/web/index'
new Base(
{
Dns: '${location.origin}/api',
Pid: '${formData.ProjectKey}',
Uid: ''
},
new XErrWeb({
onloadTimeOut: 3000
new Web({
onloadTimeOut: 8000
})
)`
})

View File

@@ -1,7 +1,7 @@
package user_protocol
import (
"x_admin/core"
)
// UserProtocolListReq 用户协议列表参数
@@ -15,8 +15,6 @@ type UserProtocolListReq struct {
UpdateTimeEnd *string // 结束更新时间
}
// UserProtocolAddReq 用户协议新增参数
type UserProtocolAddReq struct {
Title *string // 标题

View File

@@ -196,7 +196,7 @@ func (service userProtocolService) GetExcelCol() []excel2.Col {
var cols = []excel2.Col{
{Name: "标题", Key: "Title", Width: 15},
{Name: "协议内容", Key: "Content", Width: 15},
{Name: "排序", Key: "Sort", Width: 15},
{Name: "排序", Key: "Sort", Width: 15, Decode: core.DecodeFloat},
{Name: "创建时间", Key: "CreateTime", Width: 15, Decode: util.NullTimeUtil.DecodeTime},
{Name: "更新时间", Key: "UpdateTime", Width: 15, Decode: util.NullTimeUtil.DecodeTime},
}

View File

@@ -17,7 +17,7 @@ const TimeFormat = "2006-01-02 15:04:05"
type NullTime struct {
Time *time.Time
Valid bool
Format string
// Format string
}
// func (t *NullTime) IsZero() bool {
@@ -70,25 +70,23 @@ func (t NullTime) Value() (driver.Value, error) {
// 读取数据gorm调用
func (t *NullTime) Scan(v any) error {
// pt, err := time.ParseInLocation("2006-01-02 15:04:05", v.(time.Time).String(), time.Local)
if pt, ok := v.(time.Time); ok {
tt := pt.Format(TimeFormat)
switch val := v.(type) {
case time.Time:
tt := val.Format(TimeFormat)
if tt == "0001-01-01 00:00:00" {
*t = NullTime{
Time: &pt,
Time: nil,
Valid: false,
}
return nil
} else {
*t = NullTime{
Time: &pt,
Time: &val,
Valid: true,
}
}
return nil
}
return fmt.Errorf("cant convert %s to time", v)
return fmt.Errorf("NullTime cant convert %s", v)
}
func (t NullTime) String() string {

View File

@@ -78,22 +78,22 @@ func importData(f *excelize.File, dst interface{}, sheetName string, startRow in
key := col.Key
replace := col.Replace
val := rows[i][j]
rowVal := rows[i][j]
// 先替换将val替换为key
for replaceKey, v := range replace {
if fmt.Sprintf("%v", v) == fmt.Sprintf("%v", val) {
val = fmt.Sprintf("%v", replaceKey)
for replaceKey, replaceVal := range replace {
if fmt.Sprintf("%v", replaceVal) == rowVal {
rowVal = replaceKey
break
}
}
// 再解码
if col.Decode != nil {
v, e := col.Decode(val)
v, e := col.Decode(rowVal)
if e == nil {
rowMap[key] = v
}
} else {
rowMap[key] = val
rowMap[key] = rowVal
}
}
data = append(data, rowMap)

View File

@@ -149,7 +149,7 @@ class Web implements IErrorEvent {
this.callback({
Type: "onloadTime",
Path: window.location.href,
Time:onloadTime
Time:Math.floor(onloadTime)
});
}
}