This commit is contained in:
root 2024-11-18 09:11:46 +08:00
parent eac96e037e
commit a7ad71a768
3 changed files with 35 additions and 30 deletions

View File

@ -13,10 +13,10 @@ type credit struct {
user user
city city
order string `data:"101"`
authCity string `name:"authCity" role:"void"`
authPersonal string `name:"authPersonal" role:"void"`
authService string `name:"authService" role:"void"`
authCompany string `name:"authCompany" role:"void"`
authPersonal string `name:"authPersonal" role:"void"`
authCity string `name:"authCity" role:"void"`
}
func (s credit) List(m *ice.Message, arg ...string) {
@ -49,13 +49,13 @@ func (s credit) List(m *ice.Message, arg ...string) {
func (s credit) AuthService(m *ice.Message, arg ...string) {
m.Cmdy(s.PrefixPortal(m), Portal{}.PlaceAuth, kit.Dict(s.placeInfo(m).AppendSimple())).ProcessRefresh()
}
func (s credit) AuthCompany(m *ice.Message, arg ...string) {
m.Cmdy(s.Street, s.AuthCreate, kit.Dict(s.streetInfo(m).AppendSimple(model.NAME, model.INFO, model.UID, model.CITY_UID)))
}
func (s credit) AuthPersonal(m *ice.Message, arg ...string) {
msg := m.Cmd(s.city, s.Select, model.NAME, m.Option(model.CITY_NAME))
m.Cmdy(s.user, s.AuthCreate, kit.Dict(msg.AppendSimple(model.AUTH_UID)))
}
func (s credit) AuthCompany(m *ice.Message, arg ...string) {
m.Cmdy(s.Street, s.AuthCreate, kit.Dict(s.streetInfo(m).AppendSimple(model.NAME, model.INFO, model.UID, model.CITY_UID)))
}
func (s credit) AuthCity(m *ice.Message, arg ...string) {
m.Cmdy(s.city, s.AuthCreate, kit.Dict(s.cityInfo(m).AppendSimple(model.NAME, model.INFO)))
}

View File

@ -24,37 +24,32 @@ func (s profile) Modify(m *ice.Message, arg ...string) {
s.Update(m, m.OptionSimple(model.INFO), model.UID, m.Option(model.AUTH_UID))
}
func (s profile) Upload(m *ice.Message, arg ...string) {
if m.WarnNotValid(!kit.IsIn(m.OptionDefault(mdb.FIELD, model.AVATAR), model.AVATAR, model.BACKGROUND)) {
return
if !m.WarnNotValid(!kit.IsIn(m.OptionDefault(mdb.FIELD, model.AVATAR), model.AVATAR, model.BACKGROUND)) {
s.UploadUpdate(m, "", m.Option(model.AUTH_UID))
}
s.UploadUpdate(m, "", m.Option(model.AUTH_UID))
}
func (s profile) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
s.Select(m)
s.RewriteAppend(m)
m.PushAction(s.Remove)
return
} else if len(arg) == 1 {
s.Select(m, model.UID, arg[0])
kit.If(s.IsWorker(m), func() { m.Action(s.Modify) }, func() { m.Action() })
} else {
s.Select(m).PushAction(s.Remove)
return
}
s.Select(m, model.UID, arg[0]).Action()
name := m.Append(model.NAME)
switch AuthType(kit.Int(m.Append(model.AUTH_TYPE))) {
case AuthService:
kit.If(s.IsWorker(m), func() { m.Action(s.Modify, s.Enter) }, func() { m.Action() })
s.SelectJoinRecent(m, model.PLACE_UID)
name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME))
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
s.SelectJoinRecent(m, "")
s.SelectJoinService(m)
defer m.Echo(kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME)))
case AuthCompany:
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
case AuthPersonal:
s.SelectJoinUser(m)
fallthrough
default:
defer m.Echo(m.Append(model.NAME))
case AuthCity:
}
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey())).Echo(name)
m.Display("").DisplayCSS("")
s.RewriteAppend(m)
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey())).Display("").DisplayCSS("")
}
func (s profile) AuthList(m *ice.Message, arg ...string) {
m.Cmdy(s.Auth, arg[0]).Table(func(value ice.Maps) {
@ -64,9 +59,9 @@ func (s profile) AuthList(m *ice.Message, arg ...string) {
m.PushButton(s.Enter)
}
})
s.SelectJoinRecent(m, model.PLACE_UID)
s.SelectJoinRecent(m, "")
s.SelectJoinService(m)
s.RewriteAppend(m)
s.authSort(m)
}
func (s profile) MemberList(m *ice.Message, arg ...string) {
user_uid := m.Option(model.USER_UID)
@ -95,9 +90,10 @@ func (s profile) ServiceList(m *ice.Message, arg ...string) {
}
s.FieldsWithCreatedAT(m, s.Auth, kit.TransArgs(kit.Split(m.Config(mdb.FIELDS), ",", ","))...)
s.SelectList(m, kit.Simple(model.PLACE_UID, kit.Sort(list))...)
s.SelectJoinRecent(m, model.PLACE_UID)
s.SelectJoinService(m).PushAction(s.Enter)
s.RewriteAppend(m)
s.SelectJoinRecent(m, "")
s.SelectJoinService(m)
s.authSort(m)
m.PushAction(s.Enter)
}
func (s profile) FromList(m *ice.Message, arg ...string) {
from := arg[0]
@ -117,6 +113,10 @@ func (s profile) Enter(m *ice.Message, arg ...string) {}
func init() { ice.TeamCtxCmd(profile{}) }
func (s profile) authSort(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
m.Sort("auth_status,name", []string{AuthIssued.String()}, "str")
}
func (s profile) settingProfile(m *ice.Message, arg ...string) *ice.Message {
return s.SettingCmdy(m, s.Select, arg, model.NAME, "profile", model.VALUE, "on")
}

View File

@ -26,7 +26,7 @@ Volcanos(chat.ONIMPORT, {
can.onimport.myView(can, msg, function(value) {
return [
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, AUTH_TYPE), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
value.auth_type == "service" && {view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
{view: html.STATUS, list: [value.info]},
]
}, function(event, value) {
@ -59,7 +59,12 @@ Volcanos(chat.ONIMPORT, {
})
Volcanos(chat.ONACTION, {
enter: function(event, can) { var msg = can.request(event)
can.onimport.myPlugin(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]})
if (msg.Option("auth_type") == "company") {
can.user.open(can.misc.MergePodCmd(can, {pod: "20240724-enterprise", cmd: "web.team.guanlixitong.company", auth_uid: msg.Option("auth_uid")}))
} else {
can.onimport.myPlugin(can, {space: msg.Option("nodename"), index: msg.Option(ctx.INDEX), args: [msg.Option(PLACE_UID)]})
}
can.page.ClassList.del(can, can._fields, "_process")
},
updateBackground: function(event, can) { can.user.upload(can.request(event, {field: aaa.BACKGROUND}), can) },
updateAvatar: function(event, can) { can.user.upload(can.request(event, {field: aaa.AVATAR}), can) },