mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-07 00:52:57 +08:00
优化
This commit is contained in:
@@ -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
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
})
|
||||
)`
|
||||
})
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package user_protocol
|
||||
|
||||
import (
|
||||
"x_admin/core"
|
||||
|
||||
)
|
||||
|
||||
//UserProtocolListReq 用户协议列表参数
|
||||
// UserProtocolListReq 用户协议列表参数
|
||||
type UserProtocolListReq struct {
|
||||
Title *string // 标题
|
||||
Content *string // 协议内容
|
||||
@@ -15,16 +15,14 @@ type UserProtocolListReq struct {
|
||||
UpdateTimeEnd *string // 结束更新时间
|
||||
}
|
||||
|
||||
|
||||
|
||||
//UserProtocolAddReq 用户协议新增参数
|
||||
// UserProtocolAddReq 用户协议新增参数
|
||||
type UserProtocolAddReq struct {
|
||||
Title *string // 标题
|
||||
Content *string // 协议内容
|
||||
Sort core.NullFloat // 排序
|
||||
}
|
||||
|
||||
//UserProtocolEditReq 用户协议编辑参数
|
||||
// UserProtocolEditReq 用户协议编辑参数
|
||||
type UserProtocolEditReq struct {
|
||||
Id int //
|
||||
Title *string // 标题
|
||||
@@ -32,22 +30,22 @@ type UserProtocolEditReq struct {
|
||||
Sort core.NullFloat // 排序
|
||||
}
|
||||
|
||||
//UserProtocolDetailReq 用户协议详情参数
|
||||
// UserProtocolDetailReq 用户协议详情参数
|
||||
type UserProtocolDetailReq struct {
|
||||
Id int //
|
||||
}
|
||||
|
||||
//UserProtocolDelReq 用户协议删除参数
|
||||
// UserProtocolDelReq 用户协议删除参数
|
||||
type UserProtocolDelReq struct {
|
||||
Id int //
|
||||
}
|
||||
|
||||
//UserProtocolDelReq 用户协议批量删除参数
|
||||
// UserProtocolDelReq 用户协议批量删除参数
|
||||
type UserProtocolDelBatchReq struct {
|
||||
Ids string
|
||||
}
|
||||
|
||||
//UserProtocolResp 用户协议返回信息
|
||||
// UserProtocolResp 用户协议返回信息
|
||||
type UserProtocolResp struct {
|
||||
Id int //
|
||||
Title string // 标题
|
||||
|
@@ -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},
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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)
|
||||
|
@@ -149,7 +149,7 @@ class Web implements IErrorEvent {
|
||||
this.callback({
|
||||
Type: "onloadTime",
|
||||
Path: window.location.href,
|
||||
Time:onloadTime
|
||||
Time:Math.floor(onloadTime)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user